Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Hipster Theme
function svn_prompt_info {
if [ $(in_svn) ]; then
echo "$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_PREFIX\
$ZSH_THEME_REPO_NAME_COLOR$(svn_get_repo_name)$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_SUFFIX$ZSH_PROMPT_BASE_COLOR$(svn_dirty)$ZSH_PROMPT_BASE_COLOR"
fi
}
function git_prompt_info() {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo "$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_PREFIX$(current_branch)$ZSH_THEME_GIT_PROMPT_SUFFIX"
}
function get_pwd() {
print -D $PWD
}
function battery_charge() {
if [ -e ~/bin/batcharge.py ]
then
echo `python ~/bin/batcharge.py`
else
echo ''
fi
}
function put_spacing() {
local git=$(git_prompt_info)
if [ ${#git} != 0 ]; then
((git=${#git} - 10))
else
git=0
fi
local svn=$(svn_prompt_info)
if [ ${#svn} != 0 ]; then
((svn=${#svn} - 10))
else
svn=0
fi
local bat=$(battery_charge)
if [ ${#bat} != 0 ]; then
((bat = ${#bat} - 18))
else
bat=0
fi
local termwidth
(( termwidth = ${COLUMNS} - 3 - ${#HOST} - ${#$(get_pwd)} - ${bat} - ${git} - ${svn} ))
local spacing=""
for i in {1..$termwidth}; do
spacing="${spacing} "
done
echo $spacing
}
function precmd() {
print -rP '
$fg[cyan]%m: $fg[yellow]$(get_pwd)$(put_spacing)$(git_prompt_info)$(svn_prompt_info) $(battery_charge)'
}
PROMPT='$fg[magenta]★%{$reset_color%} '
ZSH_THEME_GIT_PROMPT_PREFIX="[git:"
ZSH_THEME_GIT_PROMPT_SUFFIX="]$reset_color"
ZSH_THEME_GIT_PROMPT_DIRTY="$fg[red]+"
ZSH_THEME_GIT_PROMPT_CLEAN="$fg[green]"
ZSH_THEME_SVN_PROMPT_PREFIX="[$fg[green]svn:"
ZSH_THEME_SVN_PROMPT_SUFFIX="$fg[yellow]]"
ZSH_THEME_REPO_NAME_COLOR="$fg[cyan]"
ZSH_THEME_SVN_PROMPT_DIRTY="$fg[red]+"
ZSH_THEME_SVN_PROMPT_CLEAN="$fg[green]"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.