-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path_zshrc
441 lines (370 loc) · 11.4 KB
/
_zshrc
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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
# command aliases {{{
#alias macvim='open /Users/ujihisa/src/MacVim-snapshot-49/MacVim.app'
#alias macvim='open /Users/ujihisa/git/MacVim/src/MacVim/build/Release/MacVim.app'
#alias al='~/.cabal/bin/cabal'
alias al=cabal
alias reload='exec zsh'
alias screen='echo use sr'
alias mysqld_start='sudo /opt/local/share/mysql5/mysql/mysql.server start'
alias gosh='rlwrap /opt/local/bin/gosh'
#alias ghci='rlwrap --always-readline ghci'
alias js="js -e 'Function.prototype.toString = function() { return this() };' -i"
alias gl='git pull --rebase'
alias pus='git push'
alias c='git checkout'
alias b='git branch'
alias gsrd='git svn rebase && git svn dcommit'
alias rakeg='growlnotify -n vim -m "rake started"; rake | growlnotify -n vim &'
alias rawvim='vim -u NONE -U NONE --noplugin'
alias gauchedoc='info --vi-keys gauche-refe'
alias pingg='ping google.com'
# }}}
export PATH=$PATH:~/bin/
# labp :: Boolean {{{
#function labp() {
# [ `ifconfig | grep 192.168.25 | wc -l` != 0 ]
#}
# }}}
case "${OSTYPE}" in
freebsd*|darwin*) # OSX {{{
export LESSCHARSET='utf-8'
export LANG=en_US.UTF-8
alias cp='cp -i'
#alias rm='rm -i'
alias mv='mv -i'
alias ls='ls -GFw'
alias ll='ls -lw'
alias la='ls -aw'
alias le='less'
alias cddu='cd ~/Documents/uvn'
alias cdb='cd /Users/ujihisa/Documents/rrm/rubydoc/refm/api/src/_builtin'
alias cdg='cd /opt/local/lib/ruby/gems/1.8/gems'
alias cdr='cd ~/Documents/rubyforge'
alias less='lv'
alias cote="/usr/bin/open -a /Applications/CotEditor.app"
alias ..='cd .. && ls'
alias ...='cd ../.. && ls'
alias wget='wget --user-agent=Mozilla'
alias lv='lv -c'
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
export MANPATH=/opt/local/man:$MANPATH
alias sr='command screen -r || command screen -AU'
autoload -U compinit
compinit
autoload colors
colors
autoload predict-on
setopt complete_aliases # aliased ls needs if file/dir completions work
#export EDITOR='/opt/local/bin/vim'
export EDITOR='vim'
bindkey -v
alias gnuplot="/Applications/MacPorts/AquaTerm.app/Contents/MacOS/AquaTerm &; gnuplot"
case "${OSTYPE}" in
darwin*)
alias port-out="sudo port sync -d && sudo port outdated"
alias port-upall="sudo port sync -d && sudo port upgrade outdated"
alias port-up="sudo port upgrade"
#alias updateports="sudo port selfupdate; sudo port outdated"
#alias portupgrade="sudo port upgrade installed"
;;
freebsd*)
case ${UID} in
0)
updateports()
{
if [ -f /usr/ports/.portsnap.INDEX ]
then
portsnap fetch update
else
portsnap fetch extract update
fi
(cd /usr/ports/; make index)
portversion -v -l \<
}
alias appsupgrade='pkgdb -F && BATCH=YES NO_CHECKSUM=YES portupgrade -a'
;;
esac
;;
esac
# by http://d.hatena.ne.jp/babie/20051110
#PS1=$'%{\e]2;[%n@%m:%~]\a'$'\e]1;%%: %~\a%}'$'%{\e[00;04;32m%}%~%{\e[00m%}\n[%{\e[$00;37m%}%n@%m${WINDOW:+":$WINDOW"}%{\e[00m%}]# '
#PS1=$'%{\e]2;[%n@%m:%~]\a'$'\e]1;%%: %~\a%}'$'%{\e[00;04;32m%}%~%{\e[00m%}\n%{\e[00;32m%}[%n@%m%{\e[00;32m%}]$ '
#if labp; then
# PS1=$'%{\e[00;00;32m%}%~%{\e[00m%}\n%{\e[00;04;32m%}[%n@%m]%{\e[00;00;32m%}%% '
#else
PS1=$'%{\e[00;00;32m%}%~%{\e[00m%}\n%{\e[00;04;32m%}[%n@%m]%{\e[00;00;32m%}$ '
#fi
#RPS1=$'%{\e[00;04;32m%}[%D{%H}:%D{%M}:%D{%S}]%{\e[00m%}'
# histories
# http://journal.mycom.co.jp/column/zsh/003/index.html
HISTFILE=~/.zsh_history
HISTSIZE=100000
SAVEHIST=100000
setopt hist_ignore_dups # ignore duplication command history list
setopt share_history # share command history data
# alias r18='/Users/ujihisa/Documents/uvn/workshops/ruby/18'
# export HREF_DATADIR='/usr/local/src/href-0.3.3'
function svn() {
if [ $1 = "dil" ] ; then
command svn di $2 | diffcolor.rb | /usr/bin/less -RE
else
command svn $*
fi
}
autoload history-search-end
zle -N history-beginning-search-backward-end history-search-end
zle -N history-beginning-search-forward-end history-search-end
bindkey '^N' history-beginning-search-backward-end
bindkey '^P' history-beginning-search-forward-end
bindkey '^F' history-incremental-search-backward
export __CF_USER_TEXT_ENCODING='0x1F6:0x08000100:14'
;; # }}}
linux*|cygwin*) # LINUX {{{
alias ls="ls --color"
alias aptup="sudo aptitude update && sudo aptitude full-upgrade -y"
export PATH=$PATH:/var/lib/gems/1.8/bin
export PATH=$PATH:/sbin
export PATH=/opt/ptexlive/bin/:$PATH
export GIT_PAGER='less -RE'
## Environment variable configuration
#
# LANG
#
export LANG=C
export LC_ALL=C
export EDITOR='vim'
## Default shell configuration
#
# set prompt
#
autoload colors
colors
case ${UID} in
0)
PROMPT="%B%{${fg[red]}%}%/#%{${reset_color}%}%b "
PROMPT2="%B%{${fg[red]}%}%_#%{${reset_color}%}%b "
SPROMPT="%B%{${fg[red]}%}%r is correct? [n,y,a,e]:%{${reset_color}%}%b "
[ -n "${REMOTEHOST}${SSH_CONNECTION}" ] &&
PROMPT="%{${fg[cyan]}%}$(echo ${HOST%%.*} | tr '[a-z]' '[A-Z]') ${PROMPT}"
;;
*)
PROMPT="%{${fg[red]}%}%/%%%{${reset_color}%} "
PROMPT2="%{${fg[red]}%}%_%%%{${reset_color}%} "
SPROMPT="%{${fg[red]}%}%r is correct? [n,y,a,e]:%{${reset_color}%} "
[ -n "${REMOTEHOST}${SSH_CONNECTION}" ] &&
PROMPT="%{${fg[cyan]}%}$(echo ${HOST%%.*} | tr '[a-z]' '[A-Z]') ${PROMPT}"
;;
esac
# auto change directory
#
setopt auto_cd
# auto directory pushd that you can get dirs list by cd -[tab]
#
setopt auto_pushd
# command correct edition before each completion attempt
#
setopt correct
# compacked complete list display
#
setopt list_packed
# no remove postfix slash of command line
#
setopt noautoremoveslash
# no beep sound when complete list displayed
#
setopt nolistbeep
## Keybind configuration
#
# emacs like keybind (e.x. Ctrl-a goes to head of a line and Ctrl-e goes
# to end of it)
#
bindkey -v
# historical backward/forward search with linehead string binded to ^P/^N
#
autoload history-search-end
zle -N history-beginning-search-backward-end history-search-end
zle -N history-beginning-search-forward-end history-search-end
bindkey "^p" history-beginning-search-backward-end
bindkey "^n" history-beginning-search-forward-end
bindkey "\\ep" history-beginning-search-backward-end
bindkey "\\en" history-beginning-search-forward-end
bindkey "[A" history-beginning-search-backward-end
bindkey "[B" history-beginning-search-forward-end
## Command history configuration
#
HISTFILE=~/.zsh_history
HISTSIZE=10000
SAVEHIST=10000
setopt hist_ignore_dups # ignore duplication command history list
setopt share_history # share command history data
## Completion configuration
#
fpath=(~/.zsh/functions/Completion ${fpath})
autoload -U compinit
compinit -u
## zsh editor
#
autoload zed
## Prediction configuration
#
#autoload predict-on
#predict-off
## Alias configuration
#
# expand aliases before completing
#
setopt complete_aliases # aliased ls needs if file/dir completions work
alias where="command -v"
alias j="jobs -l"
alias la="ls -a"
alias lf="ls -F"
alias ll="ls -l"
alias du="du -h"
alias df="df -h"
alias su="su -l"
## terminal configuration
#
unset LSCOLORS
case "${TERM}" in
xterm)
export TERM=xterm-color
;;
kterm)
export TERM=kterm-color
# set BackSpace control character
stty erase
;;
cons25)
unset LANG
export LSCOLORS=ExFxCxdxBxegedabagacad
export LS_COLORS='di=01;34:ln=01;35:so=01;32:ex=01;31:bd=46;34:cd=43;34:su=41;30:sg=46;30:tw=42;30:ow=43;30'
zstyle ':completion:*' list-colors \
'di=;34;1' 'ln=;35;1' 'so=;32;1' 'ex=31;1' 'bd=46;34' 'cd=43;34'
;;
esac
# set terminal title including current directory
#
case "${TERM}" in
kterm*|xterm*)
precmd() {
echo -ne "\033]0;${USER}@${HOST%%.*}:${PWD}\007"
}
export LSCOLORS=exfxcxdxbxegedabagacad
export LS_COLORS='di=34:ln=35:so=32:pi=33:ex=31:bd=46;34:cd=43;34:su=41;30:sg=46;30:tw=42;30:ow=43;30'
zstyle ':completion:*' list-colors \
'di=34' 'ln=35' 'so=32' 'ex=31' 'bd=46;34' 'cd=43;34'
;;
esac
## load user .zshrc configuration file
#
[ -f ~/.zshrc.mine ] && source ~/.zshrc.mine
alias start_sshd="/usr/sbin/sshd -d"
alias start_sshd_ten_times="start_sshd && start_sshd && start_sshd && start_sshd && start_sshd && start_sshd && start_sshd && start_sshd "
#export PATH=$PATH:~/repos_ruby/said/trunk
#export PATH=$PATH:~/repos_ruby/misc
alias heyi="hey 192.168.25.2 inulab"
function svn() {
if [ $1 = "dil" ] ; then
command svn di $2 | diffcolor.rb | /usr/bin/less -RE
else
command svn $*
fi
}
bindkey '^[[3~' backward-delete-char
bindkey '' backward-delete-char
export LESSCHARSET=utf-8
#alias sr='TERM=kterm command screen -r ||TERM=kterm command screen -AU'
alias sr='command screen -r || command screen -AU'
;; # }}}
esac
# VCS supports {{{
alias gss='git stash save'
alias gsp='git stash pop'
function s() {
local -A result
result=`git status 2> /dev/null`
if [ "$result" ] ; then
echo $result
return
fi
svn status
}
function d() {
local -A result
result=`git status 2> /dev/null`
if [ "$result" ] ; then
result=`git diff --cached`
if [ "$result" ] ; then
git diff --no-prefix --cached --color --color-words | /usr/bin/less -RE
else
git diff --no-prefix --color --color-words | /usr/bin/less -RE
fi
return
fi
svn di | diffcolor.rb | /usr/bin/less -RE
}
function l() {
local -A result
result=`git status 2> /dev/null`
if [ "$result" ] ; then
if [ "$1" = "u" ]; then
#git log -u --color
git log -p --stat
else
git l
fi
return
fi
echo '(loading...)'
svn log -v --limit 10 | /usr/bin/less -RE
}
# }}}
# for yarm
if [ -e ~/bin/yarm.zsh ]; then
source ~/bin/yarm.zsh
fi
# paths
#export PATH=$PATH:~/coderepos/ruby/misc
export PATH=~/.gem/ruby/1.9/bin:$PATH
export PATH=~/.cabal/bin:$PATH
export PATH=$PATH:~/git/termtter/bin
export PATH=$PATH:~/.gem/ruby/1.9.1/bin
export PATH=/usr/local/bin:$PATH:
if [ -e /Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine ]; then
export PATH=$PATH:/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine
fi
zstyle ':completion:*:*:vim:*:*files' ignored-patterns '*?.(pdf|o)'
# cho45 ~/
expand-to-home-or-insert () {
if [ "$LBUFFER" = "" -o "$LBUFFER[-1]" = " " ]; then
LBUFFER+="~/"
else
zle self-insert
fi
}
zle -N expand-to-home-or-insert
bindkey "\\" expand-to-home-or-insert
export GIT_EDITOR=/usr/bin/vim
export PAGER='less'
alias -g L="| $PAGER"
alias -g G="| grep"
alias -g T='| tail'
alias -g H='| head'
alias -g F="| ruby /Users/ujihisa/git/few/bin/few"
alias -g P="| pbcopy"
function lprweb() {
xulrunner-1.9 /tmp/mozilla2ps/application.ini $1 /tmp/lprweb.ps \
-margins 0.25 -papername A4 -bgcolors true -bgimages true
lpr /tmp/lprweb.ps
rm /tmp/lprweb.ps
}
function mspecci() {
rt=~/git/ruby-trunk
#/usr/bin/ruby ${rt}/spec/mspec/bin/mspec ci -t ${rt}/ruby19/bin/ruby
/usr/bin/ruby ${rt}/spec/mspec/bin/mspec ci -t ~/rubies/bin/ruby192 -fs
}
# __END__ {{{1
# vim: expandtab softtabstop=2 shiftwidth=2
# vim: foldmethod=marker
# vim: ft=zsh
# }}}