1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-03 03:40:06 +08:00

Fix clipboard feature

This commit is contained in:
wsdjeg 2017-01-12 22:17:04 +08:00
parent ad8e9c0fe2
commit e93fe481c4

View File

@ -90,8 +90,16 @@ fu! zvim#util#CopyToClipboard(...) abort
elseif a:1 == 3 elseif a:1 == 3
let f_url .= '#L' . getpos("'<")[1] . '-L' . getpos("'>")[1] let f_url .= '#L' . getpos("'<")[1] . '-L' . getpos("'>")[1]
endif endif
try
let @+=f_url let @+=f_url
echo 'Copied to clipboard' echo 'Copied to clipboard'
catch /^Vim\%((\a\+)\)\=:E354/
if has('nvim')
echohl WarningMsg | echom 'Can not find clipboard, for more info see :h clipboard' | echohl None
else
echohl WarningMsg | echom 'You need compile you vim with +clipboard feature' | echohl None
endif
endtry
else else
echohl WarningMsg | echom 'This git repo has no remote host' | echohl None echohl WarningMsg | echom 'This git repo has no remote host' | echohl None
endif endif
@ -102,8 +110,16 @@ fu! zvim#util#CopyToClipboard(...) abort
echohl WarningMsg | echom 'You need install git!' | echohl None echohl WarningMsg | echom 'You need install git!' | echohl None
endif endif
else else
try
let @+=expand('%:p') let @+=expand('%:p')
echo 'Copied to clipboard' echo 'Copied to clipboard'
catch /^Vim\%((\a\+)\)\=:E354/
if has('nvim')
echohl WarningMsg | echom 'Can not find clipboard, for more info see :h clipboard' | echohl None
else
echohl WarningMsg | echom 'You need compile you vim with +clipboard feature' | echohl None
endif
endtry
endif endif
endf endf