Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@nnja
Last active February 23, 2017 00:47
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nnja/7f7a7336d852fa8eacde to your computer and use it in GitHub Desktop.
Save nnja/7f7a7336d852fa8eacde to your computer and use it in GitHub Desktop.
My zshell prompt theme, a bastardization of robbyrussel & kolo themes
autoload -Uz vcs_info
zstyle ':vcs_info:*' stagedstr '%F{green}●'
zstyle ':vcs_info:*' unstagedstr '%F{yellow}●'
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{11}%r'
zstyle ':vcs_info:*' enable git svn
theme_precmd () {
if [[ -z $(git ls-files --other --exclude-standard 2> /dev/null) ]] {
zstyle ':vcs_info:*' formats '%c%u%B%F{green} '
} else {
zstyle ':vcs_info:*' formats '%c%u%B%F{red}● '
}
vcs_info
}
setopt prompt_subst
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ %s)"
PROMPT='%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} %{$reset_color%}%{$fg[blue]%}%{$reset_color%}${vcs_info_msg_0_}%{$reset_color%}${ret_status}%{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="(%{$fg[green]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%})%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"
autoload -U add-zsh-hook
add-zsh-hook precmd theme_precmd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment