Last active
January 2, 2016 12:49
-
-
Save djensen47/8305807 to your computer and use it in GitHub Desktop.
My theme for oh-my-zsh. WIP.
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
# Build47 theme by Dave Jensen (http://www.build47.com) | |
# Use with a dark background and 256-color terminal! | |
# You can set your computer name in the ~/.box-name file if you want. | |
# Borrowing shamelessly from these oh-my-zsh themes: | |
# bira | |
# robbyrussell | |
# fino | |
# agnoster (https://gist.github.com/agnoster/3712874) | |
function prompt_char { | |
git branch >/dev/null 2>/dev/null && echo "▷" && return | |
# echo '○' | |
# echo '●' | |
echo '▶' | |
# echo '▷' | |
# echo '±' | |
# echo '⊕' | |
# echo '⬡' | |
# echo '⬢' | |
} | |
function box_name { | |
[ -f ~/.box-name ] && cat ~/.box-name || echo "%m" | |
} | |
local ruby_env='' | |
if which rvm-prompt &> /dev/null; then | |
ruby_env=' ‹$(rvm-prompt i v g)›%{$reset_color%}' | |
else | |
if which rbenv &> /dev/null; then | |
ruby_env=' ‹$(rbenv version-name)›%{$reset_color%}' | |
fi | |
fi | |
local pre='─%{$FG[244]%}─%{$FG[240]%}─[%{$reset_color%}' | |
local post='%{$FG[240]%}]─%{$FG[244]%}─%{$reset_color%}' | |
function _git_pre() { | |
if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then | |
echo "─%{$FG[244]%}─%{$FG[240]%}─[%{$reset_color%}" | |
fi | |
} | |
function _git_post() { | |
if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then | |
echo "%{$FG[240]%}]─%{$FG[244]%}─%{$reset_color%}" | |
fi | |
} | |
local git_pre='$(_git_pre)' | |
local git_post='$(_git_post)' | |
local current_dir='${PWD/#$HOME/~}' | |
local git_info='$(git_prompt_info)$(git_prompt_status)$(git_remote_status)' | |
local prompt_char='$(prompt_char)' | |
ZSH_THEME_GIT_PROMPT_CHANGED="%{$fg[cyan]%}+" | |
ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[cyan]%}+" | |
ZSH_THEME_GIT_PROMPT_CLEAN="%{$FG[040]%} ✓" | |
ZSH_THEME_GIT_PROMPT_PREFIX="" | |
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" | |
ZSH_THEME_GIT_PROMPT_DIRTY="%{$FG[214]%} ●" | |
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[red]%}…" | |
ZSH_THEME_GIT_PROMPT_STAGED="%{$fg[red]%}●" | |
ZSH_THEME_GIT_PROMPT_CONFLICTS="%{$FG[1]%}✕" | |
ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE="%{$FG[040]%}↑%{$reset_color%}" | |
ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE="%{%F{red}%}↓%{$reset_color%}" | |
ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE="%{%F{red}%}↕%{$reset_color%}" | |
userhost() { | |
if [[ -n "$SSH_CLIENT" ]] then | |
echo "${pre}%{$FG[083]%}%n%{$reset_color%}@%{$FG[051]%}$(box_name)%{$reset_color%}${post}" | |
fi | |
} | |
PROMPT="╭${pre}%{$terminfo[bold]$FG[069]%}${current_dir}%{$reset_color%}${post}$(userhost)─● | |
╰─${git_pre}${git_info}${git_post}─${prompt_char} " | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment