Skip to content

Instantly share code, notes, and snippets.

@vtsatskin
Forked from dhuynh/tableFlip.theme
Last active August 29, 2015 14:25
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 vtsatskin/689b935bf9f64de373f7 to your computer and use it in GitHub Desktop.
Save vtsatskin/689b935bf9f64de373f7 to your computer and use it in GitHub Desktop.
Table Flip oh-my-zsh theme
autoload -Uz vcs_info
autoload -U add-zsh-hook
add-zsh-hook precmd mtmdd_precmd
add-zsh-hook preexec mtmdd_preexec
# Table flip
typeset -A table;
table=(
flip "%{$fg[yellow]%}%? %{$fg[red]%}(╯°□°)╯︵ ┻━┻%{$reset_color%}"
upright "%{$fg[yellow]%}┳━┳ ~ ◞(◦_◦◞)%{$reset_color%}"
caine "%{$fg[green]%}(⌐•_•)%{$reset_color%}"
)
mtmdd_precmd() {
if [[ $? -ne 0 ]]; then
export table_status="flip"
fi
vcs_info
}
mtmdd_preexec() {
if [[ $table_status = "flip" ]]; then
export table_status="upright"
elif [[ $table_status = "upright" ]]; then
export table_status="caine"
fi
}
right_prompt() {
printf '%s' "${table[${table_status:-caine}]}"
}
PROMPT2="${cur_cmd}> "
RPROMPT='$(right_prompt)'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment