RRethy / vim-illuminate

illuminate.vim - (Neo)Vim plugin for automatically highlighting other uses of the word under the cursor using either LSP, Tree-sitter, or regex matching.
2.14k stars 47 forks source link

goyou integration, illumination breaks on entering/leaving distraction free mode #59

Closed dpopchev closed 3 years ago

dpopchev commented 3 years ago

After exiting the distraction free mode, provided by the aforementioned goyo, the illumination is not working:

Steps to reproduce:

  1. open file, all is fine
  2. enter distraction free mode, all is fine
  3. exit distraction free mode, illumination stops working
  4. enter distraction free mode again, all is fine

It seems the plugin is clearing the highlight, as on step.3 I can check that

:hi illuminatedWord
illuminatedWord xxx cleared

I attempted to

augroup illuminate_augroup
    autocmd!
    autocmd BufEnter * hi illuminatedWord cterm=bold,underline
    autocmd BufLeave * hi illuminatedWord cterm=bold,underline
augroup END

but this is not sufficient.

NOTE: if the autocmd is applied at VimEnter, not BufEnter, then step 4 is not reproduced.

RRethy commented 3 years ago

That plugin appears to have GoyoEnter and GoyoLeave autocmds you could try. Maybe this could work:

autocmd! User GoyoLeave nested hi illuminatedWord cterm=bold,underline
dpopchev commented 3 years ago

Thanks, worked like a charm!