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`.
This commit is contained in:
2022-11-21 15:50:55 +01:00
parent 762089cbee
commit ac99f373d3

View File

@@ -58,8 +58,10 @@ function! HighlightCurrentWord()
unlet w:cword_match_id
endif
if (expand('<cword>') != '')
let w:cword_match_id = matchadd('CursorColumn',
\ '\V\<' . escape(expand('<cword>'), '/\') . '\>')
let w:cword_match_id = matchadd(
\ 'CursorColumn',
\ '\V\<' . escape(expand('<cword>'), '/\') . '\>',
\ -1)
endif
endfunction
augroup highlight_current_word