-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc.orig
423 lines (375 loc) · 10.7 KB
/
.zshrc.orig
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
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
# Created by cmdel
# My .zshrc file
#
# Written by Christos Delivorias.
# With a lot of input and nit-picking from www.dotfiles.org
#
# Latest version available from http://github.com/cmdel/rc-configs
#
# Some functions taken from various web sites/mailing lists, others written
# myself.
#
# Last updated 2010-15-03
#
# Released into the public domain.
#
# TODOtxt settings{{{
source /Users/cmd/bin/todo.txt-cli/todo_completion
#}}}
# Set less options# {{{
if [[ -x $(which less) ]]
then
export PAGER="less"
export LESS="--ignore-case --LONG-PROMPT --QUIET --chop-long-lines -Sm --RAW-CONTROL-CHARS --quit-if-one-screen --no-init"
if [[ -x $(which lesspipe.sh) ]]
then
LESSOPEN="| lesspipe.sh %s"
export LESSOPEN
fi
fi
# }}}
# Set default editor{{{
if [[ -x $(which emacs) ]]
then
export EDITOR="vim"
export USE_EDITOR=$EDITOR
export VISUAL=$EDITOR
fi
#}}}
# Zsh settings for history {{{
export HISTIGNORE="&:ls:[bf]g:exit:reset:clear:cd:cd ..:cd.."
export HISTSIZE=25000
export HISTFILE=~/.zsh_history
export SAVEHIST=25000
export CLOJURE_EXT=~/.clojure
export GPGKEY=74978A19
setopt APPEND_HISTORY
setopt INC_APPEND_HISTORY
setopt HIST_IGNORE_ALL_DUPS
setopt HIST_IGNORE_SPACE
setopt HIST_REDUCE_BLANKS
setopt HIST_SAVE_NO_DUPS
setopt HIST_VERIFY
#}}}
# Zsh spelling correction options
#setopt CORRECT
#setopt DVORAK
# Prompts for confirmation after 'rm *' etc# {{{
# Helps avoid mistakes like 'rm * o' when 'rm *.o' was intended
setopt RM_STAR_WAIT
# }}}
# Background processes aren't killed on exit of shell# {{{
setopt AUTO_CONTINUE
# }}}
# Don’t write over existing files with >, use >! instead# {{{
setopt NOCLOBBER
# }}}
# Don’t nice background processes# {{{
setopt NO_BG_NICE
# }}}
# Watch other user login/out# {{{
watch=notme
export LOGCHECK=60
# }}}
# Enable color support of ls# {{{
if [[ "$TERM" != "dumb" ]]; then
if [[ -x `which dircolors` ]]; then
eval `dircolors -b`
alias 'ls=ls --color=auto'
fi
fi
# }}}
# Short command aliases# {{{
alias 'l=ls'
alias 'la=ls -A'
alias 'll=ls -l'
alias 'lq=ls -Q'
alias 'lr=ls -R'
alias 'lrs=ls -lrS'
alias 'lt=ls -lrt'
alias 'lrta=ls -lrtA'
alias 'j=jobs -l'
alias 'kw=kwrite'
alias 'tf=tail -f'
alias 'grep=grep --colour'
alias 'e=emacs -nw --quick'
alias 'vnice=nice -n 20 ionice -c 3'
alias 'get_iplayer=get_iplayer --nopurge'
alias 'vi=vim'
alias 'df=df -h'
alias octave="export GNUTERM=x11; /Applications/Octave.app/Contents/Resources/bin/octave -q"
alias gnuplot="/Applications/GnuPlot.app/Contents/Resources/bin/gnuplot"
alias 't=todo.sh'
alias 'tall=clear;t ls;t birdseye'
alias lately='t lately'
alias mirror="wget --wait=2 --convert-links --limit-rate=50K --no-parent --mirror -p -U Mozilla $1"
alias debug="sudo fs_usage -w -f filesys > ./fs_usage.log; egrep -e read fs_usage.log | less ; egrep -e write fs_usage.log |less; rm -rf fs_usage.log"
alias python=/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
#}}}
# Server Aliases {{{
alias server="ssh [email protected]"
alias hserver='ssh [email protected]'
# }}}
# Brew specific package management# {{{
alias 'install=brew install'
# }}}
# Play safe!# {{{
alias 'rm=rm -i'
alias 'mv=mv -i'
alias 'cp=cp -i'
alias shred='shred -vu' #securely delete a file
# }}}
# For convenience# {{{
alias 'mkdir=mkdir -p'
alias 'dus=du -mhs * | sort -n'
alias 'q=clear; exit'
# }}}
# Typing errors...{{{
alias 'c=clear;fortune'
alias 'ks=ls'
alias 'cd..=cd ..'
# }}}
# Global aliases (expand whatever their position)# {{{
# e.g. find . E L
alias -g L='| less'
alias -g H='| head'
alias -g S='| sort'
alias -g T='| tail'
alias -g N='> /dev/null'
alias -g E='2> /dev/null'
# }}}
# SSH aliases# {{{
alias 'sshme=ssh [email protected]'
# }}}
# Quick find
f() {
echo "find . -iname \"*$1*\""
find . -iname "*$1*"
}
# When directory is changed set xterm title to host:dir# {{{
chpwd() {
[[ -t 1 ]] || return
case $TERM in
sun-cmd) print -Pn "\e]l%~\e\\";;
*xterm*|rxvt|(dt|k|E)term) print -Pn "\e]2;%m:%~\a";;
esac
}
# }}}
# For quickly plotting data with gnuplot. Arguments are files for 'plot "<file>" with lines'.# {{{
plot () {
echo -n '(echo set term png; '
echo -n 'echo -n plot \"'$1'\" with lines; '
for i in $*[2,$#@]; echo -n 'echo -n , \"'$i'\" with lines; '
echo 'echo ) | gnuplot | display png:-'
(
echo "set term png"
echo -n plot \"$1\" with lines
for i in $*[2,$#@]; echo -n "," \"$i\" "with lines"
) | gnuplot | display png:-
}
# }}}
# Persistant gnuplot (can be resized etc)# {{{
plotp () {
echo -n '(echo -n plot \"'$1'\" with lines; '
for i in $*[2,$#@]; echo -n 'echo -n , \"'$i'\" with lines; '
echo 'echo ) | gnuplot -persist'
(
echo -n plot \"$1\" with lines
for i in $*[2,$#@]; echo -n "," \"$i\" "with lines"
echo
) | gnuplot -persist
}
# }}}
# Rotate a jpeg, losslessly# {{{
jrotate-r () {
for i in $*; do
exiftran -9 -b -i $i
done
}
# }}}
# Print some stuff before the shell starts {{{
date
if [[ -x `which fortune` ]]; then
echo
fortune -a 2> /dev/null
fi
#}}}
# The following lines were added by compinstall{{{
zstyle ':completion:*' completer _expand _complete _match
zstyle ':completion:*' completions 0
zstyle ':completion:*' format 'Completing %d'
zstyle ':completion:*' glob 0
zstyle ':completion:*' group-name ''
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*' matcher-list '+m:{a-z}={A-Z} r:|[._-]=** r:|=**' '' '' '+m:{a-z}={A-Z} r:|[._-]=** r:|=**'
zstyle ':completion:*' max-errors 1 numeric
zstyle ':completion:*' substitute 0
zstyle :compinstall filename "$HOME/.zshrc"
autoload -Uz compinit
compinit
# End of lines added by compinstall
zstyle -d users
#zstyle ':completion:*' users mrb04 matt
zstyle ':completion:*:*:*:users' ignored-patterns \
adm apache bin daemon games gdm halt ident junkbust lp mail mailnull \
named news nfsnobody nobody nscd ntp operator pcap postgres radvd \
rpc rpcuser rpm shutdown squid sshd sync uucp vcsa xfs backup bind \
dictd gnats identd irc man messagebus postfix proxy sys www-data \
avahi Debian-exim hplip list cupsys haldaemon ntpd proftpd statd
zstyle ':completion:*' hosts $( cat $HOME/.hosts* )
zstyle ':completion:*:cd:*' ignored-patterns '(*/)#lost+found' '(*/)#CVS'
zstyle ':completion:*:(all-|)files' ignored-patterns '(|*/)CVS'
zstyle ':completion:*:(rm|kill|diff):*' ignore-line yes
zstyle ':completion:*:*:kill:*' menu yes select
zstyle ':completion:*:kill:*' force-list always
zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
# Filename suffixes to ignore during completion (except after rm command)
# This doesn't seem to work
#zstyle ':completion:*:*:(^rm):*:*files' ignored-patterns '*?.o' '*?.c~' '*?.old' '*?.pro' '*~'
#zstyle ':completion:*:(all-|)files' file-patterns '(*~|\\#*\\#):backup-files' 'core(|.*):core\ files' '*:all-files'
zstyle ':completion:*:*:rmdir:*' file-sort time
zstyle ':completion:*' local matt.blissett.me.uk /web/matt.blissett.me.uk
# CD to never select parent directory
zstyle ':completion:*:cd:*' ignore-parents parent pwd
#}}}
# Quick ../../.. {{{
rationalise-dot() {
if [[ $LBUFFER = *.. ]]; then
LBUFFER+=/..
else
LBUFFER+=.
fi
}
zle -N rationalise-dot
bindkey . rationalise-dot
#}}}
#
autoload zsh/sched
# Copies word from earlier in the current command line
# or previous line if it was chosen with ^[. etc
autoload copy-earlier-word
zle -N copy-earlier-word
bindkey '^[,' copy-earlier-word
# Cycle between positions for ambigous completions
autoload cycle-completion-positions
zle -N cycle-completion-positions
bindkey '^[z' cycle-completion-positions
# Increment integer argument
autoload incarg
zle -N incarg
bindkey '^X+' incarg
# Write globbed files into command line
autoload insert-files
zle -N insert-files
bindkey '^Xf' insert-files
# xargs but zargs
autoload -U zargs
# Calculator
autoload zcalc
# Line editor
autoload zed
# Renaming with globbing
autoload zmv
# Add host/domain specific zshrc {{{
if [ -f $HOME/.zshrc-$HOST ]
then
. $HOME/.zshrc-$HOST
fi
if [ -f $HOME/.zshrc-$(hostname -s) ]
then
. $HOME/.zshrc-$(hostname -s)
fi
#}}}
# Clojure paths# {{{
PATH=$PATH:~/bin
# }}}
#CouchDB vars# {{{
export C="http://127.0.0.1:5984"
alias curlp='curl -X PUT'
alias curld='curl -X DELETE'
alias curldbg='curl -v'
# }}}
# Extract archives {{{
extract () {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) rar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*.7z) 7z x $1 ;;
*) echo "'$1' cannot be extracted via extract()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
#}}}
# Create a directory and move into it# {{{
mdc() { mkdir -p "$1" && cd "$1" }
# }}}
# Include your custom scripts in the PATH {{{
export PATH=$PATH:~/scripts
export PATH=$PATH:~/bin/todo.txt-cli/
export CLASSPATH=~/Library/clojure/clojure-1.2.0/:~/Library/jline:/
#}}}
## less manpage colors {{{
export LESS_TERMCAP_mb=$'\E[01;31m'
export LESS_TERMCAP_md=$'\E[01;31m'
export LESS_TERMCAP_me=$'\E[0m'
export LESS_TERMCAP_se=$'\E[0m'
export LESS_TERMCAP_so=$'\E[01;44;33m'
export LESS_TERMCAP_ue=$'\E[0m'
export LESS_TERMCAP_us=$'\E[01;32m'
#}}}
# Aliases for git {{{
# Aliases
alias g='git'
compdef g=git
alias gst='git status'
compdef _git gst=git-status
alias gl='git pull'
compdef _git gl=git-pull
alias gup='git fetch && git rebase'
compdef _git gup=git-fetch
alias gp='git push'
compdef _git gp=git-push
gdv() { git-diff -w "$@" | view - }
compdef _git gdv=git-diff
alias gc='git commit -v'
compdef _git gc=git-commit
alias gca='git commit -v -a'
compdef _git gca=git-commit
alias gco='git checkout'
compdef _git gco=git-checkout
alias gcm='git checkout master'
alias gb='git branch'
compdef _git gb=git-branch
alias gba='git branch -a'
compdef _git gba=git-branch
alias gcount='git shortlog -sn'
compdef gcount=git
alias gcp='git cherry-pick'
compdef _git gcp=git-cherry-pick
alias glg='git log --stat --max-count=5'
compdef _git glg=git-log
alias glgg='git log --graph --max-count=5'
compdef _git glgg=git-log
alias gss='git status -s'
compdef _git gss=git-status
alias ga='git add'
compdef _git ga=git-add
alias gm='git merge'
compdef _git gm=git-merge
# }}}
#
#
# Aliases for sparks# {{{
alias spark_gitlog='git shortlog -s | cut -f1 | spark' # }}}