From 2495e7e22a0d56911d3677a17de3ff946b68a9a1 Mon Sep 17 00:00:00 2001 From: wzy <32936898+Freed-Wu@users.noreply.github.com> Date: Tue, 3 Dec 2024 21:06:54 +0800 Subject: [PATCH] fix(clipboard): tmux clipboard depends on $TMUX #31268 Problem: tmux clipboard not used when tmux is a daemon and $TMUX is empty. Solution: If `tmux list-buffers` succeeds, use tmux clipboard. --- runtime/autoload/provider/clipboard.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/autoload/provider/clipboard.vim b/runtime/autoload/provider/clipboard.vim index 58d3d4550f..848fa401f1 100644 --- a/runtime/autoload/provider/clipboard.vim +++ b/runtime/autoload/provider/clipboard.vim @@ -158,7 +158,7 @@ function! provider#clipboard#Executable() abort let s:copy['*'] = s:copy['+'] let s:paste['*'] = s:paste['+'] return 'termux-clipboard' - elseif !empty($TMUX) && executable('tmux') + elseif executable('tmux') && (!empty($TMUX) || 0 == jobwait([jobstart(['tmux', 'list-buffers'])], 2000)[0]) let tmux_v = v:lua.vim.version.parse(system(['tmux', '-V'])) if !empty(tmux_v) && !v:lua.vim.version.lt(tmux_v, [3,2,0]) let s:copy['+'] = ['tmux', 'load-buffer', '-w', '-']