helm/bash/aliases
2014-12-13 19:35:07 -05:00

119 lines
2.7 KiB
Bash
Executable file

#!/bin/bash
alias q='exit'
alias clr='clear'
alias catn='cat -n' # cat + line numbers
alias -- -='cd -'
# Command fixes
alias ln="${aliases[ln]:-ln} -v" # verbose ln
alias wget='wget -c' # Resume download if possible
alias rsyncd='rsync -va --delete' # Hard sync two directories
# Shortcut for git
alias g=git
is-callable 'hub' && alias git='hub'
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 --short'
alias gS='git status'
alias gr='git reset "HEAD^"'
alias gd='git diff'
if is-callable 'tmux'; then
alias t='tmux'
# 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 "$*"
}
alias tls='tmux ls'
# New instance attached to old session
alias tn='tmux new-session -t "x"'
fi
# OS-specific aliases
if [[ "$OSTYPE" == darwin* ]]; then
alias codekit='open -a CodeKit'
alias br='brew'
alias bru='brew update && brew upgrade'
function v {
[ $# -eq 0 ] && vim . || vim $@
}
unalias e # get rid of prezto's alias
function e {
[ -z "$@" ] && input="." || input=$@
emacsclient -n $input
}
function et {
[ -z "$@" ] && input="." || input=$@
emacsclient -nw $input
}
alias c11='clang++ -std=c++11 -stdlib=libc++'
alias eclimd='/Applications/eclipse/eclimd'
else
alias ipt='sudo iptables'
fi
# transmission-remote
if is-callable 'transmission-remote'; then
alias bt='transmission-remote server'
# 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
}
fi
alias va='vagrant'
alias rk='rake'
alias rkg='rake -g'
# Interpreters
alias rb='ruby'
alias rbe='rbenv'
alias b='bundle'
alias be='bundle exec'
alias bi='bundle install --path vendor'
alias py='python'
alias pye='pyenv'
alias pyi='ipython'
# Bash-only aliases
if [ -z "$ZSH_VERSION" ]; then
# Allow sudo with aliases
alias sudo='sudo '
alias ls='ls -G'
alias l='ls -o'
alias la='ls -AGFoh'
fi