a116b6f75a036aad60bd506eb76d153ce7286f72
- Author
- Claus Witt <claus@wittnezz.dk>
- Committer
- Claus Witt <claus@wittnezz.dk>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/lib/completion.zsh b/lib/completion.zsh
2index 52cc5b53c0fe14d4b65953d04cee4342122794de..9c2dfecca3cc82ee5f3b1231f11b7a9f75e2e3a4 100644
3--- a/lib/completion.zsh
4+++ b/lib/completion.zsh
5@@ -34,9 +34,31 @@ zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm
6 zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories
7 cdpath=(.)
8
9+# use /etc/hosts and known_hosts for hostname completion
10+[ -r ~/.ssh/known_hosts ] && _ssh_hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=()
11+[ -r /etc/hosts ] && : ${(A)_etc_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}} || _etc_hosts=()
12+hosts=(
13+ "$_ssh_hosts[@]"
14+ "$_etc_hosts[@]"
15+ `hostname`
16+ localhost
17+)
18+zstyle ':completion:*:hosts' hosts $hosts
19+
20+# Use caching so that commands like apt and dpkg complete are useable
21+zstyle ':completion::complete:*' use-cache 1
22+zstyle ':completion::complete:*' cache-path ~/.oh-my-zsh/cache/
23+
24+# Don't complete uninteresting users
25+zstyle ':completion:*:*:*:users' ignored-patterns \
26+ adm amanda apache avahi beaglidx bin cacti canna clamav daemon \
27+ dbus distcache dovecot fax ftp games gdm gkrellmd gopher \
28+ hacluster haldaemon halt hsqldb ident junkbust ldap lp mail \
29+ mailman mailnull mldonkey mysql nagios \
30+ named netdump news nfsnobody nobody nscd ntp nut nx openvpn \
31+ operator pcap postfix postgres privoxy pulse pvm quagga radvd \
32+ rpc rpcuser rpm shutdown squid sshd sync uucp vcsa xfs
33+
34+# ... unless we really want to.
35+zstyle '*' single-ignored show
36
37-# Load known hosts file for auto-completion with ssh and scp commands
38-if [ -f ~/.ssh/known_hosts ]; then
39- zstyle ':completion:*' hosts $( sed 's/[, ].*$//' $HOME/.ssh/known_hosts )
40- zstyle ':completion:*:*:(ssh|scp):*:*' hosts `sed 's/^\([^ ,]*\).*$/\1/' ~/.ssh/known_hosts`
41-fi
42diff --git a/plugins/command-not-found/command-not-found.plugin.zsh b/plugins/command-not-found/command-not-found.plugin.zsh
43new file mode 100644
44index 0000000000000000000000000000000000000000..5ab03d5a9a57c3ff3f46a9ae881e6bb1643becbd
45--- /dev/null
46+++ b/plugins/command-not-found/command-not-found.plugin.zsh
47@@ -0,0 +1,5 @@
48+# Uses the command-not-found package zsh support
49+# as seen in http://www.porcheron.info/command-not-found-for-zsh/
50+# this is installed in Ubuntu
51+
52+source /etc/zsh_command_not_found
53diff --git a/plugins/lighthouse/lighthouse.plugin.zsh b/plugins/lighthouse/lighthouse.plugin.zsh
54index 4eb06a997100bf1f08394626c129f571030a7517..7661c6add6124a30a9544c47fdd4521657e3d69f 100644
55--- a/plugins/lighthouse/lighthouse.plugin.zsh
56+++ b/plugins/lighthouse/lighthouse.plugin.zsh
57@@ -4,7 +4,7 @@
58 # Example usage: http://screencast.com/t/ZDgwNDUwNT
59 open_lighthouse_ticket () {
60 if [ ! -f .lighthouse-url ]; then
61- echo "There is no .lighthouse file in the current directory..."
62+ echo "There is no .lighthouse-url file in the current directory..."
63 return 0;
64 else
65 lighthouse_url=$(cat .lighthouse-url);
66@@ -13,4 +13,4 @@ open_lighthouse_ticket () {
67 fi
68 }
69
70-alias lho='open_lighthouse_ticket'
71+alias lho='open_lighthouse_ticket'
72diff --git a/plugins/vagrant/_vagrant b/plugins/vagrant/_vagrant
73new file mode 100644
74index 0000000000000000000000000000000000000000..483b29c53d57186b01ec55d780f8debce0cb5995
75--- /dev/null
76+++ b/plugins/vagrant/_vagrant
77@@ -0,0 +1,104 @@
78+#compdef vagrant
79+#autoload
80+
81+# vagrant zsh completion
82+
83+local -a _1st_arguments
84+_1st_arguments=(
85+ 'box:Box commands'
86+ 'destroy:Destroys the vagrant environment'
87+ 'halt:Halts the currently running vagrant environment'
88+ 'help:[TASK] Describe available tasks or one specific task'
89+ 'init:[box_name] [box_url] Initializes current folder for Vagrant usage'
90+ 'package:Packages a vagrant environment for distribution'
91+ 'provision:Run the provisioner'
92+ 'reload:Reload the vagrant environment'
93+ 'resume:Resumes a suspend vagrant environment'
94+ 'ssh:SSH into the currently running environment'
95+ 'ssh_config:outputs .ssh/config valid syntax for connecting to this environment via ssh.'
96+ 'status:Shows the status of the current Vagrant environment.'
97+ 'suspend:Suspends the currently running vagrant environment'
98+ 'up:Creates the vagrant environment'
99+ 'version:Prints the Vagrant version information'
100+)
101+
102+local -a _box_arguments
103+_box_arguments=(
104+ 'add:NAME URI Add a box to the system'
105+ 'help:COMMAND Describe subcommands or one specific subcommand'
106+ 'list:Lists all installed boxes'
107+ 'remove:NAME Remove a box from the system'
108+ 'repackage:NAME Repackage an installed box into a `.box` file.'
109+)
110+
111+__task_list ()
112+{
113+ local expl
114+ declare -a tasks
115+
116+ tasks=(box destroy halt init package provision reload resume ssh ssh_config status suspend up version)
117+
118+ _wanted tasks expl 'help' compadd $tasks
119+}
120+
121+__box_list ()
122+{
123+ _wanted application expl 'command' compadd $(command ls -1 $HOME/.vagrant/boxes 2>/dev/null| sed -e 's/ /\\ /g')
124+}
125+
126+__vagrant-box ()
127+{
128+ local curcontext="$curcontext" state line
129+ typeset -A opt_args
130+
131+ _arguments -C \
132+ ':command:->command' \
133+ '*::options:->options'
134+
135+ case $state in
136+ (command)
137+ _describe -t commands "gem subcommand" _box_arguments
138+ return
139+ ;;
140+
141+ (options)
142+ case $line[1] in
143+ (repackage|remove)
144+ _arguments ':feature:__box_list'
145+ ;;
146+ esac
147+ ;;
148+ esac
149+}
150+
151+
152+
153+
154+local expl
155+local -a boxes installed_boxes
156+
157+local curcontext="$curcontext" state line
158+typeset -A opt_args
159+
160+_arguments -C \
161+ ':command:->command' \
162+ '*::options:->options'
163+
164+case $state in
165+ (command)
166+ _describe -t commands "gem subcommand" _1st_arguments
167+ return
168+ ;;
169+
170+ (options)
171+ case $line[1] in
172+ (help)
173+ _arguments ':feature:__task_list'
174+ ;;
175+
176+ (box)
177diff --git a/plugins/vagrant/vagrant.plugin.zsh b/plugins/vagrant/vagrant.plugin.zsh
178new file mode 100644
179index 0000000000000000000000000000000000000000..5e9bcf10a4ed23a24bdd4040f6501f3b43562caf
180--- /dev/null
181+++ b/plugins/vagrant/vagrant.plugin.zsh
182@@ -0,0 +1,3 @@
183+fpath=($ZSH/plugins/vagrant $fpath)
184+autoload -U compinit
185+compinit -i
186diff --git a/themes/bira.zsh-theme b/themes/bira.zsh-theme
187new file mode 100644
188index 0000000000000000000000000000000000000000..f0ee6a5bded2ca01dc9dbf2bb6ca8f1890eb2b34
189--- /dev/null
190+++ b/themes/bira.zsh-theme
191@@ -0,0 +1,14 @@
192+# ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png
193+local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
194+
195+local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}'
196+local current_dir='%{$terminfo[bold]$fg[blue]%} %~%{$reset_color%}'
197+local rvm_ruby='%{$fg[red]%}‹$(~/.rvm/bin/rvm-prompt i v g)›%{$reset_color%}'
198+local git_branch='$(git_prompt_info)%{$reset_color%}'
199+
200+PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch}
201+╰─%B$%b "
202+RPS1="${return_code}"
203+
204+ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹"
205+ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}"