b865f2ab38156c33bdb1d6ffc6df56b3f2d53588
- Author
- Erik Kastner <kastner@gmail.com>
- Committer
- Erik Kastner <kastner@gmail.com>
- Date
Message
adding homebrew completions - and a function dir
Diff
1diff --git a/functions/_brew b/functions/_brew
2new file mode 100644
3index 0000000000000000000000000000000000000000..91397bf3a8406a3ebde25a3215540569f59680c6
4--- /dev/null
5+++ b/functions/_brew
6@@ -0,0 +1,61 @@
7+#compdef brew
8+
9+# copied from _fink
10+
11+_brew_all_formulae() {
12+ formulae=(`brew search`)
13+}
14+
15+_brew_installed_formulae() {
16+ installed_formulae=(`brew list`)
17+}
18+
19+local -a _1st_arguments
20+_1st_arguments=(
21+ 'install:install a formula'
22+ 'remove:remove a formula'
23+ 'search:search for a formula (/regex/ or string)'
24+ 'list:list files in a formula or not-installed formulae'
25+ 'link:link a formula'
26+ 'unlink:unlink a formula'
27+ 'home:visit the homepage of a formula or the brew project'
28+ 'info:information about a formula'
29+ 'prune:remove dead links'
30+ 'update:freshen up links'
31+ 'log:git commit log for a formula'
32+ 'create:create a new formula'
33+ 'edit:edit a formula'
34+)
35+
36+local expl
37+local -a formula installed_formulae
38+
39+_arguments \
40+ '(-v --verbose)'{-v,--verbose}'[verbose]' \
41+ '(--version)--version[version information]' \
42+ '(--prefix)--prefix[where brew lives on this system]' \
43+ '(--cache)--cache[brew cache]' \
44+ '*:: :->subcmds' && return 0
45+
46+if (( CURRENT == 1 )); then
47+ _describe -t commands "brew subcommand" _1st_arguments
48+ return
49+fi
50+
51+case "$words[1]" in
52+ list)
53+ _arguments \
54+ '(--unbrewed)--unbrewed[files in brew --prefix not controlled by brew]' \
55+ '1: :->forms' && return 0
56+
57+ if [[ "$state" == forms ]]; then
58+ _brew_installed_formulae
59+ _requested installed_formulae expl 'installed formulae' compadd -a installed_formulae
60+ fi ;;
61+ install|home|log|info)
62+ _brew_all_formulae
63+ _wanted formulae expl 'all formulae' compadd -a formulae ;;
64+ remove|edit|xo)
65+ _brew_installed_formulae
66+ _wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae ;;
67+esac
68diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh
69index 4b5959625b5ac095b7505bf6126a35ab7737c2d4..eadf02d00fb0b625f58bd4ef2ea8dd56bcc85aef 100644
70--- a/oh-my-zsh.sh
71+++ b/oh-my-zsh.sh
72@@ -1,5 +1,8 @@
73 # Initializes Oh My Zsh
74
75+# add a function path
76+fpath=($ZSH/functions $fpath)
77+
78 # Load all of the config files in ~/oh-my-zsh that end in .zsh
79 # TIP: Add files you don't want in git to .gitignore
80 for config_file ($ZSH/lib/*.zsh) source $config_file