From efea98f29c6d9591e1a648ea267194f60732e816 Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Wed, 25 Sep 2024 12:59:13 +0200 Subject: [PATCH] vim:aucmd:HighVisualSel: Abort on empty selection When starting visual mode on an empty line (i.e. empty selection) everything would get highlighted. --- .config/vim/vimrc.d/80-autocommands.vim | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.config/vim/vimrc.d/80-autocommands.vim b/.config/vim/vimrc.d/80-autocommands.vim index 67b7ff3..bfe538a 100644 --- a/.config/vim/vimrc.d/80-autocommands.vim +++ b/.config/vim/vimrc.d/80-autocommands.vim @@ -94,6 +94,11 @@ function! HighlightVisualSel() let l:old_regtype = getregtype('"') silent! norm ygv + if @" == "" + " Abort when visual mode stated on an empty line + return + endif + let w:visual_match_ids = [] " Add match to all windows containing the current buffer