vim:keys: Keep cursor position on visual yank

The cursor is always moved to the beginning of the selection when
yanking in visual mode. This mapping resets the position back to where
it was.

Link: https://stackoverflow.com/a/3806664/20927629
This commit is contained in:
2024-09-25 14:30:55 +02:00
parent bdbeada7aa
commit 4cc3b6536c

View File

@@ -41,6 +41,10 @@ if (has('clipboard'))
map <leader>P "+P
endif
" Do not move the cursor to the start of the selection after a yank
" https://stackoverflow.com/a/3806664/20927629
vmap y ygv<Esc>
" Ctrl-Backspace should delete words in insert mode and on command-line.
noremap! <C-BS> <C-W>
map! <C-H> <C-BS>