-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.zshrc
More file actions
302 lines (280 loc) · 7.57 KB
/
Copy path.zshrc
File metadata and controls
302 lines (280 loc) · 7.57 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
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
# -*- mode: sh; encoding: utf-8; tab-width: 4; indent-tabs-mode: nil; -*-
setopt \
always_last_prompt \
append_history \
auto_cd \
auto_list \
auto_menu \
auto_param_keys \
auto_param_slash \
auto_pushd \
brace_ccl \
complete_in_word \
csh_null_glob \
extended_glob \
extended_history \
hash_cmds \
hist_expand \
hist_fcntl_lock \
hist_find_no_dups \
hist_ignore_dups \
hist_ignore_space \
hist_no_store \
hist_reduce_blanks \
hist_subst_pattern \
inc_append_history \
interactive_comments \
list_ambiguous \
list_packed \
long_list_jobs \
magic_equal_subst \
mark_dirs \
multi_os \
no_list_beep \
notify \
numeric_glob_sort \
prompt_subst \
pushd_minus \
pushd_ignore_dups \
share_history \
;
[ -n "`alias run-help`" ] && unalias run-help
autoload -Uz colors; colors
autoload -Uz compinit; compinit -u
autoload -Uz predict-on
autoload -Uz run-help
autoload -Uz url-quote-magic
autoload -Uz vcs_info
autoload -Uz zcalc
autoload -Uz zed
autoload -Uz ztodo
autoload -Uz zmv
local p_user="%B%U%{%(!.$fg[red].$fg[green])%}%n@%M%u%b%{$reset_color%}"
local p_pwd="%B%{$fg[blue]%}%~%b%{$reset_color%}"
local p_suffix="%(1j.%B%{$fg[yellow]%}%(!.#.$)%b%{$reset_color%}.%(!.#.$))"
export PROMPT="[${p_user}:${p_pwd}]${p_suffix} "
local rp_vcs="(%1(V|%1v%f |)"
local rp_ret="%(?.0.%B%{$fg[magenta]%}%?%b%{$reset_color%})"
local rp_dirs="%2(V.%{$fg[cyan]%}%2v%{$reset_color%}.0)"
local rp_jobs="%1(j.%{$fg[yellow]%}%j%{$reset_color%}.0)"
export RPROMPT="${rp_vcs}r:${rp_ret} s:${rp_dirs} j:${rp_jobs})"
export PROMPT2='%B%{$fg[black]%}-->%b%{$reset_color%} '
export RPROMPT2='%_'
HISTFILE=~/.zsh_history
HISTSIZE=99999999
SAVEHIST=99999999
WORDCHARS='*?_-.[]~=&;!#$%^(){}<>'
REPORTTIME=1
TIMEFMT='%J (real: %*E user: %*U sys: %*S cpu: %P pf: %F)'
watch=(all all)
WATCHFMT='%n has %a %l from %m at %D %T'
if =ls --version 2>&1 | grep -q GNU; then
# GNU userland
alias ls='ls -av --color=auto'
alias ls!='ls -R'
alias ll='ls -l --time-style=long-iso'
alias ll!='ll -R'
alias rm='rm -vr'
alias rm!='rm -f'
alias cp='cp -av'
alias cp!='cp -f'
alias ln='ln -v'
alias ln!='ln -f'
alias mv='mv -v'
alias mv!='mv -f'
alias mkdir='mkdir -pv'
alias chown='chown -cv'
alias chown!='chown -R'
alias chgrp='chgrp -cv'
alias chgrp!='chgrp -R'
alias chmod='chmod -cv'
alias chmod!='chmod -R'
alias chacl!='chacl -r'
alias grep='grep -n --color'
alias getfacl='getfacl --tabular'
alias getfacl!='getfacl -LR'
alias setfacl!='setfacl -LR'
alias du1='du --max-depth=1'
alias psx='ps -AHo pid,user,group,%cpu,%mem,nlwp,vsize,rssize,tname,stat,ni,start_time,cputime,args'
alias watch='watch -c -d -t -n 1'
else
# (should be) BSD userland
alias ls='ls -aFG'
alias ls!='ls -R'
alias ll='ls -l'
alias ll!='ll -R'
alias rm='rm -vr'
alias rm!='rm -f'
alias cp='cp -av'
alias cp!='cp -f'
alias ln='ln -v'
alias ln!='ln -f'
alias mv='mv -v'
alias mv!='mv -f'
alias mkdir='mkdir -pv'
alias chown='chown -v'
alias chown!='chown -R'
alias chgrp='chgrp -v'
alias chgrp!='chgrp -R'
alias chmod='chmod -v'
alias chmod!='chmod -R'
alias grep='grep -n'
alias du1='du -d 1'
fi
# Common commands
alias md='mkdir'
#alias history='history -Ddi'
alias pwd='pwd -P'
alias cc='copyclip'
alias c='LANG=C LC_ALL=C'
alias ja='LANG=ja_JP.UTF-8 LC_ALL=ja_JP.UTF-8'
alias en='LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8'
alias h='history 0'
alias g='grep'
alias s='dirs -v'
alias l='$PAGER'
alias v='view -'
alias k='kill'
alias K='kill -KILL'
alias ka='killall'
alias KA='killall -KILL'
alias ssu='sudo su -'
alias r='popd'
alias j='jobs -lp'
alias H='head'
alias T='tail'
alias TF='tail -F'
alias -g _N_='> /dev/null 2>&1'
alias -s txt=$PAGER
alias -s htm=w3m
alias -s html=w3m
alias -s php=php
alias -s pl=perl
alias -s py=python
alias -s rb=ruby
alias -s exe=mono
alias -s jar='java -jar'
alias -s {sln,csproj,vbproj,fsproj}=xbuild
alias vnc='vnc4server -geometry 1366x768 -depth 24'
alias lastcmd="fc -ln -1 | tr -d '\n'"
if where dircolors > /dev/null 2>&1; then
eval `dircolors \`if [ -f $HOME/.DIR_COLORS ]; then
echo $HOME/.dir_colors
elif [ -f /etc/DIR_COLORS ]; then
echo /etc/DIR_COLORS
fi\``
fi
zstyle ':completion:*' completer _complete _expand _list _match _prefix
zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-z}={A-Z} r:|[-_.]=**'
zstyle ':completion:*' menu select
zstyle ':completion:*' use-cache true
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*:sudo:*' command-path $sudo_path $path
zstyle ':completion:*:*:-subscript-:*' tag-order indexes parameters
zstyle ':vcs_info:*' enable git hg svn
zstyle ':vcs_info:*' use-simple false
zstyle ":vcs_info:*" check-for-changes true
zstyle ':vcs_info:*' stagedstr "+"
zstyle ':vcs_info:*' unstagedstr "?"
zstyle ':vcs_info:*' formats '%s:%b%c%u'
zstyle ':vcs_info:*' actionformats '%s:%b%c%u:%a'
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([%0-9]#)*=0=01;31'
function precmd() {
psvar=()
LANG=en_US.UTF-8 vcs_info
[[ -n "$vcs_info_msg_0_" ]] && psvar[1]="$vcs_info_msg_0_"
local dirn=$((`dirs -p | wc -l` - 1))
[ $dirn -gt 0 ] && psvar[2]=$dirn
}
function cd() {
builtin cd $@ && ls;
}
function cdpop() {
if popd > /dev/null 2>&1; then
echo
ls
# HACK: to update $RPROMPT
precmd
zle reset-prompt
fi
}
function cdup() {
echo
cd ..
# HACK: to update $RPROMPT
precmd
zle reset-prompt
}
function copyclip() {
if which xsel > /dev/null 2>&1 ; then
xsel --input --clipboard # X11
elif which pbcopy > /dev/null 2>&1 ; then
pbcopy # Mac OS X
elif which putclip > /dev/null 2>&1 ; then
putclip # Cygwin
elif which clip > /dev/null 2>&1 ; then
putclip # Windows
else
$PAGER
fi
}
function predict-toggle() {
if [ ! $ZSH_PREDICT ]; then
predict-on
ZSH_PREDICT=1
else
predict-off
unset ZSH_PREDICT
fi
}
function history-hybrid-search-backward() {
if [ -z $BUFFER ]; then
zle history-incremental-pattern-search-backward
else
zle history-search-backward
fi
}
function history-hybrid-search-forward() {
if [ -z $BUFFER ]; then
zle history-incremental-pattern-search-forward
else
zle history-search-forward
fi
}
zle -N cdpop
zle -N cdup
zle -N self-insert url-quote-magic
zle -N predict-toggle
zle -N history-hybrid-search-backward
zle -N history-hybrid-search-forward
bindkey -e
bindkey "^?" backward-delete-char
bindkey "^_" describe-key-briefly
bindkey "^F" history-hybrid-search-backward
bindkey "^J" history-hybrid-search-forward
bindkey "^H" backward-delete-char
bindkey "^K" kill-region
bindkey "^P" push-input
bindkey "^Y" yank
bindkey "^Z" undo
bindkey "^[z" redo
bindkey "^[[Z" reverse-menu-complete
bindkey "^[OA" expand-word
bindkey "^[OB" list-expand
bindkey "^[OD" backward-word
bindkey "^[OC" forward-word
bindkey "^[^P" predict-toggle
bindkey "^[[11" run-help
bindkey "^[[2" overwrite-mode
bindkey "^[[3~" delete-char
bindkey "^[[1~" beginning-of-line
bindkey "^[[4~" end-of-line
bindkey "^[[[A" where-is
bindkey "^[^[[A" cdup
bindkey "^[^[[B" cdpop
bindkey -M isearch "^F" history-incremental-pattern-search-backward
bindkey -M isearch "^J" history-incremental-pattern-search-forward
for f in $HOME/.zsh/*(N); do
source f
done
vim:set ft=sh fenc=utf-8 ts=4 sw=4 sts=4 et: