Bind Ctrl+F in vi keymaps for zsh - #92
Open
Christian-Sidak wants to merge 1 commit into
Open
Conversation
The zsh integration only ran a bare bindkey, which installs the widget in whichever keymap is active when the file is sourced. Users who enable vi mode (bindkey -v) after sourcing ended up with Ctrl+F doing nothing, and even when vi mode was enabled first the binding was missing from vicmd. Bind explicitly in the emacs, viins, and vicmd keymaps, matching what the bash integration already does with bind -m for emacs-standard, vi-insert, and vi-command. Fixes djcopley#51
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The zsh integration installs the widget with a bare
bindkey '^F', which only touches whichever keymap is the current main keymap at source time. If you enable vi mode withbindkey -vaftershelloracle.zshis sourced (the usual order when the plugin line comes before the vi-mode line in.zshrc), the binding stays behind in the emacs keymap and Ctrl+F falls through toself-insert. Even withbindkey -vfirst, the widget was never bound invicmd.This binds the widget explicitly in
emacs,viins, andvicmd, which is the same thing the bash integration already does withbind -m emacs-standard,bind -m vi-insert, andbind -m vi-command. It also matches how fzf handles its zsh keybindings.Checked with
zsh -fin all four orderings (emacs default, source thenbindkey -v,bindkey -vthen source, andbindkey -M vicmd '^F'after each), and the widget is bound in every case now. Before the change, source-then-bindkey -vleftviinsonself-insertandvicmdonundefined-key.Fixes #51