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.18k stars 50 forks source link

Highlighting stops working after initial install #157

Closed elliotwesoff closed 1 year ago

elliotwesoff commented 1 year ago

The highlighting works fine immediately after installing the plugin with :PackerSync. If I close and reopen neovim nothing is ever highlighted. I know the plugin is installed and running because and jump between symbols under the cursor.

To Reproduce Steps to reproduce the behavior (include minimal init.vim or .vimrc):

  1. Add use 'RRethy/vim-illuminate/' to packer package declarations.
  2. Install with :PackerSync
  3. Observe that symbols (that occur more than once) are highlighted
  4. Close and reopen neovim
  5. Observe that no symbols (that occur more than once) are highlighted
  6. Do :IlluminatePause and then :IlluminateResume and observe that symbols still aren't highlighted

Note Omitting a minimal init.vim/init.lua/.vimrc will likely result in the issue being closed without explanation. Please see my dotfiles

Output from :IlluminateDebug :IlluminateDebug
buf_should_illuminate 1 true
config {
delay = 10,
filetype_overrides = {},
filetypes_allowlist = {},
filetypes_denylist = { "dirbuf", "dirvish", "fugitive" },
min_count_to_highlight = 1,
modes_allowlist = {},
modes_denylist = {},
providers = { "lsp", "treesitter", "regex" },
providers_regex_syntax_allowlist = {},
providers_regex_syntax_denylist = {},
under_cursor = true
}
started true
provider table: 0x7fce5a9302a0 lsp
termguicolors true
Press ENTER or type command to continue

Expected behavior Symbols under the cursor should be highlighted in all open buffers

Screenshots

Immediately after installation: 2023-01-31_11-54

No highlighting after reopening neovim: 2023-01-31_11-51

RRethy commented 1 year ago

The highlight groups are probably being cleared, try a :hi IlluminatedWordText to see if it's still defined.

Also, please follow the issue template, it asks for a minimal config, but you linked your entire dotfiles. Please post a minimal config that doesn't use packer, I suspect the issue is the order which packer loads plugins and thus creating that minimal config will show that. If you can't get things working with packer, you may have to end up defining the highlight groups yourself. The docs have examples on how to do this.

I'm going to close this because it's likely a packer loading order mistake that can be fixed by defining the highlight groups manually or reconfiguring packer. If you can produce a minimal config that shows it's unrelated to what I said, I'll reopen the issue.

elliotwesoff commented 1 year ago

@RRethy It seems that calling colorscheme [color] on pretty much any theme clears the IlluminatedWordText highlight group. So basically I can't use this plugin with any colorscheme besides the nvim default. Is there another workaround?

RRethy commented 1 year ago

This is what I figured it would be, that's an issue with packer loading things in the wrong order.

I pushed a change as a workaround so pulling latest should resolve things, but your config (and packer especially) is doing funky things if the colorscheme is being loaded after plugin initialization, see :h initialization for the correct order for things.