aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/mappings.vim13
1 files changed, 13 insertions, 0 deletions
diff --git a/core/mappings.vim b/core/mappings.vim
index c772ec9..c53d379 100644
--- a/core/mappings.vim
+++ b/core/mappings.vim
@@ -183,3 +183,16 @@ endfor
" insert semicolon in the end
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