1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 20:10:05 +08:00

fix(clipboard): return empty string

This commit is contained in:
wsdjeg 2022-06-11 08:45:08 +08:00
parent ee3ce867f4
commit 79378b0e4c

View File

@ -49,8 +49,10 @@ function! s:set_command() abort
return [yank, paste] return [yank, paste]
endfunction endfunction
" yank to system clipboard
function! clipboard#yank() abort function! clipboard#yank() abort
call system(s:yank_cmd, GetSelectedText()) call system(s:yank_cmd, s:get_selection_text())
return ''
endfunction endfunction
@ -62,9 +64,11 @@ function! clipboard#paste(mode) abort
endfunction endfunction
function! GetSelectedText() function! s:get_selection_text()
let save_x = @x
normal gv"xy normal gv"xy
let result = getreg("x") let result = @x
let @x = save_x
return result return result
endfunction endfunction