-
-
Save vtsatskin/689b935bf9f64de373f7 to your computer and use it in GitHub Desktop.
Table Flip oh-my-zsh theme
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
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