2012-01-31 12:46:41 +08:00
|
|
|
# Aliases in this file are bash and zsh compatible
|
|
|
|
|
|
|
|
# Don't change. The following determines where YADR is installed.
|
2012-09-15 03:30:08 +08:00
|
|
|
yadr=$HOME/.yadr
|
2018-12-04 14:05:34 +08:00
|
|
|
yadr_zsh=$yadr/zsh
|
2012-01-31 12:46:41 +08:00
|
|
|
|
2014-10-25 03:29:07 +08:00
|
|
|
# Get operating system
|
|
|
|
platform='unknown'
|
|
|
|
unamestr=$(uname)
|
|
|
|
if [[ $unamestr == 'Linux' ]]; then
|
|
|
|
platform='linux'
|
|
|
|
elif [[ $unamestr == 'Darwin' ]]; then
|
|
|
|
platform='darwin'
|
|
|
|
fi
|
|
|
|
|
2012-01-31 12:46:41 +08:00
|
|
|
# YADR support
|
|
|
|
alias yav='yadr vim-add-plugin'
|
2013-03-18 01:18:59 +08:00
|
|
|
alias ydv='yadr vim-delete-plugin'
|
|
|
|
alias ylv='yadr vim-list-plugin'
|
2012-10-09 12:38:21 +08:00
|
|
|
alias yup='yadr update-plugins'
|
2012-01-31 12:46:41 +08:00
|
|
|
alias yip='yadr init-plugins'
|
|
|
|
|
|
|
|
# PS
|
Support for @sorin-ionescu rewrite of oh-my-zsh
Sorin's OMZ rewrite is a bit nicer, as it's written in more
native style ZSH, doesn't do auto updates, and incorporates
many bugfixes, and is more actively maintained than Robby's branch.
For now, YADR supports both, so if you want to try out the sorin
branch, go to sorin-ionescu/oh-my-zsh, install it, and rerun
the YADR installer so that the skwp theme is installed for you.
If you want to have them side by side for comparison, rename the
old robby one to ~/.oh-my-zsh.robby or similar, so you can toggle
back and forth through renames, or symlinks.
2012-04-24 01:32:10 +08:00
|
|
|
alias psa="ps aux"
|
2012-01-31 12:46:41 +08:00
|
|
|
alias psg="ps aux | grep "
|
|
|
|
alias psr='ps aux | grep ruby'
|
|
|
|
|
|
|
|
# Moving around
|
|
|
|
alias cdb='cd -'
|
2014-09-22 13:25:23 +08:00
|
|
|
alias cls='clear;ls'
|
2012-01-31 12:46:41 +08:00
|
|
|
|
|
|
|
# Show human friendly numbers and colors
|
|
|
|
alias df='df -h'
|
|
|
|
alias du='du -h -d 2'
|
|
|
|
|
2014-10-25 03:29:07 +08:00
|
|
|
if [[ $platform == 'linux' ]]; then
|
|
|
|
alias ll='ls -alh --color=auto'
|
|
|
|
alias ls='ls --color=auto'
|
|
|
|
elif [[ $platform == 'darwin' ]]; then
|
|
|
|
alias ll='ls -alGh'
|
|
|
|
alias ls='ls -Gh'
|
|
|
|
fi
|
|
|
|
|
2012-01-31 12:46:41 +08:00
|
|
|
# show me files matching "ls grep"
|
|
|
|
alias lsg='ll | grep'
|
2017-11-14 15:30:18 +08:00
|
|
|
alias lp='ls --hide="*.pyc"'
|
2012-01-31 12:46:41 +08:00
|
|
|
|
|
|
|
# Alias Editing
|
2015-02-27 23:27:31 +08:00
|
|
|
TRAPHUP() {
|
|
|
|
source $yadr/zsh/aliases.zsh
|
|
|
|
}
|
|
|
|
|
2013-01-18 00:44:23 +08:00
|
|
|
alias ae='vim $yadr/zsh/aliases.zsh' #alias edit
|
2012-04-05 13:56:51 +08:00
|
|
|
alias ar='source $yadr/zsh/aliases.zsh' #alias reload
|
2015-02-27 23:27:31 +08:00
|
|
|
alias gar="killall -HUP -u \"$USER\" zsh" #global alias reload
|
2012-01-31 12:46:41 +08:00
|
|
|
|
2012-03-02 05:40:43 +08:00
|
|
|
# vim using
|
2013-01-10 11:42:08 +08:00
|
|
|
mvim --version > /dev/null 2>&1
|
|
|
|
MACVIM_INSTALLED=$?
|
|
|
|
if [ $MACVIM_INSTALLED -eq 0 ]; then
|
|
|
|
alias vim="mvim -v"
|
2012-10-12 15:14:33 +08:00
|
|
|
fi
|
2012-03-02 05:40:43 +08:00
|
|
|
|
2014-11-20 01:42:18 +08:00
|
|
|
# mimic vim functions
|
|
|
|
alias :q='exit'
|
|
|
|
|
2012-01-31 12:46:41 +08:00
|
|
|
# vimrc editing
|
2013-01-18 00:44:23 +08:00
|
|
|
alias ve='vim ~/.vimrc'
|
2012-01-31 12:46:41 +08:00
|
|
|
|
|
|
|
# zsh profile editing
|
2013-01-18 00:44:23 +08:00
|
|
|
alias ze='vim ~/.zshrc'
|
2012-01-31 12:46:41 +08:00
|
|
|
|
|
|
|
# Git Aliases
|
2018-11-02 09:37:54 +08:00
|
|
|
alias gl='git l'
|
2012-01-31 12:46:41 +08:00
|
|
|
alias gs='git status'
|
|
|
|
alias gstsh='git stash'
|
|
|
|
alias gst='git stash'
|
2012-10-24 23:36:17 +08:00
|
|
|
alias gsp='git stash pop'
|
|
|
|
alias gsa='git stash apply'
|
2012-01-31 12:46:41 +08:00
|
|
|
alias gsh='git show'
|
|
|
|
alias gshw='git show'
|
|
|
|
alias gshow='git show'
|
2013-01-18 00:44:23 +08:00
|
|
|
alias gi='vim .gitignore'
|
2012-01-31 12:46:41 +08:00
|
|
|
alias gcm='git ci -m'
|
|
|
|
alias gcim='git ci -m'
|
|
|
|
alias gci='git ci'
|
2012-06-23 00:09:59 +08:00
|
|
|
alias gcp='git cp'
|
2012-01-31 12:46:41 +08:00
|
|
|
alias ga='git add -A'
|
2015-06-28 06:49:13 +08:00
|
|
|
alias gap='git add -p'
|
2012-01-31 12:46:41 +08:00
|
|
|
alias guns='git unstage'
|
|
|
|
alias gunc='git uncommit'
|
|
|
|
alias gm='git merge'
|
|
|
|
alias gms='git merge --squash'
|
Support for @sorin-ionescu rewrite of oh-my-zsh
Sorin's OMZ rewrite is a bit nicer, as it's written in more
native style ZSH, doesn't do auto updates, and incorporates
many bugfixes, and is more actively maintained than Robby's branch.
For now, YADR supports both, so if you want to try out the sorin
branch, go to sorin-ionescu/oh-my-zsh, install it, and rerun
the YADR installer so that the skwp theme is installed for you.
If you want to have them side by side for comparison, rename the
old robby one to ~/.oh-my-zsh.robby or similar, so you can toggle
back and forth through renames, or symlinks.
2012-04-24 01:32:10 +08:00
|
|
|
alias gam='git amend --reset-author'
|
2012-09-27 01:23:39 +08:00
|
|
|
alias grv='git remote -v'
|
2012-10-08 13:09:36 +08:00
|
|
|
alias grr='git remote rm'
|
|
|
|
alias grad='git remote add'
|
2012-01-31 12:46:41 +08:00
|
|
|
alias gr='git rebase'
|
|
|
|
alias gra='git rebase --abort'
|
2012-04-21 01:15:08 +08:00
|
|
|
alias ggrc='git rebase --continue'
|
2012-01-31 12:46:41 +08:00
|
|
|
alias gbi='git rebase --interactive'
|
|
|
|
alias co='git co'
|
|
|
|
alias gf='git fetch'
|
2016-04-07 21:22:03 +08:00
|
|
|
alias gfp='git fetch --prune'
|
|
|
|
alias gfa='git fetch --all'
|
|
|
|
alias gfap='git fetch --all --prune'
|
2012-01-31 12:46:41 +08:00
|
|
|
alias gfch='git fetch'
|
|
|
|
alias gd='git diff'
|
|
|
|
alias gb='git b'
|
2017-03-08 17:23:32 +08:00
|
|
|
alias gdf="git diff-tree --no-commit-id --name-only -r"
|
2015-03-25 05:17:24 +08:00
|
|
|
# Staged and cached are the same thing
|
2012-10-08 13:09:36 +08:00
|
|
|
alias gdc='git diff --cached -w'
|
2015-03-25 05:17:24 +08:00
|
|
|
alias gds='git diff --staged -w'
|
2012-01-31 12:46:41 +08:00
|
|
|
alias gpub='grb publish'
|
|
|
|
alias gtr='grb track'
|
|
|
|
alias gpl='git pull'
|
|
|
|
alias gplr='git pull --rebase'
|
|
|
|
alias gps='git push'
|
2014-10-09 02:45:00 +08:00
|
|
|
alias gpsh='git push -u origin `git rev-parse --abbrev-ref HEAD`'
|
2012-01-31 12:46:41 +08:00
|
|
|
alias gnb='git nb' # new branch aka checkout -b
|
2012-10-12 15:14:33 +08:00
|
|
|
alias grs='git reset'
|
2012-01-31 12:46:41 +08:00
|
|
|
alias grsh='git reset --hard'
|
|
|
|
alias gcln='git clean'
|
|
|
|
alias gclndf='git clean -df'
|
2012-10-12 15:14:33 +08:00
|
|
|
alias gclndfx='git clean -dfx'
|
2012-01-31 12:46:41 +08:00
|
|
|
alias gsm='git submodule'
|
|
|
|
alias gsmi='git submodule init'
|
|
|
|
alias gsmu='git submodule update'
|
|
|
|
alias gt='git t'
|
2012-11-10 03:40:16 +08:00
|
|
|
alias gbg='git bisect good'
|
|
|
|
alias gbb='git bisect bad'
|
2015-09-24 02:16:01 +08:00
|
|
|
alias gdmb='git branch --merged | grep -v "\*" | xargs -n 1 git branch -d'
|
2012-01-31 12:46:41 +08:00
|
|
|
|
|
|
|
# Common shell functions
|
|
|
|
alias less='less -r'
|
|
|
|
alias tf='tail -f'
|
|
|
|
alias l='less'
|
|
|
|
alias lh='ls -alt | head' # see the last modified files
|
|
|
|
alias screen='TERM=screen screen'
|
|
|
|
alias cl='clear'
|
|
|
|
|
|
|
|
# Zippin
|
|
|
|
alias gz='tar -zcvf'
|
|
|
|
|
|
|
|
# Ruby
|
2012-11-10 03:40:16 +08:00
|
|
|
alias c='rails c' # Rails 3
|
2015-06-28 06:49:13 +08:00
|
|
|
alias co='script/console' # Rails 2
|
|
|
|
alias cod='script/console --debugger'
|
2015-08-14 04:15:56 +08:00
|
|
|
|
|
|
|
#If you want your thin to listen on a port for local VM development
|
|
|
|
#export VM_IP=10.0.0.1 <-- your vm ip
|
|
|
|
alias ts='thin start -a ${VM_IP:-127.0.0.1}'
|
2012-01-31 12:46:41 +08:00
|
|
|
alias ms='mongrel_rails start'
|
2012-05-19 05:08:46 +08:00
|
|
|
alias tfdl='tail -f log/development.log'
|
2012-10-08 13:09:36 +08:00
|
|
|
alias tftl='tail -f log/test.log'
|
2012-01-31 12:46:41 +08:00
|
|
|
|
|
|
|
alias ka9='killall -9'
|
|
|
|
alias k9='kill -9'
|
|
|
|
|
|
|
|
# Gem install
|
|
|
|
alias sgi='sudo gem install --no-ri --no-rdoc'
|
|
|
|
|
|
|
|
# TODOS
|
|
|
|
# This uses NValt (NotationalVelocity alt fork) - http://brettterpstra.com/project/nvalt/
|
|
|
|
# to find the note called 'todo'
|
|
|
|
alias todo='open nvalt://find/todo'
|
|
|
|
|
2012-05-30 16:34:20 +08:00
|
|
|
# Forward port 80 to 3000
|
|
|
|
alias portforward='sudo ipfw add 1000 forward 127.0.0.1,3000 ip from any to any 80 in'
|
2012-06-01 04:49:40 +08:00
|
|
|
|
|
|
|
alias rdm='rake db:migrate'
|
|
|
|
alias rdmr='rake db:migrate:redo'
|
2012-10-24 23:36:34 +08:00
|
|
|
|
|
|
|
# Zeus
|
|
|
|
alias zs='zeus server'
|
|
|
|
alias zc='zeus console'
|
2015-10-27 23:22:20 +08:00
|
|
|
alias zr='zeus rspec'
|
|
|
|
alias zrc='zeus rails c'
|
|
|
|
alias zrs='zeus rails s'
|
|
|
|
alias zrdbm='zeus rake db:migrate'
|
|
|
|
alias zrdbtp='zeus rake db:test:prepare'
|
2016-08-25 04:13:33 +08:00
|
|
|
alias zzz='rm .zeus.sock; pkill zeus; zeus start'
|
2012-10-24 23:36:34 +08:00
|
|
|
|
|
|
|
# Rspec
|
|
|
|
alias rs='rspec spec'
|
2013-11-14 22:36:07 +08:00
|
|
|
alias sr='spring rspec'
|
2014-08-17 03:54:10 +08:00
|
|
|
alias src='spring rails c'
|
2013-12-16 22:43:33 +08:00
|
|
|
alias srgm='spring rails g migration'
|
|
|
|
alias srdm='spring rake db:migrate'
|
|
|
|
alias srdt='spring rake db:migrate'
|
|
|
|
alias srdmt='spring rake db:migrate db:test:prepare'
|
2012-11-14 00:50:29 +08:00
|
|
|
|
2015-10-27 23:22:20 +08:00
|
|
|
|
2012-11-14 00:50:29 +08:00
|
|
|
# Sprintly - https://github.com/nextbigsoundinc/Sprintly-GitHub
|
|
|
|
alias sp='sprintly'
|
2013-01-11 00:25:18 +08:00
|
|
|
# spb = sprintly branch - create a branch automatically based on the bug you're working on
|
|
|
|
alias spb="git checkout -b \`sp | tail -2 | grep '#' | sed 's/^ //' | sed 's/[^A-Za-z0-9 ]//g' | sed 's/ /-/g' | cut -d"-" -f1,2,3,4,5\`"
|
2014-05-31 01:23:11 +08:00
|
|
|
|
2014-06-18 00:31:23 +08:00
|
|
|
alias hpr='hub pull-request'
|
2014-06-19 23:05:12 +08:00
|
|
|
alias grb='git recent-branches'
|
2014-06-18 00:31:23 +08:00
|
|
|
|
2014-05-31 01:23:11 +08:00
|
|
|
# Finder
|
|
|
|
alias showFiles='defaults write com.apple.finder AppleShowAllFiles YES; killall Finder /System/Library/CoreServices/Finder.app'
|
|
|
|
alias hideFiles='defaults write com.apple.finder AppleShowAllFiles NO; killall Finder /System/Library/CoreServices/Finder.app'
|
2014-08-08 00:37:28 +08:00
|
|
|
|
|
|
|
alias dbtp='spring rake db:test:prepare'
|
|
|
|
alias dbm='spring rake db:migrate'
|
|
|
|
alias dbmr='spring rake db:migrate:redo'
|
|
|
|
alias dbmd='spring rake db:migrate:down'
|
|
|
|
alias dbmu='spring rake db:migrate:up'
|
2014-09-22 13:25:23 +08:00
|
|
|
|
|
|
|
# Homebrew
|
2019-04-10 18:54:04 +08:00
|
|
|
alias brewu='brew update && brew upgrade && brew cleanup && brew doctor'
|
2017-03-08 17:23:32 +08:00
|
|
|
|
|
|
|
|
|
|
|
# emacs
|
|
|
|
alias emacs="env LC_CTYPE=zh_CN.UTF-8 emacs"
|
2017-05-17 02:20:10 +08:00
|
|
|
|
2017-05-24 11:09:10 +08:00
|
|
|
alias ds='dc exec server'
|
2018-10-23 11:53:27 +08:00
|
|
|
alias drspec='dc exec sidekiq rspec'
|
2018-12-26 23:11:35 +08:00
|
|
|
alias psetup='dc exec sidekiq rake parallel:setup'
|
|
|
|
alias prspec='dc exec sidekiq rake parallel:spec'
|
2017-05-17 02:20:10 +08:00
|
|
|
|
2017-12-02 18:38:32 +08:00
|
|
|
alias rs='rancher exec -it rallets-server-1'
|
|
|
|
|
2017-03-08 17:23:32 +08:00
|
|
|
alias start_dropbox='~/.dropbox-dist/dropboxd'
|
|
|
|
alias unzip_CN="unzip -O GB18030"
|
|
|
|
alias cnpm="npm --registry=https://registry.npm.taobao.org \
|
|
|
|
--cache=$HOME/.npm/.cache/cnpm \
|
|
|
|
--disturl=https://npm.taobao.org/dist \
|
|
|
|
--userconfig=$HOME/.cnpmrc"
|
|
|
|
alias gpo='git push origin'
|
|
|
|
case "$OSTYPE" in
|
|
|
|
cygwin*)
|
|
|
|
alias open="cmd /c start"
|
|
|
|
;;
|
|
|
|
linux*)
|
|
|
|
alias start="xdg-open"
|
|
|
|
alias open="xdg-open"
|
|
|
|
;;
|
|
|
|
darwin*)
|
|
|
|
alias start="open"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
alias ssh_by_password='ssh -o PreferredAuthentications=password -o PubkeyAuthentication=no'
|
2017-05-12 18:27:04 +08:00
|
|
|
alias ssh_copy_id='ssh-copy-id -o PreferredAuthentications=password -o PubkeyAuthentication=no'
|
2017-03-08 17:23:32 +08:00
|
|
|
alias chrome_proxy="google-chrome --proxy-server='http://127.0.0.1:8118'"
|
2017-07-20 21:50:39 +08:00
|
|
|
alias ls_folder_size="du -sch .[!.]* * | sort -h"
|
2017-03-08 17:23:32 +08:00
|
|
|
alias top_by_memory="top -o %MEM"
|
2017-03-25 10:21:33 +08:00
|
|
|
alias gcaa="gia .; gcF"
|
2017-05-12 18:27:04 +08:00
|
|
|
alias ror_ctags="ctags -R --languages=ruby --exclude=.git --exclude=log . \$(bundle list --paths)"
|
|
|
|
alias docker_clean_images='docker rmi $(docker images -a --filter=dangling=true -q)'
|
2017-07-20 21:50:39 +08:00
|
|
|
alias find_large_files="sudo find / -xdev -type f -size +50M"
|
2018-08-23 12:44:28 +08:00
|
|
|
alias vim_plain="vim -u NONE"
|
2018-12-04 14:05:34 +08:00
|
|
|
alias edit_alias="vim $yadr_zsh/aliases.zsh $yadr_zsh/functions.zsh -p"
|
2019-09-16 21:00:07 +08:00
|
|
|
alias dsrubocop='ds rubocop --require rubocop/formatter/junit_formatter \
|
|
|
|
--require rubocop-performance \
|
|
|
|
--format progress'
|
2019-07-25 16:02:12 +08:00
|
|
|
alias docker_purge='docker stop $(docker ps -qa);docker rm $(docker ps -qa)'
|
2019-09-20 17:51:19 +08:00
|
|
|
alias pzsh='USING_PROXYCHAINS=true proxychains zsh'
|