public
Created

ZSH Prompt w/ VI Cmd Mode and Git status

  • Download Gist
rc.zsh
Shell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
 
#https://github.com/olivierverdier/zsh-git-prompt
source ~/.zsh/zsh-git-prompt/zshrc.sh
 
# makes color constants available
autoload -U colors
colors
 
# enable colored output from ls, etc
export CLICOLOR=1
export LSCOLORS=gxBxhxDxfxhxhxhxhxcxcx
 
# expand functions in the prompt
setopt prompt_subst
 
# prompt
local ssh_prompt="%F{064}%n@%m%f:"
local MODE_INDICATOR="%F{136}-%fvi-cmd%F{136}-%f"
 
# Set path to red if return code is not 0
export PROMPT="${SSH_CONNECTION+${ssh_prompt}}%(?,%F{136},%F{160})%~%f "
export RPROMPT='$(git_super_status)'
 
function zle-line-init {
zle reset-prompt
}
function zle-line-init zle-keymap-select {
export RPROMPT="${${KEYMAP/vicmd/$MODE_INDICATOR}/(main|viins)/$(git_super_sta
tus)}"
zle reset-prompt
}
zle -N zle-line-init
zle -N zle-keymap-select

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.