-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zshrc.alias
201 lines (160 loc) · 4.55 KB
/
.zshrc.alias
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
# ls
alias la="ls -a"
alias lf="ls -F"
alias ll="ls -l"
# process
# alias j="jobs -l"
alias 'ps?'='pgrep -l -f'
alias pk='pkill -f'
# du/df
alias du="du -h"
alias df="df -h"
alias duh="du -h ./ --max-depth=1"
# su
alias su="su -l"
# vim
alias v='vim'
alias 'src'='exec zsh'
alias -g V="| vim -"
alias -g EV="| xargs --verbose sh -c 'vim \"\$@\" < /dev/tty'"
# rails
alias -g RET="RAILS_ENV=test"
alias -g RED="RAILS_ENV=development"
alias -g REP="RAILS_ENV=production"
# rake
alias raket='RAILS_ENV=test rake'
alias raked='RAILS_ENV=development rake'
alias rakep='RAILS_ENV=production rake'
# colorized cat
alias ccat='pygmentize -O style=vim -f console256 -g'
# less
alias less='less -r'
# grep
alias 'gr'='grep --color=auto -ERUIn'
alias -g TEE="2>&1 | tee"
#make
alias 'm'='make'
alias 'mn'='make native-code'
alias 'mc'='make clean'
# screen
alias s='screen -U'
alias sc='screen -S main'
alias sn='screen'
alias sl='screen -ls'
alias sr='screen -r main'
alias srr='screen -U -D -RR'
# tmux
alias tm='tmux'
alias tma='tmux attach'
alias tma0='tmux attach -t 0'
alias tma1='tmux attach -t 1'
alias tma2='tmux attach -t 2'
alias tml='tmux list-sessions'
alias pon='predict-on'
alias poff='predict-off'
alias p='ping -c 4'
#alias ls='ls -al'
alias cp='nocorrect cp -irp'
alias refe='nocorrect refe'
# git
alias g='git'
alias gi='git'
alias gs='git status -s -b'
alias gst='git status -s -b'
alias gst="git log --date=short --max-count=1 --pretty=format:'%Cgreen%h %cd %Cblue%cn%x09%Creset%s' | tail -1 && echo '' && git status -s -b"
alias gc='git commit'
alias gci='git commit -a'
# jq
alias -g JQ='jq "."'
function lessjq() {
cat $1 | jq -C "." | less -R
}
function catjq() {
cat $1 | jq -C "."
}
alias java='nocorrect java'
alias cp='nocorrect cp -irp'
alias erl='nocorrect erl'
alias sbcl='nocorrect sbcl'
alias gosh='nocorrect gosh'
# alias hg='nocorrect hg --encoding=utf-8'
# scala
alias scala='scala -deprecation -unchecked -explaintypes'
alias scc='scalac -deprecation -unchecked -explaintypes'
alias sci='scala -deprecation -unchecked -explaintypes -cp $SCALA_CLASSPATH -i ~/import.scala'
alias sce='scala'
# use oh-my-zsh/plugins/extract.zsh
#
# extract http://d.hatena.ne.jp/jeneshicc/20110215/1297778049
# extract () {
# if [ -f $1 ] ; then
# case $1 in
# *.tar.bz2) tar xvjf $1 ;;
# *.tar.gz) tar xvzf $1 ;;
# *.tar.xz) tar xvJf $1 ;;
# *.bz2) bunzip2 $1 ;;
# *.rar) unrar x $1 ;;
# *.gz) gunzip $1 ;;
# *.tar) tar xvf $1 ;;
# *.tbz2) tar xvjf $1 ;;
# *.tgz) tar xvzf $1 ;;
# *.zip) unzip $1 ;;
# *.Z) uncompress $1 ;;
# *.7z) 7z x $1 ;;
# *.lzma) lzma -dv $1 ;;
# *.xz) xz -dv $1 ;;
# *) echo "don't know how to extract '$1'..." ;;
# esac
# else
# echo "'$1' is not a valid file!"
# fi
# }
alias ex='extract'
alias ev='vi ~/dotfiles/.vimrc*'
alias be='bundle exec'
grepvim() {
XFS=`grep -ERUInl $* | uniq | xargs`
if [ "$XFS" ] ; then
vim `grep -ERUInl $* | uniq | xargs`
fi
}
alias grv='grepvim'
gem-install() {
gem install $1 && rbenv rehash
}
function _latest() {
echo "$1/`ls --format=single-column -t $1 | head -1`"
}
alias latest='_latest'
# ------------------------------------
# Docker alias and function
# from https://github.com/tcnksm/docker-alias
# ------------------------------------
# Get latest container ID
alias dl="docker ps -l -q"
# Get container process
alias dps="docker ps"
# Get process included stop container
alias dpa="docker ps -a"
# Get images
alias di="docker images"
# Get container IP
alias dip="docker inspect --format '{{ .NetworkSettings.IPAddress }}'"
# Run deamonized container, e.g., $dkd base /bin/echo hello
alias dkd="docker run -d -P"
# Run interactive container, e.g., $dki base /bin/bash
alias dki="docker run -i -t -P"
# Execute interactive container, e.g., $dex base /bin/bash
alias dex="docker exec -i -t"
# Stop all containers
dstop() { docker stop $(docker ps -a -q); }
# Remove all containers
drm() { docker rm $(docker ps -a -q); }
# Stop and Remove all containers
alias drmf='docker stop $(docker ps -a -q) && docker rm $(docker ps -a -q)'
# Remove all images
dri() { docker rmi $(docker images -q); }
# Dockerfile build, e.g., $dbu tcnksm/test
dbu() { docker build -t=$1 .; }
# Show all alias related docker
dalias() { alias | grep 'docker' | sed "s/^\([^=]*\)=\(.*\)/\1 => \2/"| sed "s/['|\']//g" | sort; }