Skip to content

Instantly share code, notes, and snippets.

@roperzh
Last active August 29, 2015 14:00
Show Gist options
  • Save roperzh/11351606 to your computer and use it in GitHub Desktop.
Save roperzh/11351606 to your computer and use it in GitHub Desktop.
Custom and minimalist zsh theme

Tinyice

Minimalist theme for oh-my-zsh, aimed to show information related to git and rvm.

Example

  • (↑) current branch is ahead of the remote.

  • (↓) current branch is behind of the remote.

  • (↯) current branch and remote have diverged.

Installation

Just copy tinyice.zsh-theme in the themes folder, and edit your .zsh file like this:

  custom/
    themes/
      tinyice.zsh-theme

  # your .zshrc
  ZSH_THEME="tinyice"

For more details take a look at: Overriding and adding themes

# Color shortcuts
RED=$fg[red]
YELLOW=$fg[yellow]
GREEN=$fg[green]
WHITE=$fg[white]
BLUE=$fg[blue]
RED_BOLD=$fg_bold[red]
YELLOW_BOLD=$fg_bold[yellow]
GREEN_BOLD=$fg_bold[green]
WHITE_BOLD=$fg_bold[white]
BLUE_BOLD=$fg_bold[blue]
RESET_COLOR=$reset_color
# Format for git_prompt_info()
ZSH_THEME_GIT_PROMPT_PREFIX=""
ZSH_THEME_GIT_PROMPT_SUFFIX=""
# Format for parse_git_dirty()
ZSH_THEME_GIT_PROMPT_DIRTY="*"
ZSH_THEME_GIT_PROMPT_CLEAN=""
# Format for git_prompt_status()
ZSH_THEME_GIT_PROMPT_UNMERGED=" %{$RED%}unmerged"
ZSH_THEME_GIT_PROMPT_DELETED=" %{$RED%}deleted"
ZSH_THEME_GIT_PROMPT_RENAMED=" %{$YELLOW%}renamed"
ZSH_THEME_GIT_PROMPT_MODIFIED=" %{$YELLOW%}modified"
ZSH_THEME_GIT_PROMPT_ADDED=" %{$GREEN%}added"
ZSH_THEME_GIT_PROMPT_UNTRACKED=" %{$WHITE%}untracked"
# Format for remote_status()
ZSH_THEME_GIT_PROMPT_AHEAD="%{$BLUE%}(↑)"
ZSH_THEME_GIT_PROMPT_BEHIND="%{$BLUE%}(↓)"
ZSH_THEME_GIT_PROMPT_DIVERGED="%{$BLUE%}(↯)"
# Format for git_prompt_long_sha() and git_prompt_short_sha()
ZSH_THEME_GIT_PROMPT_SHA_BEFORE=" %{$WHITE%}[%{$YELLOW%}"
ZSH_THEME_GIT_PROMPT_SHA_AFTER="%{$WHITE%}]"
remote_status() {
INDEX=$(command git status --porcelain -b 2> /dev/null)
STATUS=""
if $(echo "$INDEX" | grep '^## .*ahead' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_AHEAD$STATUS"
fi
if $(echo "$INDEX" | grep '^## .*behind' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_BEHIND$STATUS"
fi
if $(echo "$INDEX" | grep '^## .*ahead* .*behind' &> /dev/null); then
STATUS=""
STATUS="$ZSH_THEME_GIT_PROMPT_DIVERGED$STATUS"
fi
echo $STATUS
}
rvm-status() {
~/.rvm/bin/rvm-prompt
}
# Prompt format
PROMPT='%{$YELLOW%}%~%u%{$RESET_COLOR%}❲$(rvm-status)❳❲$(current_branch)$(parse_git_dirty)❳$(remote_status)%{$RESET_COLOR%}%% '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment