From ac99f373d3781d2a02e59621ab662ea07bf47e9f Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Mon, 21 Nov 2022 15:50:55 +0100 Subject: [PATCH] vim:autocmd: Highlight cword with lower priority Use a priority of below 0 so that the cword highlighting does not overrule the highlighting of `hlsearch`. --- .config/vim/vimrc.d/80-autocommands.vim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.config/vim/vimrc.d/80-autocommands.vim b/.config/vim/vimrc.d/80-autocommands.vim index 2fe9d9a..4cb721e 100644 --- a/.config/vim/vimrc.d/80-autocommands.vim +++ b/.config/vim/vimrc.d/80-autocommands.vim @@ -58,8 +58,10 @@ function! HighlightCurrentWord() unlet w:cword_match_id endif if (expand('') != '') - let w:cword_match_id = matchadd('CursorColumn', - \ '\V\<' . escape(expand(''), '/\') . '\>') + let w:cword_match_id = matchadd( + \ 'CursorColumn', + \ '\V\<' . escape(expand(''), '/\') . '\>', + \ -1) endif endfunction augroup highlight_current_word