Last active
January 3, 2016 05:29
-
-
Save nathanharper/8416335 to your computer and use it in GitHub Desktop.
oh-my-zsh theme I'm working on
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
prompt_setup_nathan(){ | |
ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}" | |
ZSH_THEME_GIT_PROMPT_SUFFIX="" | |
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}⚡" | |
ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[cyan]%}✚" | |
ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%}✖" | |
ZSH_THEME_GIT_PROMPT_CLEAN="" | |
# ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%}✹%{$reset_color%}" | |
# ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜" | |
# ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═" | |
# ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭" | |
base_prompt='%{$fg[cyan]%}╭─%{$reset_color%}%{$fg[magenta]%}%n%{$reset_color%}%{$fg[cyan]%}@%{$reset_color%}%{$fg[yellow]%}%m%{$reset_color%}%{$fg[red]%}:%{$reset_color%}%{$fg[cyan]%}%0~%{$reset_color%}%{$fg[red]%}|%{$reset_color%}' | |
post_prompt='%{$fg[cyan]%}╰─⇒%{$reset_color%} ' | |
# base_prompt_nocolor=$(echo "$base_prompt" | perl -pe "s/%\{[^}]+\}//g") | |
# post_prompt_nocolor=$(echo "$post_prompt" | perl -pe "s/%\{[^}]+\}//g") | |
# add-zsh-hook precmd prompt_nathan_precmd | |
precmd_functions+=(prompt_nathan_precmd) | |
} | |
prompt_nathan_precmd(){ | |
local sha="$(git_prompt_short_sha)" | |
local SVNINFO="$(svn info 2>/dev/null)" | |
local SVNREPO="$(echo "$SVNINFO" | awk -F/ '/^URL/ {print $NF}')" | |
local svnstr="" | |
if ! [[ -z "$SVNREPO" ]]; then | |
local SVNREV="$(echo "$SVNINFO" | awk '/^Revision/ {print $NF}')" | |
svnstr="%{$fg[green]%}$SVNREV%{$fg[red]%}@%{$fg[green]%}$SVNREPO%{$reset_color%}" | |
fi | |
if ! [[ -z $sha ]]; then | |
sha="%{$fg[green]%}$sha%{$fg[red]%}@" | |
fi | |
local gitinfo="$sha$(git_prompt_info)$(git_prompt_status)%{$reset_color%}" | |
local clock=" %{$fg[yellow]%}(%{$fg[cyan]%}⌚ %{$fg[yellow]%}%*)%{$reset_color%}" | |
nl=$'\n%{\r%}'; | |
PROMPT="$base_prompt$gitinfo$svnstr$nl$post_prompt" | |
RPROMPT="$clock" | |
} | |
prompt_setup_nathan |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment