Created
July 8, 2014 15:19
-
-
Save whatisinternet/8c7e9bd164d85a09181f to your computer and use it in GitHub Desktop.
My ZSH theme
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
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[green]%}➜ %s)" | |
function collapse_pwd { | |
echo $(pwd | sed -e "s,^$HOME,~,") | |
} | |
function prompt_char { | |
git branch >/dev/null 2>/dev/null && echo '±' && return | |
hg root >/dev/null 2>/dev/null && echo '☿' && return | |
echo '○' | |
} | |
function battery_charge { | |
if which acpi &> /dev/null; then | |
local BATTSTATE="$(acpi -b)" | |
local BATTPRCNT="$(echo ${BATTSTATE[(w)4]}|sed -r 's/(^[0-9]+).*/\1/')" | |
local BATTSTATUS="$(echo ${BATTSTATE[(w)3]})" | |
if [[ "${BATTSTATUS}" = "Discharging," ]]; then | |
if [[ -z "${BATTPRCNT}" ]]; then | |
PR_BATTERY="" | |
elif [[ "${BATTPRCNT}" -lt 15 ]]; then | |
PR_BATTERY=" with ${fg[red]%}${fg[red]}batt:${BATTPRCNT}%%" | |
elif [[ "${BATTPRCNT}" -lt 60 ]]; then | |
PR_BATTERY=" with ${fg[red]%}${fg[yellow]}${BATTPRCNT}%%" | |
elif [[ "${BATTPRCNT}" -lt 100 ]]; then | |
PR_BATTERY=" with ${fg[red]%}${fg[green]}${BATTPRCNT}%%" | |
else | |
PR_BATTERY="" | |
fi | |
else | |
PR_BATTERY="" | |
fi | |
fi | |
echo ${PR_BATTERY} | |
} | |
function virtualenv_info { | |
[ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') ' | |
} | |
PROMPT='%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%}$(battery_charge)%{$reset_color%} in %{$fg_bold[green]%}$(collapse_pwd)%{$reset_color%}$(hg_prompt_info)$(git_prompt_info)$(virtualenv_info) | |
$(prompt_char) ' | |
#RPROMPT='$(battery_charge)' | |
ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}" | |
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" | |
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}!" | |
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[green]%}?" | |
ZSH_THEME_GIT_PROMPT_CLEAN="" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment