Diff
1diff --git a/plugins/archlinux/archlinux.plugin.zsh b/plugins/archlinux/archlinux.plugin.zsh
2index 294dc5354cce12627ab52e0d0d69f45ec9859131..ae92a0b4c5913ee7b7074f48b9cb283b5c437992 100644
3--- a/plugins/archlinux/archlinux.plugin.zsh
4+++ b/plugins/archlinux/archlinux.plugin.zsh
5@@ -11,7 +11,7 @@ if [[ -x `which yaourt` ]]; then
6 alias yaupg='yaourt -Syu' # Synchronize with repositories before upgrading packages that are out of date on the local system.
7 alias yasu='yaourt --sucre' # Same as yaupg, but without confirmation
8 alias yain='yaourt -S' # Install specific package(s) from the repositories
9- alias yains='yaourt -U' # Install specific package not from the repositories but from a file
10+ alias yains='yaourt -U' # Install specific package not from the repositories but from a file
11 alias yare='yaourt -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies
12 alias yarem='yaourt -Rns' # Remove the specified package(s), its configuration(s) and unneeded dependencies
13 alias yarep='yaourt -Si' # Display information about a given package in the repositories
14@@ -35,7 +35,7 @@ fi
15 # Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips
16 alias pacupg='sudo pacman -Syu' # Synchronize with repositories before upgrading packages that are out of date on the local system.
17 alias pacin='sudo pacman -S' # Install specific package(s) from the repositories
18-alias pacins='sudo pacman -U' # Install specific package not from the repositories but from a file
19+alias pacins='sudo pacman -U' # Install specific package not from the repositories but from a file
20 alias pacre='sudo pacman -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies
21 alias pacrem='sudo pacman -Rns' # Remove the specified package(s), its configuration(s) and unneeded dependencies
22 alias pacrep='pacman -Si' # Display information about a given package in the repositories
23@@ -75,3 +75,19 @@ pacdisowned() {
24
25 comm -23 "$fs" "$db"
26 }
27+
28+pacmanallkeys() {
29+ # Get all keys for developers and trusted users
30+ curl https://www.archlinux.org/{developers,trustedusers}/ |
31+ awk -F\" '(/pgp.mit.edu/) {sub(/.*search=0x/,"");print $1}' |
32+ xargs sudo pacman-key --recv-keys
33+}
34+
35+pacmansignkeys() {
36+ for key in $*; do
37+ sudo pacman-key --recv-keys $key
38+ sudo pacman-key --lsign-key $key
39+ printf 'trust\n3\n' | sudo gpg --homedir /etc/pacman.d/gnupg \
40+ --no-permission-warning --command-fd 0 --edit-key $key
41+ done
42+}
43diff --git a/plugins/battery/battery.plugin.zsh b/plugins/battery/battery.plugin.zsh
44index bc75c5cf9ad01bd58ef29c4d83782ce5a849baff..9f404088a0bf66a8cedc4b0b49f0a67f9d1ebb4f 100644
45--- a/plugins/battery/battery.plugin.zsh
46+++ b/plugins/battery/battery.plugin.zsh
47@@ -1,20 +1,71 @@
48-if [[ $(acpi 2&>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then
49- function battery_pct_remaining() { echo "$(acpi | cut -f2 -d ',' | tr -cd '[:digit:]')" }
50- function battery_time_remaining() { echo $(acpi | cut -f3 -d ',') }
51- function battery_pct_prompt() {
52- b=$(battery_pct_remaining)
53- if [ $b -gt 50 ] ; then
54- color='green'
55- elif [ $b -gt 20 ] ; then
56- color='yellow'
57+###########################################
58+# Battery plugin for oh-my-zsh #
59+# Original Author: Peter hoeg (peterhoeg) #
60+# Email: peter@speartail.com #
61+###########################################
62+# Author: Sean Jones (neuralsandwich) #
63+# Email: neuralsandwich@gmail.com #
64+# Modified to add support for Apple Mac #
65+###########################################
66+
67+if [[ $(uname) -eq "Darwin" ]] ; then
68+
69+ function battery_pct_remaining() {
70+ if [[ $(ioreg -rc AppleSmartBattery | grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]] ; then
71+ typeset -F maxcapacity=$(ioreg -rc "AppleSmartBattery"| grep '^.*"MaxCapacity"\ =\ ' | sed -e 's/^.*"MaxCapacity"\ =\ //')
72+ typeset -F currentcapacity=$(ioreg -rc "AppleSmartBattery"| grep '^.*"CurrentCapacity"\ =\ ' | sed -e 's/^.*CurrentCapacity"\ =\ //')
73+ integer i=$(((currentcapacity/maxcapacity) * 100))
74+ echo $i
75 else
76- color='red'
77+ echo "External Power"
78 fi
79- echo "%{$fg[$color]%}[$(battery_pct_remaining)%%]%{$reset_color%}"
80 }
81-else
82- error_msg='no battery'
83- function battery_pct_remaining() { echo $error_msg }
84- function battery_time_remaining() { echo $error_msg }
85- function battery_pct_prompt() { echo '' }
86+
87+ function battery_time_remaining() {
88+ if [[ $(ioreg -rc AppleSmartBattery | grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]] ; then
89+ timeremaining=$(ioreg -rc "AppleSmartBattery"| grep '^.*"AvgTimeToEmpty"\ =\ ' | sed -e 's/^.*"AvgTimeToEmpty"\ =\ //')
90+ echo "~$((timeremaining / 60)):$((timeremaining % 60))"
91+ else
92+ echo "∞"
93+ fi
94+ }
95+
96+ function battery_pct_prompt () {
97+ if [[ $(ioreg -rc AppleSmartBattery | grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]] ; then
98+ b=$(battery_pct_remaining)
99+ if [ $b -gt 50 ] ; then
100+ color='green'
101+ elif [ $b -gt 20 ] ; then
102+ color='yellow'
103+ else
104+ color='red'
105+ fi
106+ echo "%{$fg[$color]%}[$(battery_pct_remaining)%%]%{$reset_color%}"
107+ else
108+ echo ""
109+ fi
110+ }
111+
112+elif [[ $(uname) -eq "Linux" ]] ; then
113+
114+ if [[ $(acpi 2&>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then
115+ function battery_pct_remaining() { echo "$(acpi | cut -f2 -d ',' | tr -cd '[:digit:]')" }
116+ function battery_time_remaining() { echo $(acpi | cut -f3 -d ',') }
117+ function battery_pct_prompt() {
118+ b=$(battery_pct_remaining)
119+ if [ $b -gt 50 ] ; then
120+ color='green'
121+ elif [ $b -gt 20 ] ; then
122+ color='yellow'
123+ else
124+ color='red'
125+ fi
126+ echo "%{$fg[$color]%}[$(battery_pct_remaining)%%]%{$reset_color%}"
127+ }
128+ else
129+ error_msg='no battery'
130+ function battery_pct_remaining() { echo $error_msg }
131+ function battery_time_remaining() { echo $error_msg }
132+ function battery_pct_prompt() { echo '' }
133+ fi
134 fi
135diff --git a/plugins/rsync/rsync.plugin.zsh b/plugins/rsync/rsync.plugin.zsh
136new file mode 100644
137index 0000000000000000000000000000000000000000..33a31a5c10eb81fc17b8d6688dea1185844b892a
138--- /dev/null
139+++ b/plugins/rsync/rsync.plugin.zsh
140@@ -0,0 +1,4 @@
141+alias rsync-copy="rsync -av --progress -h"
142+alias rsync-move="rsync -av --progress -h --remove-source-files"
143+alias rsync-update="rsync -avu --progress -h"
144+alias rsync-synchronize="rsync -avu --delete --progress -h"
145diff --git a/plugins/vagrant/_vagrant b/plugins/vagrant/_vagrant
146index 483b29c53d57186b01ec55d780f8debce0cb5995..9bed1e3c69d845c00100e21fdb2103a9d66dee4e 100644
147--- a/plugins/vagrant/_vagrant
148+++ b/plugins/vagrant/_vagrant
149@@ -46,6 +46,11 @@ __box_list ()
150 _wanted application expl 'command' compadd $(command ls -1 $HOME/.vagrant/boxes 2>/dev/null| sed -e 's/ /\\ /g')
151 }
152
153+__vm_list ()
154+{
155+ _wanted application expl 'command' compadd $(command grep Vagrantfile -oe '^[^#]*\.vm\.define *:\([a-zA-Z0-9]\+\)' 2>/dev/null | cut -d: -f2)
156+}
157+
158 __vagrant-box ()
159 {
160 local curcontext="$curcontext" state line
161@@ -99,6 +104,8 @@ case $state in
162 (box)
163 __vagrant-box
164 ;;
165+ (up|provision|package|destroy|reload|ssh|halt|resume|status)
166+ _arguments ':feature:__vm_list'
167 esac
168 ;;
169 esac
170diff --git a/themes/candy-kingdom.zsh-theme b/themes/candy-kingdom.zsh-theme
171new file mode 100644
172index 0000000000000000000000000000000000000000..25aeb65974f4c491c4ca842c4fca5b6999828d60
173--- /dev/null
174+++ b/themes/candy-kingdom.zsh-theme
175@@ -0,0 +1,37 @@
176+# neuralsanwich.zsh-theme
177+#
178+# Author: Sean Jones
179+# URL: http://www.neuralsandwich.com
180+# Repo:
181+# Direct link:
182+# Create:
183+# Modified:
184+
185+if [ "x$OH_MY_ZSH_HG" = "x" ]; then
186+ OH_MY_ZSH_HG="hg"
187+fi
188+
189+function hg_prompt_info {
190+ $OH_MY_ZSH_HG prompt --angle-brackets "\
191+< on %{$fg[magenta]%}<branch>%{$reset_color%}>\
192+< at %{$fg[yellow]%}<tags|%{$reset_color%}, %{$fg[yellow]%}>%{$reset_color%}>\
193+%{$fg[green]%}<status|modified|unknown><update>%{$reset_color%}<
194+patches: <patches|join( → )|pre_applied(%{$fg[yellow]%})|post_applied(%{$reset_color%})|pre_unapplied(%{$fg_bold[black]%})|post_unapplied(%{$reset_color%})>>" 2>/dev/null
195+}
196+
197+function box_name {
198+ [ -f ~/.box-name ] && cat ~/.box-name || hostname -s
199+}
200+
201+PROMPT='
202+%{$fg[magenta]%}%n%{$reset_color%}@%{$fg[yellow]%}$(box_name)%{$reset_color%}:%{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$(hg_prompt_info)$(git_prompt_info)
203+%(?,,%{${fg_bold[white]}%}[%?]%{$reset_color%} )$ '
204+
205+ZSH_THEME_GIT_PROMPT_PREFIX=" (%{$fg[magenta]%}branch: "
206+ZSH_THEME_GIT_PROMPT_CLEAN=""
207+ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[red]%}?"
208+ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[orange]%}!"
209+ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%})"
210+
211+local return_status="%{$fg[red]%}%(?..✘)%{$reset_color%}"
212+RPROMPT='${return_status}$(battery_time_remaining) $(battery_pct_prompt)%{$reset_color%}'
213diff --git a/themes/gentoo.zsh-theme b/themes/gentoo.zsh-theme
214index cba143d426d0dadd49d1d8a9be2e966501f5c580..ee205d248c2aa1888062dd402c2e558612e2fc1f 100644
215--- a/themes/gentoo.zsh-theme
216+++ b/themes/gentoo.zsh-theme
217@@ -1,4 +1,8 @@
218-PROMPT='%(!.%{$fg_bold[red]%}.%{$fg_bold[green]%}%n@)%m %{$fg_bold[blue]%}%(!.%1~.%~) $(git_prompt_info)%#%{$reset_color%} '
219+function prompt_char {
220+ if [ $UID -eq 0 ]; then echo "#"; else echo $; fi
221+}
222+
223+PROMPT='%(!.%{$fg_bold[red]%}.%{$fg_bold[green]%}%n@)%m %{$fg_bold[blue]%}%(!.%1~.%~) $(git_prompt_info)%_$(prompt_char)%{$reset_color%} '
224
225 ZSH_THEME_GIT_PROMPT_PREFIX="("
226 ZSH_THEME_GIT_PROMPT_SUFFIX=") "