guest@dotshare [~/groups/shells/zsh] $ ls The-Shit/ | cat

The Shit (scrot) (+11 likes)

trapd00r Jul 01, 2011 (shells/zsh)

01-colors.zsh(raw, dl)

SCROT

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
GREP_COLORS="38;5;230:sl=38;5;240:cs=38;5;100:mt=38;5;161;1:fn=38;5;197:ln=38;5;212:bn=38;5;44:se=38;5;166"
#LS_COLORS="*.m4a=38;5;137;1:*.s3m=38;5;71;1:*.S3M=38;5;71;1:*.mod=38;5;72:*.sid=38;5;71:*.mov=38;5;42:*.MOV=38;5;42:*.qcow=38;5;141:*.bak=38;5;41;1:*.signature=38;5;206:*.old=38;5;242:*.err=38;5;160;1:*.error=38;5;160;1:*.go=38;5;36;1:*.htm=38;5;125;1:*.html=38;5;125;1:*.fcm=38;5;41:*.fm2=38;5;35:*.torrent=38;5;58:*.mfasl=38;5;73:*.rdf=38;5;144:*.sqlite=38;5;60:*.tdy=38;5;214:*.ogv=38;5;94:*.out=38;5;46;1:*.un~=38;5;240:*.sample=38;5;130;1:*.example=38;5;225;1:*.enc=38;5;110;3:*.map=38;5;58;3:*.mf=38;5;220;3:*.tfm=38;5;64:*.pfb=38;5;64:*.pfm=38;5;64:*.afm=38;5;64:*.def=38;5;136:*.mtx=38;5;36;3:*.tex=38;5;172:*.etx=38;5;36;3:*.sty=38;5;58:*.cfg=1:*.properties=38;5;197;1:*.m4=38;5;196;3:*.tfnt=38;5;140:*.tcl=38;5;64;1:*.typelib=38;5;49:*.pfa=38;5;43:*.sed=38;5;130;1:*.awk=38;5;148;1:*.svg=38;5;24;1:*.ttf=38;5;69;1:*.cpp=38;5;24;1:*.cs=38;5;74;1:*.java=38;5;142;1:*.jsm=38;5;142;1:*.jad=38;5;142:*.jar=38;5;142:*.jhtm=38;5;142:*.jsp=38;5;142:*.ru=38;5;142:*.js=38;5;42:*.jsm=38;5;42:*.lisp=38;5;204;1:*.coffee=38;5;94;1:*.asm=38;5;240;1:*.mp4=38;5;124:*.flv=38;5;131:*.spl=38;5;44:*.sug=38;5;44:*.1=38;5;196;1:*.eps=38;5;192:*.xpm=38;5;32:*.gif=38;5;35:*.info=38;5;101:*.lua=38;5;34;1:*.t=38;5;028;1:*.textile=38;5;106:ln=target:*.hs=38;5;159:*.ini=38;5;122:*.part=38;5;240:*.pid=38;5;160:*.pod=38;5;172;1:*.vim=1:*.git=38;5;197:*.urlview=38;5;85:*.dump=38;5;119:*.conf=1:*.md=38;5;184:*.markdown=38;5;184:*.mkd=38;5;184:*.h=38;5;81:*.rb=38;5;192:*.c=38;5;110:*.diff=42;38:*.yml=38;5;208:*.PL=38;5;160:*.csv=38;5;78:tw=38;5;208;1:*.chm=38;5;144:*.bin=38;5;249:*.sms=38;5;33:*.pdf=38;5;203:*.cbz=38;5;140:*.cbr=38;5;140:*.nes=38;5;160:*.mpg=38;5;38:*.ts=38;5;39:*.sfv=38;5;197:*.m3u=38;5;172:*.txt=38;5;192:*.log=38;5;190:*.bash=38;5;173:*.swp=38;5;241:*.swo=38;5;236:*.theme=38;5;109:*.zsh=38;5;173:*.nfo=38;5;220:mi=38;5;124:or=38;5;160:ex=38;5;148;1:ln=target:pi=38;5;126:ow=38;5;208;1:di=38;5;30:*.pm=;38;5;197;1:*.pl=38;5;214:*.sh=38;5;113:*.patch=45;37:*.tar=38;5;118:*.tar.gz=38;5;34:*.zip=38;5;11:*.rar=38;5;106:*.tgz=38;5;11:*.7z=38;5;11:*.mp3=38;5;191:*.flac=38;5;166;1:*.mkv=38;5;202:*.avi=38;5;114:*.wmv=38;5;113:*.jpg=38;5;66:*.JPG=38;5;66:*.jpeg=38;5;67:*.png=38;5;68:*.pacnew=38;5;33:*.xz=38;5;118:*.iso=38;5;124:*.css=38;5;91:*.php=38;5;93:*.gitignore=38;5;240:*.tmp=38;5;244:*.py=38;5;41:*.rmvb=38;5;112:*.arj=38;5;11:*.a=38;5;59:*.a00=38;5;11:*.A64=38;5;82:*.pc=38;5;100:*.a52=38;5;112:*.gel=38;5;83:*.ggl=38;5;83:*.directory=38;5;83:*.a78=38;5;112:*.atr=38;5;213:*.j64=38;5;102:st=1;38;5;208:*.st=38;5;208:*.dat=38;5;165:*.db=38;5;60:*.xml=38;5;23:*.cdi=38;5;124:*.nrg=38;5;124:*.32x=38;5;137:*.gg=38;5;138:*.cue=38;5;112:*.adf=38;5;35:*.nds=38;5;193:*.gb=38;5;203:*.gbc=38;5;204:*.gba=38;5;205:*.sav=38;5;220:*.r00=38;5;233:*.r01=38;5;234:*.r02=38;5;235:*.r03=38;5;236:*.r04=38;5;237:*.r05=38;5;238:*.r06=38;5;239:*.r07=38;5;240:*.r08=38;5;241:*.r09=38;5;242:*.r10=38;5;243:*.r11=38;5;244:*.r12=38;5;245:*.r13=38;5;246:*.r14=38;5;247:*.r15=38;5;248:*.r16=38;5;249:*.r17=38;5;250:*.r18=38;5;251:*.r19=38;5;252:*.r20=38;5;253:*.r21=38;5;254:*.r22=38;5;255:*.r47=38;5;233:*.r46=38;5;234:*.r45=38;5;235:*.r44=38;5;236:*.r43=38;5;237:*.r42=38;5;238:*.r41=38;5;239:*.r40=38;5;240:*.r39=38;5;241:*.r38=38;5;242:*.r37=38;5;243:*.r36=38;5;244:*.r35=38;5;245:*.r34=38;5;246:*.r33=38;5;247:*.r32=38;5;248:*.r31=38;5;249:*.r30=38;5;250:*.r29=38;5;251:*.r28=38;5;252:*.r27=38;5;253:*.r26=38;5;254:*.r25=38;5;255:*.json=38;5;199:*.SKIP=38;5;244:*.1p=38;5;160:*.3p=38;5;160:*.r48=38;5;234:*.r49=38;5;235:*.r50=38;5;236:*.r51=38;5;237:*.r52=38;5;238:*.r53=38;5;239:*.r54=38;5;240:*.r55=38;5;241:*.r56=38;5;242:*.r57=38;5;243:*.r58=38;5;244:*.r59=38;5;245:*.r60=38;5;246:*.r61=38;5;247:*.r62=38;5;248:*.r63=38;5;249:*.r64=38;5;250:*.r65=38;5;251:*.r66=38;5;252:*.r67=38;5;253:*.r68=38;5;254:*.r69=38;5;255:*.r69=38;5;255:*.r70=38;5;254:*.r71=38;5;253:*.r72=38;5;252:*.r73=38;5;251:*.r74=38;5;250:*.r75=38;5;249:*.r76=38;5;248:*.r77=38;5;247:*.r78=38;5;246:*.r79=38;5;245:*.r80=38;5;244:*.r81=38;5;243:*.r82=38;5;242:*.r83=38;5;241:*.r84=38;5;240:*.r85=38;5;239:*.r86=38;5;238:*.r87=38;5;237:*.r88=38;5;236:*.r89=38;5;235:*.r90=38;5;234:*.r91=38;5;235:*.r92=38;5;236:*.r93=38;5;237:*.r94=38;5;238:*.r95=38;5;239:*.r96=38;5;240:*.r97=38;5;241:*.r98=38;5;242:*.r99=38;5;243:*.r100=38;5;244:*.r101=38;5;240:*.r102=38;5;241:*.r103=38;5;242:*.r104=38;5;243:*.r105=38;5;244:*.r106=38;5;245:*.r107=38;5;246:*.r108=38;5;247:*.r109=38;5;248:*.r110=38;5;249:*.r111=38;5;250:*.r112=38;5;251:*.r113=38;5;252:*.r114=38;5;253:*.r115=38;5;254:*.r116=38;5;255"

eval $( dircolors -b $HOME/dev/LS_COLORS/LS_COLORS )

export ACK_COLOR_MATCH="cyan bold"
export ACK_COLOR_FILENAME="cyan bold on_black"
export ACK_COLOR_LINENO="bold green"

export LS_COLORS GREP_COLORS

CLICK TO VIEW

x

02-abbrevations.zsh(raw, dl)

 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
#!/usr/bin/zsh

typeset -Ag abbreviations
abbreviations=(
  "pinc"  "/usr/{lib,share}/perl5/{core,site,vendor}_perl/"
  "jj"    "!$"
  "Im"    "| more"
  "Ia"    "| awk"
  "Ig"    "| grep"
  "Ieg"   "| egrep"
  "Iag"   "| agrep"
  "Igr"   "| groff -s -p -t -e -Tlatin1 -mandoc"
  "Ip"    "| $PAGER"
  "Ih"    "| head"
  "Ik"    "| keep"
  "It"    "| tail"
  "Is"    "| sort"
  "Iv"    "| ${VISUAL:-${EDITOR}}"
  "Iw"    "| wc"
  "Ix"    "| xargs"
)

