Created
November 25, 2011 19:03
-
-
Save webframp/1394221 to your computer and use it in GitHub Desktop.
zshrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#RVM | |
[[ -s "/Users/sme/.rvm/scripts/rvm" ]] && source "/Users/sme/.rvm/scripts/rvm" # load RVM into a shell session. | |
# ALIASES | |
alias l='ls -F -h' | |
alias ll='ls -l -F -h' | |
alias la='ls -a -F -h' | |
alias lla='ls -l -a -F -h' | |
# command equivalents | |
alias -g A='|ack' | |
alias -g L='|less' | |
alias -g S='&> /dev/null &' | |
alias -g G='|grep' | |
alias -g GC='|grep --color=always' | |
if [ `hostname | grep -c soundwave` -eq 1 ]; then | |
# handy, but only needed on workstation | |
alias vim='mvim -v' | |
alias view='vim -R' | |
alias notes='$EDITOR ~/notes.txt' | |
alias v='mvim -v' #--remote-silent' | |
alias gv='mvim --remote-silent' | |
alias startwin='VBoxManage startvm Win7' | |
alias stopwin='VBoxManage controlvm Win7 savestate' | |
alias rb19='rvm use 1.9.3' | |
if [ -f /Applications/Emacs.app/Contents/MacOS/Emacs ]; then | |
alias emacs=/Applications/Emacs.app/Contents/MacOS/Emacs | |
alias emacsclient=/Applications/Emacs.app/Contents/MacOS/bin/emacsclient | |
export EDITOR="/Applications/Emacs.app/Contents/MacOS/Emacs -nw" | |
else | |
export EDITOR="emacs -nw" | |
fi | |
function e() { emacs -nw $@ } | |
function ec() { emacsclient -t $@ } | |
function es() { e --daemon=$1 && ec -s $1 } | |
function el() { ps ax | egrep '[Ee]macs' } | |
function ek() { ec -e '(kill-emacs)' -s $1 } | |
# nocorrect aliases | |
NOCORRECT=~/.zsh/nocorrect | |
if [ -f $NOCORRECT ]; then | |
for p in `cat $NOCORRECT`; do alias $p="nocorrect $p"; done | |
fi | |
# drop into tmux if this is a login shell and we're not in tmux | |
# already | |
if (which tmux >/dev/null) && [[ -o login ]] && [[ -z "$TMUX" ]] && [[ -f $HOME/bin/tmuxsh ]]; then | |
exec zsh "$HOME/bin/tmuxsh" $(which tmux) | |
fi | |
fi | |
# quick config editing | |
alias muttrc='$EDITOR ~/.muttrc' | |
alias zshrc='$EDITOR ~/.zshrc' | |
alias vimrc='$EDITOR ~/.vimrc' | |
alias hgrc='$EDITOR ~/.hgrc' | |
# suffix aliases on the mac | |
alias -s flac=open | |
alias -s mp3=open | |
alias -s ogg=open | |
alias -s wav=open | |
alias -s avi=open | |
alias -s mpeg=open | |
alias -s mpg=open | |
alias -s wmv=open | |
alias -s bmp=open | |
alias -s png=open | |
alias -s jpg=open | |
alias -s jpeg=open | |
alias -s gif=open | |
alias -s pdf=open | |
alias -s pyc=python | |
alias -s org=$BROWSER | |
alias -s com=$BROWSER | |
alias -s net=$BROWSER | |
alias -s html=$BROWSER | |
# setup env | |
setopt ALL_EXPORT | |
HISTFILE=${HOME}/.zhistory | |
HISTSIZE=3000 | |
SAVEHIST=3000 | |
DIRSTACKSIZE=20 | |
BROWSER="open" | |
PAGER=less | |
LESS='-RMS' | |
#EDITOR="mvim -v" | |
EDITOR=~/bin/edit | |
GREP_COLOR='1;32' #bright green | |
GREP_OPTIONS='--color=auto' | |
PYTHONSTARTUP="$HOME/.pythonrc" | |
PYTHONPATH=$PYTHONPATH:. | |
PATH=~/bin:/usr/local/bin:/usr/texbin:/Users/sme/.rvm/bin:/bin:/usr/sbin:/sbin:/usr/bin:/usr/X11/bin | |
unsetopt ALL_EXPORT | |
# user func | |
ssh-reagent () { | |
for agent in /tmp/ssh-*/agent.*; do | |
export SSH_AUTH_SOCK=$agent | |
if ssh-add -l 2>&1 > /dev/null; then | |
echo Found working SSH Agent: | |
ssh-add -l | |
return | |
fi | |
done | |
echo Cannot find ssh agent - maybe you should reconnect and forward it? | |
} | |
function setdsm() { | |
export PYTHONPATH=$PYTHONPATH:$PWD/.. | |
export PYTHONPATH=$PYTHONPATH:$PWD | |
if [ -z "$1" ]; then | |
x=${PWD/\/[^\/]*\/} | |
export DJANGO_SETTINGS_MODULE=$x.settings | |
else | |
export DJANGO_SETTINGS_MODULE=$1 | |
fi | |
echo "DJANGO_SETTINGS_MODULE set to $DJANGO_SETTINGS_MODULE" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment