diff --git a/.config/vim/vimrc.d/80-autocommands.vim b/.config/vim/vimrc.d/80-autocommands.vim index 66121f3..af29e5c 100644 --- a/.config/vim/vimrc.d/80-autocommands.vim +++ b/.config/vim/vimrc.d/80-autocommands.vim @@ -53,11 +53,16 @@ augroup END " Highlight word under cursor function! HighlightCurrentWord() + if exists('w:old_cword') && w:old_cword == expand('') + " Do not delete and readd the match if on the same word + return + endif if exists('w:cword_match_id') call matchdelete(w:cword_match_id) unlet w:cword_match_id endif if (expand('') != '') + let w:old_cword = expand('') let w:cword_match_id = matchadd( \ 'CursorColumn', \ '\V\<' . escape(expand(''), '/\') . '\>',