Skip to content

Instantly share code, notes, and snippets.

@lborg019
Forked from smileart/README.md
Last active July 1, 2020 20:39
Show Gist options
  • Save lborg019/e19c3f642b86c04d8706 to your computer and use it in GitHub Desktop.
Save lborg019/e19c3f642b86c04d8706 to your computer and use it in GitHub Desktop.
Fine tuning smileart's zsh agnoster theme:

lukezin's .zsh-theme

Improvements to smileart's agnoster theme mod:

  • Replaced special characters in the code (fixed bugged characters, currently works with powerline fonts)
  • Prompt is shorter, shows only the current directory
  • LS Colors match iTerm's Dark Solarized theme

to do:

  • Fix tab completion: tab completion should automatically work on special characters (such as [) right now you have to escape such characters for tab to complete it \[
# Original theme https://github.com/agnoster zsh theme
# Modified from smileart's https://gist.github.com/smileart/3750104
# Changed symbol characters, should work properly with any powerline font
ZSH_THEME_GIT_PROMPT_DIRTY='±'
function _git_prompt_info() {
ref=$(git symbolic-ref HEAD 2> /dev/null) || ref="➦ $(git show-ref --head -s --abbrev |head -n1 2> /dev/null)"
echo "${ref/refs\/heads\// }$(parse_git_dirty)"
}
function _git_info() {
if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
local BG_COLOR=green
if [[ -n $(parse_git_dirty) ]]; then
BG_COLOR=yellow
FG_COLOR=black
fi
if [[ ! -z $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then
BG_COLOR=red
FG_COLOR=white
fi
echo "%{%K{$BG_COLOR}%}%{%F{$FG_COLOR}%} $(_git_prompt_info) %{%F{$BG_COLOR}%K{blue}%}"
else
echo "%{%K{blue}%}"
fi
}
function virtualenv_info {
[ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') '
}
PROMPT_HOST='%{%b%F{gray}%K{black}%} %(?.%{%F{green}%}✔.%{%F{red}%}✘)%{%F{yellow}%} %n %{%F{black}%}'
# {$fg[white%]\ to specify the foreground color
# ' %c\ ' to show only the current directory surrounded by spaces
PROMPT_DIR=%{$fg[white]%}\ %c\ %{$reset_color%}
PROMPT_SU='%(!.%{%k%F{blue}%K{black}%}%{%F{yellow}%} ⚡ %{%k%F{black}%}.%{%k%F{blue}%})%{%f%k%b%}'
PROMPT='%{%f%b%k%}$PROMPT_HOST$(_git_info)$PROMPT_DIR$PROMPT_SU
$(virtualenv_info)❯ '
RPROMPT='%{$fg[green]%}[%*]%{$reset_color%}'
# LS colors matching Solarized Dark Theme: http://ethanschoonover.com/solarized
# made with http://geoff.greer.fm/lscolors/
export LSCOLORS="exfxcxdxbxegedabagacad"
export LS_COLORS='di=34;40:ln=35:so=32;40:pi=33;40:ex=31;40:bd=34;46:cd=34;43:su=0;41:sg=0;46:tw=0;42:ow=0;43:'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment