aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/autoload/provider/clipboard.vim36
-rw-r--r--runtime/doc/options.txt7
2 files changed, 21 insertions, 22 deletions
diff --git a/runtime/autoload/provider/clipboard.vim b/runtime/autoload/provider/clipboard.vim
index 46c05a882c..458ef6257d 100644
--- a/runtime/autoload/provider/clipboard.vim
+++ b/runtime/autoload/provider/clipboard.vim
@@ -1,11 +1,11 @@
" The clipboard provider uses shell commands to communicate with the clipboard.
" The provider function will only be registered if one of the supported
" commands are available.
-let s:copy = ''
-let s:paste = ''
+let s:copy = {}
+let s:paste = {}
function! s:try_cmd(cmd, ...)
- let out = a:0 ? systemlist(a:cmd, a:1) : systemlist(a:cmd)
+ let out = a:0 ? systemlist(a:cmd, a:1, 1) : systemlist(a:cmd, [''], 1)
if v:shell_error
echo "clipboard: error: ".(len(out) ? out[0] : '')
return ''
@@ -14,14 +14,20 @@ function! s:try_cmd(cmd, ...)
endfunction
if executable('pbcopy')
- let s:copy = 'pbcopy'
- let s:paste = 'pbpaste'
-elseif executable('xsel')
- let s:copy = 'xsel -i -b'
- let s:paste = 'xsel -o -b'
+ let s:copy['+'] = 'pbcopy'
+ let s:paste['+'] = 'pbpaste'
+ let s:copy['*'] = s:copy['+']
+ let s:paste['*'] = s:paste['+']
elseif executable('xclip')
- let s:copy = 'xclip -i -selection clipboard'
- let s:paste = 'xclip -o -selection clipboard'
+ let s:copy['+'] = 'xclip -i -selection clipboard'
+ let s:paste['+'] = 'xclip -o -selection clipboard'
+ let s:copy['*'] = 'xclip -i -selection primary'
+ let s:paste['*'] = 'xclip -o -selection primary'
+elseif executable('xsel')
+ let s:copy['+'] = 'xsel -i -b'
+ let s:paste['+'] = 'xsel -o -b'
+ let s:copy['*'] = 'xsel -i -p'
+ let s:paste['*'] = 'xsel -o -p'
else
echom 'clipboard: No shell command for communicating with the clipboard found.'
finish
@@ -29,14 +35,14 @@ endif
let s:clipboard = {}
-function! s:clipboard.get(...)
- return s:try_cmd(s:paste)
+function! s:clipboard.get(reg)
+ return s:try_cmd(s:paste[a:reg])
endfunction
-function! s:clipboard.set(...)
- call s:try_cmd(s:copy, a:1)
+function! s:clipboard.set(lines, regtype, reg)
+ call s:try_cmd(s:copy[a:reg], a:lines)
endfunction
function! provider#clipboard#Call(method, args)
- return s:clipboard[a:method](a:args)
+ return call(s:clipboard[a:method],a:args,s:clipboard)
endfunction
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 0844d74070..8672ab2af9 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -7547,13 +7547,6 @@ A jump table for the options with a short description can be found at |Q_op|.
Note that this causes the whole buffer to be stored in memory. Set
this option to a lower value if you run out of memory.
- {Nvim} *'unnamedclip'* *ucp'*
-'unnamedclip' 'ucp' boolean (default off)
- global
- Use the unnamed register to access the clipboard(when available).
- This option has the same effect of setting 'clipboard' to
- 'unnamed/unnamedplus' in Vim.
-
*'updatecount'* *'uc'*
'updatecount' 'uc' number (default: 200)
global