better-escape.nvim icon indicating copy to clipboard operation
better-escape.nvim copied to clipboard

refactor: rewrite to use mappings (for most modes)

Open Sam-programs opened this issue 1 year ago • 1 comments

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

Sam-programs avatar Mar 10 '24 22:03 Sam-programs

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

max397574 avatar Mar 31 '24 08:03 max397574

@Sam-programs I added some changes to this pr would it be okay to merge this from your side?

max397574 avatar Jun 09 '24 08:06 max397574

@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)

Sam-programs avatar Jun 09 '24 11:06 Sam-programs

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

max397574 avatar Jun 09 '24 12:06 max397574

closes https://github.com/max397574/better-escape.nvim/issues/23

max397574 avatar Jun 18 '24 05:06 max397574

Thank you very much for this contribution

max397574 avatar Jul 04 '24 18:07 max397574