Skip to content

Instantly share code, notes, and snippets.

Created Aug 23, 2011
What would you like to do?
~/.zshrc for Oh My ZSH (alan)
# Path to your oh-my-zsh configuration.
# 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.
# Set to this to use case-sensitive completion
# Comment this out to disable weekly auto-update checks
# Uncomment following line if you want to disable colors in ls
# Uncomment following line if you want to disable autosetting terminal title.
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(git git-flow textmate macports mysql-macports)
source $ZSH/
# Customize to your needs...
# -----------------------------------------------------------
# Aliases
alias GR='git pull --rebase origin $(current_branch)'
compdef GR=git
alias GU='git pull origin $(current_branch)'
compdef GU=git
alias GP='git push origin $(current_branch)'
compdef GP=git
alias GS='git pull origin $(current_branch) && git push origin $(current_branch)'
compdef GS=git
alias GSR='git pull --rebase origin $(current_branch) && git push origin $(current_branch)'
compdef GSR=git
alias gti='git'
# OSX Aliases
# mysql
alias mysql='/opt/local/bin/mysql5'
alias start_mysql_alt='sudo /opt/local/bin/mysqld_safe5 &'
alias stop_mysql_alt='/opt/local/bin/mysqladmin5 -u root -p shutdown'
alias start_mysql='sudo -u _mysql /opt/local/libexec/mysqld &; sudo ln -s /opt/local/var/run/mysql5/mysqld.sock /tmp/mysql.sock'
alias stop_mysql='/opt/local/bin/mysqladmin5 -u root -p shutdown'
# nginx
alias start_nginx='sudo launchctl load -w /Library/LaunchDaemons/org.macports.nginx.plist'
alias stop_nginx='sudo launchctl unload -w /Library/LaunchDaemons/org.macports.nginx.plist'
alias restart_nginx='sudo launchctl unload -w /Library/LaunchDaemons/org.macports.nginx.plist; sudo launchctl load -w /Library/LaunchDaemons/org.macports.nginx.plist'
# php
alias start_php='php-cgi -q -b &'
alias stop_php='killall php-cgi'
alias restart_php='killall php-cgi; php-cgi -q -b &'
# -----------------------------------------------------------
unsetopt menu_complete # do not autoselect the first completion entry
unsetopt flowcontrol
setopt no_list_beep
setopt auto_menu # show completion menu on succesive tab press
setopt complete_in_word
setopt always_to_end
zstyle ':completion:*' add-space true
zstyle ':completion:*' completer _expand _complete _match _prefix _approximate _list
zstyle ':completion:*' menu select=1
zstyle ':completion:*' file-sort name
zstyle ':completion:*' list-colors ${(s.:.)ZLS_COLORS}
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' 'r:|[._-]=** r:|=**' 'l:|=** r:|=**'
zstyle ':completion:*' menu select
zstyle ':completion:*:approximate:*' max-errors 'reply=( $(( ($#PREFIX+$#SUFFIX)/3 )) numeric )'
zstyle ':completion:*' group 1
zstyle ':completion:*' format '%B---- %d%b'
zstyle ':completion:*:corrections' format '%B---- %d (errors %e)%b'
zstyle ':completion:*:descriptions' format "%B---- %d%b"
zstyle ':completion:*:messages' format '%B%U---- %d%u%b'
zstyle ':completion:*:warnings' format "%B$fg[red]%}---- no match for: $fg[white]%d%b"
zstyle ':completion:*' group-name ''
# -----------------------------------------------------------
# screen autotitle
function title {
[ "$DISABLE_AUTO_TITLE" != "true" ] || return
if [[ "$TERM" == screen* ]]; then
print -Pn "\ek$HOST|$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars
elif [[ "$TERM" == xterm* ]] || [[ $TERM == rxvt* ]] || [[ "$TERM_PROGRAM" == "" ]]; then
print -Pn "\e]2;$2:q\a" #set window name
print -Pn "\e]1;$1:q\a" #set icon (=tab) name (will override window name on broken terminal)
# -----------------------------------------------------------
EDITOR="/Applications/Sublime Text"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment