mirror of
https://github.com/neovim/neovim.git
synced 2024-12-29 14:41:06 -07:00
provider/clipboard.vim: refactor
This commit is contained in:
parent
36c0ec6dd4
commit
0a1b852cd1
@ -31,33 +31,45 @@ function! s:try_cmd(cmd, ...)
|
||||
endfunction
|
||||
|
||||
let s:cache_enabled = 1
|
||||
if executable('pbcopy')
|
||||
let s:copy['+'] = 'pbcopy'
|
||||
let s:paste['+'] = 'pbpaste'
|
||||
let s:copy['*'] = s:copy['+']
|
||||
let s:paste['*'] = s:paste['+']
|
||||
let s:cache_enabled = 0
|
||||
elseif exists('$DISPLAY') && executable('xsel')
|
||||
let s:copy['+'] = 'xsel --nodetach -i -b'
|
||||
let s:paste['+'] = 'xsel -o -b'
|
||||
let s:copy['*'] = 'xsel --nodetach -i -p'
|
||||
let s:paste['*'] = 'xsel -o -p'
|
||||
elseif exists('$DISPLAY') && executable('xclip')
|
||||
let s:copy['+'] = 'xclip -quiet -i -selection clipboard'
|
||||
let s:paste['+'] = 'xclip -o -selection clipboard'
|
||||
let s:copy['*'] = 'xclip -quiet -i -selection primary'
|
||||
let s:paste['*'] = 'xclip -o -selection primary'
|
||||
elseif executable('lemonade')
|
||||
let s:copy['+'] = 'lemonade copy'
|
||||
let s:paste['+'] = 'lemonade paste'
|
||||
let s:copy['*'] = 'lemonade copy'
|
||||
let s:paste['*'] = 'lemonade paste'
|
||||
elseif executable('doitclient')
|
||||
let s:copy['+'] = 'doitclient wclip'
|
||||
let s:paste['+'] = 'doitclient wclip -r'
|
||||
let s:copy['*'] = s:copy['+']
|
||||
let s:paste['*'] = s:paste['+']
|
||||
else
|
||||
|
||||
function! provider#clipboard#Executable() abort
|
||||
if executable('pbcopy')
|
||||
let s:copy['+'] = 'pbcopy'
|
||||
let s:paste['+'] = 'pbpaste'
|
||||
let s:copy['*'] = s:copy['+']
|
||||
let s:paste['*'] = s:paste['+']
|
||||
let s:cache_enabled = 0
|
||||
return 'pbcopy'
|
||||
elseif exists('$DISPLAY') && executable('xsel')
|
||||
let s:copy['+'] = 'xsel --nodetach -i -b'
|
||||
let s:paste['+'] = 'xsel -o -b'
|
||||
let s:copy['*'] = 'xsel --nodetach -i -p'
|
||||
let s:paste['*'] = 'xsel -o -p'
|
||||
return 'xsel'
|
||||
elseif exists('$DISPLAY') && executable('xclip')
|
||||
let s:copy['+'] = 'xclip -quiet -i -selection clipboard'
|
||||
let s:paste['+'] = 'xclip -o -selection clipboard'
|
||||
let s:copy['*'] = 'xclip -quiet -i -selection primary'
|
||||
let s:paste['*'] = 'xclip -o -selection primary'
|
||||
return 'xclip'
|
||||
elseif executable('lemonade')
|
||||
let s:copy['+'] = 'lemonade copy'
|
||||
let s:paste['+'] = 'lemonade paste'
|
||||
let s:copy['*'] = 'lemonade copy'
|
||||
let s:paste['*'] = 'lemonade paste'
|
||||
return 'lemonade'
|
||||
elseif executable('doitclient')
|
||||
let s:copy['+'] = 'doitclient wclip'
|
||||
let s:paste['+'] = 'doitclient wclip -r'
|
||||
let s:copy['*'] = s:copy['+']
|
||||
let s:paste['*'] = s:paste['+']
|
||||
return 'doitclient'
|
||||
endif
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
if empty(provider#clipboard#Executable())
|
||||
echom 'clipboard: No clipboard tool available. See :help clipboard'
|
||||
finish
|
||||
endif
|
||||
|
Loading…
Reference in New Issue
Block a user