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

Lua rewrite seems to have broken functionality on macOS #129

Closed accessvector closed 2 years ago

accessvector commented 2 years ago

I noticed a recent PlugUpdate seemed to stop vim-illuminate working (no error messages though). Walking back through the commits, it seems to have been introduced by the lua rewrite (09235da12cfdad2a4f695610a079b20f1b263b4a).

Testing with a minimal config:

set nocompatible
filetype off

call plug#begin(stdpath('data') . '/plugged')
Plug 'RRethy/vim-illuminate'
call plug#end()

filetype plugin indent on

When editing files (tested with nvim -u illuminate.vimrc), the word-under-cursor is no longer being highlighted. No errors are reported.

Doing a git checkout 09235da12cfdad2a4f695610a079b20f1b263b4a^ for the repo fixes things.

Reproduced across multiple macOS machines. This one is running:

% nvim --version
NVIM v0.7.2
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by brew@HMBRW-A-001-M1-004.local

Features: +acl +iconv +tui

With latest macOS:

% sw_vers
ProductName:    macOS
ProductVersion: 12.6
BuildVersion:   21G115

Thanks for making and maintaining this plugin - it's one I rely on a lot for my day-to-day work.

RRethy commented 2 years ago

You might need to update your highlight groups to use IlluminatedWordText, IlluminatedWordRead, and IlluminatedWordWrite (they should be showing underline by default). I added a new command to help debug this, try running :IlluminateDebug and paste the output here.

RRethy commented 2 years ago

Also fwiw these lines aren't needed in Neovim:

set nocompatible
filetype off
filetype plugin indent on
accessvector commented 2 years ago

Great, using the new highlight groups worked - thank you!

RRethy commented 2 years ago

That's weird 🤔 these groups have defaults, maybe your colorscheme is being loaded after the plugins and it's calling hi clear. Anyways, glad the fix was small.

RRethy commented 2 years ago

With the rewrite you might also want to check the migration guide, https://github.com/RRethy/vim-illuminate/issues/111. There's some new functionality:


You can now use `<a-n>` and `<a-p>` to jump around the references.

You can also use `<a-i>` as a textobject for the reference under the cursor.
toddknutson commented 2 years ago

That's weird 🤔 these groups have defaults, maybe your colorscheme is being loaded after the plugins and it's calling hi clear. Anyways, glad the fix was small.

This was the case for me. I changed my plugin load order so that vim-illuminate came after my colorscheme. Then my vim.api.nvim_set_hl settings worked as expected (see below).

require("illuminate").configure({
  providers = {
    "regex",
  },
  delay = 50,
  filetype_overrides = {},
  filetypes_denylist = { "NvimTree", "alpha", "packer", "qf", "Outline", "fugitive" },
  filetypes_allowlist = {},
  modes_denylist = {},
  modes_allowlist = {},
  providers_regex_syntax_denylist = {},
  providers_regex_syntax_allowlist = {},
  under_cursor = false,
})

vim.api.nvim_set_hl(0, "IlluminatedWordText", { link = "Visual" })
vim.api.nvim_set_hl(0, "IlluminatedWordRead", { link = "Visual" })
vim.api.nvim_set_hl(0, "IlluminatedWordWrite", { link = "Visual" })