vim:autocommands: Reset old_cword when deleting

When deleting the match, w:old_cword has to be unset as well. Otherwise
it can happen that it is not properly readded (e.g. when moving from a
word to an empty line and then back to the same word).
This commit is contained in:
2022-12-06 15:34:33 +01:00
parent 5ee98950eb
commit 9abf215871

View File

@@ -60,6 +60,7 @@ function! HighlightCurrentWord()
if exists('w:cword_match_id')
call matchdelete(w:cword_match_id)
unlet w:cword_match_id
unlet w:old_cword
endif
if (expand('<cword>') != '')
let w:old_cword = expand('<cword>')