mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge #5542 from mhinz/health/clipboard
CheckHealth: add clipboard check
This commit is contained in:
commit
349fa0048b
@ -45,6 +45,19 @@ function! s:download(url) abort
|
|||||||
return 'missing `curl` and `python`, cannot make pypi request'
|
return 'missing `curl` and `python`, cannot make pypi request'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" Check for clipboard tools.
|
||||||
|
function! s:check_clipboard() abort
|
||||||
|
call health#report_start('Clipboard')
|
||||||
|
|
||||||
|
let clipboard_tool = provider#clipboard#Executable()
|
||||||
|
if empty(clipboard_tool)
|
||||||
|
call health#report_warn(
|
||||||
|
\ "No clipboard tool found. Using the system clipboard won't work.",
|
||||||
|
\ ['See ":help clipboard"'])
|
||||||
|
else
|
||||||
|
call health#report_ok('Clipboard tool found: '. clipboard_tool)
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
" Get the latest Neovim Python client version from PyPI.
|
" Get the latest Neovim Python client version from PyPI.
|
||||||
function! s:latest_pypi_version() abort
|
function! s:latest_pypi_version() abort
|
||||||
@ -371,6 +384,7 @@ function! s:check_ruby() abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! health#provider#check() abort
|
function! health#provider#check() abort
|
||||||
|
call s:check_clipboard()
|
||||||
call s:check_python(2)
|
call s:check_python(2)
|
||||||
call s:check_python(3)
|
call s:check_python(3)
|
||||||
call s:check_ruby()
|
call s:check_ruby()
|
||||||
|
@ -31,34 +31,51 @@ function! s:try_cmd(cmd, ...)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
let s:cache_enabled = 1
|
let s:cache_enabled = 1
|
||||||
if executable('pbcopy')
|
let s:err = ''
|
||||||
let s:copy['+'] = 'pbcopy'
|
|
||||||
let s:paste['+'] = 'pbpaste'
|
function! provider#clipboard#Error() abort
|
||||||
let s:copy['*'] = s:copy['+']
|
return s:err
|
||||||
let s:paste['*'] = s:paste['+']
|
endfunction
|
||||||
let s:cache_enabled = 0
|
|
||||||
elseif exists('$DISPLAY') && executable('xsel')
|
function! provider#clipboard#Executable() abort
|
||||||
let s:copy['+'] = 'xsel --nodetach -i -b'
|
if executable('pbcopy')
|
||||||
let s:paste['+'] = 'xsel -o -b'
|
let s:copy['+'] = 'pbcopy'
|
||||||
let s:copy['*'] = 'xsel --nodetach -i -p'
|
let s:paste['+'] = 'pbpaste'
|
||||||
let s:paste['*'] = 'xsel -o -p'
|
let s:copy['*'] = s:copy['+']
|
||||||
elseif exists('$DISPLAY') && executable('xclip')
|
let s:paste['*'] = s:paste['+']
|
||||||
let s:copy['+'] = 'xclip -quiet -i -selection clipboard'
|
let s:cache_enabled = 0
|
||||||
let s:paste['+'] = 'xclip -o -selection clipboard'
|
return 'pbcopy'
|
||||||
let s:copy['*'] = 'xclip -quiet -i -selection primary'
|
elseif exists('$DISPLAY') && executable('xsel')
|
||||||
let s:paste['*'] = 'xclip -o -selection primary'
|
let s:copy['+'] = 'xsel --nodetach -i -b'
|
||||||
elseif executable('lemonade')
|
let s:paste['+'] = 'xsel -o -b'
|
||||||
let s:copy['+'] = 'lemonade copy'
|
let s:copy['*'] = 'xsel --nodetach -i -p'
|
||||||
let s:paste['+'] = 'lemonade paste'
|
let s:paste['*'] = 'xsel -o -p'
|
||||||
let s:copy['*'] = 'lemonade copy'
|
return 'xsel'
|
||||||
let s:paste['*'] = 'lemonade paste'
|
elseif exists('$DISPLAY') && executable('xclip')
|
||||||
elseif executable('doitclient')
|
let s:copy['+'] = 'xclip -quiet -i -selection clipboard'
|
||||||
let s:copy['+'] = 'doitclient wclip'
|
let s:paste['+'] = 'xclip -o -selection clipboard'
|
||||||
let s:paste['+'] = 'doitclient wclip -r'
|
let s:copy['*'] = 'xclip -quiet -i -selection primary'
|
||||||
let s:copy['*'] = s:copy['+']
|
let s:paste['*'] = 'xclip -o -selection primary'
|
||||||
let s:paste['*'] = s:paste['+']
|
return 'xclip'
|
||||||
else
|
elseif executable('lemonade')
|
||||||
echom 'clipboard: No clipboard tool available. See :help clipboard'
|
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
|
||||||
|
|
||||||
|
let s:err = 'clipboard: No clipboard tool available. See :help clipboard'
|
||||||
|
return ''
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
if empty(provider#clipboard#Executable())
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user