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

Use different widgets for 'i' and 'a' #89

Merged
merged 2 commits into from
Apr 8, 2021
Merged

Use different widgets for 'i' and 'a' #89

merged 2 commits into from
Apr 8, 2021

Conversation

eleanor-clifford
Copy link
Contributor

The current implementation of zvm_enter_insert_mode breaks if you don't use 'i' and 'a' to trigger it (which is a problem for me, as I use a non-standard keyboard). This PR replaces zvm_enter_insert_mode with zvm_enter_insert_mode_before and zvm_enter_insert_mode_after, for 'i' and 'a' respectively.

I'm aware that this will break functionality for anyone who has remapped or explicitly mapped zvm_enter_insert_mode, if you'd like we can leave the original implementation in, with a warning to change the remaps to the new functions.

@jeffreytse jeffreytse self-requested a review April 8, 2021 02:29
@jeffreytse jeffreytse self-assigned this Apr 8, 2021
@jeffreytse jeffreytse added the enhancement New feature or request label Apr 8, 2021
Copy link
Owner

@jeffreytse jeffreytse left a comment

Choose a reason for hiding this comment

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

Thank you, I understand your concern, I will do some revision for better compatibility on this issue.

This feature allows you to bind key to widget with parameters, it
gives you a way to bind a custom key to a key depended widget such
as `zvm_enter_insert_mode` and so on.
@jeffreytse
Copy link
Owner

jeffreytse commented Apr 8, 2021

For now, we can settle this issue in below snippet:

# The plugin will auto execute this zvm_after_lazy_keybindings function
function zvm_after_init() {
  zvm_bindkey vicmd ';' zvm_enter_insert_mode i
  zvm_bindkey vicmd ':' zvm_enter_insert_mode a
}

And welcome to star this project for further updates in the future. : )

@jeffreytse jeffreytse merged commit b09479f into jeffreytse:master Apr 8, 2021
Copy link
Owner

@jeffreytse jeffreytse left a comment

Choose a reason for hiding this comment

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

This revision allows users to do some complexed bindings.

Copy link
Contributor Author

@eleanor-clifford eleanor-clifford left a comment

Choose a reason for hiding this comment

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

This way of doing it looks good for compatibility! Looks like you missed a few things though, i don't think this will work in the current state (although haven't tested)

zsh-vi-mode.zsh Show resolved Hide resolved
zsh-vi-mode.zsh Show resolved Hide resolved
@eleanor-clifford
Copy link
Contributor Author

Oh, i just saw that you fixed it on the latest commit in master, nevermind!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants