Last active
February 11, 2018 08:06
-
-
Save jaxrtech/9bff9ab885eff0621133182a076d91ce to your computer and use it in GitHub Desktop.
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
# custom based on https://github.com/blinks zsh theme | |
# see http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html | |
_BOLD='%{%B%}' | |
_UNBOLD='%{%b%}' | |
_BKG="%{%K{${bkg}}%}" | |
_FG () { echo "%{%F{$1}%}" } | |
_UNBKG='%{%k%}' | |
_UNFKG='%{%f%}' | |
_UNSET="$_UNBKG$_UNFKG$_UNBOLD" | |
function _prompt_char() { | |
if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then | |
echo '$(_FG blue)±$_UNSET' | |
else | |
echo "%(!.#.\$)$_UNSET" | |
fi | |
} | |
# This theme works with both the "dark" and "light" variants of the | |
# Solarized color schema. Set the SOLARIZED_THEME variable to one of | |
# these two values to choose. If you don't specify, we'll assume you're | |
# using the "dark" variant. | |
case ${SOLARIZED_THEME:-dark} in | |
light) bkg=white;; | |
*) bkg=black;; | |
esac | |
ZSH_THEME_GIT_PROMPT_PREFIX=" [%{%B%F{blue}%}" | |
ZSH_THEME_GIT_PROMPT_SUFFIX="%{%f%k%b%K{${bkg}}%B%F{green}%}]" | |
ZSH_THEME_GIT_PROMPT_DIRTY=" %{%F{red}%}*%{%f%k%b%}" | |
ZSH_THEME_GIT_PROMPT_CLEAN="" | |
get_space () { | |
local STR=$1$2 | |
local zero='%([BSUbfksu]|([FB]|){*})' | |
local LENGTH=${#${(S%%)STR//$~zero/}} | |
local SPACES="" | |
(( LENGTH = ${COLUMNS} - $LENGTH - 1)) | |
for i in {0..$LENGTH} | |
do | |
SPACES="$SPACES " | |
done | |
echo $SPACES | |
} | |
_USERNAME_COLOR="%(!.$(_FG red).$(_FG green))" | |
_USERNAME="$_USERNAME_COLOR%n" | |
_AT="$(_FG blue)@" | |
_HOSTNAME="$(_FG cyan)%m" | |
_CWD="$(_FG yellow)%~" | |
_TIME='%D{%H:%M:%S}' | |
_PRELUDE_LEFT="$_BOLD$_USERNAME$_AT$_HOSTNAME$_UNBOLD $_CWD$_BOLD$(_FG green)$(git_prompt_info)%E$_UNFKG$_UNBOLD" | |
_PRELUDE_RIGHT="[$_TIME]" | |
_PRELUDE_SPACES=`get_space $_PRELUDE_LEFT $_PRELUDE_RIGHT` | |
_PRELUDE="$_BKG$_PRELUDE_LEFT$_PRELUDE_SPACES$_PRELUDE_RIGHT$_UNBKG" | |
PROMPT=' | |
$_UNSET$_PRELUDE | |
$_BKG $(_prompt_char)$_UNSET ' | |
RPROMPT='!$_BOLD$(_FG cyan)%!$_UNSET ' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment