#!/bin/zsh # GIT if command_exists 'git'; then # On top of oh-my-zsh's git aliases alias git='noglob git' alias gs='git status' alias gst='git stash' alias gap='git add -p' alias gf='git ls-files | grep -i' alias gt='git tag' alias gtl='git describe --tags --abbrev=0' alias gpb='git push origin' function git-new-root { git filter-branch --subdirectory-filter "$@" --prune-empty -- --all } # find oh-my-zsh's here: ~/.oh-my-zsh/plugins/git/git.plugin.zsh fi # OS-specific aliases if is_linux; then alias ipt='sudo iptables' elif is_mac; then alias b='brew' alias ql='quicklook' alias v='vim' function o { if [ $# -eq 0 ]; then open . else open $@ fi } # Open file in emacs daemon (will auto-start it) function e { macos=/Applications/Emacs.app/Contents/MacOS if pgrep -qf 'Emacs.*--daemon'; then args=-n else $macos/Emacs --daemon args=-nc fi echo $args emacsclient $args "$@" } alias es="emacsclient -e '(kill-emacs)'" fi # Tmux command_exists 'tmux' && alias t='tmux -CC' # transmission-remote if command_exists 'transmission-remote'; then alias bt="transmission-remote server" alias btl="bt -l" alias bta="bt --add" function btr { bt -t$1 -r } function bts { bt -t$1 -S } fi alias va='vagrant' # Interpreters command_exists "rbenv" && alias rbe='rbenv' command_exists "ruby" && alias rb='ruby' command_exists "pyenv" && alias pye='pyenv' command_exists "python" && alias py='python' command_exists "python3" && alias py3='python3' [ -e /Applications/love.app ] && alias love="/Applications/love.app/Contents/MacOS/love" # Shell conveniences alias ls='ls --color=auto' alias l='ls -1' alias ll='ls -l' alias la='ls -la' alias l.='ls -Ad .*' alias du='du -h -d 1' alias q='exit' alias sha1='openssl sha1' alias mkdir='mkdir -pv' alias header='curl -I' # Resume download if possible alias wget='wget -c' # Lets us sudo aliases alias sudo='sudo ' # Make a directory and change to it function mkd { mkdir "$@" && cd "$@" } alias reload='exec $SHELL -l' alias c='clear' alias r='rake -g' # Disable zsh glob syntax on the rake command alias rake='noglob rake' # vim:set ft=zsh: