mirror of
https://github.com/jdhao/nvim-config.git
synced 2025-06-08 14:14:33 +02:00
add mapping: keep cursor position after yanking
This commit is contained in:
parent
573f9277cb
commit
49fc7f3dbc
@ -183,3 +183,16 @@ endfor
|
|||||||
" insert semicolon in the end
|
" insert semicolon in the end
|
||||||
inoremap <A-;> <ESC>miA;<ESC>`ii
|
inoremap <A-;> <ESC>miA;<ESC>`ii
|
||||||
|
|
||||||
|
" Keep cursor position after yanking
|
||||||
|
nnoremap y myy
|
||||||
|
xnoremap y myy
|
||||||
|
|
||||||
|
augroup restore_after_yank
|
||||||
|
autocmd!
|
||||||
|
autocmd TextYankPost * call s:restore_cursor()
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
function! s:restore_cursor() abort
|
||||||
|
silent! normal `y
|
||||||
|
silent! delmarks y
|
||||||
|
endfunction
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user