Skip to content

Commit

Permalink
Revert "Fix to restore bindings after switching to vi-mode"
Browse files Browse the repository at this point in the history
This reverts commit b609aa0 -- this commit
was a bad idea, because it makes vi-mode very difficult to use. The default
`bindkey` keybindings are NOT MEANT to coexist with `bindkey -v` Vi mode;
that's why `bindkey -v` clears them in the first place! Restoring all of the
default keybindings after enabling Vi mode, the way the reverted commit did,
causes many collisions between those default keybindings that begin with ESC
and the command-mode-initiating ESC of Vi mode. See Issue 1438 of
robbyrussell/oh-my-zsh. If people have custom keybindings, they should create
them in their ~/.zshrc AFTER enabling the vi-mode plugin and sourcing
oh-my-zsh.sh.

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#	modified:   plugins/vi-mode/vi-mode.plugin.zsh
#
  • Loading branch information
maxbane committed Nov 28, 2012
1 parent d750e7d commit 5385475
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions plugins/vi-mode/vi-mode.plugin.zsh
Expand Up @@ -5,12 +5,7 @@ function zle-line-init zle-keymap-select {
zle -N zle-line-init
zle -N zle-keymap-select

#changing mode clobbers the keybinds, so store the keybinds before and execute
#them after
binds=`bindkey -L`
bindkey -v
for bind in ${(@f)binds}; do eval $bind; done
unset binds

# if mode indicator wasn't setup by theme, define default
if [[ "$MODE_INDICATOR" == "" ]]; then
Expand Down

2 comments on commit 5385475

@jimhester
Copy link
Contributor

Choose a reason for hiding this comment

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

A large part of what makes oh-my-zsh attractive is that it sets up these custom key bindings for a variety of useful commands. It is true that some of them are escape chords, and therefore can be inadvertently triggered. Removing all of them completely however seems to me to be an overreaction, and makes vi-mode much less useful overall. A better approach would be to omit those binds which conflict, or to modify them into using a conflict free modifier.

@maxbane
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is just a revert of a relatively recent change, so it's not removing anything that was longstanding. However, your point is taken. One solution would be to make these binds a plugin that people can choose to include or not in their zshrc.

Please sign in to comment.