-
Notifications
You must be signed in to change notification settings - Fork 2
/
.zshrc
171 lines (146 loc) · 3.65 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
HISTFILE=~/.histfile
HISTSIZE=5000
SAVEHIST=5000
DIRSTACKSIZE=50
cdpath=(. ~)
fpath=( ${HOME}/.zsh/func $fpath )
export EDITOR=vim
export PAGER=most
export ACK_COLOR_MATCH=magenta
export WORKON_HOME=$HOME/.virtualenvs
source $HOME/.virtualenvwrapper
# Add goodies to the PATH
echo $PATH | grep -q $HOME/bin
if [[ $? -eq 1 ]]; then
for f in dev/git-svn-clone-externals bin/git-tools bin .gem/ruby/1.8/bin
EXTRA=${HOME}/$f:$EXTRA
export PATH=$EXTRA:$PATH
fi
# Load aliases
if [[ -r ${HOME}/.aliasrc ]]; then
eval `awk '/^[^# ]/ {print "alias " $0}' ${HOME}/.aliasrc`
fi
# Load profile
if [[ -r ${HOME}/.profile ]]; then
source ${HOME}/.profile
fi
# Load git_ps1
if [[ -r ${HOME}/.zsh/git-ps1 ]]; then
. ${HOME}/.zsh/git-ps1
fi
# Enable color support of ls
if [ "$TERM" != "dumb" ]; then
eval "`dircolors -b`"
fi
psvar=()
# Set the title to "user@host: directory"
case $TERM in
(rxvt*|xterm*)
precmd () {
print -Pn "\e]0;%n@%m: %~\a"
psvar[2]=$(__git_ps1)
}
;;
esac
# Set the prompt
RPS1=$'%{\e[34m%}%~%{\e[0m%}%{\e[35m%}%2v%{\e[0m%}'
PS1=$'%{\e[36m%}%v %{\e[0m%}'
case $HOST in
(venona)
psvar='$';;
(archie)
psvar='(archie) $';;
(khan.mozilla.org)
psvar='(khan) $';;
(*)
psvar="($HOST) %%";;
esac
if [[ $UID == 0 ]]; then
psvar='##'
fi
# Set up completion
autoload -U compinit
compinit -i
# From zsh book
zstyle ':completion:*:warnings' format 'No matches: %d'
zstyle ':completion:*' auto-description 'specify: %d'
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
# Show and group completions by description
zstyle ':completion:*:*:kill:*' menu yes select
zstyle ':completion:*:kill:*' force-list always
# From zsh-lovers
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path ${HOME}/.zsh/cache
zstyle ':completion:*' completer _complete _match _approximate
zstyle ':completion:*:match:*' original only
zstyle ':completion:*:approximate:*' max-errors 1 numeric
zstyle ':completion:*:functions' ignored-patters '_*'
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
setopt \
aliases \
NO_all_export \
always_last_prompt \
NO_always_to_end \
append_history \
auto_cd \
auto_list \
auto_menu \
auto_name_dirs \
auto_param_slash \
auto_remove_slash \
auto_pushd \
NO_beep \
chase_dots \
chase_links \
NO_clobber \
correct \
extended_glob \
hash_cmds \
hash_dirs \
hash_list_all \
hist_find_no_dups \
hist_ignore_dups \
hist_ignore_all_dups\
hist_verify \
inc_append_history \
list_ambiguous \
multios \
NO_overstrike \
pushd_ignore_dups \
pushd_minus \
# Load keychain for ssh-agent
[[ -x /usr/bin/keychain ]] && /usr/bin/keychain -q ${HOME}/.ssh/id_rsa
[[ -f $HOME/.keychain/$HOST-sh ]] && source $HOME/.keychain/$HOST-sh
# Keybindings
bindkey -e
bindkey '\e[A' history-search-backward
bindkey '\e[B' history-search-forward
bindkey '\Cp' history-beginning-search-backward
bindkey '\Cn' history-beginning-search-forward
bindkey '\Cl' forward-word
bindkey '\Ch' backward-word
# Global aliases
alias -g ...='../..'
alias -g ....='../../..'
alias -g M='| most'
alias -g V='| view -'
alias -g A='| ack'
em () {
~/bin/em $@ &!
}
sd () {
svn diff $@ | vim -R -
}
ann () {
tig blame $@
}
di () {
diff $@ | vim -R -
}
mc () {
mk $@ && cd $@
}
gig () {
for f in $*
echo $f >> ~/.gitignore
}