Last active
December 19, 2016 13:55
-
-
Save wckd/fd4986201cc75c7ec6120dff51614aa6 to your computer and use it in GitHub Desktop.
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
# Based on pygmalion, modified to suit my taste | |
prompt_setup_alexander(){ | |
ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}" | |
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " | |
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}⚡%{$reset_color%}" | |
ZSH_THEME_GIT_PROMPT_CLEAN="" | |
base_prompt='%{$fg[cyan]%}%n%{$reset_color%}%{$fg[red]%}@%{$reset_color%}%{$fg[yellow]%}%m%{$reset_color%} %{$fg[cyan]%}%c %{$reset_color%}' | |
base_prompt_nocolor=$(echo "$base_prompt" | perl -pe "s/%\{[^}]+\}//g") | |
precmd_functions+=(prompt_alexander_precmd) | |
} | |
prompt_alexander_precmd(){ | |
local gitinfo=$(git_prompt_info) | |
local gitinfo_nocolor=$(echo "$gitinfo" | perl -pe "s/%\{[^}]+\}//g") | |
local exp_nocolor="$(print -P \"$base_prompt_nocolor$gitinfo_nocolor\")" | |
local prompt_length=${#exp_nocolor} | |
local nl="" | |
if [[ $prompt_length -gt 40 ]]; then | |
nl=$'\n%{\r%}'; | |
fi | |
PROMPT="$base_prompt$gitinfo$nl%{$fg_bold[red]%} ❯ %{$reset_color%}" | |
} | |
prompt_setup_alexander |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment