-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdot.zshrc.custom
More file actions
194 lines (153 loc) · 5.01 KB
/
dot.zshrc.custom
File metadata and controls
194 lines (153 loc) · 5.01 KB
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
## Environment variable configuration
#
# LANG
#
export LANG=en_US.UTF-8
# home and end key
bindkey "^[OH" beginning-of-line
bindkey "^[OF" end-of-line
# for Mac
bindkey '^[[H' beginning-of-line
bindkey '^[[F' end-of-line
# for fedora19 on my laptop
bindkey "^[[1~" beginning-of-line
bindkey "^[[4~" end-of-line
bindkey "^[[5~" up-line-or-history
bindkey "^[[6~" down-line-or-history
## plugins
#
# syntax highlight
[[ -f $HOME/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ]] && source $HOME/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
###
# Set shell options
###
setopt auto_menu # 補完キー連打で次の候補
setopt auto_param_slash # 補完の時/を自動で入れる
setopt rm_star_silent # rm * のとき確認
setopt extended_glob # ファイル名の指定が柔軟になる *.(cpp|h)
setopt list_types # ファイル種別をマーク表示
setopt no_beep # ビープ音鳴らさない
setopt always_last_prompt # カーソル位置を動かさずファイル名一覧を表示
setopt auto_param_keys # カッコの対応などを補完
setopt prompt_subst # プロンプトに環境変数を通す
setopt hist_ignore_dups # ignore duplication command history list
setopt share_history # share command history data
setopt auto_pushd # ふつーにcdするときもスタックに入れる
setopt pushd_ignore_dups # スタックから重複を削除
setopt hist_ignore_space # 行頭にスペースがあったらhistoryに保存しない
unsetopt extended_history # 履歴に時間を記録
unsetopt sun_keyboard_hack # `のtypoをカバーする
autoload -U compinit
compinit -u
# VCS settings
# ほか設定
HISTFILE=~/.zsh_history
HISTSIZE=20000
SAVEHIST=20000
zstyle ':completion:*' list-colors 'no=00' 'fi=00' 'di=00;34' 'ln=01;36' 'pi=40;33' 'so=40;33' 'bd=40;33' 'cd=40;33' 'ex=01;31' 'or=04;36' '*.tgz=01;32' '*.gz=01;32' '*.tar=01;32'
# apt-getとか時間のかかるコマンドにキャッシュを使う
#zstyle ':completion:*' use-cache true
# 補完候補を ←↓↑→ で選択 (補完候補が色分け表示される)
#zstyle ':completion:*:default' menu select=1
autoload vcs_info
zstyle ":vcs_info:*" enable git
zstyle ':vcs_info:git:*' check-for-changes true
zstyle ':vcs_info:git:*' stagedstr "%F{yellow}!"
zstyle ':vcs_info:git:*' unstagedstr "%F{red}+"
zstyle ':vcs_info:*' formats "%F{green}%c%u[%b]%f"
zstyle ':vcs_info:*' actionformats '[%b|%a]'
PROMPT=$'%{\e[36m%}%T%%%{\e[m%} '
RPROMPT=$'[`rprompt-git` %{\e[36m%}%~]%{\e[m%}'
PROMPT2="%_%% "
function rprompt-git {
if test -z $(git rev-parse --git-dir 2> /dev/null); then
return
fi
vcs_info
echo $vcs_info_msg_0_
return
#st=`git status`
#if [[ -n `echo "$st" | grep "^nothing to"` ]]; then
# color=%F{green}
#elif [[ -n `echo "$st" | grep "^nothing added"` ]]; then
# color=%F{yellow}
#elif [[ -n `echo "$st" | grep "^# Untracked"` ]]; then
# color=%B%F{red}
#else
# color=%F{red}
#fi
# push忘れ防止関数
# http://yuroyoro.hatenablog.com/entry/20110219/1298089409
#if [ "$(git rev-parse --is-inside-work-tree)" = "true" ]; then
# head="$(git rev-parse HEAD)"
# for x in $(git rev-parse --remotes)
# do
# if [ "$head" = "$x" ]; then
# echo "1"
# return 0
# fi
# done
# push="%B%F{red}{PUSH忘れ}%f%b"
#fi
echo "$color$name$action%f%b "
}
function prompt-svn {
local __svn_status st revision
__svn_status=(`svn info 2> /dev/null |grep 'リビジョン: '`)
if [[ $__svn_status == '' ]]
then
return
fi
revision=`echo ${__svn_status[2]}`
st=`svn status 2> /dev/null`
if [[ -n `echo "$st" | grep "^M"` ]]; then
color=%F{red}
elif [[ -n `echo "$st" | grep "^?"` ]]; then
color=%F{magenta}
elif [[ -n `echo "$st" | grep "^D"` ]]; then
color=%F{magenta}
elif [[ -n `echo "$st" | grep "^ M"` ]]; then
color=%F{red}
else
color=%F{green}
fi
echo "$color$revision%f"
}
## Default shell configuration
# set terminal title including current directory
#case "${TERM}" in
#kterm*|xterm)
# precmd() {
# echo -n "\e]2;$(date)\a"
# }
# preexec () {
# print -Pn "\e]0;$1\a"
# }
# ;;
#esac
# ターミナルタイトル
#aliases
case ${OSTYPE} in
darwin*)
alias ls="ls -G"
;;
linux*)
alias ls="ls --color=auto"
;;
esac
stty stop undef
alias where="command -v"
alias la="ls -a"
alias lf="ls -F"
alias ll="ls -l"
alias gd='dirs -v; echo -n "select number: "; read newdir; cd +"$newdir"'
# alias for Ruby on Rails
alias buinit="bundle && rake db:migrate parallel:prepare"
alias be="bundle exec"
alias du="du -h"
alias df="df -h"
# alias for git
alias gl="git log --pretty='format:%C(blue)%h%C(red)%d%C(yellow) %s %C(green)%an%Creset, %ar' --graph"
alias globalip='curl ipcheck.ieserver.net'
# for colorized svn diff
alias svndiff="svn diff . | /usr/share/vim/vim73/macros/less.sh"