Skip to content
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

refactor: rewrite to use mappings (for most modes) #59

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

Sam-programs
Copy link
Contributor

@Sam-programs Sam-programs commented Mar 10, 2024

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

@max397574
Copy link
Owner

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
Copy link
Owner

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

@Sam-programs
Copy link
Contributor Author

Sam-programs commented Jun 9, 2024

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

@max397574
Copy link
Owner

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
Copy link
Owner

closes #23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants