Skip to content

Instantly share code, notes, and snippets.

@denji
Created July 3, 2013 05:55
Show Gist options
  • Save denji/5915744 to your computer and use it in GitHub Desktop.
Save denji/5915744 to your computer and use it in GitHub Desktop.
frosted oh-my-zsh
# Path to your oh-my-zsh configuration.
export ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="frosted"
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
# Set to this to use case-sensitive completion
# CASE_SENSITIVE="true"
# Comment this out to disable weekly auto-update checks
# DISABLE_AUTO_UPDATE="true"
# Uncomment following line if you want to disable colors in ls
# DISABLE_LS_COLORS="true"
# Uncomment following line if you want to disable autosetting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment following line if you want red dots to be displayed while waiting for completion
COMPLETION_WAITING_DOTS="true"
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(git npm node github brew nyan vi-mode)
source $ZSH/oh-my-zsh.sh
# Customize to your needs...
export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
  • Font: Menlo Regular, 12pt
  • Do NOT print bold text in a bold font
  • Print bold text in bright colors
  • Black background (semitransparent if you prefer)
  • For the color scheme, I use "Tango Dark" that comes with iTerm2. But this is personal preference.
# Frosted: ZSH Theme based on 'gnzh'
# load some modules
autoload -U colors zsh/terminfo # Used in the colour alias below
colors
setopt prompt_subst
# make some aliases for the colours: (coud use normal escap.seq's too)
for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
eval PR_$color='%{$fg[${(L)color}]%}'
done
eval PR_NO_COLOR="%{$terminfo[sgr0]%}"
eval PR_BOLD="%{$terminfo[bold]%}"
# Check the UID
if [[ $UID -eq 0 ]]; then # root
eval PR_USER='%{$PR_RED$PR_BOLD%}%n%{$PR_NO_COLOR%}'
local PR_PROMPT='%{$PR_RED$PR_BOLD%}➤%{$PR_NO_COLOR%} '
else # normal user
eval PR_USER='%{$PR_GREEN$PR_BOLD%}%n%{$PR_NO_COLOR%}'
local PR_PROMPT='%{$PR_NO_COLOR%}➤ '
fi
# Check if we are on SSH or not
if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then
eval PR_HOST='%{$PR_YELLOW$PR_BOLD%}%M%{$PR_NO_COLOR%}' #SSH
else
eval PR_HOST='%{$PR_GREEN$PR_BOLD%}%M%{$PR_NO_COLOR%}' # no SSH
fi
local return_code="%(?..%{$PR_RED%}%? ↵%{$PR_NO_COLOR%})"
local user_host='${PR_USER}%{$PR_BLUE%}@${PR_HOST}'
local current_dir='%{$PR_BOLD$PR_BLUE%}${PWD/#$HOME/~}%{$PR_NO_COLOR%}'
# Construct the git prompt
function git_prompt {
gp="$(git_prompt_short_sha)$(git_prompt_info)$(git_prompt_ahead)"
if [ "x$gp" != "x" ]; then
echo "${GIT_PRE}${gp}${GIT_POST}"
else
echo ""
fi
}
local git_branch='$(git_prompt)%{$PR_NO_COLOR%}'
# The time
local p_time="%{$PR_BOLD%}%D{%L:%M%p}%{$PR_NO_COLOR%}"
PROMPT="
%{$PR_BLUE%}╭─<${user_host}%{$PR_BLUE%}>-<${current_dir}%{$PR_BLUE%}>-${git_branch}%{$PR_BLUE%}<${p_time}%{$PR_BLUE%}>-◇
%{$PR_BLUE%}╰─$PR_PROMPT"
RPS1="${return_code}"
local GIT_PRE="<%{$PR_BOLD%}"
local GIT_POST="%{$PR_NO_COLOR$PR_BLUE%}>-"
ZSH_THEME_GIT_PROMPT_PREFIX="%{$PR_NO_COLOR$PR_BLUE%}∙%{$PR_BOLD%}"
ZSH_THEME_GIT_PROMPT_SUFFIX=""
ZSH_THEME_GIT_PROMPT_DIRTY="%{$PR_NO_COLOR$PR_BLUE%}∙%{$PR_RED%}✗"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$PR_NO_COLOR$PR_BLUE%}∙%{$PR_GREEN%}✔"
ZSH_THEME_GIT_PROMPT_AHEAD="%{$PR_YELLOW$PR_BOLD%}⚡"
ZSH_THEME_GIT_PROMPT_SHA_BEFORE=""
ZSH_THEME_GIT_PROMPT_SHA_AFTER=""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment