From 3cdb9d690284ae9c2e1e7e300ad6f0baac114ebe Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Thu, 31 Oct 2024 23:18:32 +0100 Subject: [PATCH] vim:au: Stop timer too when clearing cword highlight When deleting the cword match, any running timer should stop too so that the highlighting does not restart. This had led to some weird flickering bug. --- .config/vim/vimrc.d/80-autocommands.vim | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.config/vim/vimrc.d/80-autocommands.vim b/.config/vim/vimrc.d/80-autocommands.vim index 5cc2ca6..ac34374 100644 --- a/.config/vim/vimrc.d/80-autocommands.vim +++ b/.config/vim/vimrc.d/80-autocommands.vim @@ -146,10 +146,16 @@ endfunction " Clear the highlights of and visual selection function! ClearHighlights(what = s:CLEAR_HIGHS_ALL) - if and(a:what, s:CLEAR_HIGHS_CWORD) && exists('w:cword_match_id') - call matchdelete(w:cword_match_id) - unlet w:cword_match_id - unlet w:old_cword + if and(a:what, s:CLEAR_HIGHS_CWORD) + if exists('w:cword_match_id') + call matchdelete(w:cword_match_id) + unlet w:cword_match_id + unlet w:old_cword + endif + if exists('w:cword_timer_id') + call timer_stop(w:cword_timer_id) + unlet w:cword_timer_id + endif endif if and(a:what, s:CLEAR_HIGHS_VISUAL) && exists('w:visual_match_ids') for l:pairs in w:visual_match_ids