commit 81722896e4a6d17dbf33325d344253e44a11e9ed
parent 5e86cf6c13aa0a092286b42937e578c1886a3b85
Author: Gregory Anders <8965202+gpanders@users.noreply.github.com>
Date: Fri, 4 Nov 2022 20:43:11 -0600
feat(clipboard): copy to system clipboard in tmux when supported (#20936)
Since version 3.2 tmux has had the ability to read/write buffer contents
from/to the system clipboard, if the underlying terminal emulator
supports it. Enable this feature when we can detect that tmux supports
it.
Diffstat:
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/runtime/autoload/provider/clipboard.vim b/runtime/autoload/provider/clipboard.vim
@@ -139,7 +139,12 @@ function! provider#clipboard#Executable() abort
let s:paste['*'] = s:paste['+']
return 'termux-clipboard'
elseif !empty($TMUX) && executable('tmux')
- let s:copy['+'] = ['tmux', 'load-buffer', '-']
+ let [major, minor] = matchlist(systemlist(['tmux', '-V'])[0], 'tmux \(\d\+\)\.\(\d\+\)')[1:2]
+ if major > 3 || (major == 3 && minor >= 2)
+ let s:copy['+'] = ['tmux', 'load-buffer', '-w', '-']
+ else
+ let s:copy['+'] = ['tmux', 'load-buffer', '-']
+ endif
let s:paste['+'] = ['tmux', 'save-buffer', '-']
let s:copy['*'] = s:copy['+']
let s:paste['*'] = s:paste['+']