leap.nvim
leap.nvim copied to clipboard
Disable concealing when using leap.nvim
When I have used lightspeed.nvim, it was disabling concealing of current buffer. Meanwhile with leap.nvim concealing is still present. It would be much better to have an option to disable concealing while using leap.
Yes, that is on the todo list. The problem is that window-local options (like conceallevel
) are not trivial to handle when doing cross-window motions, so I decided not doing any automagical/buggy thing for the moment, before thinking it through. You could use autocommands, disable conceal on LeapEnter
, and restore on LeapLeave
by yourself though, that will probably work fine most of the time.
I see, thanks for pointing out at augroups. I don't know whether i should keep this issue open though.
Alright, I've tried to use LeapEnter
and LeapLeave
events, but they don't work. Neovim does not recognise them. I tried to register those autocmds after loading leap.nvim, so it is not loading order issue.
Oh, this is my bad, I forgot that I need to append User
before custom vim events
Using autocmds for this pretty weird because LeapEnter
is being executed after I have typed sre
(for example). I had to map using a Lua function that turns conceal off, calls leap, and then on LeapLeave (yes, it works perfectly) enable conceal.
LeapEnter
is triggered right after s
, I don't know why you don't see the effect... maybe you could share the autocmd snippet you used, possibly there's some trivial mistake somewhere.
vim.api.nvim_create_autocmd("User LeapEnter", {
group = "Conceal",
callback = function()
vim.opt.conceallevel = 0
end
})
Conceal
augroup was created before.
When I put some print
statements there I can see them only after I have finished my jumping sequence. I believe that leap somehow stops screen redraw right after it has been triggered. So conceallevel just can't be applied at the right time
After a couple of tests I realized that the problem is in LeapLeave
event. When I disable LeapLeave
autocmd, that looks like this:
vim.api.nvim_create_autocmd("User LeapLeave", {
group = "Conceal",
callback = function()
vim.opt.conceallevel = 2
end,
})
Concealing is being disable as it should. So, the problem is inside LeapLeave
event, maybe it is being executed at the wrong moment, not after s
sequence was executed?
Oh, I get it. The event is User
, and LeapEnter
/LeapLeave
are patterns for that event. You have to call it like this:
vim.api.nvim_create_autocmd('User', { pattern = 'LeapEnter', ... }
I also tripped upon this first! (And probably lots of others.)
Oh, this makes sense now. Thanks for support, it works as expected now!