magic-abbrev-expand() {
    local MATCH
    LBUFFER=${LBUFFER%%(#m)[_a-zA-Z0-9]#}
    LBUFFER+=${abbreviations[$MATCH]:-$MATCH}
    zle self-insert
}

no-magic-abbrev-expand() {
  LBUFFER+=' '
}

zle -N magic-abbrev-expand
zle -N no-magic-abbrev-expand
bindkey " " magic-abbrev-expand
bindkey "^x " no-magic-abbrev-expand


# vim: set ts=2 expandtab sw=2:
 

x

02-alias.zsh(raw, dl)

  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
#vim: tw=0 nowrap ts=2 ft=sh:

#alias perlbrew='PERLBREW_ROOT="/mnt/Leftover/Perl5" perlbrew'

alias 80='perl -e "print q[x] x 80, qq[\n]"'
alias perlu='perl -Mv5.12 -Mutf8 -Mstrict -Mautodie -Mwarnings -Mwarnings=FATAL,utf8 -CSAD -Mopen=:std,:utf8 -Mcharnames=:full -Mfeature=unicode_strings -MEncode=encode,decode -MUnicode::Normalize=NFD,NFC,NFKD,NFKC'

alias swe='translate -from en -to swe'
alias  en='translate -from swe -to en'

alias          np='pimpd -i'
alias         np2='pimpd2 -i'
alias         psh='pimpd2 -sh'
alias         sdb='pimpd2 --search-db'
alias         spl='pimpd2 --search-playlist'
alias         sar='pimpd2 --search-artist'
alias         sal='pimpd2 --search-album'
alias         set='pimpd2 --search-title'
alias         add='pimpd2 --add'
alias        play='pimpd2 --play'
alias        stop='pimpd2 --kill'
alias        next='pimpd2 --next && pimpd2 -np'
alias        prev='pimpd2 --prev && pimpd2 -np'
alias        crop='pimpd2 --crop'
alias        love='pimpd2 --love'
alias       slove='pimpd2 --slove'
alias      unlove='pimpd2 --unlove'
alias        rand='pimpd2 --randomize'
alias       randa='pimpd2 --random-album 10|pimpd2 --add && pimpd2 -play'
alias        copy='pimpd2 --copy'
alias       copya='pimpd2 --copy-album'
alias       queue='pimpd2 --queue'
alias       songs='pimpd2 --songs'
alias      albums='pimpd2 --albums'
alias   splaylist='pimpd2 --splaylist'
alias   playlists='pimpd2 --playlists'

alias   today="echo *(e:age today now:)|perl -pe 's/ /\n/g'"
alias    hour="echo *(e-age $(date +%H:00) now-)|perl -pe 's/ /\n/g'"
alias     gcc='gcc -ansi -pedantic -Wextra -Wempty-body -Wfloat-equal -Wignored-qualifiers -Wmissing-declarations -Wmissing-parameter-type -Wmissing-prototypes -Wold-style-declaration -Woverride-init -Wsign-compare -Wstrict-prototypes -Wtype-limits -Wuninitialized -fstack-protector-all -D_FORTIFY_SOURCE=2'
alias    gccc='gcc -ansi -pedantic -Wall'
alias csyntax='gcc -fsyntax-only'
alias   editc='vim $HOME/.zsh/01-colors.zsh $HOME/dev/File::LsColor/lib/File/LsColor.pm $HOME/devel/LS_COLORS/LS_COLORS'
alias   share='perl $HOME/dev/CPAN::Mirror::Server::HTTP/bin/cpanmirrorhttpd -root . -port 8080 --verbose'
alias     get='woof -u -U -i 0.0.0.0 -p 4040'
alias     put='woof -u -i 0.0.0.0 -p 4040'

alias brutus='ssh scp1@brutus.ethup.se'
alias macosx='ssh trapd00r@90.225.22.81'
alias macoss='ssh scp1@industrialrefuge.com'
alias  india='ssh scp1@192.168.1.102 -p 19216'
alias   dvdc='ssh scp1@192.168.1.100 -p 19216'
alias   n900='ssh -p 19216 user@192.168.1.112'
alias docupd='scp -P 19216 -r /mnt/Leftover/doc/* scp1@192.168.1.100:http/japh.se/doc'

alias   sshl='sshfs -p 19216 scp1@192.168.1.100:/var/log/lighttpd /mnt/lighttpd'

alias     gs='git status --short -b'
alias     gt='git tag|sort --reverse'
alias     gp='git push'
alias    gdd='git diff'
alias     gc='git commit'
alias    glp='gl -p'
alias    gcu='git commit -m "updates"'
alias github='PAGER=cat perl /home/scp1/bin/github'
alias   what="--stat -p --reverse HEAD@{1}.. | perl -pe 's/^(\++.+).*/\e[38;5;34m\e[1m$1\e[m/; s/^(\-+.*)/\e[38;5;196m\e[1m$1\e[m/'"
#alias     gd='PAGER="" git diff $ | skate --language diff -'

alias      cp='cp -v'
alias      mv='mv -v'
alias      rm='rm -v'
alias    grep='grep -Pi --color=auto'
alias   grepp='grep -Pi --color=auto "^|$@"'
alias    rmvi='rm *.sw*'
alias prename='prename -v'

alias      pc='perlcritic'
alias     pod='grep \=pod -A 9999 "$@"'
alias     pdb='perl -d -e 1'
alias   perlf='ack -f --perl'


#alias upstream='cd $HOME/bin/upstream && git-rec -d . -c pull -b master'
alias        r='perl $HOME/dev/App::Rel/rel/'

alias     x='cd $XDG_CONFIG_HOME'
alias     h='cd $HOME/dev/trapd00r.se'
alias    vb='cd $HOME/etc/vim/bundle'
alias tests='cd $HOME/dev/CPANTS'

alias     b='cd $HOME/bin'
alias     c='cd $HOME/etc'
alias     d='cd $HOME/dev'
alias     u='cd $HOME/dev/utils'
alias     g='cd $HOME/bin/upstream'
alias     z='cd $HOME/.zsh'
alias    aa='cd $HOME/dev/App::Autotest'
alias    ap='cd $HOME/dev/App::Pimpd'
alias    pp='cd $HOME/dev/App::Pimpd'
alias   apl='cd $HOME/dev/App::Pimpd_Legacy'
alias     p='cd $HOME/dev/App::Pimpd_Legacy'
alias     q='cd $HOME/dev/App::Pickyfont'
alias   apf='cd $HOME/dev/App::Pickyfont'
alias    ar='cd $HOME/dev/App::Rel/'
alias   RPD='cd $HOME/dev/App::RPD'
alias    at='cd $HOME/dev/App::Ttycolor'
alias    dm='cd $HOME/dev/Daemon::Mplayer'
alias   flc='cd $HOME/dev/File::LsColor'
alias   tec='cd $HOME/dev/Term::ExtendedColor'
alias   tet='cd $HOME/dev/Term::ExtendedColor::TTY'
alias   tex='cd $HOME/dev/Term::ExtendedColor::Xresources'
alias   mll='cd $HOME/dev/Module::LocalLoad'
alias   mnp='cd $HOME/dev/Mplayer::NowPlaying-CPAN'
alias xxlfd='cd $HOME/dev/Xorg::XLFD'
alias   mp3='cd /mnt/Leftover/TransferMusic'
alias     t='mkdr /tmp/scp1 ; cd /tmp/scp1'
alias    tt='cd $HOME/bin/upstream'

alias lsusb='lsusb | matchline -random'
alias lspci='lspci | matchline -lspci'

alias  ls=' ls++'
alias lso='\ls | pv -qL 10'
alias lsq='\ls --color=always --time-style=full-iso -AlQ'
alias lsl='\ls --color=auto   --group-directories-first -Ah'
alias lss='\ls --color=auto -1 | grep "(^\w*[^_-])"'
alias ls1='\ls -1'
alias lsa='\ls --color=auto --time-style=full-iso'
alias lsd='/bin/ls -FAv | grep /$ | column'


alias       ps='$HOME/bin/cope/ps'
alias     nmap='$HOME/bin/cope/nmap'
alias  netstat='$HOME/bin/cope/netstat'
alias ifconfig='$HOME/bin/cope/ifconfig'
alias     free='$HOME/bin/cope/free'
alias    fdisk='$HOME/bin/cope/fdisk'
alias       df='$HOME/bin/cope/df'

alias sortbycolumn='sort -n -k3'
alias            R='rehash'
alias           qi='qemu -cdrom iso -boot d hd'
alias           ss='source $HOME/etc/zsh/zshrc'
alias          npd='srinfo -np'
alias         scat='source-highlight -o STDOUT -f esc -i'

alias       v+='ossmix vmix0.pcm8 -- +2'
alias       v-='ossmix vmix0.pcm8 -- -2'
alias      v++='ossmix vmix0.pcm9 -- +2'
alias      v--='ossmix vmix0.pcm9 -- -2'

alias      wmp='wminput -c mplayer&'
alias      win='wminput -c ir_ptr -w -c neverball&'
alias      wir='wminput -c ir_ptr -w -c ir_ptr&'
alias      wim='wminput -c ir_ptr -w -c buttons-mame&'
alias      wig='wminput -c gamepad&'
alias      wit='wminput -c buttons-term&'

alias       fevil='find . -regextype posix-extended -regex'
alias         rec='ffmpeg -f x11grab -s 3360x1050 -r 150 -i :0.0 -sameq /tmp/foo.mpg'
alias         feh='feh -Fzrd'
alias     rampeak='dd if=/dev/mem|\cat|strings'
alias  seen_movie='chmod +t,o+w "$@"'
alias mountfixbug='echo 64 > /sys/block/sdn/device/max_sectors && mount -a'
alias     getmail='getmail --rcfile /home/scp1/.getmail/magnus_at_trapd00r.se \
              && getmail --rcfile /home/scp1/.getmail/trapd00r_at_trapd00r.se'

alias        i='echo http://i.japh.se && echo http://i.japh.se|xclip'
alias        l='echo http://l.japh.se && echo http://l.japh.se|xclip'
alias     japh='echo http://japh.se && echo http://japh.se|xclip'
alias      pst='echo http://p.japh.se && echo http://p.japh.se|xclip'
alias     todo='$HOME/dev/time-spent-in-vim/vim $HOME/doc/TODO'

alias    dmesg='$HOME/dev/Term::ExtendedColor/bin/colored_dmesg|grep -v TCP'
#alias      vim='/home/scp1/dev/time-spent-in-vim/vim'
alias  vimtime='/home/scp1/dev/time-spent-in-vim/vim --total'
alias    vimsh='vim *.sh'
alias    vimpm='vim *.pm'
alias    vimpl='vim *.pl'
alias     vimc='vim *.{c,h}'
alias     cpan='cpanm'
alias    flash=' clive --stream-exec="mplayer -really-quiet %i" --stream=10'
alias      cat='v'
alias      scx='TERM=xterm;screen -x'
alias     make='/home/scp1/dev/utils/mymake'
alias     wimp='(wminput -c mplayer&); mplayer'
alias       :q='exit'
alias      die='kill -9 $$'
alias    urxvt='urxvt -name URxvt.shiva'
alias     less='vimpager'
alias     wget='wget --no-check-certificate -U=Mozilla'
alias     ptop='watch -n1 ps aux --sort=+%cpu'
alias     tree='tree -dA'
alias      mem='su -c mem'
alias    links='/bin/cat /home/scp1/doc/links'
#alias  ncmpcpp='colorcoke -r 105 -g 30 -b 50 -s 0 -e 15&&ncmpcpp; \
#                  cc-x-color-scheme-trapd00r'
alias    dev='echo http://devel.japh.se/ \
                  && echo http://dev.japh.se/|xclip'


alias   1='printf "\e]710;%s\007" "9x15bold,xft:Kochi Gothic"'
alias   2='pickyfont -f speedy2'
alias   3='pickyfont -f progsole'
alias  pf='pickyfont ter7'
alias  jj='pickyfont -f terminus2'
alias   j='pickyfont -f terminus1'
alias   k='pickyfont -f proggy1'
alias lll='pickyfont -f profont4'
alias  ll='pickyfont -f profont2'
alias  hh='pickyfont -f fixed7'
alias  kk='pickyfont -f clea3'
alias   f='pickyfont monte1 normal \
            && pickyfont monte2 bold \
            && pickyfont pro1 italic'


alias evil="grep 'sub escape' -A 2 \
  $HOME/dev/App::Pimpd/lib/App/Pimpd/Validate.pm |
  tail -1|perl -pe 's/^\s+\$str =~ //'"

alias gource='gource -1280x720 --max-files 0 --file-idle-time 0 --bloom-multiplier 0.5 --bloom-intensity 0.9 -e 0.7 --background 121212 -o - | ffmpeg -y -b 3000K -r 60 -f image2pipe -vcodec ppm -i - -vcodec libx264 -vpre slow -threads 0 gource.mp4'
alias logstalgia='logstalgia  japh_selected_log -s 5 --output-ppm-stream - |  ffmpeg -y -b 3000K -r 60 -f image2pipe -vcodec ppm -i - -vcodec libx264 -vpre slow -threads 0 logstalgia.mp4'

alias testfetch='sync_cpantesters -a WOLDRICH -d $HOME/dev/CPANTS \
                    && cd $HOME/dev/CPANTS'

alias pkgclean="yes |
                  rm -r $(find $HOME/dev/PKGBUILDS -name 'pkg' \
                    && find $HOME/dev/PKGBUILDS -name 'src')"

alias   iostat='iostat -mtx'
alias     cpuu='ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10'
alias memusage='ps -e -orss=,args= | sort -b -k1,1n|pr -TW$COLUMNS'
alias    shiva='ps -eo pcpu,pid,user,args \
                  | sort -k 1 -r \
                  | head -10 && iostat -mtx && mpstat -P 'ALL' && sar'


alias a='printf "  %s\n  %s\n  %s\n  %s\n" "Magnus Woldrich" "CPAN ID: WOLDRICH" "m@japh.se" "http://japh.se"'
alias trapd00r='printf "\t\033#3trapd00r\n\t\033#4trapd00r\n\tA simple, lightweight Perl hacker\n"'
alias trapd00rc='printf "\t\033#3\e[38;5;25mt\e[38;5;26mr\e[38;5;27ma\e[38;5;31mp\e[38;5;32md\e[38;5;33m0\e[38;5;33m0\e[38;5;37mr\n\t\033#4\e[38;5;133mt\e[38;5;134mr\e[38;5;135ma\e[38;5;139mp\e[38;5;140md\e[38;5;141m00\e[38;5;145mr\n\t\e[38;5;240mA simple, lightweight Perl hacker\n"'
alias reset='printf "\033c\033(K\033[J\033[0m\033[?25h"'
alias dev_null='rm /dev/null; mknod /dev/null c 1 3'
 

x

02-alias-global.zsh(raw, dl)

 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
#vim: tw=0 nowrap ts=2 ft=sh:

alias -g     muttrc=$HOME/etc/muttrc
alias -g procmailrc=$HOME/.procmailrc
alias -g Xresources=$HOME/etc/Xresources


alias -g vimhome=$HOME/etc/vim
alias -g   vimrc=$HOME/etc/vimrc
alias -g vimfunc=$HOME/etc/vim/functions.vim
alias -g  vimmap=$HOME/etc/vim/mappings.vim
alias -g   vimft=$HOME/etc/vim/filetypes.vim
alias -g   vimab=$HOME/etc/vim/abbrevations.vim
alias -g  vimcol=$HOME/etc/vim/colors

alias -g     zshrc=$HOME/etc/zsh/zshrc
alias -g    zshcol=$HOME/etc/zsh/01-colors.zsh
alias -g     zshab=$HOME/etc/zsh/02-abbrevations.zsh
alias -g  zshalias=$HOME/etc/zsh/02-alias{,-suffix,-global}.zsh
alias -g     zshbm=$HOME/etc/zsh/02-bookmarks.zsh
alias -g   zshcmpl=$HOME/etc/zsh/02-completion.zsh
alias -g    zshexp=$HOME/etc/zsh/02-exports.zsh
alias -g    zshopt=$HOME/etc/zsh/02-setopts.zsh
alias -g   zshkeys=$HOME/etc/zsh/03-bindkeys.zsh
alias -g   zshfunc=$HOME/etc/zsh/03-functions.zsh
alias -g    zshgit=$HOME/etc/zsh/04-git.zsh
alias -g    zshapp=$HOME/etc/zsh/05-appearance.zsh
alias -g   zshperl=$HOME/etc/zsh/06-perlbrew.zsh
alias -g zshsyntax=$HOME/etc/zsh/10-syntax.zsh
alias -g  zshtheme=$HOME/etc/zsh/$ZSH_THEME.theme
 

x

02-alias-suffix.zsh(raw, dl)

  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
#!/usr/bin/zsh

local -a MPLAYER VIM FEH XCHM APVLV

VIM=(
  asm
  awk
  bash
  c
  cfg
  coffee
  conf
  cpp
  cs
  css
  csv
  diff
  enc
  eps
  etx
  ex
  example
  git
  gitignore
  go
  h
  hs
  htm
  html
  info
  ini
  java
  jhtm
  js
  jsm
  jsm
  json
  jsp
  lisp
  log
  lua
  map
  markdown
  md
  mf
  mfasl
  mi
  mkd
  mtx
  nfo
  pacnew
  patch
  pc
  pfa
  php
  pid
  PKGBUILD
  pl
  PL
  pm
  pod
  py
  rb
  rdf
  ru
  sed
  sfv
  sh
  signature
  sty
  sug
  t
  tcl
  tdy
  tex
  textile
  tfm
  tfnt
  theme
  txt
  urlview
  vim
  viminfo
  xml
  yml
  zsh
)

MPLAYER=(
  avi
  cue
  dat
  fcm
  flac
  flv
  m3u
  m4
  m4a
  m4v
  mkv
  mov
  mp3
  mp4
  mpeg
  MOV
  mpg
  ogg
  ogm
  ogv
  rmvb
  sample
  spl
  ts
  wmv
)

FEH=(
  bmp
  cdr
  gif
  ico
  jpeg
  jpg
  JPG
  png
  svg
  xpm
)

XCHM=(
  chm
)

APVLV=(
  pdf
)

local MPLAYER_CONFIG=$XDG_CONFIG_HOME/mplayer/config

alias -s $^VIM='vim -X --'
alias -s $^MPLAYER='mplayer -msgmodule 1 -msgcolor -include $MPLAYER_CONFIG --'
alias -s $^FEH='feh -Fzrd --'
alias -s $^XCHM='xchm --noindex --'
alias -s $^APVLV='apvlv'

alias -s se='ssh'


# vim: set ts=2 expandtab sw=2 ft=sh:
 

x

02-bookmarks.zsh(raw, dl)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
#!/usr/bin/zsh

hash -d b=~/bin
hash -d c=~/etc
hash -d d=~/dev
hash -d h=~/dev/trapd00r.se
hash -d rc=~/etc/rc.d/
hash -d u=~/dev/utils
hash -d up=~/bin/upstream
hash -d v=~/.vim
hash -d x=~/.config


# vim: set ts=2 expandtab sw=2:
 

x

02-completion.zsh(raw, dl)

  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
#!/usr/bin/zsh

#zstyle ':completion:*'                       list-colors ${(s.:.)LS_COLORS}

zstyle ':completion:*'                       accept-exact '*(N)'
zstyle ':completion:*'                       separate-sections 'yes'
zstyle ':completion:*'                       list-dirs-first true
zstyle ':completion:*:default'               list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*'                       menu select=200
zstyle ':completion:*'                       use-perl=1
zstyle ':completion:*'                       my-accounts='m@japh.se'

zstyle ':completion:*'                       squeeze-slashes true
zstyle ':completion:*:cd:*'                  ignore-parents parent pwd
#zstyle ':completion:*:cd:*'                  tag-order 'named-directories'

zstyle ':completion:*:(all-|)files'          ignored-patterns '*.un~'
zstyle ':completion:*:*:kill:*:processes' \
  list-colors '=(#b) #([0-9]#)*=0=01;31'

zstyle ':completion::complete:*'             use-cache on
zstyle ':completion::complete:*'             cache-path ~/etc/cache/$HOST
zstyle ':completion:*:processes'             command 'ps -axw'
zstyle ':completion:*:processes-names'       command 'ps -awxho command'
zstyle ':completion:*'                       matcher-list 'm:{a-z}={A-Z}'
zstyle ':completion:*:functions'             ignored-patterns '_*'

zstyle ':completion:*' group-name            ''
zstyle ':completion:*:*:mplayer:*'           tag-order files
zstyle ':completion:*:*:mplayer:*'           file-patterns   \
       '*.(rmvb|mkv|mpg|wmv|mpeg|avi|flv|mp3|mp4|flac|ogg):video' \
       '*:all-files' '*(-/):directories'

zstyle ':completion:*:*:(vim|rview|vimdiff|xxd):*:*files' \
  ignored-patterns '*~|*.(old|bak|zwc|viminfo|rxvt-*|zcompdump)|pm_to_blib|cover_db|blib' \
  file-sort modification
zstyle ':completion:*:*:(vim|rview|vimdiff|xxd):*' \
  file-sort modification
zstyle ':completion:*:*:(vim|rview|vimdiff|xxd):*' \
  tag-order files
#zstyle ':completion:*:vim:*:directories' ignored-patterns \*

zstyle ':completion:*:*:(scp):*' \
  file-sort modification

zstyle ':completion:*:*:(cd):*:*files' ignored-patterns '*~' file-sort access
zstyle ':completion:*:*:(cd):*'        file-sort access
zstyle ':completion:*:*:(cd):*'        menu select
zstyle ':completion:*:*:(cd):*'        completer _history

zstyle ':completion:*:*:perl:*'        file-patterns '*'


zstyle ':completion:*:descriptions' \
  format $'%{- \e[38;5;137;1m\e[48;5;234m%}%B%d%b%{\e[m%}'
zstyle ':completion:*:warnings' \
  format $'%{No match for \e[38;5;240;1m%}%d%{\e[m%}'

zstyle ':completion:*:*:apvlv:*'             tag-order files
zstyle ':completion:*:*:apvlv:*'             file-patterns '*.pdf'

zstyle ':completion:most-accessed-file:*' match-original both
zstyle ':completion:most-accessed-file:*' file-sort access
zstyle ':completion:most-accessed-file:*' file-patterns '*:all\ files'
zstyle ':completion:most-accessed-file:*' hidden all
zstyle ':completion:most-accessed-file:*' completer _files


zstyle ':completion:*:scp:*' group-order \
      users files all-files hosts-domain hosts-host hosts-ipaddr

zstyle ':completion:*:ssh:*' tag-order \
      users 'hosts:-host hosts:-domain:domain hosts:-ipaddr:IP\ address *'

zstyle ':completion:*:ssh:*' group-order \
      hosts-domain hosts-host users hosts-ipaddr

zstyle ':completion:*:(ssh|scp):*:hosts-host' ignored-patterns \
      '*.*' loopback localhost

zstyle ':completion:*:(ssh|scp):*:hosts-domain' ignored-patterns \
      '<->.<->.<->.<->' '^*.*' '*@*'

zstyle ':completion:*:(ssh|scp):*:hosts-ipaddr' ignored-patterns \
      '^<->.<->.<->.<->' '127.0.0.<->'

zstyle ':completion:*:(ssh|scp):*:users' ignored-patterns \
      adm bin daemon halt lp named shutdown sync

zstyle ':completion:*:(ssh|scp):*:my-accounts' users-hosts \
  'scp1@192.168.1.100' 'scp1@brutus.ethup.se' 'trapd00r@90.225.22.81'


zstyle ':completion:*:*:*:users' ignored-patterns \
        adm amanda apache avahi beaglidx bin cacti canna clamav daemon \
        dbus distcache dovecot fax ftp games gdm gkrellmd gopher \
        hacluster haldaemon halt hsqldb ident junkbust ldap lp mail \
        mailman mailnull mldonkey mysql nagios \
        named netdump news nfsnobody nobody nscd ntp nut nx openvpn \
        operator pcap postfix postgres privoxy pulse pvm quagga radvd \
        rpc rpcuser rpm shutdown squid sshd sync uucp vcsa xfs
zstyle '*' single-ignored show

#zstyle ':completion:*:options'               menu search



go_prefixes=(5 6 8)
for p in $prefixes; do
  compctl -g "*.${p}" ${p}l
  compctl -g "*.go"   ${p}g
done
compctl -g "*.go" gofmt
compctl -g "*.go" gccgo


#zstyle ':completion:*:*:kill:*' menu yes select
#zstyle ':completion:*:kill:*'   force-list always
#zstyle ':completion:*' menu select=10 interactive list-dirs-first


# vim: set ts=2 expandtab sw=2:
 

x

02-exports.zsh(raw, dl)

  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
#!/usr/bin/zsh

#export RELEASE_TESTING=1

export HOSTNAME="shiva"
export ZSH_THEME="trapd00r"
export ZSH_ACTIVE_COMPLETIONS="$( echo ${(kv)_comps[@]} )"
export EDITOR=vim
export PAGER=vimpager
export ACKRC="/home/scp1/etc/ackrc"

export XDG_CONFIG_HOME="$HOME/etc"
export XDG_CACHE_HOME="$HOME/etc/cache"
export XDG_DATA_HOME="$HOME/var"
export DEVEL_HOME="$HOME/dev"
export BIN_HOME="$HOME/bin"
export DEVEL_HOME="$HOME/dev"

export PERL_HACK_LIB="/tmp"
export PERL_MM_USE_DEFAULT=1
#export PERL5OPT='-Mstrict'

export HARNESS_SUMMARY_COL_FAIL="bold red"
export HARNESS_SUMMARY_COL_SUC="bold cyan"

export GIST_DIR=$HOME/dev/_gists/

export GOROOT=$HOME/go
export GOOS='linux'
export GO_ARCH=386

export VI_QUICKFIX_SOURCEFILE='stdin'

export LP_DEST="Canon_MP150"
export PRINTER="Canon_MP150"

export HISTFILE=$XDG_DATA_HOME/zsh/history
export HISTSIZE=5000
export SAVEHIST=1000000
export HISTIGNORE="&:ls:[bf]g:exit:reset:clear:cd*"

export MOZ_DISABLE_PANGO=1
export CLIVE_CONFIG="/home/scp1/etc/cliverc"

export PATH=$HOME/dev/utils:~/bin:/bin:/usr/bin:/usr/local/bin:/usr/bin/site_perl:/usr/bin/core_perl:/usr/bin/vendor_perl:/usr/lib/perl5/site_perl/bin:/usr/lib/perl5/vendor_perl/bin:/usr/lib/perl5/core_perl/bin:/sbin:/usr/sbin:/usr/bin/perlbin/site:/usr/bin/perlbin/vendor:/usr/bin/perlbin/core:/home/scp1/perl5/perlbrew/perls/perl-5.8.3/:$HOME/go/bin
export MANPATH=$MANPATH:/usr/local/man:/opt/local/share/man

export FONT='-windows-montecarlo-medium-r-normal--0-0-72-72-c-0-microsoft-cp1252'
export FONT_B='-windows-montecarlo-bold-r-normal--0-0-72-72-c-0-microsoft-cp1252'
export FONT_I='-nil-profont-medium-r-normal--10-100-72-72-c-50-iso8859-1'

export CLIPBORED_DMENU_FONT=${FONT}
export CLIPBORED_DMENU_NORMAL_FG='#484848'
export CLIPBORED_DMENU_NORMAL_BG='#1c1c1c'
export CLIPBORED_DMENU_SELECT_FG='#1c78ef'
export CLIPBORED_DMENU_SELECT_BG='#292929'
export CLIPBORED_DMENU_LISTMODE='vertical'
export CLIPBORED_DMENU_LINES=30

export DMENU_FONT=${FONT}
export DMENU_NORMAL_FG='#484848'
export DMENU_NORMAL_BG='#1c1c1c'
export DMENU_SELECT_FG='#1c78ef'
export DMENU_SELECT_BG='#292929'
export DMENU_LINES='-l 30'

export DZEN_FONT=${FONT}
export DZEN_FG='#ffffff'
export DZEN_BG='#1c1c1c'
export DZEN_WIDTH=1680
export DZEN_X_POS=0
export DZEN_Y_POS=1040
export DZEN_ALIGNMENT='c'

export X_OSD_COLOR='#a8ff00'

export MPD_HOST='localhost'

#export MPD_HOST='192.168.1.100'
#export MPD_PORT=6600
#export MPD_PASS=`smokingkills`
#export MPD_USER='scp1'

export LISTMAX=300


#export CDPATH='.:~:/mnt'

#export PERL_DL_NONLAZY=1
#export PERLBREW_ROOT="/mnt/Leftover/Perl5"
#export PERL_UNICODE=1

## Use Term::ReadLine::Zoid for vi-bindings
## Not needed anymore - http://japh.se/all/perl/2011/01/21/Readline/
## also see https://github.com/trapd00r/configs/blob/master/.inputrc
#export PERL_RL=Zoid



# vim: set ts=2 expandtab sw=2:
 

x

03-bindkeys.zsh(raw, dl)

 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
#!/usr/bin/zsh

bindkey -v
bindkey "^?" backward-delete-char
bindkey "^H" backward-delete-char
bindkey "^[[3~" delete-char
bindkey "^[[1~" beginning-of-line
bindkey "^[[4~" end-of-line
bindkey '^r' history-incremental-search-backward
bindkey "^[[5~" up-line-or-history
bindkey "^[[6~" down-line-or-history
bindkey "^A" beginning-of-line
bindkey "^E" end-of-line
bindkey "^W" backward-delete-word
bindkey "^b" backward-word
bindkey "^f" forward-word
bindkey "^d" delete-word
bindkey "^k" kill-line
bindkey ' ' magic-space
bindkey '^I' complete-word

bindkey -M isearch ' ' self-insert

bindkey -s '^x0' ' &> /dev/null '
bindkey -s '^x1' '  > /dev/null '
bindkey -s '^x2' ' 2> /dev/null '
bindkey -s '^x3' ' 2>&1 '

bindkey -s '^p' 'mpc playlist --format "%file%" | separate | ls_color\n'
bindkey -s '^t' '\\top\n'
bindkey -s '^n' '\\ncmpcpp\n'
bindkey -s '^v' 'vim\n'


# Bind custom defined completers
bindkey "^N"      most-accessed-file
bindkey "^X^A"    all-matches
bindkey "^_^A"    all-matches
bindkey "^X^P"    pids
bindkey "^_^P"    pids
 

x

03-functions.zsh(raw, dl)

  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
apvlv() {
  /usr/bin/apvlv -c $XDG_CONFIG_HOME/apvlvrc "$@"
}

cpan_up() {
  cpan_upload "$@" && mv -v "$@" /mnt/Docs/Backup/
}

neverball() {
  /usr/bin/neverball --data $XDG_CONFIG_HOME/neverball/
}

mplayer() {
  /usr/bin/mplayer \
    -msgmodule 1 -msgcolor -include $XDG_CONFIG_HOME/mplayer/config "$@"
}

mplayer_headphones() {
  /usr/bin/mplayer \
    -msgmodule 1 -msgcolor -include $XDG_CONFIG_HOME/mplayer/config \
    -channels 6 -af resample=48000,hrtf "$@"
}

zc() {
  for z in $HOME/etc/zsh/*.zsh $HOME/.zshrc; do
    zcompile $z
    echo "Compiled $z"
  done
}

tig() {
  TERM=xterm-256color /usr/bin/tig
}

mutt() {
  TERM=xterm-256color /usr/bin/mutt -F /home/scp1/etc/muttrc "$@"
}

re() {
  [[ $1 =~ $REPLY ]]
}

vimconfig() {
  $HOME/dev/time-spent-in-vim/vim $HOME/.vim{rc,/*.vim}
}

zshconfig() {
  $HOME/dev/time-spent-in-vim/vim $XDG_CONFIG_HOME/zsh/*.{zsh,theme}
}

commands() {
  echo -n $PATH | xargs -d : -I {} find {} -maxdepth 1 \
       -executable -type f -printf '%P\n' | sort -u
}

daemon() {
  echo '
sub daemonize {
  my $daemon_log = shift // q{/dev/null};
  use POSIX q{setsid};
  my $PID = fork();
  exit(0) if($PID); #parent
  exit(1) if(!defined($PID)); # out of resources

  setsid();
  $PID = fork();
  exit(1) if(!defined($PID));

  if($PID) { # parent
    waitpid($PID, 0);
    unlink($pidfile_daemon); # remove the lock when child have died
    exit(0);
  }
  elsif($PID == 0) { # child
    open(my $fh, q{>}, $pidfile_daemon)
      or die(qq{Cant open $pidfile_daemon: $!});
    print $fh $$;
    close($fh);
    open(STDOUT, q{>}, $daemon_log);
    open(STDERR, q{>}, q{/dev/null});
    open(STDIN,  q{<}, q{/dev/null});
  }
}
sub killkid {
  open(my $fh, q{<}, $pidfile_pimpd) or return 1; # for now
  my $pimpd_player = <$fh>;
  close($fh);
  return 0;
}'
}


doc() {
  builtin cd $HOME/doc
  if [[ $(pwd) == "$HOME/doc" ]]; then
    find . -maxdepth 1 -regextype posix-extended  -regex '^[.]/[^\.].+' \
           -type f -printf "%f\n"| sort | ls_color
  fi
}

du1() {
  du -h --max-depth=1 "$@" | sort -k 1,1hr -k 2,2f;
}

horny() { feh -FZrD3 /mnt/Porn/00-Pics/** && printf "Done!\n" }

vimp() {
  /home/scp1/dev/time-spent-in-vim/vim $(find . |grep -Pi '.+(?:pl|pm)$'|grep -v 'blib'|perl -pe 's/\n/ /')
}

vimgo() {
  /home/scp1/dev/time-spent-in-vim/vim $(find . |grep -Pi '.+(?:go)$'|perl -pe 's/\n/ /')
}


cd() {
  builtin cd $@; ls
}
regcheck() {
  emulate -L zsh
  zmodload -i zsh/pcre
  pcre_compile $1 && \
  pcre_match $2 && echo 'matches' || echo 'no match'
}
zsh_stats() {
  history|awk '{print $2}'|sort|uniq -c|sort -rn|head
}
mk() {
  mkdir -p $1
  cd $1
}

absurl() {
  perl -MWWW::Mechanize -e "$m = WWW::Mechanize->new;$u=shift;$m->get($u)||die;print $_->url_abs, "\n" for  $m->links;"
}

tf() {
    val=$?
    if [ "$val" = "0" ]
    then
        echo ":-)"
    else
        echo ":-("
    fi
}

goto() { [ -d "$1" ] && cd "$1" || cd "$(dirname "$1")"; }
cpf() { cp "$@" && goto "$_"; }
mvf() { mv "$@" && goto "$_"; }

# vim: ft=sh:
 

x

04-git.zsh(raw, dl)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# get the name of the branch we are on
function git_prompt_info() {
  ref=$(git symbolic-ref HEAD 2> /dev/null) || return
  echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"
}

parse_git_dirty () {
  if [[ $((git status 2> /dev/null) | tail -n1) != "nothing to commit (working directory clean)" ]]; then
    echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
  else
    echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
  fi
}

#
# Will return the current branch name
# Usage example: git pull origin $(current_branch)
#
function current_branch() {
  ref=$(git symbolic-ref HEAD 2> /dev/null) || return
  echo ${ref#refs/heads/}
}
 

x

05-appearance.zsh(raw, dl)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# ls colors
autoload colors; colors;

setopt multios
setopt cdablevarS

if [[ x$WINDOW != x ]]
then
    SCREEN_NO="%B$WINDOW%b "
else
    SCREEN_NO=""
fi

# Apply theming defaults
PS1="%n@%m:%~%# "

# git theming default: Variables for theming the git info prompt
#export ZSH_THEME_GIT_PROMPT_PREFIX="git->["         # Prefix at the very beginning of the prompt, before the branch name
#export ZSH_THEME_GIT_PROMPT_SUFFIX="]"             # At the very end of the prompt
#export ZSH_THEME_GIT_PROMPT_DIRTY="Œ"              # Text to display if the branch is dirty
#export ZSH_THEME_GIT_PROMPT_CLEAN="afaf"               # Text to display if the branch is clean

# Setup the prompt with pretty colors
setopt prompt_subst
 

x

06-perlbrew.zsh(raw, dl)

 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
if [[ -f $HOME/.perlbrew/init ]]; then
    source $HOME/.perlbrew/init
fi

__perlbrew_reinit () {
    echo '# DO NOT EDIT THIS FILE' > $HOME/.perlbrew/init
    command perlbrew env $1 >> $HOME/.perlbrew/init
    source $HOME/.perlbrew/init
    __perlbrew_set_path
}

__perlbrew_set_path () {
    [[ -z "$PERLBREW_ROOT" ]] && return 1
    export PATH_WITHOUT_PERLBREW=$(perl -e 'print join ":", grep { index($_, $ENV{PERLBREW_ROOT}) } split/:/,$ENV{PATH};')
    export PATH=$PERLBREW_PATH:$PATH_WITHOUT_PERLBREW
}
__perlbrew_set_path


perlbrew () {
    local exit_status
    case $1 in
        (use)
            if [[ -x "$PERLBREW_ROOT/perls/$2/bin/perl" ]]; then
                eval $(command perlbrew env $2)
                __perlbrew_set_path
            elif [[ "$2" = "system" ]]; then
                unset PERLBREW_PERL
                eval $(command perlbrew env)
                __perlbrew_set_path
            else
                echo "$2 is not installed" >&2
                exit_status=1
            fi
            ;;

        (switch)
            if [[ ! -d $HOME/.perlbrew ]]; then
                mkdir -p $HOME/.perlbrew
            fi

            if [[ -x "$PERLBREW_ROOT/perls/$2/bin/perl" ]]; then
                __perlbrew_reinit $2

            elif [[ "$2" = "system" ]]; then
                perlbrew off
                return $?
            else
                echo "$2 is not installed" >&2
                exit_status=1
            fi
            ;;

        (off)
            if [[ ! -d $HOME/.perlbrew ]]; then
                mkdir -p $HOME/.perlbrew
            fi

            unset PERLBREW_PERL
            command perlbrew off

            __perlbrew_reinit
            ;;

        (*)
            command perlbrew $*
            exit_status=$?
            ;;
    esac
    hash -r
    return ${exit_status:-0}
}
 

x

10-syntax.zsh(raw, dl)

  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
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
#!/bin/zsh
# Name:   zsh-syntax-highlighting-filetypes
# Author: Magnus Woldrich <m@japh.se>
# Update: 2011-06-20 23:26:38
#
# This is based on nicoulaj's zsh-syntax-highlighting project [0]. I've
# taken the initial version of his script and added highlighting for
# filetypes and a few other things. The filetype highlighting rules are
# taken from my LS_COLORS [1] project.
#
# This will only work in terminals capable of displaying 256 colors.
#
# [0]: https://github.com/nicoulaj/zsh-syntax-highlighting
# [1]: https://github.com/trapd00r/LS_COLORS


# Core highlighting update system

# Array used by highlighters to declare overridable styles.
typeset -gA ZSH_HIGHLIGHT_STYLES

# An `object' implemented by below 3 arrays' elements could be called a
# `highlighter', registered by `_zsh_highlight_add-highlighter`. In
# other words, these arrays are indexed and tied by their own
# functionality. If they have been arranged inconsistently, things goes
# wrong. Please see `_zsh_highlight-zle-buffer` and `_zsh_highlight_add-
# highlighter`.


# Actual recolorize functions to be called.
typeset -a zsh_highlight_functions; zsh_highlight_functions=()

# Predicate functions whether its recolorize function should be called or not.
typeset -a zsh_highlight_predicates; zsh_highlight_predicates=()

# Highlight storages for each recolorize functions.
typeset -a zsh_highlight_caches; zsh_highlight_caches=()

_zsh_highlight-zle-buffer() {
  if (( PENDING )); then
    return
  fi

  local ret=$?
  {
    local -a funinds
    local -i rh_size=$#region_highlight
    for i in {1..${#zsh_highlight_functions}}; do
      local pred=${zsh_highlight_predicates[i]}
      local cache_place=${zsh_highlight_caches[i]}
      if _zsh_highlight-zle-buffer-p "$rh_size" "$pred"; then
        if ((${#${(P)cache_place}} > 0)); then
          region_highlight=(${region_highlight:#(${(P~j.|.)cache_place})})
          local -a empty; empty=(); : ${(PA)cache_place::=$empty}
        fi
        funinds+=$i
      fi
    done
    for i in $funinds; do
      local func=${zsh_highlight_functions[i]}
      local cache_place=${zsh_highlight_caches[i]}
      local -a rh; rh=($region_highlight)
      {
        "$func"
      } always  {
        : ${(PA)cache_place::=${region_highlight:#(${(~j.|.)rh})}}
      }
    done
  } always {
    ZSH_PRIOR_CURSOR=$CURSOR
    ZSH_PRIOR_HIGHLIGHTED_BUFFER=$BUFFER
    return $ret
  }
}

# Whether supplied highlight_predicate satisfies or not.
_zsh_highlight-zle-buffer-p() {
  local region_highlight_size="$1" highlight_predicate="$2"
  # If any highlightings are not taken into account, asume it is needed.
  # This holds for some up/down-history commands, for example.
  ((region_highlight_size == 0)) || "$highlight_predicate"
}

# Whether the command line buffer is modified or not.
_zsh_highlight_buffer-modified-p() {
  [[ ${ZSH_PRIOR_HIGHLIGHTED_BUFFER:-} != $BUFFER ]]
}

# Whether the cursor is moved or not.
_zsh_highlight_cursor-moved-p() {
  ((ZSH_PRIOR_CURSOR != $CURSOR))
}

# Register an highlighter.
_zsh_highlight_add-highlighter() {
  zsh_highlight_functions+="$1"
  zsh_highlight_predicates+="${2-${1}-p}"
  zsh_highlight_caches+="${3-${1//-/_}}"
}


# Main highlighter

ZSH_HIGHLIGHT_STYLES+=(
  default                       'fg=248'
  unknown-token                 'fg=196,bold,bg=234'
  reserved-word                 'fg=197,bold'
  alias                         'fg=197,bold'
  builtin                       'fg=107,bold'
  function                      'fg=85,bold'
  command                       'fg=166,bold'
  hashed-command                'fg=70'
  path                          'fg=30'
  globbing                      'fg=170,bold'
  history-expansion             'fg=blue'
  single-hyphen-option          'fg=244'
  double-hyphen-option          'fg=244'
  back-quoted-argument          'fg=220,bold'
  single-quoted-argument        'fg=137'
  double-quoted-argument        'fg=137'
  dollar-double-quoted-argument 'fg=148'
  back-double-quoted-argument   'fg=172,bold'
  assign                        'fg=240,bold'

  filetype-perl                 'fg=214'
  filetype-sh                   'fg=113'
  filetype-bash                 'fg=173'
  filetype-1                    'fg=196,bold'
  filetype-1p                   'fg=160,bold'
  filetype-32x                  'fg=137,bold'
  filetype-3p                   'fg=160,bold'
  filetype-7z                   'fg=40,bold'
  filetype-a00                  'fg=11,bold'
  filetype-a52                  'fg=112,bold'
  filetype-a64                  'fg=82'
  filetype-A64                  'fg=82'
  filetype-a78                  'fg=112'
  filetype-adf                  'fg=35'
  filetype-a                    'fg=46'
  filetype-afm                  'fg=58'
  filetype-am                   'fg=242'
  filetype-arj                  'fg=41'
  filetype-asm                  'fg=240;1'
  filetype-atr                  'fg=213'
  filetype-avi                  'fg=114'
  filetype-awk                  'fg=148;1'
  filetype-bak                  'fg=41;1'
  filetype-bash                 'fg=173'
  filetype-bat                  'fg=108'
  filetype-BAT                  'fg=108'
  filetype-bin                  'fg=249'
  filetype-bmp                  'fg=62'
  filetype-bz2                  'fg=44'
  filetype-cbr                  'fg=140'
  filetype-cbz                  'fg=140'
  filetype-cdi                  'fg=124'
  filetype-cdr                  'fg=59'
  filetype-cfg                  'bold'
  filetype-c                    'fg=110'
  filetype-chm                  'fg=144'
  filetype-coffee               'fg=94;1'
  filetype-conf                 'bold'
  filetype-cpp                  'fg=24;1'
  filetype-cs                   'fg=74;1'
  filetype-css                  'fg=91'
  filetype-csv                  'fg=78'
  filetype-cue                  'fg=112'
  filetype-dat                  'fg=165'
  filetype-db                   'fg=60'
  filetype-def                  'fg=136'
  filetype-diff                 'fg=232,bg=197'
  filetype-directory            'fg=83'
  filetype-djvu                 'fg=141'
  filetype-dump                 'fg=119'
  filetype-enc                  'fg=192;3'
  filetype-eps                  'fg=192'
  filetype-err                  'fg=160;1'
  filetype-error                'fg=160;1'
  filetype-etx                  'fg=172'
  filetype-example              'fg=225;1'
  filetype-ex                   'fg=148;1'
  filetype-fcm                  'fg=41'
  filetype-flac                 'fg=166;1'
  filetype-flv                  'fg=131'
  filetype-fm2                  'fg=35'
  filetype-gba                  'fg=205'
  filetype-gbc                  'fg=204'
  filetype-gb                   'fg=203'
  filetype-gel                  'fg=83'
  filetype-gg                   'fg=138'
  filetype-ggl                  'fg=83'
  filetype-gif                  'fg=72'
  filetype-git                  'fg=197'
  filetype-gitignore            'fg=240'
  filetype-go                   'fg=36;1'
  filetype-h                    'fg=81'
  filetype-hs                   'fg=159'
  filetype-htm                  'fg=125;1'
  filetype-html                 'fg=125;1'
  filetype-ico                  'fg=73'
  filetype-in                   'fg=242'
  filetype-info                 'fg=101'
  filetype-ini                  'fg=122'
  filetype-iso                  'fg=124'
  filetype-j64                  'fg=102'
  filetype-jad                  'fg=50'
  filetype-jar                  'fg=51'
  filetype-java                 'fg=142;1'
  filetype-jhtm                 'fg=125;1'
  filetype-jpeg                 'fg=66'
  filetype-jpg                  'fg=66'
  filetype-JPG                  'fg=66'
  filetype-js                   'fg=42'
  filetype-jsm                  'fg=42'
  filetype-jsm                  'fg=42'
  filetype-json                 'fg=199'
  filetype-jsp                  'fg=45'
  filetype-lisp                 'fg=204;1'
  filetype-log                  'fg=190'
  filetype-lua                  'fg=34;1'
  filetype-m3u                  'fg=172'
  filetype-m4a                  'fg=137;1'
  filetype-m4                   'fg=196;3'
  filetype-map                  'fg=58;3'
  filetype-markdown             'fg=184'
  filetype-md                   'fg=184'
  filetype-mfasl                'fg=73'
  filetype-mf                   'fg=220;3'
  filetype-mi                   'fg=124'
  filetype-mkd                  'fg=184'
  filetype-mkv                  'fg=202'
  filetype-mod                  'fg=72'
  filetype-mov                  'fg=42'
  filetype-MOV                  'fg=42'
  filetype-mp3                  'fg=191'
  filetype-mp4                  'fg=124'
  filetype-mpeg                 'fg=38'
  filetype-mpg                  'fg=38'
  filetype-mtx                  'fg=36;3'
  filetype-nds                  'fg=193'
  filetype-nes                  'fg=160'
  filetype-nfo                  'fg=220'
  filetype-nrg                  'fg=124'
  filetype-odb                  'fg=161'
  filetype-odp                  'fg=166'
  filetype-ods                  'fg=112'
  filetype-odt                  'fg=111'
  filetype-oga                  'fg=95'
  filetype-ogg                  'fg=96'
  filetype-ogm                  'fg=97'
  filetype-ogv                  'fg=94'
  filetype-old                  'fg=242'
  filetype-out                  'fg=46;1'
  filetype-pacnew               'fg=33'
  filetype-part                 'fg=240;1'
  filetype-patch                'fg=232,bold,bg=197'
  filetype-pcf                  'fg=65'
  filetype-pc                   'fg=100'
  filetype-pdf                  'fg=203'
  filetype-pfa                  'fg=43'
  filetype-pfb                  'fg=58'
  filetype-pfm                  'fg=58'
  filetype-php                  'fg=93'
  filetype-pid                  'fg=160'
  filetype-pi                   'fg=126'
  filetype-PL                   'fg=160'
  filetype-pl                   'fg=214'
  filetype-pm                   'fg=197;1'
  filetype-png                  'fg=68;1'
  filetype-pod                  'fg=172;1'
  filetype-properties           'fg=197;1'
  filetype-psf                  'fg=64'
  filetype-py                   'fg=41'
  filetype-qcow                 'fg=141'
  filetype-r00                  'fg=235'
  filetype-r01                  'fg=235'
  filetype-r02                  'fg=235'
  filetype-r03                  'fg=236'
  filetype-r04                  'fg=237'
  filetype-r05                  'fg=238'
  filetype-r06                  'fg=239'
  filetype-r07                  'fg=240'
  filetype-r08                  'fg=241'
  filetype-r09                  'fg=242'
  filetype-r100                 'fg=244'
  filetype-r101                 'fg=240'
  filetype-r102                 'fg=241'
  filetype-r103                 'fg=242'
  filetype-r104                 'fg=243'
  filetype-r105                 'fg=244'
  filetype-r106                 'fg=245'
  filetype-r107                 'fg=246'
  filetype-r108                 'fg=247'
  filetype-r109                 'fg=248'
  filetype-r10                  'fg=243'
  filetype-r110                 'fg=249'
  filetype-r111                 'fg=250'
  filetype-r112                 'fg=251'
  filetype-r113                 'fg=252'
  filetype-r114                 'fg=253'
  filetype-r115                 'fg=254'
  filetype-r116                 'fg=255'
  filetype-r11                  'fg=244'
  filetype-r12                  'fg=245'
  filetype-r13                  'fg=246'
  filetype-r14                  'fg=247'
  filetype-r15                  'fg=248'
  filetype-r16                  'fg=249'
  filetype-r17                  'fg=250'
  filetype-r18                  'fg=251'
  filetype-r19                  'fg=252'
  filetype-r20                  'fg=253'
  filetype-r21                  'fg=254'
  filetype-r22                  'fg=255'
  filetype-r25                  'fg=255'
  filetype-r26                  'fg=254'
  filetype-r27                  'fg=253'
  filetype-r28                  'fg=252'
  filetype-r29                  'fg=251'
  filetype-r30                  'fg=250'
  filetype-r31                  'fg=249'
  filetype-r32                  'fg=248'
  filetype-r33                  'fg=247'
  filetype-r34                  'fg=246'
  filetype-r35                  'fg=245'
  filetype-r36                  'fg=244'
  filetype-r37                  'fg=243'
  filetype-r38                  'fg=242'
  filetype-r39                  'fg=241'
  filetype-r40                  'fg=240'
  filetype-r41                  'fg=239'
  filetype-r42                  'fg=238'
  filetype-r43                  'fg=237'
  filetype-r44                  'fg=236'
  filetype-r45                  'fg=235'
  filetype-r46                  'fg=235'
  filetype-r47                  'fg=235'
  filetype-r48                  'fg=235'
  filetype-r49                  'fg=235'
  filetype-r50                  'fg=236'
  filetype-r51                  'fg=237'
  filetype-r52                  'fg=238'
  filetype-r53                  'fg=239'
  filetype-r54                  'fg=240'
  filetype-r55                  'fg=241'
  filetype-r56                  'fg=242'
  filetype-r57                  'fg=243'
  filetype-r58                  'fg=244'
  filetype-r59                  'fg=245'
  filetype-r60                  'fg=246'
  filetype-r61                  'fg=247'
  filetype-r62                  'fg=248'
  filetype-r63                  'fg=249'
  filetype-r64                  'fg=250'
  filetype-r65                  'fg=251'
  filetype-r66                  'fg=252'
  filetype-r67                  'fg=253'
  filetype-r68                  'fg=254'
  filetype-r69                  'fg=255'
  filetype-r69                  'fg=255'
  filetype-r70                  'fg=254'
  filetype-r71                  'fg=253'
  filetype-r72                  'fg=252'
  filetype-r73                  'fg=251'
  filetype-r74                  'fg=250'
  filetype-r75                  'fg=249'
  filetype-r76                  'fg=248'
  filetype-r77                  'fg=247'
  filetype-r78                  'fg=246'
  filetype-r79                  'fg=245'
  filetype-r80                  'fg=244'
  filetype-r81                  'fg=243'
  filetype-r82                  'fg=242'
  filetype-r83                  'fg=241'
  filetype-r84                  'fg=240'
  filetype-r85                  'fg=239'
  filetype-r86                  'fg=238'
  filetype-r87                  'fg=237'
  filetype-r88                  'fg=236'
  filetype-r89                  'fg=235'
  filetype-r90                  'fg=235'
  filetype-r91                  'fg=235'
  filetype-r92                  'fg=236'
  filetype-r93                  'fg=237'
  filetype-r94                  'fg=238'
  filetype-r95                  'fg=239'
  filetype-r96                  'fg=240'
  filetype-r97                  'fg=241'
  filetype-r98                  'fg=242'
  filetype-r99                  'fg=243'
  filetype-rar                  'fg=106,bold'
  filetype-rb                   'fg=192'
  filetype-rdf                  'fg=144'
  filetype-rmvb                 'fg=112'
  filetype-rom                  'fg=59,bold'
  filetype-ru                   'fg=142'
  filetype-s3m                  'fg=71,bold'
  filetype-S3M                  'fg=71,bold'
  filetype-sample               'fg=130,bold'
  filetype-sav                  'fg=220'
  filetype-sed                  'fg=130,bold'
  filetype-sfv                  'fg=197'
  filetype-sh                   'fg=113'
  filetype-sid                  'fg=69;1'
  filetype-signature            'fg=206'
  filetype-SKIP                 'fg=244'
  filetype-sms                  'fg=33'
  filetype-spl                  'fg=173'
  filetype-sql                  'fg=222'
  filetype-sqlite               'fg=60'
  filetype-srt                  'fg=116'
  filetype-st                   'fg=208,bold'
  filetype-sty                  'fg=58'
  filetype-sug                  'fg=44'
  filetype-svg                  'fg=24,bold'
  filetype-swo                  'fg=236'
  filetype-swp                  'fg=241'
  filetype-tar                  'fg=118'
  filetype-tar.gz               'fg=34'
  filetype-tcl                  'fg=64,bold'
  filetype-tdy                  'fg=214'
  filetype-tex                  'fg=172'
  filetype-textile              'fg=106'
  filetype-t                    'fg=28;1'
  filetype-tfm                  'fg=64'
  filetype-tfnt                 'fg=140'
  filetype-tgz                  'fg=35;1'
  filetype-theme                'fg=109'
  filetype-tmp                  'fg=244'
  filetype-torrent              'fg=58'
  filetype-ts                   'fg=39'
  filetype-ttf                  'bg=1'
  filetype-txt                  'fg=192'
  filetype-typelib              'fg=60'
  filetype-un~                  'fg=240'
  filetype-urlview              'fg=85'
  filetype-vim                  'bold'
  filetype-viminfo              'fg=240;1'
  filetype-wmv                  'fg=113'
  filetype-wvc                  'fg=149'
  filetype-wv                   'fg=149'
  filetype-xml                  'fg=199'
  filetype-xpm                  'fg=36'
  filetype-xz                   'fg=118'
  filetype-yml                  'fg=208'
  filetype-zcompdump            'fg=240'
  filetype-zip                  'fg=41'
  filetype-zsh                  'fg=173'
  filetype-zwc                  'fg=240'

)

# Tokens that are always immediately followed by a command.
ZSH_HIGHLIGHT_TOKENS_FOLLOWED_BY_COMMANDS=(
  '|' '||' ';' '&' '&&' 'noglob' 'nocorrect' 'builtin'
)

# Check if the argument is variable assignment
_zsh_highlight_check-assign() {
    setopt localoptions extended_glob
    [[ ${(Q)arg} == [[:alpha:]_]([[:alnum:]_])#=* ]]
}

# Check if the argument is a path.
_zsh_highlight_check-path() {
  [[ -z ${(Q)arg} ]] && return 1
  [[ -e ${(Q)arg} ]] && return 0
  [[ ! -e ${(Q)arg:h} ]] && return 1
  [[ ${#BUFFER} == $end_pos && -n $(print ${(Q)arg}*(N)) ]] && return 0
  return 1
}

# Highlight special chars inside double-quoted strings
_zsh_highlight_highlight_string() {
  setopt localoptions noksharrays
  local i j k style
  # Starting quote is at 1, so start parsing at offset 2 in the string.
  for (( i = 2 ; i < end_pos - start_pos ; i += 1 )) ; do
    (( j = i + start_pos - 1 ))
    (( k = j + 1 ))
    case "$arg[$i]" in
      '$')  style=$ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument];;
      '%')  style=$ZSH_HIGHLIGHT_STYLES[globbing];;
      '^')  style=$ZSH_HIGHLIGHT_STYLES[globbing];;
      "\\") style=$ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]
            (( k += 1 )) # Color following char too.
            (( i += 1 )) # Skip parsing the escaped char.
            ;;
      *)    continue;;
    esac
    region_highlight+=("$j $k $style")
  done
}

# Core syntax highlighting.
_zsh_main-highlight() {
  setopt localoptions extendedglob bareglobqual
  local start_pos=0 end_pos highlight_glob=true new_expression=true arg style
  region_highlight=()

  for arg in ${(z)BUFFER}; do
    local substr_color=0

    [[ $start_pos -eq 0 && $arg = 'noglob' ]] && highlight_glob=false

    ((start_pos+=${#BUFFER[$start_pos+1,-1]}-${#${BUFFER[$start_pos+1,-1]##[[:space:]]#}}))
    ((end_pos=$start_pos+${#arg}))

    if $new_expression; then
      new_expression=false

      res=$(LC_ALL=C builtin type -w $arg 2>/dev/null)
      case $res in
        *': reserved')  style=$ZSH_HIGHLIGHT_STYLES[reserved-word];;
        *': alias')     style=$ZSH_HIGHLIGHT_STYLES[alias]
                        local aliased_command="${"$(alias $arg)"#*=}"
                        [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_FOLLOWED_BY_COMMANDS:#"$aliased_command"} && -z ${(M)ZSH_HIGHLIGHT_TOKENS_FOLLOWED_BY_COMMANDS:#"$arg"} ]] && ZSH_HIGHLIGHT_TOKENS_FOLLOWED_BY_COMMANDS+=($arg)
                        ;;
        *': builtin')   style=$ZSH_HIGHLIGHT_STYLES[builtin];;
        *': function')  style=$ZSH_HIGHLIGHT_STYLES[function];;
        *': command')   style=$ZSH_HIGHLIGHT_STYLES[command];;
        *': hashed')    style=$ZSH_HIGHLIGHT_STYLES[hashed-command];;
        *)              if _zsh_highlight_check-assign; then
                          style=$ZSH_HIGHLIGHT_STYLES[assign]
                          new_expression=true
                        elif _zsh_highlight_check-path; then
                          style=$ZSH_HIGHLIGHT_STYLES[path]
                        elif [[ $arg[0,1] = $histchars[0,1] ]]; then
                          style=$ZSH_HIGHLIGHT_STYLES[history-expansion]
                        else
                          style=$ZSH_HIGHLIGHT_STYLES[unknown-token]
                        fi
                        ;;
      esac
    else
      case $arg in
        *.pl)         style=$ZSH_HIGHLIGHT_STYLES[filetype-perl];;
        *.bash)       style=$ZSH_HIGHLIGHT_STYLES[filetype-bash];;
        *.sh)         style=$ZSH_HIGHLIGHT_STYLES[filetype-sh];;
        *.1p)         style=$ZSH_HIGHLIGHT_STYLES[filetype-1p];;
        *.32x)        style=$ZSH_HIGHLIGHT_STYLES[filetype-32x];;
        *.3p)         style=$ZSH_HIGHLIGHT_STYLES[filetype-3p];;
        *.7z)         style=$ZSH_HIGHLIGHT_STYLES[filetype-7z];;
        *.a00)        style=$ZSH_HIGHLIGHT_STYLES[filetype-a00];;
        *.a52)        style=$ZSH_HIGHLIGHT_STYLES[filetype-a52];;
        *.a64)        style=$ZSH_HIGHLIGHT_STYLES[filetype-a64];;
        *.A64)        style=$ZSH_HIGHLIGHT_STYLES[filetype-A64];;
        *.a78)        style=$ZSH_HIGHLIGHT_STYLES[filetype-a78];;
        *.adf)        style=$ZSH_HIGHLIGHT_STYLES[filetype-adf];;
        *.afm)        style=$ZSH_HIGHLIGHT_STYLES[filetype-afm];;
        *.am)         style=$ZSH_HIGHLIGHT_STYLES[filetype-am];;
        *.arj)        style=$ZSH_HIGHLIGHT_STYLES[filetype-arj];;
        *.asm)        style=$ZSH_HIGHLIGHT_STYLES[filetype-asm];;
        *.a)          style=$ZSH_HIGHLIGHT_STYLES[filetype-a];;
        *.atr)        style=$ZSH_HIGHLIGHT_STYLES[filetype-atr];;
        *.avi)        style=$ZSH_HIGHLIGHT_STYLES[filetype-avi];;
        *.awk)        style=$ZSH_HIGHLIGHT_STYLES[filetype-awk];;
        *.bak)        style=$ZSH_HIGHLIGHT_STYLES[filetype-bak];;
        *.bash)       style=$ZSH_HIGHLIGHT_STYLES[filetype-bash];;
        *.bat)        style=$ZSH_HIGHLIGHT_STYLES[filetype-bat];;
        *.BAT)        style=$ZSH_HIGHLIGHT_STYLES[filetype-BAT];;
        *.bin)        style=$ZSH_HIGHLIGHT_STYLES[filetype-bin];;
        *.bmp)        style=$ZSH_HIGHLIGHT_STYLES[filetype-bmp];;
        *.bz2)        style=$ZSH_HIGHLIGHT_STYLES[filetype-bz2];;
        *.cbr)        style=$ZSH_HIGHLIGHT_STYLES[filetype-cbr];;
        *.cbz)        style=$ZSH_HIGHLIGHT_STYLES[filetype-cbz];;
        *.cdi)        style=$ZSH_HIGHLIGHT_STYLES[filetype-cdi];;
        *.cdr)        style=$ZSH_HIGHLIGHT_STYLES[filetype-cdr];;
        *.cfg)        style=$ZSH_HIGHLIGHT_STYLES[filetype-cfg];;
        *.chm)        style=$ZSH_HIGHLIGHT_STYLES[filetype-chm];;
        *.coffee)     style=$ZSH_HIGHLIGHT_STYLES[filetype-coffee];;
        *.conf)       style=$ZSH_HIGHLIGHT_STYLES[filetype-conf];;
        *.cpp)        style=$ZSH_HIGHLIGHT_STYLES[filetype-cpp];;
        *.css)        style=$ZSH_HIGHLIGHT_STYLES[filetype-css];;
        *.cs)         style=$ZSH_HIGHLIGHT_STYLES[filetype-cs];;
        *.c)          style=$ZSH_HIGHLIGHT_STYLES[filetype-c];;
        *.csv)        style=$ZSH_HIGHLIGHT_STYLES[filetype-csv];;
        *.cue)        style=$ZSH_HIGHLIGHT_STYLES[filetype-cue];;
        *.dat)        style=$ZSH_HIGHLIGHT_STYLES[filetype-dat];;
        *.db)         style=$ZSH_HIGHLIGHT_STYLES[filetype-db];;
        *.def)        style=$ZSH_HIGHLIGHT_STYLES[filetype-def];;
        *.diff)       style=$ZSH_HIGHLIGHT_STYLES[filetype-diff];;
        *.directory)  style=$ZSH_HIGHLIGHT_STYLES[filetype-directory];;
        *.djvu)       style=$ZSH_HIGHLIGHT_STYLES[filetype-djvu];;
        *.dump)       style=$ZSH_HIGHLIGHT_STYLES[filetype-dump];;
        *.enc)        style=$ZSH_HIGHLIGHT_STYLES[filetype-enc];;
        *.eps)        style=$ZSH_HIGHLIGHT_STYLES[filetype-eps];;
        *.error)      style=$ZSH_HIGHLIGHT_STYLES[filetype-error];;
        *.err)        style=$ZSH_HIGHLIGHT_STYLES[filetype-err];;
        *.etx)        style=$ZSH_HIGHLIGHT_STYLES[filetype-etx];;
        *.example)    style=$ZSH_HIGHLIGHT_STYLES[filetype-example];;
        *.ex)         style=$ZSH_HIGHLIGHT_STYLES[filetype-ex];;
        *.fcm)        style=$ZSH_HIGHLIGHT_STYLES[filetype-fcm];;
        *.flac)       style=$ZSH_HIGHLIGHT_STYLES[filetype-flac];;
        *.flv)        style=$ZSH_HIGHLIGHT_STYLES[filetype-flv];;
        *.fm2)        style=$ZSH_HIGHLIGHT_STYLES[filetype-fm2];;
        *.gba)        style=$ZSH_HIGHLIGHT_STYLES[filetype-gba];;
        *.gbc)        style=$ZSH_HIGHLIGHT_STYLES[filetype-gbc];;
        *.gb)         style=$ZSH_HIGHLIGHT_STYLES[filetype-gb];;
        *.gel)        style=$ZSH_HIGHLIGHT_STYLES[filetype-gel];;
        *.ggl)        style=$ZSH_HIGHLIGHT_STYLES[filetype-ggl];;
        *.gg)         style=$ZSH_HIGHLIGHT_STYLES[filetype-gg];;
        *.gif)        style=$ZSH_HIGHLIGHT_STYLES[filetype-gif];;
        *.gitignore)  style=$ZSH_HIGHLIGHT_STYLES[filetype-gitignore];;
        *.git)        style=$ZSH_HIGHLIGHT_STYLES[filetype-git];;
        *.go)         style=$ZSH_HIGHLIGHT_STYLES[filetype-go];;
        *.hs)         style=$ZSH_HIGHLIGHT_STYLES[filetype-hs];;
        *.h)          style=$ZSH_HIGHLIGHT_STYLES[filetype-h];;
        *.html)       style=$ZSH_HIGHLIGHT_STYLES[filetype-html];;
        *.htm)        style=$ZSH_HIGHLIGHT_STYLES[filetype-htm];;
        *.ico)        style=$ZSH_HIGHLIGHT_STYLES[filetype-ico];;
        *.info)       style=$ZSH_HIGHLIGHT_STYLES[filetype-info];;
        *.ini)        style=$ZSH_HIGHLIGHT_STYLES[filetype-ini];;
        *.in)         style=$ZSH_HIGHLIGHT_STYLES[filetype-in];;
        *.iso)        style=$ZSH_HIGHLIGHT_STYLES[filetype-iso];;
        *.j64)        style=$ZSH_HIGHLIGHT_STYLES[filetype-j64];;
        *.jad)        style=$ZSH_HIGHLIGHT_STYLES[filetype-jad];;
        *.jar)        style=$ZSH_HIGHLIGHT_STYLES[filetype-jar];;
        *.java)       style=$ZSH_HIGHLIGHT_STYLES[filetype-java];;
        *.jhtm)       style=$ZSH_HIGHLIGHT_STYLES[filetype-jhtm];;
        *.jpeg)       style=$ZSH_HIGHLIGHT_STYLES[filetype-jpeg];;
        *.jpg)        style=$ZSH_HIGHLIGHT_STYLES[filetype-jpg];;
        *.JPG)        style=$ZSH_HIGHLIGHT_STYLES[filetype-JPG];;
        *.jsm)        style=$ZSH_HIGHLIGHT_STYLES[filetype-jsm];;
        *.jsm)        style=$ZSH_HIGHLIGHT_STYLES[filetype-jsm];;
        *.json)       style=$ZSH_HIGHLIGHT_STYLES[filetype-json];;
        *.jsp)        style=$ZSH_HIGHLIGHT_STYLES[filetype-jsp];;
        *.js)         style=$ZSH_HIGHLIGHT_STYLES[filetype-js];;
        *.lisp)       style=$ZSH_HIGHLIGHT_STYLES[filetype-lisp];;
        *.log)        style=$ZSH_HIGHLIGHT_STYLES[filetype-log];;
        *.lua)        style=$ZSH_HIGHLIGHT_STYLES[filetype-lua];;
        *.m3u)        style=$ZSH_HIGHLIGHT_STYLES[filetype-m3u];;
        *.m4a)        style=$ZSH_HIGHLIGHT_STYLES[filetype-m4a];;
        *.m4)         style=$ZSH_HIGHLIGHT_STYLES[filetype-m4];;
        *.map)        style=$ZSH_HIGHLIGHT_STYLES[filetype-map];;
        *.markdown)   style=$ZSH_HIGHLIGHT_STYLES[filetype-markdown];;
        *.md)         style=$ZSH_HIGHLIGHT_STYLES[filetype-md];;
        *.mfasl)      style=$ZSH_HIGHLIGHT_STYLES[filetype-mfasl];;
        *.mf)         style=$ZSH_HIGHLIGHT_STYLES[filetype-mf];;
        *.mi)         style=$ZSH_HIGHLIGHT_STYLES[filetype-mi];;
        *.mkd)        style=$ZSH_HIGHLIGHT_STYLES[filetype-mkd];;
        *.mkv)        style=$ZSH_HIGHLIGHT_STYLES[filetype-mkv];;
        *.mod)        style=$ZSH_HIGHLIGHT_STYLES[filetype-mod];;
        *.mov)        style=$ZSH_HIGHLIGHT_STYLES[filetype-mov];;
        *.MOV)        style=$ZSH_HIGHLIGHT_STYLES[filetype-MOV];;
        *.mp3)        style=$ZSH_HIGHLIGHT_STYLES[filetype-mp3];;
        *.mp4)        style=$ZSH_HIGHLIGHT_STYLES[filetype-mp4];;
        *.mpeg)       style=$ZSH_HIGHLIGHT_STYLES[filetype-mpeg];;
        *.mpg)        style=$ZSH_HIGHLIGHT_STYLES[filetype-mpg];;
        *.mtx)        style=$ZSH_HIGHLIGHT_STYLES[filetype-mtx];;
        *.nds)        style=$ZSH_HIGHLIGHT_STYLES[filetype-nds];;
        *.nes)        style=$ZSH_HIGHLIGHT_STYLES[filetype-nes];;
        *.nfo)        style=$ZSH_HIGHLIGHT_STYLES[filetype-nfo];;
        *.nrg)        style=$ZSH_HIGHLIGHT_STYLES[filetype-nrg];;
        *.odb)        style=$ZSH_HIGHLIGHT_STYLES[filetype-odb];;
        *.odp)        style=$ZSH_HIGHLIGHT_STYLES[filetype-odp];;
        *.ods)        style=$ZSH_HIGHLIGHT_STYLES[filetype-ods];;
        *.odt)        style=$ZSH_HIGHLIGHT_STYLES[filetype-odt];;
        *.oga)        style=$ZSH_HIGHLIGHT_STYLES[filetype-oga];;
        *.ogg)        style=$ZSH_HIGHLIGHT_STYLES[filetype-ogg];;
        *.ogm)        style=$ZSH_HIGHLIGHT_STYLES[filetype-ogm];;
        *.ogv)        style=$ZSH_HIGHLIGHT_STYLES[filetype-ogv];;
        *.old)        style=$ZSH_HIGHLIGHT_STYLES[filetype-old];;
        *.out)        style=$ZSH_HIGHLIGHT_STYLES[filetype-out];;
        *.pacnew)     style=$ZSH_HIGHLIGHT_STYLES[filetype-pacnew];;
        *.part)       style=$ZSH_HIGHLIGHT_STYLES[filetype-part];;
        *.patch)      style=$ZSH_HIGHLIGHT_STYLES[filetype-patch];;
        *.pcf)        style=$ZSH_HIGHLIGHT_STYLES[filetype-pcf];;
        *.pc)         style=$ZSH_HIGHLIGHT_STYLES[filetype-pc];;
        *.pdf)        style=$ZSH_HIGHLIGHT_STYLES[filetype-pdf];;
        *.pfa)        style=$ZSH_HIGHLIGHT_STYLES[filetype-pfa];;
        *.pfb)        style=$ZSH_HIGHLIGHT_STYLES[filetype-pfb];;
        *.pfm)        style=$ZSH_HIGHLIGHT_STYLES[filetype-pfm];;
        *.php)        style=$ZSH_HIGHLIGHT_STYLES[filetype-php];;
        *.pid)        style=$ZSH_HIGHLIGHT_STYLES[filetype-pid];;
        *.pi)         style=$ZSH_HIGHLIGHT_STYLES[filetype-pi];;
        *.pl)         style=$ZSH_HIGHLIGHT_STYLES[filetype-pl];;
        *.PL)         style=$ZSH_HIGHLIGHT_STYLES[filetype-PL];;
        *.pm)         style=$ZSH_HIGHLIGHT_STYLES[filetype-pm];;
        *.png)        style=$ZSH_HIGHLIGHT_STYLES[filetype-png];;
        *.pod)        style=$ZSH_HIGHLIGHT_STYLES[filetype-pod];;
        *.properties) style=$ZSH_HIGHLIGHT_STYLES[filetype-properties];;
        *.psf)        style=$ZSH_HIGHLIGHT_STYLES[filetype-psf];;
        *.py)         style=$ZSH_HIGHLIGHT_STYLES[filetype-py];;
        *.qcow)       style=$ZSH_HIGHLIGHT_STYLES[filetype-qcow];;
        *.r00)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r00];;
        *.r01)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r01];;
        *.r02)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r02];;
        *.r03)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r03];;
        *.r04)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r04];;
        *.r05)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r05];;
        *.r06)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r06];;
        *.r07)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r07];;
        *.r08)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r08];;
        *.r09)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r09];;
        *.r100)       style=$ZSH_HIGHLIGHT_STYLES[filetype-r100];;
        *.r101)       style=$ZSH_HIGHLIGHT_STYLES[filetype-r101];;
        *.r102)       style=$ZSH_HIGHLIGHT_STYLES[filetype-r102];;
        *.r103)       style=$ZSH_HIGHLIGHT_STYLES[filetype-r103];;
        *.r104)       style=$ZSH_HIGHLIGHT_STYLES[filetype-r104];;
        *.r105)       style=$ZSH_HIGHLIGHT_STYLES[filetype-r105];;
        *.r106)       style=$ZSH_HIGHLIGHT_STYLES[filetype-r106];;
        *.r107)       style=$ZSH_HIGHLIGHT_STYLES[filetype-r107];;
        *.r108)       style=$ZSH_HIGHLIGHT_STYLES[filetype-r108];;
        *.r109)       style=$ZSH_HIGHLIGHT_STYLES[filetype-r109];;
        *.r10)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r10];;
        *.r110)       style=$ZSH_HIGHLIGHT_STYLES[filetype-r110];;
        *.r111)       style=$ZSH_HIGHLIGHT_STYLES[filetype-r111];;
        *.r112)       style=$ZSH_HIGHLIGHT_STYLES[filetype-r112];;
        *.r113)       style=$ZSH_HIGHLIGHT_STYLES[filetype-r113];;
        *.r114)       style=$ZSH_HIGHLIGHT_STYLES[filetype-r114];;
        *.r115)       style=$ZSH_HIGHLIGHT_STYLES[filetype-r115];;
        *.r116)       style=$ZSH_HIGHLIGHT_STYLES[filetype-r116];;
        *.r11)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r11];;
        *.r12)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r12];;
        *.r13)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r13];;
        *.r14)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r14];;
        *.r15)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r15];;
        *.r16)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r16];;
        *.r17)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r17];;
        *.r18)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r18];;
        *.r19)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r19];;
        *.r20)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r20];;
        *.r21)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r21];;
        *.r22)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r22];;
        *.r25)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r25];;
        *.r26)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r26];;
        *.r27)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r27];;
        *.r28)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r28];;
        *.r29)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r29];;
        *.r30)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r30];;
        *.r31)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r31];;
        *.r32)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r32];;
        *.r33)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r33];;
        *.r34)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r34];;
        *.r35)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r35];;
        *.r36)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r36];;
        *.r37)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r37];;
        *.r38)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r38];;
        *.r39)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r39];;
        *.r40)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r40];;
        *.r41)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r41];;
        *.r42)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r42];;
        *.r43)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r43];;
        *.r44)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r44];;
        *.r45)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r45];;
        *.r46)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r46];;
        *.r47)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r47];;
        *.r48)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r48];;
        *.r49)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r49];;
        *.r50)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r50];;
        *.r51)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r51];;
        *.r52)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r52];;
        *.r53)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r53];;
        *.r54)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r54];;
        *.r55)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r55];;
        *.r56)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r56];;
        *.r57)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r57];;
        *.r58)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r58];;
        *.r59)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r59];;
        *.r60)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r60];;
        *.r61)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r61];;
        *.r62)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r62];;
        *.r63)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r63];;
        *.r64)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r64];;
        *.r65)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r65];;
        *.r66)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r66];;
        *.r67)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r67];;
        *.r68)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r68];;
        *.r69)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r69];;
        *.r69)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r69];;
        *.r70)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r70];;
        *.r71)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r71];;
        *.r72)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r72];;
        *.r73)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r73];;
        *.r74)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r74];;
        *.r75)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r75];;
        *.r76)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r76];;
        *.r77)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r77];;
        *.r78)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r78];;
        *.r79)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r79];;
        *.r80)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r80];;
        *.r81)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r81];;
        *.r82)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r82];;
        *.r83)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r83];;
        *.r84)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r84];;
        *.r85)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r85];;
        *.r86)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r86];;
        *.r87)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r87];;
        *.r88)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r88];;
        *.r89)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r89];;
        *.r90)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r90];;
        *.r91)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r91];;
        *.r92)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r92];;
        *.r93)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r93];;
        *.r94)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r94];;
        *.r95)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r95];;
        *.r96)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r96];;
        *.r97)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r97];;
        *.r98)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r98];;
        *.r99)        style=$ZSH_HIGHLIGHT_STYLES[filetype-r99];;
        *.rar)        style=$ZSH_HIGHLIGHT_STYLES[filetype-rar];;
        *.rb)         style=$ZSH_HIGHLIGHT_STYLES[filetype-rb];;
        *.rdf)        style=$ZSH_HIGHLIGHT_STYLES[filetype-rdf];;
        *.rmvb)       style=$ZSH_HIGHLIGHT_STYLES[filetype-rmvb];;
        *.rom)        style=$ZSH_HIGHLIGHT_STYLES[filetype-rom];;
        *.ru)         style=$ZSH_HIGHLIGHT_STYLES[filetype-ru];;
        *.s3m)        style=$ZSH_HIGHLIGHT_STYLES[filetype-s3m];;
        *.S3M)        style=$ZSH_HIGHLIGHT_STYLES[filetype-S3M];;
        *.sample)     style=$ZSH_HIGHLIGHT_STYLES[filetype-sample];;
        *.sav)        style=$ZSH_HIGHLIGHT_STYLES[filetype-sav];;
        *.sed)        style=$ZSH_HIGHLIGHT_STYLES[filetype-sed];;
        *.sfv)        style=$ZSH_HIGHLIGHT_STYLES[filetype-sfv];;
        *.sh)         style=$ZSH_HIGHLIGHT_STYLES[filetype-sh];;
        *.sid)        style=$ZSH_HIGHLIGHT_STYLES[filetype-sid];;
        *.signature)  style=$ZSH_HIGHLIGHT_STYLES[filetype-signature];;
        *.SKIP)       style=$ZSH_HIGHLIGHT_STYLES[filetype-SKIP];;
        *.sms)        style=$ZSH_HIGHLIGHT_STYLES[filetype-sms];;
        *.spl)        style=$ZSH_HIGHLIGHT_STYLES[filetype-spl];;
        *.sqlite)     style=$ZSH_HIGHLIGHT_STYLES[filetype-sqlite];;
        *.sql)        style=$ZSH_HIGHLIGHT_STYLES[filetype-sql];;
        *.srt)        style=$ZSH_HIGHLIGHT_STYLES[filetype-srt];;
        *.st)         style=$ZSH_HIGHLIGHT_STYLES[filetype-st];;
        *.sty)        style=$ZSH_HIGHLIGHT_STYLES[filetype-sty];;
        *.sug)        style=$ZSH_HIGHLIGHT_STYLES[filetype-sug];;
        *.svg)        style=$ZSH_HIGHLIGHT_STYLES[filetype-svg];;
        *.swo)        style=$ZSH_HIGHLIGHT_STYLES[filetype-swo];;
        *.swp)        style=$ZSH_HIGHLIGHT_STYLES[filetype-swp];;
        *.tar.gz)     style=$ZSH_HIGHLIGHT_STYLES[filetype-tar.gz];;
        *.tar)        style=$ZSH_HIGHLIGHT_STYLES[filetype-tar];;
        *.tcl)        style=$ZSH_HIGHLIGHT_STYLES[filetype-tcl];;
        *.tdy)        style=$ZSH_HIGHLIGHT_STYLES[filetype-tdy];;
        *.tex)        style=$ZSH_HIGHLIGHT_STYLES[filetype-tex];;
        *.textile)    style=$ZSH_HIGHLIGHT_STYLES[filetype-textile];;
        *.tfm)        style=$ZSH_HIGHLIGHT_STYLES[filetype-tfm];;
        *.tfnt)       style=$ZSH_HIGHLIGHT_STYLES[filetype-tfnt];;
        *.tgz)        style=$ZSH_HIGHLIGHT_STYLES[filetype-tgz];;
        *.theme)      style=$ZSH_HIGHLIGHT_STYLES[filetype-theme];;
        *.tmp)        style=$ZSH_HIGHLIGHT_STYLES[filetype-tmp];;
        *.torrent)    style=$ZSH_HIGHLIGHT_STYLES[filetype-torrent];;
        *.ts)         style=$ZSH_HIGHLIGHT_STYLES[filetype-ts];;
        *.t)          style=$ZSH_HIGHLIGHT_STYLES[filetype-t];;
        *.ttf)        style=$ZSH_HIGHLIGHT_STYLES[filetype-ttf];;
        *.txt)        style=$ZSH_HIGHLIGHT_STYLES[filetype-txt];;
        *.typelib)    style=$ZSH_HIGHLIGHT_STYLES[filetype-typelib];;
        *.un~)        style=$ZSH_HIGHLIGHT_STYLES[filetype-un~];;
        *.urlview)    style=$ZSH_HIGHLIGHT_STYLES[filetype-urlview];;
        *.viminfo)    style=$ZSH_HIGHLIGHT_STYLES[filetype-viminfo];;
        *.vim)        style=$ZSH_HIGHLIGHT_STYLES[filetype-vim];;
        *.wmv)        style=$ZSH_HIGHLIGHT_STYLES[filetype-wmv];;
        *.wvc)        style=$ZSH_HIGHLIGHT_STYLES[filetype-wvc];;
        *.wv)         style=$ZSH_HIGHLIGHT_STYLES[filetype-wv];;
        *.xml)        style=$ZSH_HIGHLIGHT_STYLES[filetype-xml];;
        *.xpm)        style=$ZSH_HIGHLIGHT_STYLES[filetype-xpm];;
        *.xz)         style=$ZSH_HIGHLIGHT_STYLES[filetype-xz];;
        *.yml)        style=$ZSH_HIGHLIGHT_STYLES[filetype-yml];;
        *.zcompdump)  style=$ZSH_HIGHLIGHT_STYLES[filetype-zcompdump];;
        *.zip)        style=$ZSH_HIGHLIGHT_STYLES[filetype-zip];;
        *.zsh)        style=$ZSH_HIGHLIGHT_STYLES[filetype-zsh];;


        '--'*)   style=$ZSH_HIGHLIGHT_STYLES[double-hyphen-option];;
        '-'*)    style=$ZSH_HIGHLIGHT_STYLES[single-hyphen-option];;
        "'"*"'") style=$ZSH_HIGHLIGHT_STYLES[single-quoted-argument];;
        '"'*'"') style=$ZSH_HIGHLIGHT_STYLES[double-quoted-argument]
                 region_highlight+=("$start_pos $end_pos $style")
                 _zsh_highlight_highlight_string
                 substr_color=1
                 ;;
        '`'*'`') style=$ZSH_HIGHLIGHT_STYLES[back-quoted-argument];;
        *"*"*)   $highlight_glob && style=$ZSH_HIGHLIGHT_STYLES[globbing] ||
                   style=$ZSH_HIGHLIGHT_STYLES[default];;
        *)       if _zsh_highlight_check-path; then
                   style=$ZSH_HIGHLIGHT_STYLES[path]
                 elif [[ $arg[0,1] = $histchars[0,1] ]]; then
                   style=$ZSH_HIGHLIGHT_STYLES[history-expansion]
                 else
                   style=$ZSH_HIGHLIGHT_STYLES[default]
                 fi
                 ;;
      esac
    fi
    [[ $substr_color = 0 ]] &&
      region_highlight+=("$start_pos $end_pos $style")
    [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_FOLLOWED_BY_COMMANDS:#"$arg"} ]] && new_expression=true
    start_pos=$end_pos
  done
}


# Setup functions

# Intercept specified ZLE events to have highlighting triggered.
_zsh_highlight_bind-events() {

  # Resolve event names what have to be bound to.
  zmodload zsh/zleparameter 2>/dev/null || {
    echo 'zsh-syntax-highlighting:zmodload error. exiting.' >&2
    return -1
  }
  local -a events; : ${(A)events::=${@:#(_*|orig-*|.run-help|.which-command)}}

  # Bind the events to _zsh_highlight-zle-buffer.
  local clean_event
  for event in $events; do
    if [[ "$widgets[$event]" == completion:* ]]; then
      eval "zle -C orig-$event ${${${widgets[$event]}#*:}/:/ } ; $event() { builtin zle orig-$event && _zsh_highlight-zle-buffer } ; zle -N $event"
    else
      case $event in
        accept-and-menu-complete)
          eval "$event() { builtin zle .$event && _zsh_highlight-zle-buffer } ; zle -N $event"
          ;;
        .*)
          # Remove the leading dot in the event name
          clean_event=$event[2,${#event}]
          case ${widgets[$clean_event]-} in
            (completion|user):*)
              ;;
            *)
              eval "$clean_event() { builtin zle $event && _zsh_highlight-zle-buffer } ; zle -N $clean_event"
              ;;
          esac
          ;;
        *)
          ;;
      esac
    fi
  done
}

# Load highlighters from specified directory if it exists.
_zsh_highlight_load-highlighters() {
  [[ -d $1 ]] && for highlighter_def ($1/*.zsh) . $highlighter_def
}


# Setup

# Bind highlighting to all known events.
_zsh_highlight_bind-events "${(@f)"$(zle -la)"}"

# Register the main highlighter.
_zsh_highlight_add-highlighter _zsh_main-highlight _zsh_highlight_buffer-modified-p

# Load additional highlighters if available.
_zsh_highlight_load-highlighters "${${(%):-%N}:h}/highlighters"
 

x

zshrc(raw, dl)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/zsh
##export ZDOTDIR=/home/scp1
#export VIMRUNTIME="$HOME/etc/vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$HOME/etc/vim/after,$HOME/etc/vim/colors" 
#export VIMINIT="so /home/scp1/etc/vimrc"

for r in $HOME/etc/zsh/*.zsh; do
  if [[ $DEBUG > 0 ]]; then
    echo "zsh: sourcing $r"
  fi
  source $r
done

source $HOME/etc/zsh/$ZSH_THEME.theme
source $HOME/etc/zsh/02-abbrevations.zsh

eval `keychain --dir $HOME/etc/keychain -q --eval id_dsa`
export TZ='Europe/Stockholm'

# XXX
fpath=(~/etc/zsh/compdef $fpath)
compinit -i

compdef _files mkdir
compdef _gnu_generic ln
 

x

Notes

The most up-to-date zsh configuration files can be found here.
The dircolors/LS_COLORS can be found here.
The ‘ls’ is called ls++ and can be found here.

Comments

numbchild said about 5 years ago

shit, The first one style shake me. very very beautiful. I like it.

trapd00r said about 5 years ago

Thanks, enjoy!