Diff
1diff --git a/lib/completion.zsh b/lib/completion.zsh
2index 9c2dfecca3cc82ee5f3b1231f11b7a9f75e2e3a4..e8e9776a5b9f7e70e51bc8421d8080c9d637d793 100644
3--- a/lib/completion.zsh
4+++ b/lib/completion.zsh
5@@ -4,6 +4,7 @@ unsetopt menu_complete # do not autoselect the first completion entry
6 unsetopt flowcontrol
7 setopt auto_menu # show completion menu on succesive tab press
8 setopt complete_in_word
9+setopt complete_aliases
10 setopt always_to_end
11
12 WORDCHARS=''
13diff --git a/plugins/cpanm/_cpanm b/plugins/cpanm/_cpanm
14new file mode 100644
15index 0000000000000000000000000000000000000000..58451d35ae7b4ab1a32c880e76b47c3d00e7aacd
16--- /dev/null
17+++ b/plugins/cpanm/_cpanm
18@@ -0,0 +1,67 @@
19+#compdef cpanm
20+
21+##
22+# cpanminus Z Shell completion script
23+##
24+#
25+# Current supported cpanm version: 1.4000 (Tue Mar 8 01:00:49 PST 2011)
26+#
27+# The latest code is always located at:
28+# https://github.com/rshhh/cpanminus/blob/master/etc/_cpanm
29+#
30+
31+local arguments curcontext="$curcontext"
32+typeset -A opt_args
33+
34+
35+arguments=(
36+
37+# Commands
38+# '(--install -i)'{--install,-i}'[Installs the modules]'
39+ '(- :)--self-upgrade[Upgrades itself]'
40+ '(- :)--info[Displays distribution info on CPAN]'
41+ '(--installdeps)--installdeps[Only install dependencies]'
42+ '(--look)--look[Download/unpack the distribution and then open the directory with your shell]'
43+ '(- :)'{--help,-h}'[Displays help information]'
44+ '(- :)'{--version,-V}'[Displays software version]'
45+
46+# Options
47+ {--force,-f}'[Force install]'
48+ {--notest,-n}'[Do not run unit tests]'
49+ {--sudo,-S}'[sudo to run install commands]'
50+ '(-v --verbose --quiet -q)'{--verbose,-v}'[Turns on chatty output]'
51+ '(-q --quiet --verbose -v)'{--quiet,-q}'[Turns off all output]'
52+ {--local-lib,-l}'[Specify the install base to install modules]'
53+ {--local-lib-contained,-L}'[Specify the install base to install all non-core modules]'
54+ '--mirror[Specify the base URL for the mirror (e.g. http://cpan.cpantesters.org/)]:URLs:_urls'
55+ '--mirror-only[Use the mirror\''s index file instead of the CPAN Meta DB]'
56+ '--prompt[Prompt when configure/build/test fails]'
57+ '--reinstall[Reinstall the distribution even if you already have the latest version installed]'
58+ '--interactive[Turn on interactive configure]'
59+
60+ '--scandeps[Scan the depencencies of given modules and output the tree in a text format]'
61+ '--format[Specify what format to display the scanned dependency tree]:scandeps format:(tree json yaml dists)'
62+
63+ '--save-dists[Specify the optional directory path to copy downloaded tarballs]'
64+# '--uninst-shadows[Uninstalls the shadow files of the distribution that you\''re installing]'
65+
66+ '--auto-cleanup[Number of days that cpanm\''s work directories expire in. Defaults to 7]'
67+ '(--no-man-pages)--man-pages[Generates man pages for executables (man1) and libraries (man3)]'
68+ '(--man-pages)--no-man-pages[Do not generate man pages]'
69+
70+
71+ # Note: Normally with "--lwp", "--wget" and "--curl" options set to true (which is the default) cpanm tries LWP,
72+ # Wget, cURL and HTTP::Tiny (in that order) and uses the first one available.
73+ # (So that the exclusions are not enabled here for the completion)
74+ '(--lwp)--lwp[Use LWP module to download stuff]'
75+ '(--wget)--wget[Use GNU Wget (if available) to download stuff]'
76+ '(--curl)--curl[Use cURL (if available) to download stuff]'
77+
78+# Other completions
79+ '*:Local directory or archive:_files -/ -g "*.(tar.gz|tgz|tar.bz2|zip)(-.)"'
80+ # '*::args: _normal' # this looks for default files (any files)
81+)
82+_arguments -s $arguments \
83+ && return 0
84+
85+return 1
86diff --git a/plugins/cpanm/cpanm.plugin.zsh b/plugins/cpanm/cpanm.plugin.zsh
87new file mode 100644
88index 0000000000000000000000000000000000000000..af52d3e8b2567a2a61f9f41cae8f3b15e0d4b933
89--- /dev/null
90+++ b/plugins/cpanm/cpanm.plugin.zsh
91@@ -0,0 +1,4 @@
92+# add cpanm completion function to path
93+fpath=($ZSH/plugins/cpanm $fpath)
94+autoload -U compinit
95+compinit -i
96diff --git a/plugins/deb/deb.plugin.zsh b/plugins/deb/deb.plugin.zsh
97new file mode 100644
98index 0000000000000000000000000000000000000000..732294a87d08858a8abb05248d19a27256680eca
99--- /dev/null
100+++ b/plugins/deb/deb.plugin.zsh
101@@ -0,0 +1,12 @@
102+# Aliases
103+alias as="aptitude -F \"* %p -> %d \n(%v/%V)\" \
104+ --no-gui --disable-columns search" # search package
105+alias ad="sudo apt-get update" # update packages lists
106+alias au="sudo apt-get update && \
107+ sudo apt-get dselect-upgrade" # upgrade packages
108+alias ai="sudo apt-get install" # install package
109+alias ar="sudo apt-get remove --purge && \
110+ sudo apt-get autoremove --purge" # remove package
111+alias ap="apt-cache policy" # apt policy
112+alias av="apt-cache show" # show package info
113+alias ac="sudo apt-get clean && sudo apt-get autoclean" # clean apt cache
114diff --git a/plugins/debian/debian.plugin.zsh b/plugins/debian/debian.plugin.zsh
115new file mode 100644
116index 0000000000000000000000000000000000000000..f8865a41210d3318525e867734cffd7cbe5bb7b2
117--- /dev/null
118+++ b/plugins/debian/debian.plugin.zsh
119@@ -0,0 +1,60 @@
120+# https://github.com/dbbolton/
121+#
122+# Debian-related zsh aliases and functions for zsh
123+
124+
125+# Aliases ###################################################################
126+
127+# Some self-explanatory aliases
128+alias afs='apt-file search --regexp'
129+alias aps='aptitude search'
130+alias apsrc='apt-get source'
131+alias apv='apt-cache policy'
132+
133+alias apdg='su -c "aptitude update && aptitude safe-upgrade"'
134+alias apud='su -c "aptitude update"'
135+alias apug='su -c "aptitude safe-upgrade"'
136+
137+# print all installed packages
138+alias allpkgs='aptitude search -F "%p" --disable-columns ~i'
139+
140+# Install all .deb files in the current directory.
141+# Warning: you will need to put the glob in single quotes if you use:
142+# glob_subst
143+alias di='su -c "dpkg -i ./*.deb"'
144+
145+# Create a basic .deb package
146+alias mydeb='time dpkg-buildpackage -rfakeroot -us -uc'
147+
148+# Remove ALL kernel images and headers EXCEPT the one in use
149+alias kclean='su -c '\''aptitude remove -P ?and(~i~nlinux-(ima|hea) ?not(~n`uname -r`))'\'' root'
150+
151+
152+
153+# Functions #################################################################
154+
155+# create a simple script that can be used to 'duplicate' a system
156+apt-copy() {
157+ print '#!/bin/sh'"\n" > apt-copy.sh
158+
159+ list=$(perl -m'AptPkg::Cache' -e '$c=AptPkg::Cache->new; for (keys %$c){ push @a, $_ if $c->{$_}->{'CurrentState'} eq 'Installed';} print "$_ " for sort @a;')
160+
161+ print 'aptitude install '"$list\n" >> apt-copy.sh
162+
163+ chmod +x apt-copy.sh
164+}
165+
166+
167+# Kernel-package building shortcut
168+dbb-build () {
169+ MAKEFLAGS='' # temporarily unset MAKEFLAGS ( '-j3' will fail )
170+ appendage='-custom' # this shows up in $ (uname -r )
171+ revision=$(date +"%Y%m%d") # this shows up in the .deb file name
172+
173+ make-kpkg clean
174+
175+ time fakeroot make-kpkg --append-to-version "$appendage" --revision \
176+ "$revision" kernel_image kernel_headers
177+}
178+
179+
180diff --git a/plugins/lol/lol.plugin.zsh b/plugins/lol/lol.plugin.zsh
181new file mode 100644
182index 0000000000000000000000000000000000000000..a7153bb570d559fc4cdabb7f88c9aba2db2d94a4
183--- /dev/null
184+++ b/plugins/lol/lol.plugin.zsh
185@@ -0,0 +1,26 @@
186+# LOL!!1
187+# Source: http://aur.archlinux.org/packages/lolbash/lolbash/lolbash.sh
188+
189+alias wtf='dmesg'
190+alias onoz='cat /var/log/errors.log'
191+alias rtfm='man'
192+
193+alias visible='echo'
194+alias invisible='cat'
195+alias moar='more'
196+
197+alias icanhas='mkdir'
198+alias donotwant='rm'
199+alias dowant='cp'
200+alias gtfo='mv'
201+
202+alias hai='cd'
203+alias plz='pwd'
204+
205+alias inur='locate'
206+
207+alias nomz='ps -aux'
208+alias nomnom='killall'
209+
210+alias cya='reboot'
211+alias kthxbai='halt'
212diff --git a/plugins/macports/_port b/plugins/macports/_port
213new file mode 100644
214index 0000000000000000000000000000000000000000..06d7fb426cc8c5374720845a3c91d6591a17e0fd
215--- /dev/null
216+++ b/plugins/macports/_port
217@@ -0,0 +1,89 @@
218+#compdef port
219+
220+local subcmds
221+
222+# we cache the list of ports
223+# we shall use some cache policy to avoid problems with new ports
224+if (( ! $+portlist )); then
225+ portlist=($(port echo all; echo "all current active inactive installed uninstalled outdated"))
226+fi
227+
228+subcmds=(
229+'activate'
230+'archive'
231+'build'
232+'cat'
233+'clean'
234+'configure'
235+'contents'
236+'deactivate'
237+'dependents'
238+'deps'
239+'destroot'
240+'dir'
241+'distcheck'
242+'distclean'
243+'dmg'
244+'echo'
245+'edit'
246+'extract'
247+'fetch'
248+'file'
249+'help'
250+'info'
251+'install'
252+'installed'
253+'list'
254+'livecheck'
255+'location'
256+'mpkg'
257+'outdated'
258+'patch'
259+'pkg'
260+'provides'
261+'rpmpackage'
262+'search'
263+'selfupdate'
264+'sync'
265+'test'
266+'unarchive'
267+'uninstall'
268+'upgrade'
269+'variants'
270+'version'
271+)
272+
273+_arguments -C \
274+'-v[verbose mode (generate verbose messages)]' \
275+'-d[debug mode (generate debugging messages)]' \
276+'-q[quiet mode (suppress messages)]' \
277+'-D[specify portdir]' \
278+'-k[keep mode (do not autoclean after install)]' \
279+'-n[dont follow dependencies in upgrade (only for upgrading)]' \
280+'-a[upgrade all installed ports (only for upgrading)]' \
281+'-u[uninstall non-active ports when upgrading and uninstalling]' \
282+'-f[force mode (ignore state file)]' \
283+'-s[source-only mode]' \
284+'-b[binary-only mode]' \
285+'-o[honor state files older than Portfile]' \
286+'*::command:->command' \
287+&& return 0
288+
289+case $state in
290+ command)
291+ if ((CURRENT == 1)); then
292+ state=subcommands
293+ else
294+ state=portname
295+ fi
296+ ;;
297+esac
298+
299+case $state in
300+ subcommands)
301+ _describe -t commands 'port commands' subcmds
302+ ;;
303+ portname)
304+ _describe -t commands 'available ports' portlist
305+ ;;
306+esac
307diff --git a/plugins/macports/macports.plugin.zsh b/plugins/macports/macports.plugin.zsh
308index 9564829b036373ce405dd17c61936a9b5ab4184d..cbbc4926596480a1567ae5b36e812412c3c901d3 100644
309--- a/plugins/macports/macports.plugin.zsh
310+++ b/plugins/macports/macports.plugin.zsh
311@@ -5,3 +5,8 @@ alias psu="sudo port selfupdate"
312 alias puni="sudo port uninstall inactive"
313 alias puo="sudo port upgrade outdated"
314 alias pup="psu && puo"
315+
316+# add macports completion function to path
317+fpath=($ZSH/plugins/macports $fpath)
318+autoload -U compinit
319+compinit -i
320diff --git a/plugins/perl/perl.plugin.zsh b/plugins/perl/perl.plugin.zsh
321new file mode 100644
322index 0000000000000000000000000000000000000000..f94c4195dcecb2d0c15e5baa6a651731212405ad
323--- /dev/null
324+++ b/plugins/perl/perl.plugin.zsh
325@@ -0,0 +1,62 @@
326+# https://github.com/dbbolton
327+#
328+# Below are some useful Perl-related aliases/functions that I use with zsh.
329+
330+
331+# Aliases ###################################################################
332+
333+# perlbrew ########
334+alias pbi='perlbrew install'
335+alias pbl='perlbrew list'
336+alias pbo='perlbrew off'
337+alias pbs='perlbrew switch'
338+alias pbu='perlbrew use'
339+
340+# Perl ############
341+
342+# perldoc`
343+alias pd='perldoc'
344+
345+# use perl like awk/sed
346+alias ple='perl -wlne'
347+
348+# show the latest stable release of Perl
349+alias latest-perl='curl -s http://www.perl.org/get.html | perl -wlne '\''if (/perl\-([\d\.]+)\.tar\.gz/) { print $1; exit;}'\'
350+
351+
352+
353+# Functions #################################################################
354+
355+# newpl - creates a basic Perl script file and opens it with $EDITOR
356+newpl () {
357+ # set $EDITOR to 'vim' if it is undefined
358+ [[ -z $EDITOR ]] && EDITOR=vim
359+
360+ # if the file exists, just open it
361+ [[ -e $1 ]] && print "$1 exists; not modifying.\n" && $EDITOR $1
362+
363+ # if it doesn't, make it, and open it
364+ [[ ! -e $1 ]] && print '#!/usr/bin/perl'"\n"'use strict;'"\n"'use warnings;'\
365+ "\n\n" > $1 && $EDITOR $1
366+}
367+
368+
369+# pgs - Perl Global Substitution
370+# find pattern = 1st arg
371+# replace pattern = 2nd arg
372+# filename = 3rd arg
373+pgs() { # [find] [replace] [filename]
374+ perl -i.orig -pe 's/'"$1"'/'"$2"'/g' "$3"
375+}
376+
377+
378+# Perl grep, because 'grep -P' is terrible. Lets you work with pipes or files.
379+prep() { # [pattern] [filename unless STDOUT]
380+ perl -nle 'print if /'"$1"'/;' $2
381+}
382+
383+# say - append a newline to 'print'
384+say() {
385+ print "$1\n"
386+}
387+
388diff --git a/plugins/ssh-agent/ssh-agent.plugin.zsh b/plugins/ssh-agent/ssh-agent.plugin.zsh
389index ce0d645c1c00ae3494aeeb5ff1f0ebd334b00955..0efc4546f98767de768bef86e9e34169935c4c13 100644
390--- a/plugins/ssh-agent/ssh-agent.plugin.zsh
391+++ b/plugins/ssh-agent/ssh-agent.plugin.zsh
392@@ -1,7 +1,7 @@
393 # Based on code from Joseph M. Reagle
394 # http://www.cygwin.com/ml/cygwin/2001-06/msg00537.html
395
396-local SSH_ENV=$HOME/.ssh/environment
397+local SSH_ENV=$HOME/.ssh/environment-$HOST
398
399 function start_agent {
400 /usr/bin/env ssh-agent | sed 's/^echo/#echo/' > ${SSH_ENV}
401diff --git a/themes/tjkirch.zsh-theme b/themes/tjkirch.zsh-theme
402new file mode 100644
403index 0000000000000000000000000000000000000000..446cde724e7e66fa40c754b47af7ab6adc6ec1c4
404--- /dev/null
405+++ b/themes/tjkirch.zsh-theme
406@@ -0,0 +1,15 @@
407+ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[green]%}"
408+ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
409+ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}⚡"
410+ZSH_THEME_GIT_PROMPT_CLEAN=""
411+
412+function prompt_char {
413+ if [ $UID -eq 0 ]; then echo "%{$fg[red]%}#%{$reset_color%}"; else echo $; fi
414+}
415+
416+PROMPT='%(?, ,%{$fg[red]%}FAIL: $?%{$reset_color%}
417+)
418+%{$fg[magenta]%}%n%{$reset_color%}@%{$fg[yellow]%}%m%{$reset_color%}: %{$fg_bold[blue]%}%~%{$reset_color%}$(git_prompt_info)
419+%_$(prompt_char) '
420+
421+RPROMPT='%{$fg[green]%}[%*]%{$reset_color%}'