diff options
Diffstat (limited to 'themes/agnoster.zsh-theme')
-rw-r--r-- | themes/agnoster.zsh-theme | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme index 07546fd34..0edb773aa 100644 --- a/themes/agnoster.zsh-theme +++ b/themes/agnoster.zsh-theme @@ -13,9 +13,13 @@ # # In addition, I recommend the # [Solarized theme](https://github.com/altercation/solarized/) and, if you're -# using it on Mac OS X, [iTerm 2](http://www.iterm2.com/) over Terminal.app - +# using it on Mac OS X, [iTerm 2](https://iterm2.com/) over Terminal.app - # it has significantly better color fidelity. # +# If using with "light" variant of the Solarized color schema, set +# SOLARIZED_THEME variable to "light". If you don't specify, we'll assume +# you're using the "dark" variant. +# # # Goals # # The aim of this theme is to only show you *relevant* information. Like most @@ -30,6 +34,11 @@ CURRENT_BG='NONE' +case ${SOLARIZED_THEME:-dark} in + light) CURRENT_FG='white';; + *) CURRENT_FG='black';; +esac + # Special Powerline characters () { @@ -80,28 +89,31 @@ prompt_end() { # Context: user@hostname (who am I and where am I) prompt_context() { if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then - prompt_segment black default "%(!.%{%F{yellow}%}.)$USER@%m" + prompt_segment black default "%(!.%{%F{yellow}%}.)%n@%m" fi } # Git: branch/detached head, dirty status prompt_git() { (( $+commands[git] )) || return + if [[ "$(git config --get oh-my-zsh.hide-status 2>/dev/null)" = 1 ]]; then + return + fi local PL_BRANCH_CHAR () { local LC_ALL="" LC_CTYPE="en_US.UTF-8" PL_BRANCH_CHAR=$'\ue0a0' # } local ref dirty mode repo_path - repo_path=$(git rev-parse --git-dir 2>/dev/null) if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then + repo_path=$(git rev-parse --git-dir 2>/dev/null) dirty=$(parse_git_dirty) ref=$(git symbolic-ref HEAD 2> /dev/null) || ref="➦ $(git rev-parse --short HEAD 2> /dev/null)" if [[ -n $dirty ]]; then prompt_segment yellow black else - prompt_segment green black + prompt_segment green $CURRENT_FG fi if [[ -e "${repo_path}/BISECT_LOG" ]]; then @@ -151,7 +163,7 @@ prompt_bzr() { prompt_hg() { (( $+commands[hg] )) || return - local rev status + local rev st branch if $(hg id >/dev/null 2>&1); then if $(hg prompt >/dev/null 2>&1); then if [[ $(hg prompt "{status|unknown}") = "?" ]]; then @@ -164,7 +176,7 @@ prompt_hg() { st='±' else # if working copy is clean - prompt_segment green black + prompt_segment green $CURRENT_FG fi echo -n $(hg prompt "☿ {rev}@{branch}") $st else @@ -178,7 +190,7 @@ prompt_hg() { prompt_segment yellow black st='±' else - prompt_segment green black + prompt_segment green $CURRENT_FG fi echo -n "☿ $rev@$branch" $st fi @@ -187,7 +199,7 @@ prompt_hg() { # Dir: current working directory prompt_dir() { - prompt_segment blue black '%~' + prompt_segment blue $CURRENT_FG '%~' } # Virtualenv: current working virtualenv @@ -203,8 +215,8 @@ prompt_virtualenv() { # - am I root # - are there background jobs? prompt_status() { - local symbols - symbols=() + local -a symbols + [[ $RETVAL -ne 0 ]] && symbols+="%{%F{red}%}✘" [[ $UID -eq 0 ]] && symbols+="%{%F{yellow}%}⚡" [[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{cyan}%}⚙" |