Closed YuCao16 closed 2 years ago
Please provide a minimal init.vim in the future, what you pasted is not minimal nor can be it used in isolation.
Highlight priority is handling internally in Neovim here and uses this value. That's out of scope for this plugin to modify.
Also having this problem, sadly linking neovims internals isn't much help.
Does anyone have a work around?
I tried with neovim internals but got frustrated very quickly. I just added some extra lines to my on_yank
highlight autocmd.
This will hide vim-illuminate
's highlights while the yanking highlight is visible and show them again when is not.
Not a perfect solution though... because illuminate's highlights take some time to hide completely.
autocmd("TextYankPost", {
desc = "Highlight yanked text",
group = augroup("highlightyank", { clear = true }),
callback = function(event)
local highlight_timeout = 800
local illuminate_available = utils.is_available("vim-illuminate")
if illuminate_available then
require("illuminate").invisible_buf(event.buf)
vim.defer_fn(function() require("illuminate").visible_buf(event.buf) end, highlight_timeout + 200)
end
vim.highlight.on_yank({
higroup = "Substitute",
timeout = highlight_timeout,
on_macro = true,
})
end,
})
utils.is_available
is just a helper function to see if vim-illuminate
exists in my current instance of neovim.
Changed my previous approach because it wasn't working when yanking words (yiw
)...
A workaround here. Works well.
vim.api.nvim_create_autocmd({ 'TextYankPost' }, {
group = vim.api.nvim_create_augroup('highlight_yank', { clear = true }),
callback = function()
local illuminate = require "illuminate"
illuminate.pause()
vim.highlight.on_yank({ timeout = 300 })
illuminate.resume()
end,
})
Apparently no workaround is needed after this recent commit.
Working fine now for me.
Yea when this issue was first opened we weren't using extmarks at the time.
Describe the bug I was using
illuminate
and highlightedyank before, but I have now given up onhighlightedyank
and useneovim
build in autocmd as follows:This code should highlight the whole line, but miss the word highlighted by
illuminate
:To Reproduce Steps to reproduce the behavior (include minimal
init.vim
or.vimrc
):illuminate
y
Expected behavior The whole line been highlighted.