diff --git a/.config/vim/vimrc.d/80-autocommands.vim b/.config/vim/vimrc.d/80-autocommands.vim index d167466..e2aead5 100644 --- a/.config/vim/vimrc.d/80-autocommands.vim +++ b/.config/vim/vimrc.d/80-autocommands.vim @@ -52,8 +52,13 @@ augroup termdebug_bindings augroup END " Highlight word under cursor +function! HighlightCurrentWord() + if (expand('') != '') + exec 'match CursorColumn /\V\<' . escape(expand(''), '/\') . '\>/' + endif +endfunction augroup highlight_current_word au! - au CursorHold * :exec 'match CursorColumn /\V\<' . escape(expand(''), '/\') . '\>/' - au CursorMoved * :exec 'match' + au CursorHold * call HighlightCurrentWord() + au CursorMoved * match augroup END