Created
March 3, 2015 16:54
-
-
Save JonathanAnderson/e2a2c315d766392c0298 to your computer and use it in GitHub Desktop.
janders theme zprezto
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
# | |
# A simple theme that displays relevant, contextual information. | |
# | |
# Authors: | |
# janders Ionescu <janders.ionescu@gmail.com> | |
# | |
# Screenshots: | |
# http://i.imgur.com/nBEEZ.png | |
# | |
# Load dependencies. | |
pmodload 'helper' | |
function prompt_janders_pwd { | |
local pwd="${PWD/#$HOME/~}" | |
if [[ "$pwd" == (#m)[/~] ]]; then | |
_prompt_janders_pwd="$MATCH" | |
unset MATCH | |
else | |
_prompt_janders_pwd="${${${${(@j:/:M)${(@s:/:)pwd}##.#?}:h}%/}//\%/%%}/${${pwd:t}//\%/%%}" | |
fi | |
} | |
function prompt_janders_precmd { | |
setopt LOCAL_OPTIONS | |
unsetopt XTRACE KSH_ARRAYS | |
# Format PWD. | |
prompt_janders_pwd | |
# Get Git repository information. | |
if (( $+functions[git-info] )); then | |
git-info | |
fi | |
} | |
function prompt_janders_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_janders_precmd | |
# Set editor-info parameters. | |
zstyle ':prezto:module:editor:info:completing' format '%B%F{red}...%f%b' | |
zstyle ':prezto:module:editor:info:keymap:primary' format ' %B%F{red}❯%F{yellow}❯%F{green}❯%f%b' | |
zstyle ':prezto:module:editor:info:keymap:primary:overwrite' format ' %B%F{red}❯❯❯%f%b' | |
zstyle ':prezto:module:editor:info:keymap:alternate' format ' %B%F{green}❮%F{yellow}❮%F{red}❮%f%b' | |
# Set git-info parameters. | |
zstyle ':prezto:module:git:info' verbose 'yes' | |
zstyle ':prezto:module:git:info:action' format ':%%B%F{yellow}%s%f%%b' | |
zstyle ':prezto:module:git:info:added' format ' %%B%F{green}added%f%%b' | |
zstyle ':prezto:module:git:info:ahead' format ' %%B%F{yellow}ahead%f%%b' | |
zstyle ':prezto:module:git:info:behind' format ' %%B%F{yellow}behind%f%%b' | |
zstyle ':prezto:module:git:info:branch' format '%F{green}%b%f' | |
zstyle ':prezto:module:git:info:commit' format '%F{green}%.7c%f' | |
zstyle ':prezto:module:git:info:deleted' format ' %%B%F{red}deleted%f%%b' | |
zstyle ':prezto:module:git:info:modified' format ' %%B%F{blue}modified%f%%b' | |
zstyle ':prezto:module:git:info:position' format '%F{red}%p%f' | |
zstyle ':prezto:module:git:info:renamed' format ' %%B%F{magenta}renamed%f%%b' | |
zstyle ':prezto:module:git:info:stashed' format ' %%B%F{cyan}stash%f%%b' | |
zstyle ':prezto:module:git:info:unmerged' format ' %%B%F{yellow}unmerged%f%%b' | |
zstyle ':prezto:module:git:info:untracked' format ' %%B%F{yellow}untracked%f%%b' | |
zstyle ':prezto:module:git:info:keys' format 'rprompt' '%A%B %b%p [%c]%S%a%d%m%r%U%u' | |
# Define prompts. | |
ECC="%(?,%F{105},%F{red})" | |
#PROMPT='[%F{green}%m%f][%D{%H:%M:%S}][%F{cyan}${_prompt_janders_pwd}%f]%(!. %B%F{red}#%f%b.)${editor_info[keymap]}%(?:: %B%F{red}*%f%b) ' | |
PROMPT='[%{$ECC%}%m%f][%{$ECC%}%D{%H:%M:%S}%f][%{$ECC%}${_prompt_janders_pwd}%f]%(!. %B%F{red}#%f%b.)${editor_info[keymap]} ' | |
RPROMPT='${git_info[rprompt]}' | |
SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? ' | |
} | |
prompt_janders_setup "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment