better-escape.nvim
better-escape.nvim copied to clipboard
refactor: rewrite to use mappings (for most modes)
Operator-pending mode still doesn't work, because i am not sure how it's supposed to work.
I added comments starting with WIP: for things that still need discussion.
Fix: #58
Fix: #46
Fix: #49
I'm also currently rewriting this on a branch here in the repo I don't currently have time to work on it nor to review this pr properly so for now I wouldn't spend too much time working on this because perhaps I'll rather use my implementation
@Sam-programs I added some changes to this pr would it be okay to merge this from your side?
@Sam-programs I added some changes to this pr would it be okay to merge this from your side?
Your changes LGTM.
In the commit above, I swapped expr-mappings to feedkeys calls to allow functions to change the buffer because functions needed to vim.schedule code that modifies the buffer. e.g:
vim.schedule(function()
vim.api.nvim_set_current_line("")
end
EDIT: This might also remove the need for the defer here. I can't check because I don't use luasnip
-- Defer execution to avoid side-effects
vim.defer_fn(function()
-- set undo point
vim.o.ul = vim.o.ul
require("luasnip").expand_or_jump()
end, 1)
the defer is still needed didn't test the other case but sounds good 👍 thank you very much for the contribution
I'll merge this in the next few days
closes https://github.com/max397574/better-escape.nvim/issues/23
Thank you very much for this contribution