provider/clipboard.vim: never show a warning on sourcing

Never throw an error when provider/clipboard.vim is sourced for the first time.
Save the error instead and expose it via `provider#clipboard#Error()`, mimicking
provider/python.vim.
This commit is contained in:
Marco Hinz 2016-10-29 14:35:15 +02:00
parent 797d72a997
commit 3a802e3c16

View File

@ -31,6 +31,11 @@ function! s:try_cmd(cmd, ...)
endfunction
let s:cache_enabled = 1
let s:err = ''
function! provider#clipboard#Error() abort
return s:err
endfunction
function! provider#clipboard#Executable() abort
if executable('pbcopy')
@ -66,11 +71,11 @@ function! provider#clipboard#Executable() abort
return 'doitclient'
endif
let s:err = 'clipboard: No clipboard tool available. See :help clipboard'
return ''
endfunction
if empty(provider#clipboard#Executable())
echom 'clipboard: No clipboard tool available. See :help clipboard'
finish
endif