helm/bash/aliases

117 lines
2.7 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
# 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
2014-09-22 09:06:02 -07:00
alias g=git
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'
2014-09-22 09:06:02 -07:00
alias gs='git status --short'
alias gS='git status'
2014-09-19 15:24:34 -07:00
alias gr='git reset "HEAD^"'
alias gd='git diff'
if is-callable 'tmux'; then
2014-12-13 16:35:07 -08:00
alias t='tmux'
2014-09-19 15:24:34 -07:00
2014-12-13 16:35:07 -08:00
# Start new session or create a grouped session so I'm not simply watching
# the same session in both windows.
alias ta='tmux new -s $(hostname) || tmux new -t $(hostname) -s $(hostname)-2 || tmux attach -t "io-2"'
function ts {
tmux send-keys "$*"
2014-09-19 15:24:34 -07:00
}
2014-12-13 16:35:07 -08:00
alias tls='tmux ls'
# New instance attached to old session
alias tn='tmux new-session -t "x"'
2014-09-19 15:24:34 -07:00
fi
# OS-specific aliases
if [[ "$OSTYPE" == darwin* ]]; then
alias codekit='open -a CodeKit'
2014-11-18 22:22:08 -08:00
alias br='brew'
2014-12-13 16:35:07 -08:00
alias bru='brew update && brew upgrade'
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=$@
2014-12-13 16:35:07 -08:00
emacsclient -n $input
}
function et {
[ -z "$@" ] && input="." || input=$@
emacsclient -nw $input
2014-09-21 07:10:47 -07:00
}
2014-12-13 16:35:07 -08:00
alias c11='clang++ -std=c++11 -stdlib=libc++'
alias eclimd='/Applications/eclipse/eclimd'
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'
2014-12-13 16:35:07 -08:00
# pretty print torrent list on remote server
function btl {
results=`transmission-remote server -l | \
awk 'NR > 1 { s = ""; for (i = 10; i <= NF; i++) s = s $i " "; print $9 " | " s }' | \
sed '$d' | \
perl -pe 's/\s\[[a-zA-Z0-9]+\]\s/ /g'`
if [ -z "$results" ]; then
echo "No torrents!"
else
echo $results
fi
}
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'
2014-11-18 22:22:08 -08:00
alias b='bundle'
2014-09-19 15:24:34 -07:00
alias be='bundle exec'
2014-12-13 16:35:07 -08:00
alias bi='bundle install --path vendor'
2014-09-19 15:24:34 -07:00
alias py='python'
alias pye='pyenv'
2014-12-13 16:35:07 -08:00
alias pyi='ipython'
2014-10-09 15:31:11 -07:00
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