From 09c5996cd0528eb03a93dd464f3cbd755eafd624 Mon Sep 17 00:00:00 2001 From: Henry Yan Date: Mon, 5 Mar 2012 21:36:50 +0800 Subject: [PATCH 1/8] Added kafeitu theme it modified by robbyrussell --- kafeitu.zsh-theme | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 kafeitu.zsh-theme diff --git a/kafeitu.zsh-theme b/kafeitu.zsh-theme new file mode 100644 index 000000000..60c0303b9 --- /dev/null +++ b/kafeitu.zsh-theme @@ -0,0 +1,6 @@ +PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%n %{$fg[blue]%}%D{[%I:%M:%S]} %{$fg_bold[green]%}%p %{$fg[cyan]%}%~ %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" From c1e9d9226c106aaf973712b1a700dd045aeff9bc Mon Sep 17 00:00:00 2001 From: Henry Yan Date: Mon, 5 Mar 2012 21:39:09 +0800 Subject: [PATCH 2/8] move kafeitu.zsh-theme to themes folder --- kafeitu.zsh-theme => themes/kafeitu.zsh-theme | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename kafeitu.zsh-theme => themes/kafeitu.zsh-theme (100%) diff --git a/kafeitu.zsh-theme b/themes/kafeitu.zsh-theme similarity index 100% rename from kafeitu.zsh-theme rename to themes/kafeitu.zsh-theme From bd4f1eeca2d1430029153f7be0aa432ef5d2fce9 Mon Sep 17 00:00:00 2001 From: Henry Yan Date: Tue, 6 Mar 2012 14:09:11 +0800 Subject: [PATCH 3/8] =?UTF-8?q?add=20hostname=20behind=20username,=20examp?= =?UTF-8?q?le:=20henryyan=20[02:07:20]=20=20~/.oh-my-zsh=20git:(master)=20?= =?UTF-8?q?=E2=9C=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/kafeitu.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/kafeitu.zsh-theme b/themes/kafeitu.zsh-theme index 60c0303b9..18e941601 100644 --- a/themes/kafeitu.zsh-theme +++ b/themes/kafeitu.zsh-theme @@ -1,4 +1,4 @@ -PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%n %{$fg[blue]%}%D{[%I:%M:%S]} %{$fg_bold[green]%}%p %{$fg[cyan]%}%~ %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' +PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%n%{$fg[blue]%}@%{$fg_bold[green]%}%m %{$fg[blue]%}%D{[%I:%M:%S]} %{$fg_bold[green]%}%p %{$fg[cyan]%}%~ %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" From 7ffc3e745fa7ab020ec45e4ffe7a069c823e386a Mon Sep 17 00:00:00 2001 From: Henry Yan Date: Tue, 6 Mar 2012 14:14:17 +0800 Subject: [PATCH 4/8] change color of @ to cyan --- themes/kafeitu.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/kafeitu.zsh-theme b/themes/kafeitu.zsh-theme index 18e941601..a89a899aa 100644 --- a/themes/kafeitu.zsh-theme +++ b/themes/kafeitu.zsh-theme @@ -1,4 +1,4 @@ -PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%n%{$fg[blue]%}@%{$fg_bold[green]%}%m %{$fg[blue]%}%D{[%I:%M:%S]} %{$fg_bold[green]%}%p %{$fg[cyan]%}%~ %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' +PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%n%{$fg[cyan]%}@%{$fg_bold[green]%}%m %{$fg[blue]%}%D{[%I:%M:%S]} %{$fg_bold[green]%}%p %{$fg[cyan]%}%~ %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" From 814ecfc60daffc1eac250d41643d05fb1f43bd4c Mon Sep 17 00:00:00 2001 From: Henry Yan Date: Wed, 7 Mar 2012 23:52:51 +0800 Subject: [PATCH 5/8] delete time filed --- themes/kafeitu.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/kafeitu.zsh-theme b/themes/kafeitu.zsh-theme index a89a899aa..c4720b24d 100644 --- a/themes/kafeitu.zsh-theme +++ b/themes/kafeitu.zsh-theme @@ -1,4 +1,4 @@ -PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%n%{$fg[cyan]%}@%{$fg_bold[green]%}%m %{$fg[blue]%}%D{[%I:%M:%S]} %{$fg_bold[green]%}%p %{$fg[cyan]%}%~ %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' +PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%n%{$fg[cyan]%}@%{$fg_bold[green]%}%m %{$fg_bold[green]%}%p %{$fg[cyan]%}%~ %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" From e9feccf6a94f9f5238ff0b3501f62575d14ae148 Mon Sep 17 00:00:00 2001 From: Henry Yan Date: Thu, 22 Mar 2012 09:33:55 +0800 Subject: [PATCH 6/8] add maven plugin --- plugins/mvn/mvn.plugin.zsh | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 plugins/mvn/mvn.plugin.zsh diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh new file mode 100644 index 000000000..8c87d3afe --- /dev/null +++ b/plugins/mvn/mvn.plugin.zsh @@ -0,0 +1,6 @@ +function listMavenCompletions { +reply=( +cli:execute cli:execute-phase archetype:generate generate-sources compile clean install test test-compile deploy package cobertura:cobertura jetty:run gwt:run gwt:debug -DskipTests -Dmaven.test.skip=true -Dtest= `if [ -d ./src ] ; then find ./src -type f | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dtest=\1?' ; fi`); +} + +compctl -K listMavenCompletions mvn From 3fe1e5c78760b81335eef501ef7f89875ae7753a Mon Sep 17 00:00:00 2001 From: Henry Yan Date: Wed, 18 Jul 2012 23:37:21 +0800 Subject: [PATCH 7/8] add maven zsh autocomplete plugin, copy from juvenxu's bash maven autocomplete plugin --- plugins/mvn/mvn.plugin.zsh | 117 +++++++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 plugins/mvn/mvn.plugin.zsh diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh new file mode 100644 index 000000000..7131893c9 --- /dev/null +++ b/plugins/mvn/mvn.plugin.zsh @@ -0,0 +1,117 @@ +function listMavenCompletions { + reply=( + # common lifecycle + clean process-resources compile process-test-resources test-compile test package verify install deploy site + + # common plugins + deploy failsafe install site surefire checkstyle javadoc jxr pmd ant antrun archetype assembly dependency enforcer gpg help release repository source eclipse idea jetty cargo jboss tomcat tomcat6 tomcat7 exec versions war ear ejb android scm buildnumber nexus repository sonar license hibernate3 liquibase flyway gwt + + # deploy + deploy:deploy-file + # failsafe + failsafe:integration-test failsafe:verify + # install + install:install-file + # site + site:site site:deploy site:run site:stage site:stage-deploy + # surefire + surefire:test + + # checkstyle + checkstyle:checkstyle checkstyle:check + # javadoc + javadoc:javadoc javadoc:jar javadoc:aggregate + # jxr + jxr:jxr + # pmd + pmd:pmd pmd:cpd pmd:check pmd:cpd-check + + # ant + ant:ant ant:clean + # antrun + antrun:run + # archetype + archetype:generate archetype:create-from-project archetype:crawl + # assembly + assembly:single assembly:assembly + # dependency + dependency:analyze dependency:analyze-dep-mgt dependency:analyze-only dependency:analyze-report dependency:build-classpath dependency:copy dependency:copy-dependencies dependency:get dependency:go-offline dependency:list dependency:purge-local-repository dependency:resolve dependency:resolve-plugins dependency:sources dependency:tree dependency:unpack dependency:unpack-dependencies + # enforcer + enforcer:enforce + # gpg + gpg:sign gpg:sign-and-deploy-file + # help + help:active-profiles help:all-profiles help:describe help:effective-pom help:effective-settings help:evaluate help:expressions help:system + # release + release:clean release:prepare release:rollback release:perform release:stage release:branch release:update-versions + # repository + repository:bundle-create repository:bundle-pack + # source + source:aggregate source:jar source:jar-no-fork + + # eclipse + eclipse:clean eclipse:eclipse + # idea + idea:clean idea:idea + + # jetty + jetty:run jetty:run-exploded + # cargo + cargo:start cargo:run cargo:stop cargo:deploy cargo:undeploy cargo:help + # jboss + jboss:start jboss:stop jboss:deploy jboss:undeploy jboss:redeploy + # tomcat + tomcat:start tomcat:stop tomcat:deploy tomcat:undeploy tomcat:undeploy + # tomcat6 + tomcat6:run tomcat6:run-war tomcat6:run-war-only tomcat6:stop tomcat6:deploy tomcat6:undeploy + # tomcat7 + tomcat7:run tomcat7:run-war tomcat7:run-war-only tomcat7:deploy + # exec + exec:exec exec:java + # versions + versions:display-dependency-updates versions:display-plugin-updates versions:display-property-updates versions:update-parent versions:update-properties versions:update-child-modules versions:lock-snapshots versions:unlock-snapshots versions:resolve-ranges versions:set versions:use-releases versions:use-next-releases versions:use-latest-releases versions:use-next-snapshots versions:use-latest-snapshots versions:use-next-versions versions:use-latest-versions versions:commit versions:revert + # scm + scm:add scm:checkin scm:checkout scm:update scm:status + # buildnumber + buildnumber:create buildnumber:create-timestamp buildnumber:help buildnumber:hgchangeset + + # war + war:war war:exploded war:inplace war:manifest + # ear + ear:ear ear:generate-application-xml + # ejb + ejb:ejb + # android + android:apk android:apklib android:deploy android:deploy-dependencies android:dex android:emulator-start android:emulator-stop android:emulator-stop-all android:generate-sources android:help android:instrument android:manifest-update android:pull android:push android:redeploy android:run android:undeploy android:unpack android:version-update android:zipalign android:devices + # nexus + nexus:staging-list nexus:staging-close nexus:staging-drop nexus:staging-release nexus:staging-build-promotion nexus:staging-profiles-list nexus:settings-download + # repository + repository:bundle-create repository:bundle-pack repository:help + + # sonar + sonar:sonar + # license + license:format license:check + # hibernate3 + hibernate3:hbm2ddl hibernate3:help + # liquibase + liquibase:changelogSync liquibase:changelogSyncSQL liquibase:clearCheckSums liquibase:dbDoc liquibase:diff liquibase:dropAll liquibase:help liquibase:migrate liquibase:listLocks liquibase:migrateSQL liquibase:releaseLocks liquibase:rollback liquibase:rollbackSQL liquibase:status liquibase:tag liquibase:update liquibase:updateSQL liquibase:updateTestingRollback + # flyway + flyway:clean flyway:history flyway:init flyway:migrate flyway:status flyway:validate + # gwt + gwt:browser gwt:clean gwt:compile gwt:compile-report gwt:css gwt:debug gwt:eclipse gwt:eclipseTest gwt:generateAsync gwt:help gwt:i18n gwt:mergewebxml gwt:resources gwt:run gwt:sdkInstall gwt:source-jar gwt:soyc gwt:test + + # options + -Dmaven.test.skip=true -DskipTests -Dmaven.surefire.debug -DenableCiProfile -Dpmd.skip=true -Dcheckstyle.skip=true -Dtycho.mode=maven + + # arguments + -am -amd -B -C -c -cpu -D -e -emp -ep -f -fae -ff -fn -gs -h -l -N -npr -npu -nsu -o -P -pl -q -rf -s -T -t -U -up -V -v -X + + cli:execute cli:execute-phase + archetype:generate generate-sources + cobertura:cobertura + -Dtest= `if [ -d ./src ] ; then find ./src/test/java -type f -name '*.java' | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dtest=\1?' ; fi` + ); +} + +compctl -K listMavenCompletions mvn From 2fa02621b27fbb3b788ee8576717fa64b2cb0065 Mon Sep 17 00:00:00 2001 From: Henry Yan Date: Sun, 14 Oct 2012 22:07:38 +0800 Subject: [PATCH 8/8] add git-extras plugin --- plugins/git-extras/git-extras.plugin.zsh | 285 +++++++++++++++++++++++ 1 file changed, 285 insertions(+) create mode 100644 plugins/git-extras/git-extras.plugin.zsh diff --git a/plugins/git-extras/git-extras.plugin.zsh b/plugins/git-extras/git-extras.plugin.zsh new file mode 100644 index 000000000..8419166ab --- /dev/null +++ b/plugins/git-extras/git-extras.plugin.zsh @@ -0,0 +1,285 @@ +#compdef git +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# Completion script for git-extras (http://github.com/visionmedia/git-extras). +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * Alexis GRIMALDI (https://github.com/agrimaldi) +# +# ------------------------------------------------------------------------------ +# Inspirations +# ----------- +# +# * git-extras (http://github.com/visionmedia/git-extras) +# * git-flow-completion (http://github.com/bobthecow/git-flow-completion) +# +# ------------------------------------------------------------------------------ + + +__git_command_successful () { + if (( ${#pipestatus:#0} > 0 )); then + _message 'not a git repository' + return 1 + fi + return 0 +} + + +__git_tag_names() { + local expl + declare -a tag_names + tag_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/tags 2>/dev/null)"}#refs/tags/}) + __git_command_successful || return + _wanted tag-names expl tag-name compadd $* - $tag_names +} + + +__git_branch_names() { + local expl + declare -a branch_names + branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/}) + __git_command_successful || return + _wanted branch-names expl branch-name compadd $* - $branch_names +} + + +__git_feature_branch_names() { + local expl + declare -a branch_names + branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/feature 2>/dev/null)"}#refs/heads/feature/}) + __git_command_successful || return + _wanted branch-names expl branch-name compadd $* - $branch_names +} + + +__git_refactor_branch_names() { + local expl + declare -a branch_names + branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/refactor 2>/dev/null)"}#refs/heads/refactor/}) + __git_command_successful || return + _wanted branch-names expl branch-name compadd $* - $branch_names +} + + +__git_bug_branch_names() { + local expl + declare -a branch_names + branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/bug 2>/dev/null)"}#refs/heads/bug/}) + __git_command_successful || return + _wanted branch-names expl branch-name compadd $* - $branch_names +} + + +__git_submodule_names() { + local expl + declare -a submodule_names + submodule_names=(${(f)"$(_call_program branchrefs git submodule status | awk '{print $2}')"}) + __git_command_successful || return + _wanted submodule-names expl submodule-name compadd $* - $submodule_names +} + + +__git_author_names() { + local expl + declare -a author_names + author_names=(${(f)"$(_call_program branchrefs git log --format='%aN' | sort -u)"}) + __git_command_successful || return + _wanted author-names expl author-name compadd $* - $author_names +} + + +_git-changelog() { + _arguments \ + '(-l --list)'{-l,--list}'[list commits]' \ +} + + +_git-effort() { + _arguments \ + '--above[ignore file with less than x commits]' \ +} + + +_git-contrib() { + _arguments \ + ':author:__git_author_names' +} + + +_git-count() { + _arguments \ + '--all[detailed commit count]' +} + + +_git-delete-branch() { + _arguments \ + ':branch-name:__git_branch_names' +} + + +_git-delete-submodule() { + _arguments \ + ':submodule-name:__git_submodule_names' +} + + +_git-delete-tag() { + _arguments \ + ':tag-name:__git_tag_names' +} + + +_git-extras() { + local curcontext=$curcontext state line ret=1 + declare -A opt_args + + _arguments -C \ + ': :->command' \ + '*:: :->option-or-argument' && ret=0 + + case $state in + (command) + declare -a commands + commands=( + 'update:update git-extras' + ) + _describe -t commands command commands && ret=0 + ;; + esac + + _arguments \ + '(-v --version)'{-v,--version}'[show current version]' \ +} + + +_git-graft() { + _arguments \ + ':src-branch-name:__git_branch_names' \ + ':dest-branch-name:__git_branch_names' +} + + +_git-squash() { + _arguments \ + ':branch-name:__git_branch_names' +} + + +_git-feature() { + local curcontext=$curcontext state line ret=1 + declare -A opt_args + + _arguments -C \ + ': :->command' \ + '*:: :->option-or-argument' && ret=0 + + case $state in + (command) + declare -a commands + commands=( + 'finish:merge feature into the current branch' + ) + _describe -t commands command commands && ret=0 + ;; + (option-or-argument) + curcontext=${curcontext%:*}-$line[1]: + case $line[1] in + (finish) + _arguments -C \ + ':branch-name:__git_feature_branch_names' + ;; + esac + esac +} + + +_git-refactor() { + local curcontext=$curcontext state line ret=1 + declare -A opt_args + + _arguments -C \ + ': :->command' \ + '*:: :->option-or-argument' && ret=0 + + case $state in + (command) + declare -a commands + commands=( + 'finish:merge refactor into the current branch' + ) + _describe -t commands command commands && ret=0 + ;; + (option-or-argument) + curcontext=${curcontext%:*}-$line[1]: + case $line[1] in + (finish) + _arguments -C \ + ':branch-name:__git_refactor_branch_names' + ;; + esac + esac +} + + +_git-bug() { + local curcontext=$curcontext state line ret=1 + declare -A opt_args + + _arguments -C \ + ': :->command' \ + '*:: :->option-or-argument' && ret=0 + + case $state in + (command) + declare -a commands + commands=( + 'finish:merge bug into the current branch' + ) + _describe -t commands command commands && ret=0 + ;; + (option-or-argument) + curcontext=${curcontext%:*}-$line[1]: + case $line[1] in + (finish) + _arguments -C \ + ':branch-name:__git_bug_branch_names' + ;; + esac + esac +} + + +zstyle ':completion:*:*:git:*' user-commands \ + changelog:'populate changelog file with commits since the previous tag' \ + contrib:'display author contributions' \ + count:'count commits' \ + delete-branch:'delete local and remote branch' \ + delete-submodule:'delete submodule' \ + delete-tag:'delete local and remote tag' \ + extras:'git-extras' \ + graft:'merge commits from source branch to destination branch' \ + squash:'merge commits from source branch into the current one as a single commit' \ + feature:'create a feature branch' \ + refactor:'create a refactor branch' \ + bug:'create a bug branch' \ + summary:'repository summary' \ + effort:'display effort statistics' \ + repl:'read-eval-print-loop' \ + commits-since:'list commits since a given date' \ + release:'release commit with the given tag' \ + alias:'define, search and show aliases' \ + ignore:'add patterns to .gitignore' \ + info:'show info about the repository' \ + create-branch:'create local and remote branch' \ + fresh-branch:'create empty local branch' \ + undo:'remove the latest commit' \ + setup:'setup a git repository' \ + touch:'one step creation of new files' \ + obliterate:'Completely remove a file from the repository, including past commits and tags' \ + local-commits:'list unpushed commits on the local branch' \