-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc
224 lines (207 loc) · 5.49 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
###################################################################
# Plamo Linux ユーザ設定ファイルサンプル .zshrc
# Chisato Yamauchi (cyamauch@phyas.aichi-edu.ac.jp)
# Time-stamp: <2011-09-30 20:13:44 karma>
#if [ $SHLVL = 1 ] ; then
# PATH="$PATH:." ;
#fi
# 端末によって日本語表示する/しないの切り替え
#if [ "$TERM" = "linux" ] ; then
# LANG=C
#else
# LANG=ja_JP.eucJP
#fi
LANG=ja_JP.eucJP
export LANG
# JISで表示できない端末はEUCにする
if [ "$TERM" = "xterm" -o "$TERM" = "dtterm" ] ; then
JLESSCHARSET=japanese-euc
fi
# less で行番号をつけ,終了後に画面を残す
LESS='-R -M -X'
EDITOR='vi'
#EDITOR='emacs -nw'
PAGER='less'
export LESS EDITOR PAGER
HISTFILE=$HOME/.zhistory
# for Python
PYTHONPATH=/usr/lib64/python2.7/site-packages:/opt/kde/lib64/python2.7/site-packages
# color-ls
# 色設定等は ~/.dir_colors
if which dircolors >& /dev/null; then
eval `dircolors -b ~/.dir_colors`
LS_OPTIONS=(--color=auto -F -T 0 -N) ;
else
LS_OPTIONS=(-F -T 0 -N) ;
fi
# Emacs などの dumb 端末では色をつけない
if [ "$TERM" = "dumb" ] ; then
LS_OPTIONS=(-F -T 0 -N --color=none) ;
else
GREP_OPTIONS="--color=auto"
export GREP_OPTIONS
fi
export LS_OPTIONS
alias ls='/bin/ls $LS_OPTIONS';
alias dir='/bin/dir $LS_OPTIONS';
alias vdir='/bin/vdir $LS_OPTIONS';
# Windowのタイトルバーにカレントディレクトリが
# 表示不可能な場合のプロンプト設定
PS1='%n@%m[%~]%# '
# kterm,xterm,rxvt のタイトルに prompt を表示する
case $TERM in
kterm|xterm|rxvt|dtterm|vt100)
# Windowのタイトルバーにカレントディレクトリ
# が表示可能な場合のプロンプト設定
# 表示例→ hoge@host[/usr/lib64/X11/app-defaults]% _
PS1='%n@%m[%~]%# '
# 表示例→ hoge@host[app-defaults]% _
#PS1='%n@%m[%c]%# '
HN="`hostname`:"
# HN="`hostname -s`:"
case "$TERM" in
vt*)
HN=""
;;
esac
function mkrmhmpwd () {
tty > /dev/null
if [ "$?" = "0" ] ; then
BSBS_HOME=`echo "/$HOME"|/usr/bin/sed -e 's/\//\\\\\//g'` ;
RMHMPWD=`echo "/$PWD"|/usr/bin/sed -e "s/$BSBS_HOME/~/g"` ;
if [ "$RMHMPWD" = "/$PWD" ] ; then
RMHMPWD="$PWD"
fi
fi
}
# 遅いマシンではこの設定の方がいいかも…
# function mkrmhmpwd () { RMHMPWD="$PWD" ; }
function termtitle () {
tty > /dev/null
if [ "$?" = "0" ] ; then
if [ -w `tty` ] ; then
echo -ne "\033]0;$TERM - $*\007" > `tty`
fi
fi
}
function cd () { builtin cd $* ; mkrmhmpwd ; termtitle "$HN""[$RMHMPWD]" ; }
function popd () { builtin popd $* ; mkrmhmpwd ; termtitle "$HN""[$RMHMPWD]" ; }
function pushd () { builtin pushd $* ; mkrmhmpwd ; termtitle "$HN""[$RMHMPWD]" ; }
#function pwd () { builtin pwd ; mkrmhmpwd ; termtitle "$HN""[$RMHMPWD]" ; }
function su () { mkrmhmpwd ; termtitle "$HN""su $*($RMHMPWD)" ;
command su $* ;
mkrmhmpwd ;
termtitle "$HN""[$RMHMPWD]" ; }
function rsh () {
termtitle "$HN""rsh $*"
command rsh $*
mkrmhmpwd ;
termtitle "$HN""[$RMHMPWD]"
}
function rlogin () {
termtitle "$HN""rlogin $*"
command rlogin $*
mkrmhmpwd ;
termtitle "$HN""[$RMHMPWD]"
}
function telnet () {
termtitle "$HN""telnet $*"
command telnet $*
mkrmhmpwd ;
termtitle "$HN""[$RMHMPWD]"
}
function ssh () {
termtitle "$HN""ssh $*"
command ssh $*
mkrmhmpwd ;
termtitle "$HN""[$RMHMPWD]"
}
# mkrmhmpwd ; termtitle "$HN""[$RMHMPWD]"
;;
esac
# プロンプト PS1 は export しない(後でbashを実行すると変になるので)
typeset +x PS1
# 保存する履歴の行数
HISTSIZE=512
SAVEHIST=512
# 補完候補を表示
setopt auto_list
# 重複するイベントを保存しない
setopt hist_ignore_all_dups
# ラインエディタ中でプロンプトを表示するまえにキャリッジリターンを表示しない
#unsetopt prompt_cr
# シェルが終了する前にジョブの状態を報告しない
#unsetopt check_jobs
# シェルが終了しても、実行中のジョブにHUPシグナルを送らない
unsetopt hup
# beep音を鳴らさない
#unsetopt beep
# Ctrl+D で exit しない
#setopt ignoreeof
# 補完で無視するサフィックス
#fignore=('.o' '~')
# メールを知らせる
#setopt mail_warning
#emacs ライクなキーバインドにする
bindkey -e
#vi ライクなキーバインドにする
#bindkey -v
# 検索付き履歴機能にする
# PageUp,PageDown キー
bindkey "^[[5~" history-beginning-search-backward
bindkey "^[[6~" history-beginning-search-forward
# ↑↓キー
# 古い zsh の history-search-xxxx にする
autoload -U history-search-end
zle -N history-beginning-search-backward-end history-search-end
zle -N history-beginning-search-forward-end history-search-end
bindkey "^[[A" history-beginning-search-backward-end
bindkey "^[[B" history-beginning-search-forward-end
#bindkey "^[[A" history-search-backward
#bindkey "^[[B" history-search-forward
#bindkey "^[[A" backward-word
#bindkey "^[[B" forward-word
bindkey "^[[3~" delete-char
# Home,End キー
bindkey "^[[1~" beginning-of-history
bindkey "^[[4~" end-of-history
bindkey "^[[7~" beginning-of-history
bindkey "^[[8~" end-of-history
# 端末による BackSpace キーの調整
stty erase '^?'
case "$TERM" in
kterm|sun)
stty erase '^H'
bindkey "^?" delete-char
;;
#vt*)
# stty erase '^H'
# bindkey "^?" delete-char
# ;;
esac
stty werase '^W'
# Ctrl+S での stop をやめる
stty stop undef
# aliases
alias h='history'
alias rmdvi='rm *.dvi ; rm *.log ; rm *.aux ; rm *.toc'
alias rmback='rm *~ ; rm *.bak'
alias j='jobs -l'
alias la='ls -a'
alias ll='ls -l'
alias z='suspend'
alias x='exit'
alias LS='ls -alF | command less -E'
alias mu='mule -rv'
#alias ssh1='ssh -1'
#alias scp1='scp -oProtocol=1'
#alias xv='xv -nolimits'
# csh emulation
setenv () {
if [ $# -eq 0 ]; then
/usr/bin/printenv
else
export $1=$*[2,-1]
fi
}
alias unsetenv=unset