Skip to content

Instantly share code, notes, and snippets.

@heiberg
Created January 23, 2013 21:33
Show Gist options
  • Save heiberg/4613757 to your computer and use it in GitHub Desktop.
Save heiberg/4613757 to your computer and use it in GitHub Desktop.
Parts of my .zshrc
# Path to oh-my-zsh configuration.
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="muse"
# 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 bi-weekly auto-update checks
# DISABLE_AUTO_UPDATE="true"
# Uncomment to change how many often would you like to wait before auto-updates occur? (in days)
# export UPDATE_ZSH_DAYS=13
# 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 osx brew gem bundler sublime)
source $ZSH/oh-my-zsh.sh
# --------------------------------------------------
# Customizations
# --------------------------------------------------
# mv on STEROIDS, please
autoload zmv
# Use space in menu-select to open a dir and show sub-dirs in the menu
bindkey -M menuselect ' ' accept-and-infer-next-history
# Ripped blindly from some random theme. Look closer at this some day.
export LS_COLORS="di=34;40:ln=35;40:so=32;40:pi=33;40:ex=31;40:bd=31;40:cd=31;40:su=31;40:sg=31;40:tw=31;40:ow=31;40:"
export PATH="~/Dropbox/Scripts:/usr/local/bin:$PATH"
export PATH="/Applications/Postgres.app/Contents/MacOS/bin:$PATH"
export PATH="/usr/local/heroku/bin:$PATH"
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.
alias omz="subl ~/.oh-my-zsh"
alias nuke-xcode-derived-data='rm -rf ~/Library/Developer/Xcode/DerivedData'
# Colorful completion listings
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
# Disable spell correction on some commands
alias mv='nocorrect mv'
alias cp='nocorrect cp'
# Always add -p to mkdir for improved sanity
alias mkdir='nocorrect mkdir -p'
# Set less options
if [[ -x $(which less) ]]
then
export PAGER="less"
export LESS="--ignore-case --LONG-PROMPT --QUIET --chop-long-lines -Sm --RAW-CONTROL-CHARS --quit-if-one-screen --no-init"
export LESSHISTFILE='-'
if [[ -x $(which lesspipe.sh) ]]
then
LESSOPEN="| lesspipe.sh %s"
export LESSOPEN
fi
fi
# Say how long a command took, if it took more than N seconds
export REPORTTIME=10
# Prompts for confirmation after 'rm *' etc
# Helps avoid mistakes like 'rm * o' when 'rm *.o' was intended
setopt RM_STAR_WAIT
# Background processes aren't killed on exit of shell
setopt AUTO_CONTINUE
# Don’t write over existing files with >, use >! instead
setopt NOCLOBBER
# Don’t nice background processes
setopt NO_BG_NICE
# Watch other user login/out
watch=notme
export LOGCHECK=60
export EDITOR='subl -w'
# Custom cd command for Strange Loop projects, with auto-complete
cdsl() { cd ~/Development/StrangeLoop/$1; }
_cdsl() { _files -W ~/Development/StrangeLoop -/; }
compdef _cdsl cdsl
# Assign a random MAC address to the Wi-Fi interface. Useful in places with 15 minutes free Wi-Fi. :-P
function spoof-wifi-mac() {
sudo /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -z
sleep 1
sudo ifconfig en0 down
sleep 1
sudo ifconfig en0 up
sleep 1
openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//' | xargs sudo ifconfig en0 ether
}
function rebuild-osx-open-with-list() {
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user
killall Finder
}
unsetopt correct_all
#####################################################################
# Prompt
# Apparently only needed when using vcs_info?
setopt promptsubst
# Use spectrum_ls to see available colors
GIT_PROMPT_INFO_COLOR="$FG[074]"
GIT_PROMPT_DIRTY_COLOR="$FG[088]"
GIT_PROMPT_CLEAN_COLOR="$FG[022]"
ZSH_THEME_GIT_PROMPT_PREFIX="%{$GIT_PROMPT_INFO_COLOR%}("
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$GIT_PROMPT_INFO_COLOR%})"
ZSH_THEME_GIT_PROMPT_DIRTY=" %{$GIT_PROMPT_DIRTY_COLOR%}✗"
#ZSH_THEME_GIT_PROMPT_CLEAN=" %{$GIT_PROMPT_CLEAN_COLOR%}✔"
# Add $(git_prompt_status) to prompt to see these.
# ZSH_THEME_GIT_PROMPT_ADDED="%{$FG[082]%}✚%{$reset_color%}"
# ZSH_THEME_GIT_PROMPT_MODIFIED="%{$FG[166]%}✹%{$reset_color%}"
# ZSH_THEME_GIT_PROMPT_DELETED="%{$FG[160]%}✖%{$reset_color%}"
# ZSH_THEME_GIT_PROMPT_RENAMED="%{$FG[220]%}➜%{$reset_color%}"
# ZSH_THEME_GIT_PROMPT_UNMERGED="%{$FG[082]%}═%{$reset_color%}"
# ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$FG[190]%}✭%{$reset_color%}"
# $(git_prompt_ahead) – Current branch is ahead of remote. Remember to push.
ZSH_THEME_GIT_PROMPT_AHEAD=" %{$FG[166]%}▶▶%{$reset_color%}"
#
# Check out ~/.oh-my-zsh/lib/git.zsh for more options. Git remote status, SHA, ...
# The precmd() trick for the first line avoids reprinting the prompt when resizing the terminal window.
precmd() { print -rP "%{$FG[026]%}%~%{$reset_color%} $(git_prompt_info)$(git_prompt_ahead)%{$reset_color%}" }
PROMPT='%(?..%{$FG[088]%}%?↵ %{$reset_color%})%{$FG[061]%}[$[HISTCMD]]%{$reset_color%}\$ '
# Add a red right-hand prompt if last command finished with non-zero exit code
#RPS1='%(?..%{$fg[red]%}%?↵%{$reset_color%})'
# End of prompt
#####################################################################
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment