-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc
276 lines (226 loc) · 7.41 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
# users generic .zshrc file for zsh(1)
## Environment variable configuration
# LANG
export LANG=ja_JP.UTF-8
export PATH=/usr/local/bin:$PATH
# JAVA
# export JAVA_HOME=`/usr/libexec/java_home`
# export PATH=$JAVA_HOME/bin:$PATH
export PATH=$PATH:/Applications/"Android Studio.app"/Contents/jre/jdk/Contents/Home/bin
export JAVA_HOME=/Applications/"Android Studio.app"/Contents/jre/jdk/Contents/Home
# export JAVA_OPTS='-XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee'
# OTHERS
export BUNDLER_EDITOR=emacs
export EDITOR=vim
## Default shell configuration
# set prompt
autoload colors; colors
case ${UID} in
0)
PROMPT="%B%{${fg[magenta]}%}%/ #%{${reset_color}%}%b "
PROMPT2="%B%{${fg[magenta]}%}%_ #%{${reset_color}%}%b "
SPROMPT="%B%{${fg[magenta]}%}%r is correct? [n,y,a,e]:%{${reset_color}%}%b "
[ -n "${REMOTEHOST}${SSH_CONNECTION}" ] &&
PROMPT="%{${fg[magenta]}%}$(echo ${HOST%%.*} | tr '[a-z]' '[A-Z]') ${PROMPT}"
;;
*)
PROMPT="%{${fg[cyan]}%}%/ %%%{${reset_color}%} "
PROMPT2="%{${fg[cyan]}%}%_ %%%{${reset_color}%} "
SPROMPT="%{${fg[cyan]}%}%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
# vcs
autoload -Uz add-zsh-hook
autoload -Uz vcs_info
zstyle ':vcs_info:*' enable git svn hg bzr
zstyle ':vcs_info:*' formats '[%s: %b]'
zstyle ':vcs_info:*' actionformats '[%s: %b|%a]'
zstyle ':vcs_info:(svn|bzr):*' branchformat '%b:r%r'
zstyle ':vcs_info:bzr:*' use-simple true
function _update_vcs_info_msg() {
psvar=()
LANG=en_US.UTF-8 vcs_info
[[ -n "$vcs_info_msg_0_" ]] && psvar[1]="$vcs_info_msg_0_"
}
add-zsh-hook precmd _update_vcs_info_msg
RPROMPT="%1(v|%F{green}%1v%f|)"
# 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
bindkey -e
# 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 "^[f" emacs-forward-word
bindkey "^[b" emacs-backward-word
export WORDCHARS=""
autoload smart-insert-last-word
zle -N insert-last-word smart-insert-last-word
zstyle :insert-last-word match \
'*([^[:space:]][[:alpha:]/\\]|[[:alpha:]/\\][^[:space:]])*'
bindkey '^]' insert-last-word
# quote previous word in single or double quote
autoload -U modify-current-argument
_quote-previous-word-in-single() {
modify-current-argument '${(qq)${(Q)ARG}}'
zle vi-forward-blank-word
}
zle -N _quote-previous-word-in-single
bindkey '^[s' _quote-previous-word-in-single
_quote-previous-word-in-double() {
modify-current-argument '${(qqq)${(Q)ARG}}'
zle vi-forward-blank-word
}
zle -N _quote-previous-word-in-double
bindkey '^[d' _quote-previous-word-in-double
## Command history configuration
HISTFILE=~/.zsh_history
HISTSIZE=1000000
SAVEHIST=1000000
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
## zsh editor
autoload zed
## zsh rename
autoload zmv
## Alias configuration
setopt complete_aliases
alias where="command -v"
alias j="jobs -l"
case "${OSTYPE}" in
freebsd*)
alias ls="ls -G -w"
;;
darwin*)
alias ls="ls -a -G"
;;
linux*)
alias ls="ls -a --color"
alias open="gnome-open"
;;
esac
alias la="ls -a"
alias lf="ls -F"
alias ll="ls -l"
alias du="du -h"
alias df="df -h"
alias su="su -l"
alias sl="sl -ae"
alias gomi='touch gomigomi\~ \.gomigomi\~ \#gomigomi\#; rm -f *\~; rm -f \.*\~; rm -f \#*\#'
alias r="rails"
function dbox() { emacs ~/Dropbox/memos/${1}& }
case "${OSTYPE}" in
darwin*)
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
## terminal configuration
export LESS='-R'
# export LESSOPEN='| /usr/share/source-highlight/src-hilite-lesspipe.sh %s' # apt-get install source-highlight
export LESSOPEN='| /usr/local/bin/src-hilite-lesspipe.sh %s' # brew install source-highlight
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 ~/.zshmyrc ] && source ~/.zshmyrc
# if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then source "$HOME/.rvm/scripts/rvm" ; fi
# # git completion
# autoload bashcompinit
# bashcompinit
# source ~/git-completion.bash
## attach screen
# screen -xR
export LESSOPEN="| src-hilite-lesspipe.sh %s"
export LESS=" -R "
[ -f ~/.zsh/antigen/antigen.zsh ] && source ~/.zshrc.antigen
### Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"
## python
export PYTHONPATH=~/work/caffe/python:$PYTHONPATH
## flutter,android
export FLUTTER_HOME=/usr/local/flutter/bin # 下に行で使うために定義しただけ
export PATH=$FLUTTER_HOME:$PATH
export PATH=$PATH:$FLUTTER_HOME/cache/dart-sdk/bin # flutter for web で要らなくなったら削除
export PATH=$PATH:$HOME/.pub-cache/bin
export ANDROID_SDK_ROOT=~/Library/Android/sdk
export ANDROID_NDK_HOME=~/Library/Android/sdk/ndk-bundle
export ANDROID_HOME=$ANDROID_SDK_ROOT
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$ANDROID_NDK_HOME
# YARN
export PATH=$PATH:`yarn global bin`
# GO
export GOPATH=$HOME/gopath
export PATH=$PATH:/usr/local/opt/go/libexec/bin:$GOPATH/bin
# mono
export MONO_GAC_PREFIX="/usr/local"
# Google Cloud Functions Emulator
function f { command functions "$@" }
if which rbenv > /dev/null; then eval "$(rbenv init - zsh)"; fi
# added by travis gem
[ -f /Users/kchinnda/.travis/travis.sh ] && source /Users/kchinnda/.travis/travis.sh