Created
February 2, 2012 17:58
-
-
Save finack/1724873 to your computer and use it in GitHub Desktop.
ZSH Prompt w/ VI Cmd Mode and Git status
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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