mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-12 21:39:48 +01:00
53854754e0
This reverts commit b609aa0e6c
-- 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
#
22 lines
526 B
Bash
22 lines
526 B
Bash
function zle-line-init zle-keymap-select {
|
|
zle reset-prompt
|
|
}
|
|
|
|
zle -N zle-line-init
|
|
zle -N zle-keymap-select
|
|
|
|
bindkey -v
|
|
|
|
# if mode indicator wasn't setup by theme, define default
|
|
if [[ "$MODE_INDICATOR" == "" ]]; then
|
|
MODE_INDICATOR="%{$fg_bold[red]%}<%{$fg[red]%}<<%{$reset_color%}"
|
|
fi
|
|
|
|
function vi_mode_prompt_info() {
|
|
echo "${${KEYMAP/vicmd/$MODE_INDICATOR}/(main|viins)/}"
|
|
}
|
|
|
|
# define right prompt, if it wasn't defined by a theme
|
|
if [[ "$RPS1" == "" && "$RPROMPT" == "" ]]; then
|
|
RPS1='$(vi_mode_prompt_info)'
|
|
fi
|