Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] provider/clipboard: allow configuration #6030

Closed
wants to merge 9 commits into from
7 changes: 6 additions & 1 deletion runtime/autoload/provider/clipboard.vim
Expand Up @@ -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['+']
Expand Down
19 changes: 19 additions & 0 deletions runtime/doc/provider.txt
Expand Up @@ -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.

Expand Down