smoka7/hop.nvim

create_hl_autocmd = false does not work

Closed this issue · 5 comments

Hi,

Thanks for maintaining this plugin.

The wiki and internal documentation indicate to use create_hl_autocmd = false (:help hop-config-create_hl_autocmd)

https://github.com/smoka7/hop.nvim/wiki/Configuration#control-highlight-autocommands-with-create_hl_autocmd

It doesn't work anymore since 90e078a as reported in #20.

Is it possible to restore this option?

Some colorshemes (like gruvbox-materiel ans others) customize highlights for popular plugins like hop.

version (please complete the following information):

  • Nvim version: 0.9.2
  • hop.nvim version: 2.3.0 (git master)

In lua/hop/init.lua, moving highlight.insert_highlights() in if M.opts.create_hl_autocmdlike this seems to work:

if M.opts.create_hl_autocmd then
  -- Insert the highlights and register the autocommand if asked to.
  local highlight = require('hop.highlight')
  highlight.insert_highlights()
  highlight.create_autocmd()
end

I don't know if it has any side effects.

smoka7 commented

It doesn't work anymore since 90e078a as reported in #20.

The logic of highlighting hasn't changed in hop and create_hl_autocmd does exactly as it's described in docs.
If you want your theme to override hop's default highlighst you can set create_hl_autocmd = false and load your theme after require('hop').setup().

In my case, what's happening is I use lazy.nvim and lazy-load hop. I believe this means hop overwrites the hop highlights that I have set in my colorscheme. Can we either do waht @misaflo suggested, or create another config item to skip creating the highlights at all? Happy to make a PR if either of those solutions are acceptable @smoka7

smoka7 commented

@sodiumjoe Since 3b982df hop doesn't create highlights when there is already a definition.

This has fixed my issue, thanks!