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

Replace operator keymap field with smarter funcs #22

Merged
merged 2 commits into from
Aug 12, 2023

Conversation

julienvincent
Copy link
Owner

Currently the E/B motions are configured with operator = true which additionally adds the o mode keymap with the fn wrapped in normal! v to allow it to function in operator-pending mode.

This moves responsibility into the keymap setup phase instead of the function handling the action, and in the current implementation won't work in visual mode operator-pending states.

This commit shifts the responsibility to the motions API by allowing them to detect the current mode and conditionally set normal! v.

Currently the E/B motions are configured with `operator = true` which
additionally adds the `o` mode keymap with the fn wrapped in `normal! v`
to allow it to function in operator-pending mode.

This moves responsibility into the keymap setup phase instead of the
function handling the action, and in the current implementation won't
work in visual mode operator-pending states.

This commit shifts the responsibility to the motions API by allowing
them to detect the current mode and conditionally set `normal! v`.
When switching to visual mode from operator-pending the value of the
internal `vim.v.count1` var is reset to 1.

This commit stores the value before switching to `normal! v`.
Copy link
Collaborator

@armed armed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

9000*APROVED!

@julienvincent julienvincent merged commit 3237777 into master Aug 12, 2023
2 checks passed
@julienvincent julienvincent deleted the simplify-keymap-settings branch August 12, 2023 12:10
@julienvincent julienvincent restored the simplify-keymap-settings branch October 13, 2024 12:14
@julienvincent julienvincent deleted the simplify-keymap-settings branch October 13, 2024 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants