From 81722896e4a6d17dbf33325d344253e44a11e9ed Mon Sep 17 00:00:00 2001 From: Gregory Anders <8965202+gpanders@users.noreply.github.com> Date: Fri, 4 Nov 2022 20:43:11 -0600 Subject: 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. --- runtime/autoload/provider/clipboard.vim | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/runtime/autoload/provider/clipboard.vim b/runtime/autoload/provider/clipboard.vim index 991bed6bbd..026c01bce6 100644 --- 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['+'] -- cgit