Option to respect highlighted search over coc-highlight
teddyhwang opened this issue · 2 comments
I'm looking for a way for coc-highlight to respect search highlights with something like the following:
autocmd CursorHold * silent call HighlightCursorWord()
autocmd CursorMoved * silent call ValidateHighlight()
function! HighlightCursorWord()
let search = getreg('/')
let cword = expand('<cword>')
if match(cword, search) == -1
call CocActionAsync('highlight')
endif
endfunction
function! ValidateHighlight()
let search = getreg('/')
let cword = expand('<cword>')
if match(cword, search) == 0
call CocActionAsync('clearHighlight')
endif
endfunction
There's currently no coc-action
to do something like clearHighlight
so this doesn't work. Is there a better way to do this?
I've attached a video of what the problem looks like where the search highlight does not kick in until after you move off the word:
I think you should just decrease updatetime
by set updatetime=300
.
My current setting is set updatetime=100
The problem is that CocActionAsync('highlight')
will always trump the search highlight color. Here's a more clear example with just autocmd CursorHold * silent call CocActionAsync('highlight')
:
I would prefer to maintain the yellow bg highlight even when coc-highlight
kicks in for the word being under the cursor