vim_current_word icon indicating copy to clipboard operation
vim_current_word copied to clipboard

When disabling highlight, highlights remain

Open fqxp opened this issue 4 years ago • 2 comments

When the cursor is on a word and twin words are highlighted, and when I then disable highlighting by running :let g:vim_current_word#enabled=0, the highlighted words keep being highlighted. Expected behavior would be that they lose their highlighting.

I want to switch highlighting on and off using a shortcut because scrolling is rather slow when highlighting is turned off.

fqxp avatar Jul 16 '20 07:07 fqxp

Oh... got it. You need to use :call vim_current_word#vim_current_word_disable() instead of modifying the variable.

This function can be used to switch this plugin on and off:

function ToggleCurrentWord()
  if g:vim_current_word#enabled == 1
    call vim_current_word#vim_current_word_disable()
  else
    call vim_current_word#vim_current_word_enable()
    call vim_current_word#highlight_word_under_cursor()
  endif
endfunction

I’ll leave it to you to close this issue because this might be expected behavior after all.

fqxp avatar Jul 16 '20 07:07 fqxp

why is the autocmd :let b:vim_current_word_disabled_in_this_buffer = 1? Should we remove the : ?

sisrfeng avatar Mar 29 '22 01:03 sisrfeng