helm/bash/aliases

97 lines
1.9 KiB
Plaintext
Raw Normal View History

2014-09-21 07:10:47 -07:00
#!/bin/bash
2014-09-19 15:24:34 -07:00
alias q='exit'
alias clr='clear'
alias catn='cat -n' # cat + line numbers
2014-09-20 13:38:08 -07:00
alias -- -='cd -'
2014-09-19 15:24:34 -07:00
# Command fixes
alias ln="${aliases[ln]:-ln} -v" # verbose ln
alias wget='wget -c' # Resume download if possible
2014-09-21 07:10:47 -07:00
alias rsyncd='rsync -va --delete' # Hard sync two directories
2014-09-19 15:24:34 -07:00
# Shortcut for git
g() {
if [[ $# -gt 0 ]]; then
${aliases[git]:-git} $@
else
${aliases[git]:-git} status --short
fi
}
2014-09-21 07:10:47 -07:00
is-callable 'hub' && alias git='hub'
2014-09-19 15:24:34 -07:00
alias gi='git init'
alias ga='git add'
alias gap='git add --patch'
alias gc='git commit --verbose'
alias gcm='git commit --verbose -m'
alias gco='git checkout'
alias gcl='git clone'
alias gp='git push'
alias gpl='git pull'
alias gb='git branch'
alias gt='git tag'
alias gs='git status'
alias gr='git reset "HEAD^"'
alias gd='git diff'
if is-callable 'tmux'; then
alias t='tmux new -s x || tmux attach -t x'
alias tl='tmux list-sessions'
alias ts='tmux switch'
2014-09-21 07:10:47 -07:00
function tmux-send {
2014-09-19 15:24:34 -07:00
tmux send-keys -s "x" $1 Enter
}
fi
# OS-specific aliases
if [[ "$OSTYPE" == darwin* ]]; then
alias codekit='open -a CodeKit'
alias b='brew'
2014-09-21 07:10:47 -07:00
function v {
[ $# -eq 0 ] && vim . || vim $@
}
unalias e # get rid of prezto's alias
function e {
[ -z "$@" ] && input="." || input=$@
open -a "Emacs" $input
}
2014-09-19 15:24:34 -07:00
else
alias ipt='sudo iptables'
fi
# transmission-remote
if is-callable 'transmission-remote'; then
2014-09-20 13:38:08 -07:00
alias bt='transmission-remote server'
alias btl='bt -l'
2014-09-19 15:24:34 -07:00
fi
alias va='vagrant'
alias rk='rake'
alias rkg='rake -g'
# Interpreters
alias rb='ruby'
alias rbe='rbenv'
alias be='bundle exec'
alias spec='rspec'
alias py='python'
alias pye='pyenv'
2014-09-20 13:38:08 -07:00
[ -e /Applications/love.app ] && alias love='/Applications/love.app/Contents/MacOS/love'
2014-09-19 15:24:34 -07:00
# Bash-only aliases
if [ -z "$ZSH_VERSION" ]; then
2014-09-21 07:10:47 -07:00
# Allow sudo with aliases
2014-09-19 15:24:34 -07:00
alias sudo='sudo '
alias ls='ls -G'
2014-09-20 13:38:08 -07:00
alias l='ls -o'
alias la='ls -AGFoh'
2014-09-19 15:24:34 -07:00
fi