Skip to content

Instantly share code, notes, and snippets.

@gaulinmp
Created November 24, 2014 23:40
Show Gist options
  • Save gaulinmp/84922cd7b934490e932f to your computer and use it in GitHub Desktop.
Save gaulinmp/84922cd7b934490e932f to your computer and use it in GitHub Desktop.
ZSH Theme
# reference colors
GREEN="%{$fg_bold[green]%}"
RED="%{$fg_bold[red]%}"
CYAN="%{$fg_bold[cyan]%}"
YELLOW="%{$fg_bold[yellow]%}"
BLUE="%{$fg_bold[blue]%}"
MAGENTA="%{$fg_bold[magenta]%}"
WHITE="%{$fg_bold[white]%}"
COLOR_ARRAY=($GREEN $RED $CYAN $YELLOW $BLUE $MAGENTA $WHITE)
# color reset
RSTC="%{$reset_color%}"
# which color should be applied?
USERNAME_NORMAL_COLOR=$CYAN
USERNAME_ROOT_COLOR=$RED
USERNAME_COLOR=%(!.$USERNAME_ROOT_COLOR.$USERNAME_NORMAL_COLOR)
HOSTNAME_NORMAL_COLOR=$BLUE
HOSTNAME_ROOT_COLOR=$RED
HOSTNAME_COLOR=%(!.$HOSTNAME_ROOT_COLOR.$HOSTNAME_NORMAL_COLOR)
CURRENT_DIR_COLOR=$GREEN
LAST_COMMAND_COLOR="%(?.%(!.$RED.$GREEN).$YELLOW)"
# zsh commands
USERNAME_COMMAND="%n"
HOSTNAME_COMMAND="%m"
CURRENT_DIR="%~"
# output: colors + commands
USERNAME_OUTPUT="$USERNAME_COLOR$USERNAME_COMMAND$RSTC"
HOSTNAME_OUTPUT="$HOSTNAME_COLOR$HOSTNAME_COMMAND$RSTC"
CURRENT_DIR_OUTPUT="$CURRENT_DIR_COLOR$CURRENT_DIR$RSTC"
LINE_ENDER="$LAST_COMMAND_COLOR%(!.☢.➜)$RSTC "
# git theming (including git_prompt)
ZSH_THEME_GIT_PROMPT_PREFIX="("
ZSH_THEME_GIT_PROMPT_SUFFIX=")"
ZSH_THEME_GIT_PROMPT_DIRTY=" $RED✘$RSTC"
ZSH_THEME_GIT_PROMPT_CLEAN=" $GREEN✔$RSTC"
ZSH_THEME_GIT_PROMPT_ADDED="%{$FG[082]%}✚$RSTC"
ZSH_THEME_GIT_PROMPT_MODIFIED="%{$FG[166]%}✹$RSTC"
ZSH_THEME_GIT_PROMPT_DELETED="%{$FG[160]%}✖$RSTC"
ZSH_THEME_GIT_PROMPT_RENAMED="%{$FG[220]%}➜$RSTC"
ZSH_THEME_GIT_PROMPT_UNMERGED="%{$FG[082]%}═$RSTC"
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$FG[190]%}✭$RSTC"
# wrap all together
PROMPT='$USERNAME_OUTPUT@$HOSTNAME_OUTPUT:$CURRENT_DIR_OUTPUT $(git_prompt_status)$LINE_ENDER'
RPROMPT='$(git_prompt_info) [%D{%Y.%m.%d - %K:%M}]'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment