Created
April 7, 2017 21:31
-
-
Save rutchkiwi/130c7cf664888099b31382a04e2b8edd to your computer and use it in GitHub Desktop.
This file contains hidden or 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
ZSH_THEME_GIT_PROMPT_PREFIX="%F{green}" | |
ZSH_THEME_GIT_PROMPT_SUFFIX="%f" | |
ZSH_THEME_GIT_PROMPT_DIRTY="%F{red}!" | |
ZSH_THEME_GIT_PROMPT_CLEAN="" | |
ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} ✚" | |
ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} ✹" | |
ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖" | |
ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜" | |
ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═" | |
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭" | |
precmd(){ | |
if [ $status -ne 0 ]; then | |
echo "$fg_bold[red]fail$reset_color" | |
fi | |
local preprompt_left="%{$fg_bold[blue]%}%~%{$reset_color%} $(git_prompt_info)" | |
local preprompt_right="%F{magenta}[%*]%f " | |
local preprompt_left_length=${#${(S%%)preprompt_left//(\%([KF1]|)\{*\}|\%[Bbkf])}} | |
local preprompt_right_length=${#${(S%%)preprompt_right//(\%([KF1]|)\{*\}|\%[Bbkf])}} | |
local num_filler_spaces=$((COLUMNS - preprompt_left_length - preprompt_right_length)) | |
print -Pr $'\n'"$preprompt_left${(l:$num_filler_spaces:)}$preprompt_right" | |
} | |
function prompt_char { | |
if [ $UID -eq 0 ]; then echo "%{$fg[red]%}❯%{$reset_color%}"; else echo '❯'; fi | |
} | |
PROMPT="$(prompt_char) " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment