diff --git a/.config/vim/vimrc.d/80-autocommands.vim b/.config/vim/vimrc.d/80-autocommands.vim index a13a417..653fb11 100644 --- a/.config/vim/vimrc.d/80-autocommands.vim +++ b/.config/vim/vimrc.d/80-autocommands.vim @@ -61,16 +61,17 @@ augroup END " Highlight word under cursor in other places function! HighlightCurrentWord() - if exists('w:old_cword') && w:old_cword == expand('') + let l:cword = expand('') + if exists('w:old_cword') && w:old_cword == l:cword " Do not delete and readd the match if on the same word return endif call ClearHighlights() - if (expand('') != '') - let w:old_cword = expand('') + if (l:cword != '') + let w:old_cword = l:cword let w:cword_match_id = matchadd( \ 'CursorColumn', - \ '\V\<' . escape(expand(''), '/\') . '\>', + \ '\V\<' . escape(l:cword, '/\') . '\>', \ -1) endif endfunction