use zsh vi-mode

This commit is contained in:
shiludeng 2017-11-26 23:03:14 +08:00
commit 814cc29496
3 changed files with 7 additions and 6 deletions

4
.zshrc
View file

@ -7,8 +7,8 @@ export ZSH=$HOME/.oh-my-zsh
# time that oh-my-zsh is loaded. # time that oh-my-zsh is loaded.
#ZSH_THEME="robbyrussell" #ZSH_THEME="robbyrussell"
#ZSH_THEME="random" #ZSH_THEME="random"
ZSH_THEME="azure" #ZSH_THEME="azure"
#ZSH_THEME="re5et" ZSH_THEME="re5et"
#ZSH_THEME="fox" #ZSH_THEME="fox"
# Example aliases # Example aliases

View file

@ -15,6 +15,7 @@ zle -N edit-command-line
bindkey -v bindkey -v
# allow v to edit the command line (standard behaviour) # allow v to edit the command line (standard behaviour)
autoload -Uz edit-command-line autoload -Uz edit-command-line
bindkey -M vicmd 'v' edit-command-line bindkey -M vicmd 'v' edit-command-line
@ -45,6 +46,6 @@ function vi_mode_prompt_info() {
} }
# define right prompt, if it wasn't defined by a theme # define right prompt, if it wasn't defined by a theme
if [[ "$RPS1" == "" && "$RPROMPT" == "" ]]; then #if [[ "$RPS1" == "" && "$RPROMPT" == "" ]]; then
RPS1='$(vi_mode_prompt_info)' RPS1="$RPS1"'$(vi_mode_prompt_info)'"$RPROMPT"
fi #fi

View file

@ -6,7 +6,7 @@ PROMPT='
%{$fg_bold[cyan]%}%n%{$reset_color%}%{$fg[yellow]%}@%{$reset_color%}%{$fg_bold[blue]%}%m%{$reset_color%}:%{${fg_bold[green]}%}%~%{$reset_color%}$(git_prompt_info) %{$fg_bold[cyan]%}%n%{$reset_color%}%{$fg[yellow]%}@%{$reset_color%}%{$fg_bold[blue]%}%m%{$reset_color%}:%{${fg_bold[green]}%}%~%{$reset_color%}$(git_prompt_info)
%{${fg[$CARETCOLOR]}%}%# %{${reset_color}%}' %{${fg[$CARETCOLOR]}%}%# %{${reset_color}%}'
RPS1='${return_code} %D - %*' RPS1='${return_code} %D - %*'"$RPS1"
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[magenta]%}^%{$reset_color%}%{$fg_bold[yellow]%}" ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[magenta]%}^%{$reset_color%}%{$fg_bold[yellow]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"