-
Notifications
You must be signed in to change notification settings - Fork 2
/
zshrc
189 lines (150 loc) · 3.97 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
#!/usr/bin/env zsh
# ~/.zshrc - zsh config file
# From: Fergus Bremner
# Email: <fergus.bremner@gmail.com>
# set PATH so it includes user bin (if it exists)
if [ -d $HOME/bin ] ; then
export PATH=$HOME/bin:$PATH
fi
export PATH=/usr/bin:$PATH
export PATH=/usr/local/bin:$PATH
export PATH=/usr/local/sbin:$PATH
export PATH
# you say tomato, I say tomato
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export LC_CTYPE=$LANG
for var in LANG LC_ALL LC_MESSAGES ; do
[[ -n ${(P)var} ]] && export $var
done
# ruby env
if [ -d $HOME/.rbenv ] ; then
eval "$(rbenv init -)"
fi
# color setup for ls
export LSCOLORS="Gxfxcxdxbxegedabagacad"
if [[ $(uname) == 'Darwin' ]]; then # we're on OS X
__LS_FLAGS='-G'
export CLICOLOR=1
else # we're on Linux
__LS_FLAGS='--color=auto'
eval $(dircolors -b)
export TERM=xterm-256color
fi
export COLORFGBG="default;default" # for mutt & vim
export MAIL=${MAIL:-/var/mail/$USER}
# integrate vim goodness
export EDITOR=vim
export VISUAL=vim
bindkey -v
fg-vim() {
fg %vim
}
zle -N fg-vim
bindkey '^Z' fg-vim
# vi style incremental search
bindkey '^R' history-incremental-search-backward
bindkey '^S' history-incremental-search-forward
bindkey '^P' history-search-backward
bindkey '^N' history-search-forward
# huge history
export HISTFILE=$HOME/.zsh/history
export HISTSIZE=5000
export SAVEHIST=$HISTSIZE
setopt append_history
setopt extended_history
setopt hist_expire_dups_first
setopt hist_ignore_dups
setopt histignorealldups
setopt hist_ignore_space
setopt hist_reduce_blanks
setopt hist_verify
setopt inc_append_history
setopt share_history
unsetopt nomatch
# add some readline keys back
bindkey "^A" beginning-of-line
bindkey "^E" end-of-line
# directory stack
export dirstacksize=20
DIRSTACKFILE=~/.zdirs
if [[ -f $DIRSTACKFILE ]] && [[ $#dirstack -eq 0 ]]; then
dirstack=( ${(f)"$(< $DIRSTACKFILE)"} )
[[ -d $dirstack[1] ]] && cd $dirstack[1] && cd $OLDPWD
fi
chpwd() {
print -l $PWD ${(u)dirstack} >$DIRSTACKFILE
}
# automatically pushd
setopt auto_pushd
setopt pushd_ignore_dups
# automatically enter directories without cd
setopt auto_cd
# handy cd movements from zshkit
setopt AUTOCD
setopt AUTOPUSHD PUSHDMINUS PUSHDSILENT PUSHDTOHOME
setopt cdablevars
setopt multios
# resolve symlinks
setopt chase_links
# try to correct command line spelling
setopt CORRECT CORRECT_ALL
# enable extended globbing
setopt extended_glob
# don't match dotfiles. ever.
setopt noglobdots
# try to avoid the 'zsh: no matches found...'
setopt nonomatch
# use zsh style word splitting
setopt noshwordsplit
# report the status of backgrounds jobs immediately
setopt notify
#unsetopt menu_complete # do not autoselect the first completion entry
#unsetopt flowcontrol
setopt auto_menu # show completion menu on succesive tab press
setopt complete_in_word
setopt always_to_end
# code versioning
autoload -Uz vcs_info
# easy renaming
autoload -U zmv
# command line
autoload -U edit-command-line
zle -N edit-command-line
bindkey '\C-x\C-e' edit-command-line
# smart urls
autoload -U url-quote-magic
zle -N self-insert url-quote-magic
# file rename magick
bindkey "^[m" copy-prev-shell-word
# jobs
setopt long_list_jobs
# pager
export PAGER="less"
export LESS="-R"
# python virtualenv(s)
if [[ -n "$commands[virtualenvwrapper.sh]" ]]; then
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/Projects
export VIRTUALENVWRAPPER_SCRIPT=/usr/local/bin/virtualenvwrapper.sh
if [ ! -d "$WORKON_HOME" ] ; then
mkdir -p $WORKON_HOME
fi
source $VIRTUALENVWRAPPER_SCRIPT
fi
# load custom goodness
for GOODIES ($HOME/.zsh/plugins/*.zsh); do
source $GOODIES
done
# extra completions
if [ -d $HOME/.zsh/extras/zsh-completions ]; then
fpath=($HOME/.zsh/extras/zsh-completions/src $fpath)
fi
# fish shell like syntax highlighting
if [ -d $HOME/.zsh/extras/zsh-syntax-highlighting ]; then
source $HOME/.zsh/extras/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
fi
# load & init completions last
autoload -Uz compinit && compinit
#date +"%F"
# vim:ft=zsh