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/git/git.plugin.zsh6
-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/rbenv/rbenv.plugin.zsh8
-rw-r--r--plugins/sudo/sudo.plugin.zsh (renamed from plugins/sudo/sudo.zsh)0
-rw-r--r--plugins/svn-fast-info/svn-fast-info.plugin.zsh73
-rw-r--r--plugins/tmuxinator/_tmuxinator2
-rw-r--r--plugins/xcode/xcode.plugin.zsh1
14 files changed, 186 insertions, 20 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/git/git.plugin.zsh b/plugins/git/git.plugin.zsh
index fde22a37d..1285a3247 100644
--- a/plugins/git/git.plugin.zsh
+++ b/plugins/git/git.plugin.zsh
@@ -142,13 +142,13 @@ compdef _git glp=git-log
#
# This function return a warning if the current branch is a wip
function work_in_progress() {
- if $(git log -n 1 2>/dev/null | grep -q -c wip); then
+ if $(git log -n 1 2>/dev/null | grep -q -c "\-\-wip\-\-"); then
echo "WIP!!"
fi
}
# these alias commit and uncomit wip branches
-alias gwip='git add -A; git ls-files --deleted -z | xargs -0 git rm; git commit -m "wip"'
-alias gunwip='git log -n 1 | grep -q -c wip && git reset HEAD~1'
+alias gwip='git add -A; git ls-files --deleted -z | xargs -0 git rm; git commit -m "--wip--"'
+alias gunwip='git log -n 1 | grep -q -c "\-\-wip\-\-" && git reset HEAD~1'
# these alias ignore changes to file
alias gignore='git update-index --assume-unchanged'
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/rbenv/rbenv.plugin.zsh b/plugins/rbenv/rbenv.plugin.zsh
index 78f76c3a3..57ae2ca1f 100644
--- a/plugins/rbenv/rbenv.plugin.zsh
+++ b/plugins/rbenv/rbenv.plugin.zsh
@@ -10,12 +10,18 @@ FOUND_RBENV=0
rbenvdirs=("$HOME/.rbenv" "/usr/local/rbenv" "/opt/rbenv")
if _homebrew-installed && _rbenv-from-homebrew-installed ; then
rbenvdirs=($(brew --prefix rbenv) "${rbenvdirs[@]}")
+ if [[ $RBENV_ROOT = '' ]]; then
+ RBENV_ROOT="$HOME/.rbenv"
+ fi
fi
for rbenvdir in "${rbenvdirs[@]}" ; do
if [ -d $rbenvdir/bin -a $FOUND_RBENV -eq 0 ] ; then
FOUND_RBENV=1
- export RBENV_ROOT=$rbenvdir
+ if [[ $RBENV_ROOT = '' ]]; then
+ RBENV_ROOT=$rbenvdir
+ fi
+ export RBENV_ROOT
export PATH=${rbenvdir}/bin:$PATH
eval "$(rbenv init --no-rehash - zsh)"
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/svn-fast-info/svn-fast-info.plugin.zsh b/plugins/svn-fast-info/svn-fast-info.plugin.zsh
new file mode 100644
index 000000000..ea19bcea0
--- /dev/null
+++ b/plugins/svn-fast-info/svn-fast-info.plugin.zsh
@@ -0,0 +1,73 @@
+# vim:ft=zsh ts=2 sw=2 sts=2 et
+#
+# Faster alternative to the current SVN plugin implementation.
+#
+# Works with svn 1.6, 1.7, 1.8.
+# Use `svn_prompt_info` method to enquire the svn data.
+# It's faster because his efficient use of svn (single svn call) which saves a lot on a huge codebase
+# It displays the current status of the local files (added, deleted, modified, replaced, or else...)
+#
+# Use as a drop-in replacement of the svn plugin not as complementary plugin
+
+function svn_prompt_info() {
+ local info
+ info=$(svn info 2>&1) || return 1; # capture stdout and stderr
+ local repo_need_upgrade=$(svn_repo_need_upgrade $info)
+
+ if [[ -n $repo_need_upgrade ]]; then
+ printf '%s%s%s%s%s%s%s\n' \
+ $ZSH_PROMPT_BASE_COLOR \
+ $ZSH_THEME_SVN_PROMPT_PREFIX \
+ $ZSH_PROMPT_BASE_COLOR \
+ $repo_need_upgrade \
+ $ZSH_PROMPT_BASE_COLOR \
+ $ZSH_THEME_SVN_PROMPT_SUFFIX \
+ $ZSH_PROMPT_BASE_COLOR
+ else
+ printf '%s%s%s %s%s:%s%s%s%s%s' \
+ $ZSH_PROMPT_BASE_COLOR \
+ $ZSH_THEME_SVN_PROMPT_PREFIX \
+ \
+ "$(svn_status_info $info)" \
+ $ZSH_PROMPT_BASE_COLOR \
+ \
+ $ZSH_THEME_BRANCH_NAME_COLOR \
+ $(svn_current_branch_name $info) \
+ $ZSH_PROMPT_BASE_COLOR \
+ \
+ $(svn_current_revision $info) \
+ $ZSH_PROMPT_BASE_COLOR \
+ \
+ $ZSH_THEME_SVN_PROMPT_SUFFIX \
+ $ZSH_PROMPT_BASE_COLOR
+ fi
+}
+
+function svn_repo_need_upgrade() {
+ grep -q "E155036" <<< ${1:-$(svn info 2> /dev/null)} && \
+ echo "E155036: upgrade repo with svn upgrade"
+}
+
+function svn_current_branch_name() {
+ grep '^URL:' <<< "${1:-$(svn info 2> /dev/null)}" | egrep -o '(tags|branches)/[^/]+|trunk'
+}
+
+function svn_repo_root_name() {
+ grep '^Repository\ Root:' <<< "${1:-$(svn info 2> /dev/null)}" | sed 's#.*/##'
+}
+
+function svn_current_revision() {
+ echo "${1:-$(svn info 2> /dev/null)}" | sed -n 's/Revision: //p'
+}
+
+function svn_status_info() {
+ local svn_status_string="$ZSH_THEME_SVN_PROMPT_CLEAN"
+ local svn_status="$(svn status 2> /dev/null)";
+ if grep -E '^\s*A' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_ADDITIONS:-+}"; fi
+ if grep -E '^\s*D' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_DELETIONS:-✖}"; fi
+ if grep -E '^\s*M' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_MODIFICATIONS:-✎}"; fi
+ if grep -E '^\s*[R~]' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_REPLACEMENTS:-∿}"; fi
+ if grep -E '^\s*\?' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_UNTRACKED:-?}"; fi
+ if grep -E '^\s*[CI!L]' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_DIRTY:-'!'}"; fi
+ echo $svn_status_string
+}
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
;;
diff --git a/plugins/xcode/xcode.plugin.zsh b/plugins/xcode/xcode.plugin.zsh
index f137253f3..4816ab0ed 100644
--- a/plugins/xcode/xcode.plugin.zsh
+++ b/plugins/xcode/xcode.plugin.zsh
@@ -16,3 +16,4 @@ function xcsel {
alias xcb='xcodebuild'
alias xcp='xcode-select --print-path'
+alias simulator='open $(xcode-select -p)/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app'