-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
illuminate.nvim does not refresh highlights after autojump #221
Comments
Are you using stable or nightly (0.10) nvim? |
nightly |
Does this snippet fix the issue? vim.api.nvim_create_augroup('LeapIlluminate', {})
vim.api.nvim_create_autocmd('User', {
pattern = 'LeapPatternPost',
callback = function ()
vim.api.nvim_exec_autocmds('CursorMoved', {
group = 'vim_illuminate_v2_augroup'
})
end,
group = 'LeapIlluminate',
}) |
No, on nightly it's the real one. |
You might ask this in the illuminate repo too. |
Hi, if I use this function vim.api.nvim_create_augroup("LeapIlluminate", {})
vim.api.nvim_create_autocmd("User", {
pattern = "LeapPatternPost",
callback = function()
local winid = vim.api.nvim_get_current_win()
local cursor = vim.api.nvim_win_get_cursor(winid)
-- __AUTO_GENERATED_PRINT_VAR_START__
print([==[function cursor:]==], vim.inspect(cursor)) -- __AUTO_GENERATED_PRINT_VAR_END__
require("illuminate.engine").refresh_references(_, _, "hi")
end,
group = "LeapIlluminate",
}) the cursor pos is not updated when autojump, so illuminate can't update too |
Sorry, try |
If I add a redraw command under https://github.com/RRethy/vim-illuminate/blob/305bf07b919ac526deb5193280379e2f8b599926/lua/illuminate/highlight.lua#L51 Edit: change redraw to redraw! works in every time. If someone face the same problem, here is full code vim.api.nvim_create_augroup("LeapIlluminate", {})
_G.leapjump = false
vim.api.nvim_create_autocmd("User", {
pattern = "LeapSelectPre",
callback = function()
_G.leapjump = true
local buf = vim.api.nvim_get_current_buf()
local win = vim.api.nvim_get_current_win()
require("illuminate.engine").refresh_references(buf, win)
end,
group = "LeapIlluminate",
})
function M.buf_highlight_references(bufnr, references)
if config.min_count_to_highlight() > #references then
return
end
local cursor_pos = util.get_cursor_pos()
for _, reference in ipairs(references) do
if config.under_cursor(bufnr) or not ref.is_pos_in_ref(cursor_pos, reference) then
M.range(bufnr, reference[1], reference[2], reference[3])
end
end
if _G.leapjump then
vim.cmd("redraw!")
_G.leapjump = false
end
end |
I have illuminate.nvim and it will highlight cursorword, but leap's autojump seems not trigger their detect of new cursorpos, only after I type the third char. Is it probably a fake cursor during autojump?
iShot_2024-04-10_08.35.15.mp4
The text was updated successfully, but these errors were encountered: