101 lines
2.6 KiB
Bash
101 lines
2.6 KiB
Bash
#!/bin/zsh
|
|
|
|
# GIT
|
|
if command_exists 'git'; then
|
|
alias gi='git init'
|
|
alias ga='git add'
|
|
alias gap='git add --patch'
|
|
alias gt='git tag'
|
|
alias gtl='git describe --tags --abbrev=0'
|
|
|
|
git-move-root() {
|
|
git filter-branch --subdirectory-filter "$@" --prune-empty -- --all
|
|
}
|
|
|
|
git-undo-commit() {
|
|
git reset --soft "HEAD^"
|
|
}
|
|
fi
|
|
|
|
# Tmux
|
|
if command_exists 'tmux'; then
|
|
alias t='tmux new -s x || tmux attach -t x'
|
|
alias tl='tmux list-sessions'
|
|
alias ts='tmux switch'
|
|
|
|
function tmux-send {
|
|
tmux send-keys -s "x" $1 Enter
|
|
}
|
|
|
|
if command_exists 'irssi'; then
|
|
function tmux-irssi-nickpane {
|
|
tmux renamew irssi # name the window
|
|
tmux -q setw main-pane-width $(( $(tput cols) - 21)) # set the main pane width to the total width-20
|
|
tmux splitw -v "cat ~/.irssi/nicklistfifo" # create the window and begin reading the fifo
|
|
tmux -q selectl main-vertical # assign the layout
|
|
tmux selectw -t irssi # select window 'irssi'
|
|
tmux selectp -t 0 # select pane 0
|
|
}
|
|
|
|
function tmux-irssi {
|
|
tmux-irssi-nickpane
|
|
$(which irssi) # launch irssi
|
|
}
|
|
|
|
# repair running irssi's nicklist pane
|
|
function tmux-irssi-repair() {
|
|
tmux selectw -t irssi
|
|
tmux selectp -t 0
|
|
tmux killp -a # kill all panes
|
|
irssi_nickpane
|
|
}
|
|
fi
|
|
fi
|
|
|
|
# OS-specific aliases
|
|
if [[ "$OSTYPE" == darwin* ]]; then
|
|
alias codekit='open -a CodeKit'
|
|
alias b='brew'
|
|
alias v='vim'
|
|
# Open file in emacs server; must be running!
|
|
alias e="emacsclient -n"
|
|
else
|
|
alias ipt='sudo iptables'
|
|
fi
|
|
|
|
# transmission-remote
|
|
if command_exists 'transmission-remote'; then
|
|
alias bt="transmission-remote server"
|
|
alias btl="bt -l"
|
|
alias bta="bt --add"
|
|
|
|
btr() { bt -t$1 -r }
|
|
bts() { bt -t$1 -S }
|
|
fi
|
|
|
|
alias va='vagrant'
|
|
alias r='noglob rake -g'
|
|
|
|
# Interpreters
|
|
alias rbe='rbenv'
|
|
alias rb='ruby'
|
|
alias pye='pyenv'
|
|
alias py='python'
|
|
alias py3='python3'
|
|
alias be='bundle exec'
|
|
[ -e /Applications/love.app ] && alias love="/Applications/love.app/Contents/MacOS/love"
|
|
|
|
# Shell conveniences
|
|
alias sha1='openssl sha1'
|
|
alias header='curl -I'
|
|
# Resume download if possible
|
|
alias wget='wget -c'
|
|
|
|
# Make a directory and change to it
|
|
function mkd { mkdir "$@" && cd "$@" }
|
|
|
|
alias qq='exit'
|
|
alias cc='clear'
|
|
|
|
# vim:set ft=zsh:
|