diff options
Diffstat (limited to 'runtime/autoload/provider')
-rw-r--r-- | runtime/autoload/provider/clipboard.vim | 32 | ||||
-rw-r--r-- | runtime/autoload/provider/python.vim | 6 |
2 files changed, 20 insertions, 18 deletions
diff --git a/runtime/autoload/provider/clipboard.vim b/runtime/autoload/provider/clipboard.vim index 615a80ca6d..46c05a882c 100644 --- a/runtime/autoload/provider/clipboard.vim +++ b/runtime/autoload/provider/clipboard.vim @@ -4,6 +4,15 @@ let s:copy = '' let s:paste = '' +function! s:try_cmd(cmd, ...) + let out = a:0 ? systemlist(a:cmd, a:1) : systemlist(a:cmd) + if v:shell_error + echo "clipboard: error: ".(len(out) ? out[0] : '') + return '' + endif + return out +endfunction + if executable('pbcopy') let s:copy = 'pbcopy' let s:paste = 'pbpaste' @@ -13,28 +22,21 @@ elseif executable('xsel') elseif executable('xclip') let s:copy = 'xclip -i -selection clipboard' let s:paste = 'xclip -o -selection clipboard' -endif - -if s:copy == '' - echom 'No shell command for communicating with the clipboard found.' +else + echom 'clipboard: No shell command for communicating with the clipboard found.' finish endif -let s:methods = {} +let s:clipboard = {} -function! s:ClipboardGet(...) - return systemlist(s:paste) +function! s:clipboard.get(...) + return s:try_cmd(s:paste) endfunction -function! s:ClipboardSet(...) - call systemlist(s:copy, a:1) +function! s:clipboard.set(...) + call s:try_cmd(s:copy, a:1) endfunction -let s:methods = { - \ 'get': function('s:ClipboardGet'), - \ 'set': function('s:ClipboardSet') - \ } - function! provider#clipboard#Call(method, args) - return s:methods[a:method](a:args) + return s:clipboard[a:method](a:args) endfunction diff --git a/runtime/autoload/provider/python.vim b/runtime/autoload/provider/python.vim index 9ca81c35f4..53b984dfe2 100644 --- a/runtime/autoload/provider/python.vim +++ b/runtime/autoload/provider/python.vim @@ -11,11 +11,11 @@ let s:loaded_python_provider = 1 let s:plugin_path = expand('<sfile>:p:h').'/script_host.py' " The python provider plugin will run in a separate instance of the python " host. -call rpc#host#RegisterClone('legacy-python-provider', 'python') -call rpc#host#RegisterPlugin('legacy-python-provider', s:plugin_path, []) +call remote#host#RegisterClone('legacy-python-provider', 'python') +call remote#host#RegisterPlugin('legacy-python-provider', s:plugin_path, []) " Ensure that we can load the python host before bootstrapping try - let s:host = rpc#host#Require('legacy-python-provider') + let s:host = remote#host#Require('legacy-python-provider') catch echomsg v:exception finish |