Skip to content

Instantly share code, notes, and snippets.

@finack
Created February 2, 2012 17:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save finack/1724873 to your computer and use it in GitHub Desktop.
Save finack/1724873 to your computer and use it in GitHub Desktop.
ZSH Prompt w/ VI Cmd Mode and Git status
#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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment