Skip to content

Instantly share code, notes, and snippets.

@musaid
Last active December 10, 2015 01:28
Show Gist options
  • Save musaid/4359621 to your computer and use it in GitHub Desktop.
Save musaid/4359621 to your computer and use it in GitHub Desktop.
Kinky ZSH theme for personal use :)
# ZSH Theme by musaid (musaid@live.com) [http://github.com/musaid]
# FOR PERSONAL USE ONLY
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_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]%}✭ "
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 display_git() {
echo "$(git_prompt_status)%{$reset_color%} $(git_prompt_info)%{$reset_color%}"
}
function battery_status() {
if [ -e ~/bin/batstatus.py ]
then
# yet to be implemented
# echo `python ~/bin/batstatus.py`
else
echo "shuha"
fi
}
function box_name {
[ -f ~/.box-name ] && cat ~/.box-name || hostname -s
}
function get_pwd() {
echo "${PWD/#$HOME/~}"
}
function put_spacing() {
local pmt=0
if [ ${#$(git_prompt_status)} = 0 ]; then
pmt=2
elif [ ${#$(git_prompt_status)} = 1 ]; then
pmt=4
elif [ ${#$(git_prompt_status)} = 2 ]; then
pmt=6
else
pmt=5
fi
local git=$(current_branch)
if [ ${#git} != 0 ]; then
((git=${#git} + 9))
else
git=0
fi
local bat=$(battery_status)
if [ ${#bat} != 0 ]; then
((bat=${#bat} + 7));
else
bat=0
fi
local width;
(( width = 17 + ${#HOST} + ${#$(box_name)} + ${#$(get_pwd)} + ${pmt} + ${git} + ${bat} ))
if [ ${width} -gt ${COLUMNS} ]; then
(( width=${COLUMNS} ))
else
width=${width}
fi
local termwidth;
(( termwidth = ${COLUMNS} - ${width} ))
local spacing=""
for i in {1..$termwidth}; do
spacing="${spacing} "
done
echo $spacing;
}
PROMPT='
❝%{$fg[blue]%}$(box_name)%{$reset_color%}%{$fg[black]%}:%{$reset_color%}%{$fg_bold[red]%}%n%{$reset_color%}❞ %{$fg[cyan]%}➺%{$reset_color%} ❨%{$fg_bold[magenta]%}$(get_pwd)%{$reset_color%}❩ @ %{$fg_bold[black]%}%D{%I:%M:%S}%{$reset_color%}$(put_spacing)$(display_git) %{$fg[red]%}❤ $(battery_status) ❤%{$reset_color%}
%(?,,%{${fg[red]}%}[%?]%{$reset_color%} )✈ '
local return_status="%{$fg[red]%}%(?..✘)%{$reset_color%}"
RPROMPT='${return_status}%{$reset_color%}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment