aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Anders <8965202+gpanders@users.noreply.github.com>2022-11-04 20:43:11 -0600
committerGitHub <noreply@github.com>2022-11-04 20:43:11 -0600
commit81722896e4a6d17dbf33325d344253e44a11e9ed (patch)
treeba19435989f3548544fb51f0321cc9ae20ba3bdb
parent5e86cf6c13aa0a092286b42937e578c1886a3b85 (diff)
downloadrneovim-81722896e4a6d17dbf33325d344253e44a11e9ed.tar.gz
rneovim-81722896e4a6d17dbf33325d344253e44a11e9ed.tar.bz2
rneovim-81722896e4a6d17dbf33325d344253e44a11e9ed.zip
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.
-rw-r--r--runtime/autoload/provider/clipboard.vim7
1 files changed, 6 insertions, 1 deletions
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['+']