From 4cc3b6536cd0445585197aeeb48e03eabf3b9d3a Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Wed, 25 Sep 2024 14:30:55 +0200 Subject: [PATCH] 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 --- .config/vim/vimrc.d/40-keys.vim | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.config/vim/vimrc.d/40-keys.vim b/.config/vim/vimrc.d/40-keys.vim index 6f59079..52ab9bc 100644 --- a/.config/vim/vimrc.d/40-keys.vim +++ b/.config/vim/vimrc.d/40-keys.vim @@ -41,6 +41,10 @@ if (has('clipboard')) map 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 + " Ctrl-Backspace should delete words in insert mode and on command-line. noremap! map!