summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/atom/atom.plugin.zsh4
-rw-r--r--plugins/battery/battery.plugin.zsh80
-rw-r--r--plugins/brew/_brew1
-rw-r--r--plugins/cabal/cabal.plugin.zsh11
-rw-r--r--plugins/gitignore/gitignore.plugin.zsh6
-rw-r--r--plugins/iwhois/iwhois.plugin.zsh8
-rw-r--r--plugins/nyan/nyan.plugin.zsh2
-rw-r--r--plugins/rake/rake.plugin.zsh4
-rw-r--r--plugins/sudo/sudo.plugin.zsh (renamed from plugins/sudo/sudo.zsh)0
-rw-r--r--plugins/tmuxinator/_tmuxinator2
10 files changed, 102 insertions, 16 deletions
diff --git a/plugins/atom/atom.plugin.zsh b/plugins/atom/atom.plugin.zsh
new file mode 100644
index 000000000..048fd7521
--- /dev/null
+++ b/plugins/atom/atom.plugin.zsh
@@ -0,0 +1,4 @@
+#
+# Your guess is as good as mine. Let's just assume that we will need this...
+# - For more info visit... http://atom.io/
+# \ No newline at end of file
diff --git a/plugins/battery/battery.plugin.zsh b/plugins/battery/battery.plugin.zsh
index 9f053383a..16ad3e651 100644
--- a/plugins/battery/battery.plugin.zsh
+++ b/plugins/battery/battery.plugin.zsh
@@ -11,8 +11,9 @@
if [[ $(uname) == "Darwin" ]] ; then
function battery_pct() {
- typeset -F maxcapacity=$(ioreg -rc "AppleSmartBattery"| grep '^.*"MaxCapacity"\ =\ ' | sed -e 's/^.*"MaxCapacity"\ =\ //')
- typeset -F currentcapacity=$(ioreg -rc "AppleSmartBattery"| grep '^.*"CurrentCapacity"\ =\ ' | sed -e 's/^.*CurrentCapacity"\ =\ //')
+ local smart_battery_status="$(ioreg -rc "AppleSmartBattery")"
+ typeset -F maxcapacity=$(echo $smart_battery_status | grep '^.*"MaxCapacity"\ =\ ' | sed -e 's/^.*"MaxCapacity"\ =\ //')
+ typeset -F currentcapacity=$(echo $smart_battery_status | grep '^.*"CurrentCapacity"\ =\ ' | sed -e 's/^.*CurrentCapacity"\ =\ //')
integer i=$(((currentcapacity/maxcapacity) * 100))
echo $i
}
@@ -26,8 +27,9 @@ if [[ $(uname) == "Darwin" ]] ; then
}
function battery_time_remaining() {
- if [[ $(ioreg -rc AppleSmartBattery | grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]] ; then
- timeremaining=$(ioreg -rc "AppleSmartBattery"| grep '^.*"AvgTimeToEmpty"\ =\ ' | sed -e 's/^.*"AvgTimeToEmpty"\ =\ //')
+ local smart_battery_status="$(ioreg -rc "AppleSmartBattery")"
+ if [[ $(echo $smart_battery_status | grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]] ; then
+ timeremaining=$(echo $smart_battery_status | grep '^.*"AvgTimeToEmpty"\ =\ ' | sed -e 's/^.*"AvgTimeToEmpty"\ =\ //')
echo "~$((timeremaining / 60)):$((timeremaining % 60))"
else
echo "∞"
@@ -49,6 +51,10 @@ if [[ $(uname) == "Darwin" ]] ; then
echo "∞"
fi
}
+
+ function battery_is_charging() {
+ [[ $(ioreg -rc "AppleSmartBattery"| grep '^.*"IsCharging"\ =\ ' | sed -e 's/^.*"IsCharging"\ =\ //') == "Yes" ]]
+ }
elif [[ $(uname) == "Linux" ]] ; then
@@ -79,14 +85,66 @@ elif [[ $(uname) == "Linux" ]] ; then
echo "∞"
fi
}
+
+ function battery_pct() {
+ # todo for on linux
+ }
+
+ function battery_is_charging() {
+ # todo on linux
+ false
+ }
+
else
- # Empty functions so we don't cause errors in prompts
- function battery_pct_remaining() {
- }
+ # Empty functions so we don't cause errors in prompts
+ function battery_pct_remaining() {
+ }
- function battery_time_remaining() {
- }
+ function battery_time_remaining() {
+ }
- function battery_pct_prompt() {
- }
+ function battery_pct_prompt() {
+ }
fi
+
+function battery_level_gauge() {
+ local gauge_slots=${BATTERY_GAUGE_SLOTS:-10};
+ local green_threshold=${BATTERY_GREEN_THRESHOLD:-6};
+ local yellow_threshold=${BATTERY_YELLOW_THRESHOLD:-4};
+ local color_green=${BATTERY_COLOR_GREEN:-%F{green}};
+ local color_yellow=${BATTERY_COLOR_YELLOW:-%F{yellow}};
+ local color_red=${BATTERY_COLOR_RED:-%F{red}};
+ local color_reset=${BATTERY_COLOR_RESET:-%{%f%k%b%}};
+ local battery_prefix=${BATTERY_GAUGE_PREFIX:-'['};
+ local battery_suffix=${BATTERY_GAUGE_SUFFIX:-']'};
+ local filled_symbol=${BATTERY_GAUGE_FILLED_SYMBOL:-'▶'};
+ local empty_symbol=${BATTERY_GAUGE_EMPTY_SYMBOL:-'▷'};
+ local charging_color=${BATTERY_CHARGING_COLOR:-$color_yellow};
+ local charging_symbol=${BATTERY_CHARGING_SYMBOL:-'⚡'};
+
+ local battery_remaining_percentage=$(battery_pct);
+
+ if [[ $battery_remaining_percentage =~ [0-9]+ ]]; then
+ local filled=$(((( $battery_remaining_percentage + $gauge_slots - 1) / $gauge_slots)));
+ local empty=$(($gauge_slots - $filled));
+
+ if [[ $filled -gt $green_threshold ]]; then local gauge_color=$color_green;
+ elif [[ $filled -gt $yellow_threshold ]]; then local gauge_color=$color_yellow;
+ else local gauge_color=$color_red;
+ fi
+ else
+ local filled=$gauge_slots;
+ local empty=0;
+ filled_symbol=${BATTERY_UNKNOWN_SYMBOL:-'.'};
+ fi
+
+
+ local charging=' ' && battery_is_charging && charging=$charging_symbol;
+
+ printf ${charging_color//\%/\%\%}$charging${color_reset//\%/\%\%}${battery_prefix//\%/\%\%}${gauge_color//\%/\%\%}
+ printf ${filled_symbol//\%/\%\%}'%.0s' {1..$filled}
+ [[ $filled -lt $gauge_slots ]] && printf ${empty_symbol//\%/\%\%}'%.0s' {1..$empty}
+ printf ${color_reset//\%/\%\%}${battery_suffix//\%/\%\%}${color_reset//\%/\%\%}
+}
+
+
diff --git a/plugins/brew/_brew b/plugins/brew/_brew
index a25caf40c..d4306f223 100644
--- a/plugins/brew/_brew
+++ b/plugins/brew/_brew
@@ -33,6 +33,7 @@ _1st_arguments=(
'remove:remove a formula'
'search:search for a formula (/regex/ or string)'
'server:start a local web app that lets you browse formulae (requires Sinatra)'
+ 'services:manage background services via launchctl'
'unlink:unlink a formula'
'update:freshen up links'
'upgrade:upgrade outdated formulae'
diff --git a/plugins/cabal/cabal.plugin.zsh b/plugins/cabal/cabal.plugin.zsh
index 8d3c64587..9f76add7a 100644
--- a/plugins/cabal/cabal.plugin.zsh
+++ b/plugins/cabal/cabal.plugin.zsh
@@ -1,3 +1,14 @@
+function cabal_sandbox_info() {
+ cabal_files=(*.cabal(N))
+ if [ $#cabal_files -gt 0 ]; then
+ if [ -f cabal.sandbox.config ]; then
+ echo "%{$fg[green]%}sandboxed%{$reset_color%}"
+ else
+ echo "%{$fg[red]%}not sandboxed%{$reset_color%}"
+ fi
+ fi
+}
+
function _cabal_commands() {
local ret=1 state
_arguments ':subcommand:->subcommand' && ret=0
diff --git a/plugins/gitignore/gitignore.plugin.zsh b/plugins/gitignore/gitignore.plugin.zsh
index 332497cec..be037d87a 100644
--- a/plugins/gitignore/gitignore.plugin.zsh
+++ b/plugins/gitignore/gitignore.plugin.zsh
@@ -1,7 +1,7 @@
-function gi() { curl http://gitignore.io/api/$@ ;}
+function gi() { curl http://www.gitignore.io/api/$@ ;}
_gitignireio_get_command_list() {
- curl -s http://gitignore.io/api/list | tr "," "\n"
+ curl -s http://www.gitignore.io/api/list | tr "," "\n"
}
_gitignireio () {
@@ -9,4 +9,4 @@ _gitignireio () {
compadd -S '' `_gitignireio_get_command_list`
}
-compdef _gitignireio gi \ No newline at end of file
+compdef _gitignireio gi
diff --git a/plugins/iwhois/iwhois.plugin.zsh b/plugins/iwhois/iwhois.plugin.zsh
new file mode 100644
index 000000000..38790bf28
--- /dev/null
+++ b/plugins/iwhois/iwhois.plugin.zsh
@@ -0,0 +1,8 @@
+# provide a whois command with a more accurate and up to date list of whois
+# servers using CNAMES via whois.geek.nz
+
+function iwhois() {
+ resolver="whois.geek.nz"
+ tld=`echo ${@: -1} | awk -F "." '{print $NF}'`
+ whois -h ${tld}.${resolver} "$@" ;
+}
diff --git a/plugins/nyan/nyan.plugin.zsh b/plugins/nyan/nyan.plugin.zsh
index 6321e5f5a..ac9d0017e 100644
--- a/plugins/nyan/nyan.plugin.zsh
+++ b/plugins/nyan/nyan.plugin.zsh
@@ -1,5 +1,5 @@
if [[ -x `which nc` ]]; then
- alias nyan='nc -v miku.acm.uiuc.edu 23' # nyan cat
+ alias nyan='nc -v nyancat.dakko.us 23' # nyan cat
fi
diff --git a/plugins/rake/rake.plugin.zsh b/plugins/rake/rake.plugin.zsh
index 16b933c14..121150017 100644
--- a/plugins/rake/rake.plugin.zsh
+++ b/plugins/rake/rake.plugin.zsh
@@ -1,3 +1,7 @@
+# Thank you Jim for everything you contributed to the Ruby and open source community
+# over the years. We will miss you dearly.
+alias jimweirich="rake"
+
alias rake="noglob rake" # allows square brackts for rake task invocation
alias brake='noglob bundle exec rake' # execute the bundled rake gem
alias srake='noglob sudo rake' # noglob must come before sudo
diff --git a/plugins/sudo/sudo.zsh b/plugins/sudo/sudo.plugin.zsh
index d12e06853..d12e06853 100644
--- a/plugins/sudo/sudo.zsh
+++ b/plugins/sudo/sudo.plugin.zsh
diff --git a/plugins/tmuxinator/_tmuxinator b/plugins/tmuxinator/_tmuxinator
index 117685279..cd227b7df 100644
--- a/plugins/tmuxinator/_tmuxinator
+++ b/plugins/tmuxinator/_tmuxinator
@@ -25,7 +25,7 @@ case $state in
args)
case $line[1] in
start|open|copy|delete)
- _configs=(`find ~/.tmuxinator/ -name \*.yml | cut -d/ -f5 | sed s:.yml::g`)
+ _configs=(`find ~/.tmuxinator -name \*.yml | cut -d/ -f5 | sed s:.yml::g`)
_values 'configs' $_configs
ret=0
;;