helm/zsh/aliases.zsh

110 lines
2.5 KiB
Bash
Raw Normal View History

#!/bin/zsh
2014-03-17 14:25:17 -07:00
2015-01-20 00:00:13 -08:00
export p=~/Dropbox/projects
2013-12-19 06:48:28 -08:00
2015-01-20 00:00:13 -08:00
alias q=exit
alias clr=clear
alias sudo='sudo '
# Homebrew
alias br='brew'
2015-05-20 19:53:27 -07:00
alias bru='brew update && brew upgrade --all'
2015-01-20 00:00:13 -08:00
# Tools
alias codekit='open -a CodeKit'
2014-09-20 13:38:40 -07:00
alias ag='nocorrect noglob ag'
2015-06-18 13:16:54 -07:00
alias ls="ls -G"
alias l="ls -l"
alias ll="ls -l"
alias ln="ln -v" # Verbose ln
2015-01-20 00:00:13 -08:00
alias wget='wget -c' # Resume dl if possible
alias rsyncd='rsync -va --delete' # Hard sync two directories
zman() { PAGER="less -g -s '+/^ "$1"'" man zshall; }
2015-04-22 17:46:04 -07:00
mkd() { mkdir "$1" && cd "$1"; }
2014-09-05 13:55:50 -07:00
2015-01-20 00:00:13 -08:00
# transmission-remote
if is-callable 'transmission-remote'; then
alias bt='transmission-remote server'
# pretty print torrent list on remote server
2015-05-20 19:53:27 -07:00
btl() {
local results
2015-01-20 00:00:13 -08:00
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'`
2015-01-20 00:00:13 -08:00
if [ -z "$results" ]; then
echo "No torrents!"
else
echo $results
fi
}
fi
# Editors
v() { [ $# -eq 0 ] && vim . || vim $@ }
e() { # emacs
2015-05-20 19:53:27 -07:00
local input
2015-01-25 23:10:05 -08:00
[ ! $# -eq 0 ] && input=$@
2015-01-20 00:00:13 -08:00
emacsclient -n ${input:-.}
2014-09-05 13:55:50 -07:00
}
2015-04-22 17:46:04 -07:00
ee() { # emacs in project root
if git root 2>/dev/null; then
e "$(git rev-parse --show-toplevel)"
else
e .
fi
}
2015-01-20 00:00:13 -08:00
# Compilers 'n interpretors
alias va='vagrant'
alias py='python'
alias pye='pyenv'
alias pip='sudo pip'
alias rb='ruby'
alias rbe='rbenv'
alias b='bundle'
alias be='bundle exec'
alias bi='bundle install -path vendor'
alias c11='clang++ -std=c++11 -stdlib=libc++'
alias eclimd='/Applications/eclipse/eclimd'
2015-02-01 23:02:40 -08:00
# Build tools
alias rk='noglob rake'
alias rkg='noglob rake -g'
alias m='make'
2015-01-20 00:00:13 -08:00
# GIT
is-callable 'hub' && alias git='hub'
g() { [ $# -eq 0 ] && git status --short || git $* }
alias gi='git init'
alias gs='git status'
alias gco='git checkout'
alias gc='git commit'
alias gcm='noglob git commit -m'
2015-01-21 12:16:01 -08:00
alias gd='git diff'
2015-01-20 00:00:13 -08:00
alias gp='git push'
alias gl='git pull'
alias ga='git add'
2015-04-22 20:53:37 -07:00
alias ge='git exec'
2015-01-20 00:00:13 -08:00
alias gb='git branch'
alias gap='git add --patch'
alias gr='git reset "HEAD^"'
# Tmux
if is-callable 'tmux'; then
alias t='tmux'
alias ts='tmux send-keys'
alias tl='tmux ls'
# 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"'
# New instance attached to old session
alias tn='tmux new-session -t $(hostname)'
fi