provider/clipboard.vim: allow configuration #6030

Closes #6029
This commit is contained in:
Justin M. Keyes 2017-06-27 12:21:53 +02:00
parent 91749c06dc
commit 6016ac270f
2 changed files with 25 additions and 1 deletions

View File

@ -47,7 +47,12 @@ function! provider#clipboard#Error() abort
endfunction
function! provider#clipboard#Executable() abort
if has('mac') && executable('pbcopy')
if exists('g:clipboard')
let s:copy = g:clipboard.copy
let s:paste = g:clipboard.paste
let s:cache_enabled = g:clipboard.cache_enabled
return g:clipboard.name
elseif has('mac') && executable('pbcopy')
let s:copy['+'] = 'pbcopy'
let s:paste['+'] = 'pbpaste'
let s:copy['*'] = s:copy['+']

View File

@ -129,6 +129,25 @@ are found in your `$PATH`.
- lemonade (for SSH) https://github.com/pocke/lemonade
- doitclient (for SSH) http://www.chiark.greenend.org.uk/~sgtatham/doit/
If you would like to configure the provider: >
let g:clipboard = {
\ 'name': 'myClipboard',
\ 'copy': {
\ '+': 'copyCommand',
\ '*': 'copyCommand',
\ },
\ 'paste': {
\ '+': 'pasteCommand',
\ '*': 'pasteCommand',
\ },
\ 'cache_enabled': 1,
\ }
If the cache is enabled, then when a selection is copied and the copy command
is executed, neovim will cache this selection until the copy command process
dies. Then, when pasting, if the copy command process has not died, the cached
selection is returned instead of executing the paste command.
The presence of a suitable clipboard tool implicitly enables the '+' and '*'
registers.