Skip to content

Instantly share code, notes, and snippets.

@baopham
Created December 7, 2012 04:54
Show Gist options
  • Save baopham/4230860 to your computer and use it in GitHub Desktop.
Save baopham/4230860 to your computer and use it in GitHub Desktop.
Prezto bpm theme
#
# Based on sorin theme
#
# Authors:
# Bao Pham <[email protected]>
#
# Screenshots:
# http://cl.ly/image/0O3y120B0T1z
# http://cl.ly/image/111H2O170z0Q
#
# GistID: 4230860
#
# Load dependencies.
pmodload 'helper'
function prompt_bpm_pwd {
if [ -n "$SSH_CONNECTION" ] ; then
_prompt_bpm_pwd='%F{cyan}%n@%m %40<...<%~%f'
else
if [ "$USER" != "baopham" ] ; then
_prompt_bpm_pwd='%F{cyan}%n %40<...<%~%f'
else
_prompt_bpm_pwd='%F{cyan}%40<...<%~%f'
fi
fi
}
function prompt_bpm_precmd {
setopt LOCAL_OPTIONS
unsetopt XTRACE KSH_ARRAYS
# Format PWD.
prompt_bpm_pwd
# Get Git repository information.
if (( $+functions[git-info] )); then
git-info
fi
}
function prompt_bpm_setup {
setopt LOCAL_OPTIONS
unsetopt XTRACE KSH_ARRAYS
prompt_opts=(cr percent subst)
# Load required functions.
autoload -Uz add-zsh-hook
# Add hook for calling git-info before each command.
add-zsh-hook precmd prompt_bpm_precmd
zstyle ':prezto:module:editor:info:completing' format '%B%F{red}...%f%b'
zstyle ':prezto:module:editor:info:keymap:primary' format " %B%F{green}❯%f%b"
zstyle ':prezto:module:editor:info:keymap:alternate' format " %B%F{red}❯%f%b"
zstyle ':prezto:module:git:info' verbose 'yes'
zstyle ':prezto:module:git:info:branch' format '%F{green}%b%f' # %b
zstyle ':prezto:module:git:info:commit' format '%F{green}%.7c...%f' # %c
zstyle ':prezto:module:git:info:position' format '%F{green}%p%f' # %p
zstyle ':prezto:module:git:info:action' format '%%B%F{yellow}%s%f%%b:' # %s
zstyle ':prezto:module:git:info:added' format '%F{green}●%f' # %a
zstyle ':prezto:module:git:info:deleted' format '%%B%F{red}✖%f%%b' # %d
zstyle ':prezto:module:git:info:modified' format '%F{yellow}●%f' # %m
zstyle ':prezto:module:git:info:untracked' format '%F{red}●%f' # %u
zstyle ':prezto:module:git:info:unmerged' format ' %%B%F{yellow}═%f%%b' # %U
zstyle ':prezto:module:git:info:ahead' format ' %%B%F{yellow}⬆%f%%b' # %A
zstyle ':prezto:module:git:info:behind' format ' %%B%F{yellow}⬇%f%%b' # %B
zstyle ':prezto:module:git:info:stashed' format ' %%B%F{cyan}✭%f%%b' # %S
zstyle ':prezto:module:git:info:renamed' format ' %%B%F{magenta}➜%f%%b' # %r
zstyle ':prezto:module:git:info:keys' format \
'prompt' ' (%s$(coalesce "%b" "%c" "%p")%m%u%d%a%C)' \
'rprompt' '%r%U%A%B%S'
# Define prompts.
PROMPT='${_prompt_bpm_pwd}${(e)git_info[prompt]}${editor_info[keymap]} '
RCMD=" %B%F{red}❮❮❮%f%b" # indicate vim command mode
RPROMPT='${${KEYMAP/vicmd/$RCMD}/(main|viins)/}${git_info[rprompt]}'
SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? '
}
prompt_bpm_setup "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment