helm/zsh/aliases.zsh

147 lines
3.6 KiB
Bash
Raw Normal View History

2015-01-20 00:00:13 -08:00
alias q=exit
alias clr=clear
alias sudo='sudo '
# Tools
2014-09-20 13:38:40 -07:00
alias ag='nocorrect noglob ag'
2015-06-18 13:16:54 -07:00
alias l="ls -l"
2015-06-19 07:04:48 -07:00
alias ll="ls -1"
alias la="ls -la"
2015-06-18 13:16:54 -07:00
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
2015-09-10 22:44:27 -07:00
alias mkdir='mkdir -p'
2015-01-20 00:00:13 -08:00
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-06-19 07:04:48 -07:00
j() {
local fasd_ret="$(fasd -i -d "$@")"
if [[ -d "$fasd_ret" ]]; then
cd "$fasd_ret"
else
print "$fasd_ret"
fi
}
2015-01-20 00:00:13 -08:00
# transmission-remote
if is-callable 'transmission-remote'; then
alias bt='transmission-remote server'
2015-08-19 18:23:35 -07:00
alias bt-clear='bt -t all -r'
2015-01-20 00:00:13 -08:00
# 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
2015-06-19 07:04:48 -07:00
v() { vim ${@:-.}; } # Open in vim
2015-07-09 16:53:35 -07:00
e() { emacsclient -n ${@:-.}; } # Open in emacs (daemon)
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
2015-07-26 04:18:32 -07:00
# Compilers, interpretors 'n builders
2015-01-20 00:00:13 -08:00
alias va='vagrant'
alias py='python'
alias pye='pyenv'
alias rb='ruby'
alias rbe='rbenv'
alias b='bundle'
alias be='bundle exec'
alias bi='bundle install -path vendor'
2015-07-26 04:18:32 -07:00
alias ans='ansible'
alias ansp='ansible-playbook'
alias fabg='noglob fab -f ~/.dotfiles/ansible/fabfile.py'
2015-02-01 23:02:40 -08:00
alias rk='noglob rake'
alias rkg='noglob rake -g'
alias m='make'
2015-07-29 03:39:34 -07:00
alias c11='CPPFLAGS+=-std=c++11 '
2015-02-01 23:02:40 -08:00
2015-07-30 08:57:22 -07:00
# needs imagemagick and ghostscript (for ai)
2png() {
mkdir -p _png;
for f in *.(psd|ai); do convert -resize 1200x1200 ${f}[0] _png/${f}.png; done;
}
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'
2015-06-19 07:04:48 -07:00
alias gsu='git submodule'
2015-01-20 00:00:13 -08:00
alias gco='git checkout'
alias gc='git commit'
alias gcm='noglob git commit -m'
2015-07-29 03:39:34 -07:00
alias gcma='noglob git commit --amend -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'
2015-08-28 18:16:12 -07:00
alias gpl='git pull'
2015-01-20 00:00:13 -08:00
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^"'
2015-06-19 07:04:48 -07:00
alias gre='git remote'
2015-01-20 00:00:13 -08:00
# 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.
2015-07-29 03:39:34 -07:00
ta() {tmux new -s $1 || tmux new -t $1 -s $1-2 || tmux attach -t $1-2;}
2015-01-20 00:00:13 -08:00
# New instance attached to old session
alias tn='tmux new-session -t $(hostname)'
fi
2015-06-19 07:04:48 -07:00
if is-mac; then
2015-07-29 03:39:34 -07:00
# alias open='open'
2015-06-19 07:04:48 -07:00
alias ls="ls -G"
alias c11='clang++ -std=c++11 -stdlib=libc++'
alias eclimd='/Applications/eclipse/eclimd'
# Homebrew
alias br='brew'
alias bru='brew update && brew upgrade --all'
alias brc='brew cask'
alias codekit='open -a CodeKit'
elif is-cygwin; then
2015-07-29 03:39:34 -07:00
alias open='cygstart'
2015-06-19 07:04:48 -07:00
alias pbcopy='tee > /dev/clipboard'
alias pbpaste='cat /dev/clipboard'
else
2015-07-29 03:39:34 -07:00
alias open='xdg-open'
2015-06-19 07:04:48 -07:00
alias ls="ls --color=auto"
if (( $+commands[xclip] )); then
alias pbcopy='xclip -selection clipboard -in'
alias pbpaste='xclip -selection clipboard -out'
elif (( $+commands[xsel] )); then
alias pbcopy='xsel --clipboard --input'
alias pbpaste='xsel --clipboard --output'
fi
fi
2015-07-29 03:39:34 -07:00
# By default, open cwd
o() { open ${@:-.}; }