From 9796992737ec35f442fe32f1389326b0b09cab2c Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Thu, 17 Feb 2022 15:21:51 +0100 Subject: [PATCH] vim:autocmd: Highlight word under cursor --- .config/vim/vimrc.d/80-autocommands.vim | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.config/vim/vimrc.d/80-autocommands.vim b/.config/vim/vimrc.d/80-autocommands.vim index 72a80bf..d1fc95c 100644 --- a/.config/vim/vimrc.d/80-autocommands.vim +++ b/.config/vim/vimrc.d/80-autocommands.vim @@ -59,3 +59,10 @@ autocmd SourcePost termdebug.vim tnoremap " Adjust the colorcolumn together with &textwidth autocmd OptionSet textwidth let &colorcolumn=&textwidth +" +" Highlight word under cursor +augroup highlight_current_word + au! + au CursorHold * :exec 'match CursorColumn /\V\<' . escape(expand(''), '/\') . '\>/' + au CursorMoved * :exec 'match' +augroup END