From f6fb34845d31a840c73416f138dae1761ea4adb9 Mon Sep 17 00:00:00 2001 From: Alexandre Joly Date: Tue, 10 Sep 2013 09:14:24 +0200 Subject: updated the arguments list to the newest version (0.24.0) of cocoapods --- plugins/pod/_pod | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/pod/_pod b/plugins/pod/_pod index 563fa5e66..6dd8b6371 100644 --- a/plugins/pod/_pod +++ b/plugins/pod/_pod @@ -3,18 +3,19 @@ # ----------------------------------------------------------------------------- # FILE: _pod -# DESCRIPTION: Cocoapods autocomplete plugin for Oh-My-Zsh +# DESCRIPTION: Cocoapods (0.24.0) autocomplete plugin for Oh-My-Zsh # http://cocoapods.org # AUTHOR: Alexandre Joly (alexandre.joly@mekanics.ch) # GITHUB: https://github.com/mekanics # TWITTER: @jolyAlexandre -# VERSION: 0.0.1 +# VERSION: 0.0.2 # LICENSE: MIT # ----------------------------------------------------------------------------- local -a _1st_arguments _1st_arguments=( 'help:Show help for the given command.' + 'init:Generate a Podfile for the current directory.' 'install:Install project dependencies' 'ipc:Inter-process communication' 'list:List pods' -- cgit v1.2.3-70-g09d2 From bdb2cabaa68a8c3af72df5a10bb3925fe1eda45e Mon Sep 17 00:00:00 2001 From: Alexandre Joly Date: Tue, 10 Sep 2013 09:17:09 +0200 Subject: typo --- plugins/pod/_pod | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/pod/_pod b/plugins/pod/_pod index 6dd8b6371..745e9b15d 100644 --- a/plugins/pod/_pod +++ b/plugins/pod/_pod @@ -14,8 +14,8 @@ local -a _1st_arguments _1st_arguments=( - 'help:Show help for the given command.' - 'init:Generate a Podfile for the current directory.' + 'help:Show help for the given command' + 'init:Generate a Podfile for the current directory' 'install:Install project dependencies' 'ipc:Inter-process communication' 'list:List pods' -- cgit v1.2.3-70-g09d2 From 40b1cf01035a3d74395b5d9def4f79af17fca4c8 Mon Sep 17 00:00:00 2001 From: Alexandre Joly Date: Tue, 10 Sep 2013 15:20:57 +0200 Subject: repo list search one level deeper the folder structure changed '.cocoapods/' -> '.cocoapods/repos' --- plugins/pod/_pod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/pod/_pod b/plugins/pod/_pod index 745e9b15d..ba0c9ab30 100644 --- a/plugins/pod/_pod +++ b/plugins/pod/_pod @@ -159,7 +159,7 @@ __first_command_list () } __repo_list() { - _wanted application expl 'repo' compadd $(command ls -1 ~/.cocoapods 2>/dev/null | sed -e 's/ /\\ /g') + _wanted application expl 'repo' compadd $(command ls -1 ~/.cocoapods/repos 2>/dev/null | sed -e 's/ /\\ /g') } __pod-repo() { -- cgit v1.2.3-70-g09d2 From 0eb86f82d6d3a6cf05b11818bb69ba4de80124da Mon Sep 17 00:00:00 2001 From: Alexandre Joly Date: Tue, 29 Oct 2013 10:33:37 +0100 Subject: updated to the latest version of cocoapods 0.27.1 --- plugins/pod/_pod | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/pod/_pod b/plugins/pod/_pod index ba0c9ab30..8c0f4460f 100644 --- a/plugins/pod/_pod +++ b/plugins/pod/_pod @@ -3,12 +3,12 @@ # ----------------------------------------------------------------------------- # FILE: _pod -# DESCRIPTION: Cocoapods (0.24.0) autocomplete plugin for Oh-My-Zsh +# DESCRIPTION: Cocoapods (0.27.1) autocomplete plugin for Oh-My-Zsh # http://cocoapods.org # AUTHOR: Alexandre Joly (alexandre.joly@mekanics.ch) # GITHUB: https://github.com/mekanics # TWITTER: @jolyAlexandre -# VERSION: 0.0.2 +# VERSION: 0.0.3 # LICENSE: MIT # ----------------------------------------------------------------------------- @@ -33,6 +33,7 @@ local -a _repo_arguments _repo_arguments=( 'add:Add a spec repo' 'lint:Validates all specs in a repo' + 'remove:Remove a spec repo.' 'update:Update a spec repo' ) @@ -194,6 +195,12 @@ __pod-repo() { (add) _arguments \ $_inherited_options + + (remove) + _arguments \ + $_inherited_options \ + ':feature:__repo_list' + ;; esac ;; esac -- cgit v1.2.3-70-g09d2 From 78df6e96f5ad2d6df77af39f70f4906a09700849 Mon Sep 17 00:00:00 2001 From: Brandon W Maister Date: Tue, 29 Oct 2013 23:02:44 -0400 Subject: pip: successfully cache all the packages Switch to using curl and regular expressions to generate a local cache file so that we don't need to hit pypi.python.org every time. This (obviously) results in a massive speed improvement, especially if you spawn new shells frequently. This also makes the autocompletion work for me, it didn't before. (pip would always time out.) And, also, for fun: This allows you to explicitly set which pip indexes to use. Technically the old version of the plugin should have had this behavior automatically -- without having to do more than configure pip -- but the install completion never worked for me so this is a net gain in functionality. --- plugins/pip/_pip | 4 ++-- plugins/pip/pip.plugin.zsh | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 plugins/pip/pip.plugin.zsh (limited to 'plugins') diff --git a/plugins/pip/_pip b/plugins/pip/_pip index fb8765c7e..967da48ca 100644 --- a/plugins/pip/_pip +++ b/plugins/pip/_pip @@ -6,8 +6,8 @@ _pip_all() { # we cache the list of packages (originally from the macports plugin) if (( ! $+piplist )); then - echo -n " (caching package index...)" - piplist=($(pip search * | cut -d ' ' -f 1 | tr '[A-Z]' '[a-z]')) + zsh-pip-cache-packages + piplist=($(cat $ZSH_PIP_CACHE_FILE)) fi } diff --git a/plugins/pip/pip.plugin.zsh b/plugins/pip/pip.plugin.zsh new file mode 100644 index 000000000..78532a6d3 --- /dev/null +++ b/plugins/pip/pip.plugin.zsh @@ -0,0 +1,37 @@ +# Usage: +# Just add pip to your installed plugins. + +# If you would like to change the cheeseshops used for autocomplete set +# ZSH_PIP_INDEXES in your zshrc. If one of your indexes are bogus you won't get +# any kind of error message, pip will just not autocomplete from them. Double +# check! +# +# If you would like to clear your cache, go ahead and do a +# "zsh-pip-clear-cache". + +ZSH_PIP_CACHE_FILE=~/.pip/zsh-cache +ZSH_PIP_INDEXES=(https://pypi.python.org/simple/) + +zsh-pip-clear-cache() { + rm $ZSH_PIP_CACHE_FILE + unset piplist +} + +zsh-pip-cache-packages() { + if [[ ! -d ${PIP_CACHE_FILE:h} ]]; then + mkdir -p ${PIP_CACHE_FILE:h} + fi + + if [[ ! -f $ZSH_PIP_CACHE_FILE ]]; then + echo -n "(...caching package index...)" + tmp_cache=/tmp/zsh_tmp_cache + for index in $ZSH_PIP_INDEXES ; do + # well... I've already got two problems + curl $index 2>/dev/null | \ + sed -nr '/^([^<]+).*/\1/p' \ + >> $tmp_cache + done + sort $tmp_cache | uniq | tr '\n' ' ' > $ZSH_PIP_CACHE_FILE + rm $tmp_cache + fi +} -- cgit v1.2.3-70-g09d2 From 008e57aa5aec0f38445785da58a11462ef9451f9 Mon Sep 17 00:00:00 2001 From: Brandon W Maister Date: Wed, 30 Oct 2013 21:00:08 -0400 Subject: Make the pip cache work with djangopypi2 Also add a test function that allows messing with the cache-creating regex with some assurance that you're not trampling other people's index-parsing. --- plugins/pip/pip.plugin.zsh | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/pip/pip.plugin.zsh b/plugins/pip/pip.plugin.zsh index 78532a6d3..71f977bbf 100644 --- a/plugins/pip/pip.plugin.zsh +++ b/plugins/pip/pip.plugin.zsh @@ -17,6 +17,10 @@ zsh-pip-clear-cache() { unset piplist } +zsh-pip-clean-packages() { + sed -nr '/([^<]+).*/\1/p' +} + zsh-pip-cache-packages() { if [[ ! -d ${PIP_CACHE_FILE:h} ]]; then mkdir -p ${PIP_CACHE_FILE:h} @@ -28,10 +32,47 @@ zsh-pip-cache-packages() { for index in $ZSH_PIP_INDEXES ; do # well... I've already got two problems curl $index 2>/dev/null | \ - sed -nr '/^([^<]+).*/\1/p' \ + zsh-pip-clean-packages \ >> $tmp_cache done sort $tmp_cache | uniq | tr '\n' ' ' > $ZSH_PIP_CACHE_FILE rm $tmp_cache fi } + +# A test function that validates the regex against known forms of the simple +# index. If you modify the regex to make it work for you, you should add a test +# case in here and make sure that your changes don't break things for someone +# else. +zsh-pip-test-clean-packages() { + local expected + local actual + expected="0x10c-asm +1009558_nester" + + actual=$(echo -n "Simple Index +0x10c-asm
+1009558_nester
+" | zsh-pip-clean-packages) + + if [[ $actual != $expected ]] ; then + echo -e "python's simple index is broken:\n$actual\n !=\n$expected" + else + echo "python's simple index is fine" + fi + + actual=$(echo -n ' + + Simple Package Index + + + 0x10c-asm
+ 1009558_nester
+' | zsh-pip-clean-packages) + + if [[ $actual != $expected ]] ; then + echo -e "the djangopypi2 index is broken:\n$actual\n !=\n$expected" + else + echo "the djangopypi2 index is fine" + fi +} -- cgit v1.2.3-70-g09d2 From 27f9747143e421e6908e9c2d0eb6247df4a3af8c Mon Sep 17 00:00:00 2001 From: Sabarish Kumar R Date: Tue, 12 Nov 2013 12:31:13 +0530 Subject: bundle plugin throwing error when bundle is not in path while initializing --- plugins/bundler/bundler.plugin.zsh | 48 ++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 23 deletions(-) (limited to 'plugins') diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index 2e657e5a8..e390f8620 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -4,18 +4,6 @@ alias bp="bundle package" alias bo="bundle open" alias bu="bundle update" -bundler_version=`bundle version | cut -d' ' -f3` -if [[ $bundler_version > '1.4.0' || $bundler_version = '1.4.0' ]]; then - if [[ "$(uname)" == 'Darwin' ]] - then - local cores_num="$(sysctl hw.ncpu | awk '{print $2}')" - else - local cores_num="$(nproc)" - fi - eval "alias bi='bundle install --jobs=$cores_num'" -else - alias bi='bundle install' -fi # The following is based on https://github.com/gma/bundler-exec @@ -44,14 +32,28 @@ _run-with-bundler() { fi } -## Main program -for cmd in $bundled_commands; do - eval "function unbundled_$cmd () { $cmd \$@ }" - eval "function bundled_$cmd () { _run-with-bundler $cmd \$@}" - alias $cmd=bundled_$cmd - - if which _$cmd > /dev/null 2>&1; then - compdef _$cmd bundled_$cmd=$cmd - fi -done - +if _bundler-installed; then + bundler_version=`bundle version | cut -d' ' -f3` + if [[ $bundler_version > '1.4.0' || $bundler_version = '1.4.0' ]]; then + if [[ "$(uname)" == 'Darwin' ]] + then + local cores_num="$(sysctl hw.ncpu | awk '{print $2}')" + else + local cores_num="$(nproc)" + fi + eval "alias bi='bundle install --jobs=$cores_num'" + else + alias bi='bundle install' + fi + + ## Main program + for cmd in $bundled_commands; do + eval "function unbundled_$cmd () { $cmd \$@ }" + eval "function bundled_$cmd () { _run-with-bundler $cmd \$@}" + alias $cmd=bundled_$cmd + + if which _$cmd > /dev/null 2>&1; then + compdef _$cmd bundled_$cmd=$cmd + fi + done +fi -- cgit v1.2.3-70-g09d2 From bb2064e92bdb2f64dfeb148bc0b9a61dfeff8f43 Mon Sep 17 00:00:00 2001 From: Marco Chan Date: Tue, 12 Nov 2013 15:55:16 +0800 Subject: Use environment specific open command when creating a new Jira issue. --- plugins/jira/jira.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/jira/jira.plugin.zsh b/plugins/jira/jira.plugin.zsh index 9aa192c1e..739ee7142 100644 --- a/plugins/jira/jira.plugin.zsh +++ b/plugins/jira/jira.plugin.zsh @@ -31,7 +31,7 @@ open_jira_issue () { if [ -z "$1" ]; then echo "Opening new issue" - `open $jira_url/secure/CreateIssue!default.jspa` + $open_cmd "$jira_url/secure/CreateIssue!default.jspa" else echo "Opening issue #$1" if [[ "x$JIRA_RAPID_BOARD" = "xtrue" ]]; then -- cgit v1.2.3-70-g09d2 From c6dce05fabd31c018cd77197329a6d5212e56787 Mon Sep 17 00:00:00 2001 From: Carlos Cardoso Date: Tue, 12 Nov 2013 22:55:28 -0200 Subject: python3 clean updated. --- plugins/python/python.plugin.zsh | 1 + 1 file changed, 1 insertion(+) (limited to 'plugins') diff --git a/plugins/python/python.plugin.zsh b/plugins/python/python.plugin.zsh index 852c8b919..a8f9760ad 100644 --- a/plugins/python/python.plugin.zsh +++ b/plugins/python/python.plugin.zsh @@ -6,6 +6,7 @@ alias pyfind='find . -name "*.py"' function pyclean() { ZSH_PYCLEAN_PLACES=${*:-'.'} find ${ZSH_PYCLEAN_PLACES} -type f -name "*.py[co]" -delete + find ${ZSH_PYCLEAN_PLACES} -type d -name "__pycache__" -delete } # Grep among .py files -- cgit v1.2.3-70-g09d2 From 6f48f586ba55507bb90fa8dd078b01c0333b907d Mon Sep 17 00:00:00 2001 From: Markus Færevaag Date: Sat, 16 Nov 2013 02:15:17 +0100 Subject: Added wd plugin --- plugins/wd2/wd2/wd.plugin.zsh | 9 ++ plugins/wd2/wd2/wd.sh | 201 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 210 insertions(+) create mode 100755 plugins/wd2/wd2/wd.plugin.zsh create mode 100755 plugins/wd2/wd2/wd.sh (limited to 'plugins') diff --git a/plugins/wd2/wd2/wd.plugin.zsh b/plugins/wd2/wd2/wd.plugin.zsh new file mode 100755 index 000000000..e0846ffd9 --- /dev/null +++ b/plugins/wd2/wd2/wd.plugin.zsh @@ -0,0 +1,9 @@ +#!/bin/zsh + +# WARP +# ==== +# oh-my-zsh plugin +# +# @github.com/mfaerevaag/wd + +alias wd='. ~/.oh-my-zsh/plugins/wd/wd.sh' diff --git a/plugins/wd2/wd2/wd.sh b/plugins/wd2/wd2/wd.sh new file mode 100755 index 000000000..7852028c0 --- /dev/null +++ b/plugins/wd2/wd2/wd.sh @@ -0,0 +1,201 @@ +#!/bin/zsh + +# WARP +# ==== +# Jump to custom directories in terminal +# because `cd` takes too long... +# +# @github.com/mfaerevaag/wd + + +## variables +CONFIG=$HOME/.warprc + +## colors +BLUE="\033[96m" +GREEN="\033[92m" +YELLOW="\033[93m" +RED="\033[91m" +NOC="\033[m" + + +## load warp points +typeset -A points +while read line +do + arr=(${(s,:,)line}) + key=${arr[1]} + val=${arr[2]} + + points[$key]=$val +done < $CONFIG + + +## functions +# prepended wd_ to not conflict with your environment (no sub shell) + +wd_warp() +{ + if [[ $1 =~ "^\.+$" ]] + then + if [[ $#1 < 2 ]] + then + wd_print_msg $YELLOW "Warping to current directory?" + else + (( n = $#1 - 1 )) + wd_print_msg $BLUE "Warping..." + cd -$n > /dev/null + fi + elif [[ ${points[$1]} != "" ]] + then + wd_print_msg $BLUE "Warping..." + cd ${points[$1]} + else + wd_print_msg $RED "Unkown warp point '$1'" + fi +} + +wd_add() +{ + if [[ $1 =~ "^\.+$" ]] + then + wd_print_msg $RED "Illeagal warp point (see README)." + elif [[ ${points[$1]} == "" ]] || $2 + then + wd_remove $1 > /dev/null + print "$1:$PWD" >> $CONFIG + wd_print_msg $GREEN "Warp point added" + else + wd_print_msg $YELLOW "Warp point '$1' alredy exists. Use 'add!' to overwrite." + fi +} + +wd_remove() +{ + if [[ ${points[$1]} != "" ]] + then + if wd_tmp=`sed "/^$1:/d" $CONFIG` + then + echo $wd_tmp > $CONFIG + wd_print_msg $GREEN "Warp point removed" + else + wd_print_msg $RED "Warp point unsuccessfully removed. Sorry!" + fi + else + wd_print_msg $RED "Warp point was not found" + fi +} + +wd_show() +{ + wd_print_msg $BLUE "Warp points to current directory:" + wd_list_all | grep $PWD$ +} + +wd_list_all() +{ + wd_print_msg $BLUE "All warp points:" + while read line + do + if [[ $line != "" ]] + then + arr=(${(s,:,)line}) + key=${arr[1]} + val=${arr[2]} + + print "\t" $key "\t -> \t" $val + fi + done < $CONFIG +} + +wd_print_msg() +{ + if [[ $1 == "" || $2 == "" ]] + then + print " $RED*$NOC Could not print message. Sorry!" + else + print " $1*$NOC $2" + fi +} + +wd_print_usage() +{ + print "Usage: wd [add|-a|--add] [rm|-r|--remove] [ls|-l|--list] " + print "\nCommands:" + print "\t add \t Adds the current working directory to your warp points" + print "\t add! \t Overwrites existing warp point" + print "\t remove Removes the given warp point" + print "\t list \t Outputs all stored warp points" + print "\t help \t Show this extremely helpful text" +} + + +## run + +# get opts +args=`getopt -o a:r:lhs -l add:,remove:,list,help,show -- $*` + +if [[ $? -ne 0 || $#* -eq 0 ]] +then + wd_print_usage +else + # can't exit, as this would exit the excecuting shell + # e.i. your terminal + + #set -- $args # WTF + + for i + do + case "$i" + in + -a|--add|add) + wd_add $2 false + shift + shift + break + ;; + -a!|--add!|add!) + wd_add $2 true + shift + shift + break + ;; + -r|--remove|rm) + wd_remove $2 + shift + shift + break + ;; + -l|--list|ls) + wd_list_all + shift + break + ;; + -h|--help|help) + wd_print_usage + shift + break + ;; + -s|--show|show) + wd_show + shift + break + ;; + *) + wd_warp $i + shift + break + ;; + --) + shift; break;; + esac + done +fi + + +## garbage collection +# if not, next time warp will pick up variables from this run +# remember, there's no sub shell +points="" +args="" +unhash -d val &> /dev/null # fixes issue #1 -- cgit v1.2.3-70-g09d2