[bugfix] unable to copy inline text
This commit is contained in:
parent
279f0bb414
commit
afc81a5d07
|
@ -62,7 +62,20 @@ nnoremap <leader>5 :b5<CR>
|
||||||
nnoremap <leader>w :w<CR>
|
nnoremap <leader>w :w<CR>
|
||||||
nnoremap <leader><Esc> :noh<return><esc>
|
nnoremap <leader><Esc> :noh<return><esc>
|
||||||
|
|
||||||
xnoremap <leader>y <esc>:'<,'>:w !clip.exe<CR>
|
function! WSLCopy()
|
||||||
|
" Why is this not a built-in Vim script function?!
|
||||||
|
let [line_start, column_start] = getpos("'<")[1:2]
|
||||||
|
let [line_end, column_end] = getpos("'>")[1:2]
|
||||||
|
let lines = getline(line_start, line_end)
|
||||||
|
if len(lines) == 0
|
||||||
|
return ''
|
||||||
|
endif
|
||||||
|
let lines[-1] = lines[-1][: column_end - (&selection == 'inclusive' ? 1 : 2)]
|
||||||
|
let lines[0] = lines[0][column_start - 1:]
|
||||||
|
call system('clip.exe', join(lines, "\n"))
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
xnoremap <leader>y <esc>:call WSLCopy()<CR>
|
||||||
|
|
||||||
nmap <leader>"" ysiW"
|
nmap <leader>"" ysiW"
|
||||||
nmap <leader>'' ysiW'
|
nmap <leader>'' ysiW'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user