forked from pulkit/zshfiles
/
zshrc
193 lines (147 loc) · 5.07 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
fpath=(~/.zsh/functions $fpath)
autoload -U ~/.zsh/functions/*(:t)
for config_file ($ZSH/lib/*.zsh) source $config_file
# Hooks
typeset -ga precmd_functions
typeset -ga preexec_functions
HISTFILE=~/.histfile
HISTSIZE=5000
SAVEHIST=5000
# zsh options; man zshoptions
setopt sharehistory
setopt histignoredups
setopt histignorealldups
setopt histfindnodups
setopt histignorespace
setopt extendedglob
setopt notify
setopt correct
setopt interactivecomments
setopt multios
setopt autocd
setopt autopushd
setopt pushdignoredups
setopt pushdsilent
setopt autolist
unsetopt listambiguous
setopt listpacked
setopt listtypes
unsetopt flowcontrol
unsetopt beep
### Key bindings ###
bindkey -e
bindkey '^P' history-beginning-search-backward
bindkey '^N' history-beginning-search-forward
bindkey '^[[Z' reverse-menu-complete
bindkey '^[/' undo
zle -N rationalize-dot
bindkey . rationalize-dot
# configure zsh's autocompletion system; man zshcompsys
zstyle ':completion:*' use-cache on
zstyle ':completion:*' completer _expand _complete _match _approximate
zstyle ':completion:*' matcher-list '+' '+m:{[:lower:]}={[:upper:]}' '+r:|[._-]=** r:|=**' '+l:|=* r:|=*'
zstyle ':completion:*:match:*' original only
zstyle -e ':completion:*' max-errors 'reply=( $(( ($#PREFIX+$#SUFFIX)/3 )) numeric )'
zstyle ':completion:*:functions' ignored-patterns '_*'
zstyle ':completion:*' ignore-parents parent pwd
zstyle ':completion:*' list-suffixes true
zstyle ':completion:*' expand suffix
zstyle ':completion:*:kill:*' command 'ps -u$USER'
zstyle ':completion::expand:*' tag-order 'expansions all-expansions'
zstyle ':completion:*' remove-all-dups true
zstyle ':completion:*' group-name ''
zstyle ':completion:*' format '%B%d:%b'
zstyle ':completion:*' verbose true
zstyle ':completion:*' list-colors no=00 fi=00 di=01\;34 pi=33 so=01\;35 bd=00\;35 cd=00\;34 or=00\;41 mi=00\;45 ex=01\;32
zstyle ':completion:*' menu 'select=0'
zstyle ':completion:*' list-prompt ''
zstyle ':completion:*' select-prompt ''
zstyle ':completion:*' insert-tab false
zstyle ':completion:*' prompt ''\''%e'\'''
zstyle ':completion:*:manuals' separate-sections true
# Load plugins
plugins=(git)
is_plugin() {
local base_dir=$1
local name=$2
test -f $base_dir/plugins/$name/$name.plugin.zsh \
|| test -f $base_dir/plugins/$name/_$name
}
# Add all defined plugins to fpath. This must be done
# before running compinit.
for plugin ($plugins); do
fpath=($ZSH/plugins/$plugin $fpath)
done
autoload -Uz compinit
compinit
# Load all of the plugins that were defined in ~/.zshrc
for plugin ($plugins); do
source $ZSH/plugins/$plugin/$plugin.plugin.zsh
done
# Initialize prompt
PROMPT=$'%{$fg_bold[green]%}%n@%m %{$fg[blue]%}%D{[%I:%M:%S]} %{$reset_color%}%{$fg[white]%}[%~]%{$reset_color%} $(git_prompt_info)\
%{$fg[blue]%}->%{$fg_bold[blue]%} %#%{$reset_color%} '
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}["
ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}*%{$fg[green]%}"
ZSH_THEME_GIT_PROMPT_CLEAN=""
#PS1="%~$ "
#export MOZ_NO_REMOTE=1
### Aliases
alias df='df -h'
alias du='du -hs'
alias la='ls -aG -color'
alias ll='ls -lhG -color'
alias ls='ls -G -color'
alias l='ls -G -color'
alias pi='sudo aptitude install'
alias pr='sudo aptitude remove'
alias pp='sudo aptitude purge'
alias pud='sudo aptitude update'
alias pug='sudo aptitude safe-upgrade'
alias pufg='sudo aptitude full-upgrade'
alias pse='aptitude search'
alias psh='aptitude show'
alias halt='sudo shutdown -h now'
alias reboot='sudo reboot'
alias e='gvim --remote-tab-silent'
alias -g ack='ack-grep'
alias -g G='| grep'
alias -g L='| less'
alias -g H='| head'
alias -g T='| tail'
alias -g Y='| xclip && xclip -o | xclip -se c'
alias -g R='$(git rev-parse --show-toplevel 2> /dev/null)'
alias sz='source ~/.zshrc'
alias ez='e ~/.zshrc'
alias ee='e ~/.vimrc'
alias entertain='mplayer "$(find "." -type f -regextype posix-egrep -regex ".*\.(avi|mkv|flv|mpg|mpeg|mp4|wmv|3gp|mov|divx)" | shuf -n1)"'
alias rand='tr -c "[:digit:]" " " < /dev/urandom | dd cbs=$COLUMNS conv=unblock | GREP_COLOR="1;32" grep --color "[^ ]"'
### Exports
export _JAVA_AWT_WM_NONREPARENTING=1
precmd() {
# send a visual bell to awesome
echo -ne '\a'
}
# Title
precmd_functions=( "${precmd_functions[@]:#_title_precmd}" _title_precmd )
preexec_functions=( "${preexec_functions[@]:#_title_preexec}" _title_preexec )
# Auto jump; https://github.com/sjl/z-zsh
. $HOME/.zsh/z/z.sh
autoload -U colors
colors
setopt prompt_subst
precmd_functions=( "${precmd_functions[@]:#_z_precmd}" _z_precmd )
source /usr/local/bin/virtualenvwrapper.sh
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export PIP_DOWNLOAD_CACHE=$HOME/.pip_download_cache
function gi() { curl http://www.gitignore.io/api/$@ ;}
alias e='emacsclient -t'
alias ec='emacsclient -c'
export GOPATH=~/go
export PATH=$PATH:$GOPATH/bin
alias pip_freeze='GITROOT=$(git rev-parse --show-toplevel) && cd $GITROOT && pip freeze --local > requirements.txt && cd -'
alias audio_dl='noglob youtube-dl -f "bestaudio" -o "~/Music/audio-downloads/%(title)s.%(ext)s" '
### Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"