vim:aucmd:HighVisualSel: Abort on empty selection

When starting visual mode on an empty line (i.e. empty selection)
everything would get highlighted.
This commit is contained in:
2024-09-25 12:59:13 +02:00
parent 551db1f1d5
commit efea98f29c

View File

@@ -94,6 +94,11 @@ function! HighlightVisualSel()
let l:old_regtype = getregtype('"') let l:old_regtype = getregtype('"')
silent! norm ygv silent! norm ygv
if @" == ""
" Abort when visual mode stated on an empty line
return
endif
let w:visual_match_ids = [] let w:visual_match_ids = []
" Add match to all windows containing the current buffer " Add match to all windows containing the current buffer