diff options
author | wzy <32936898+Freed-Wu@users.noreply.github.com> | 2022-11-07 11:46:58 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-06 19:46:58 -0800 |
commit | b042f6d9022a4c734477f1fdbc92b4f8134661b3 (patch) | |
tree | e87e8aa9678e020a1209283009dfd52403696292 | |
parent | d337814906b1377e34aa2c2dfd8aa16285328692 (diff) | |
download | rneovim-b042f6d9022a4c734477f1fdbc92b4f8134661b3.tar.gz rneovim-b042f6d9022a4c734477f1fdbc92b4f8134661b3.tar.bz2 rneovim-b042f6d9022a4c734477f1fdbc92b4f8134661b3.zip |
fix(clipboard): prefer xsel #20918
Problem:
xclip is not actively maintained compared to xsel, and it has a bug:
$ touch a
$ xsel -ib < a
$ xsel -ob
$ xclip -o -selection clipboard
Error: target STRING not available
Years ago, the situation was reversed.
We originally preferred xsel 46bd3c0f77f282b93ca1307c011562243c394306
but then swapped to xclip 799d9c32157c841c3b8d355fa98a5ace435eef07
to work around https://github.com/neovim/neovim/issues/7237#issuecomment-443440633
Solution:
Prefer xsel again.
close #20862
ref #9302
ref https://github.com/astrand/xclip/issues/38
-rw-r--r-- | runtime/autoload/provider/clipboard.vim | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/runtime/autoload/provider/clipboard.vim b/runtime/autoload/provider/clipboard.vim index 026c01bce6..e4161290d9 100644 --- a/runtime/autoload/provider/clipboard.vim +++ b/runtime/autoload/provider/clipboard.vim @@ -97,18 +97,18 @@ function! provider#clipboard#Executable() abort let s:copy['*'] = ['wl-copy', '--foreground', '--primary', '--type', 'text/plain'] let s:paste['*'] = ['wl-paste', '--no-newline', '--primary'] return 'wl-copy' - elseif !empty($DISPLAY) && executable('xclip') - let s:copy['+'] = ['xclip', '-quiet', '-i', '-selection', 'clipboard'] - let s:paste['+'] = ['xclip', '-o', '-selection', 'clipboard'] - let s:copy['*'] = ['xclip', '-quiet', '-i', '-selection', 'primary'] - let s:paste['*'] = ['xclip', '-o', '-selection', 'primary'] - return 'xclip' elseif !empty($DISPLAY) && executable('xsel') && s:cmd_ok('xsel -o -b') let s:copy['+'] = ['xsel', '--nodetach', '-i', '-b'] let s:paste['+'] = ['xsel', '-o', '-b'] let s:copy['*'] = ['xsel', '--nodetach', '-i', '-p'] let s:paste['*'] = ['xsel', '-o', '-p'] return 'xsel' + elseif !empty($DISPLAY) && executable('xclip') + let s:copy['+'] = ['xclip', '-quiet', '-i', '-selection', 'clipboard'] + let s:paste['+'] = ['xclip', '-o', '-selection', 'clipboard'] + let s:copy['*'] = ['xclip', '-quiet', '-i', '-selection', 'primary'] + let s:paste['*'] = ['xclip', '-o', '-selection', 'primary'] + return 'xclip' elseif executable('lemonade') let s:copy['+'] = ['lemonade', 'copy'] let s:paste['+'] = ['lemonade', 'paste'] |