From 688e9c7ffd757e790e1c079ac410570ccef9793e Mon Sep 17 00:00:00 2001 From: Daniel Schauenberg Date: Fri, 20 Aug 2010 18:55:30 +0200 Subject: [PATCH 01/20] fix problems with brew completion - update plugin architecture - completion function in $ZSH/functions/brew - plugins/brew.plugin.zsh only activates --- functions/brew/_brew | 69 +++++++++++++++++++++++++++++++++++++++ plugins/brew.plugin.zsh | 71 +++-------------------------------------- 2 files changed, 73 insertions(+), 67 deletions(-) create mode 100644 functions/brew/_brew diff --git a/functions/brew/_brew b/functions/brew/_brew new file mode 100644 index 00000000..4e590ac6 --- /dev/null +++ b/functions/brew/_brew @@ -0,0 +1,69 @@ +#compdef brew +#autoload + +# imported from the latest homebrew contributions + +_brew_all_formulae() { + formulae=(`brew search`) +} + +_brew_installed_formulae() { + installed_formulae=(`brew list`) +} + +local -a _1st_arguments +_1st_arguments=( + 'cat:display formula file for a formula' + 'cleanup:uninstall unused and old versions of packages' + 'create:create a new formula' + 'deps:list dependencies and dependants of a formula' + 'doctor:audits your installation for common issues' + 'edit:edit a formula' + 'home:visit the homepage of a formula or the brew project' + 'info:information about a formula' + 'install:install a formula' + 'link:link a formula' + 'list:list files in a formula or not-installed formulae' + 'log:git commit log for a formula' + 'outdated:list formulas for which a newer version is available' + 'prune:remove dead links' + 'remove:remove a formula' + 'search:search for a formula (/regex/ or string)' + 'unlink:unlink a formula' + 'update:freshen up links' + 'uses:show formulas which depend on a formula' +) + +local expl +local -a formula installed_formulae + +_arguments \ + '(-v --verbose)'{-v,--verbose}'[verbose]' \ + '(--version)--version[version information]' \ + '(--prefix)--prefix[where brew lives on this system]' \ + '(--cache)--cache[brew cache]' \ + '*:: :->subcmds' && return 0 + +if (( CURRENT == 1 )); then + _describe -t commands "brew subcommand" _1st_arguments + return +fi + +case "$words[1]" in + list) + _arguments \ + '(--unbrewed)--unbrewed[files in brew --prefix not controlled by brew]' \ + '1: :->forms' && return 0 + + if [[ "$state" == forms ]]; then + _brew_installed_formulae + _requested installed_formulae expl 'installed formulae' compadd -a installed_formulae + fi ;; + install|home|log|info|uses|cat|deps) + _brew_all_formulae + _wanted formulae expl 'all formulae' compadd -a formulae ;; + remove|edit|xo) + _brew_installed_formulae + _wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae ;; +esac + diff --git a/plugins/brew.plugin.zsh b/plugins/brew.plugin.zsh index 162eb644..a3054096 100644 --- a/plugins/brew.plugin.zsh +++ b/plugins/brew.plugin.zsh @@ -1,67 +1,4 @@ -#compdef brew - -# imported from the latest homebrew contributions - -_brew_all_formulae() { - formulae=(`brew search`) -} - -_brew_installed_formulae() { - installed_formulae=(`brew list`) -} - -local -a _1st_arguments -_1st_arguments=( - 'cat:display formula file for a formula' - 'cleanup:uninstall unused and old versions of packages' - 'create:create a new formula' - 'deps:list dependencies and dependants of a formula' - 'doctor:audits your installation for common issues' - 'edit:edit a formula' - 'home:visit the homepage of a formula or the brew project' - 'info:information about a formula' - 'install:install a formula' - 'link:link a formula' - 'list:list files in a formula or not-installed formulae' - 'log:git commit log for a formula' - 'outdated:list formulas for which a newer version is available' - 'prune:remove dead links' - 'remove:remove a formula' - 'search:search for a formula (/regex/ or string)' - 'unlink:unlink a formula' - 'update:freshen up links' - 'uses:show formulas which depend on a formula' -) - -local expl -local -a formula installed_formulae - -_arguments \ - '(-v --verbose)'{-v,--verbose}'[verbose]' \ - '(--version)--version[version information]' \ - '(--prefix)--prefix[where brew lives on this system]' \ - '(--cache)--cache[brew cache]' \ - '*:: :->subcmds' && return 0 - -if (( CURRENT == 1 )); then - _describe -t commands "brew subcommand" _1st_arguments - return -fi - -case "$words[1]" in - list) - _arguments \ - '(--unbrewed)--unbrewed[files in brew --prefix not controlled by brew]' \ - '1: :->forms' && return 0 - - if [[ "$state" == forms ]]; then - _brew_installed_formulae - _requested installed_formulae expl 'installed formulae' compadd -a installed_formulae - fi ;; - install|home|log|info|uses|cat|deps) - _brew_all_formulae - _wanted formulae expl 'all formulae' compadd -a formulae ;; - remove|edit|xo) - _brew_installed_formulae - _wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae ;; -esac +# add brew completion function to path +fpath=($ZSH/functions/brew $fpath) +autoload -U compinit +compinit -i From dfc4b850008a04007126f7c19caa08042aa1e40c Mon Sep 17 00:00:00 2001 From: Daniel Schauenberg Date: Wed, 1 Sep 2010 13:07:11 +0200 Subject: [PATCH 02/20] add gem completion function and plugin --- functions/gem/_gem | 64 ++++++++++++++++++++++++++++++++++++++++++ plugins/gem.plugin.zsh | 4 +++ 2 files changed, 68 insertions(+) create mode 100644 functions/gem/_gem create mode 100644 plugins/gem.plugin.zsh diff --git a/functions/gem/_gem b/functions/gem/_gem new file mode 100644 index 00000000..83cba40d --- /dev/null +++ b/functions/gem/_gem @@ -0,0 +1,64 @@ +#compdef gem +#autoload + +# gem zsh completion, based on homebrew completion + +_gem_installed() { + installed_gems=(`gem list --local --no-versions`) +} + +local -a _1st_arguments +_1st_arguments=( + 'cert:Manage RubyGems certificates and signing settings' + 'check:Check installed gems' + 'cleanup:Clean up old versions of installed gems in the local repository' + 'contents:Display the contents of the installed gems' + 'dependency:Show the dependencies of an installed gem' + 'environment:Display information about the RubyGems environment' + 'fetch:Download a gem and place it in the current directory' + 'generate_index:Generates the index files for a gem server directory' + 'help:Provide help on the `gem` command' + 'install:Install a gem into the local repository' + 'list:Display gems whose name starts with STRING' + 'lock:Generate a lockdown list of gems' + 'mirror:Mirror a gem repository' + 'outdated:Display all gems that need updates' + 'owner:Manage gem owners on RubyGems.org.' + 'pristine:Restores installed gems to pristine condition from files located in the gem cache' + 'push:Push a gem up to RubyGems.org' + 'query:Query gem information in local or remote repositories' + 'rdoc:Generates RDoc for pre-installed gems' + 'search:Display all gems whose name contains STRING' + 'server:Documentation and gem repository HTTP server' + 'sources:Manage the sources and cache file RubyGems uses to search for gems' + 'specification:Display gem specification (in yaml)' + 'stale:List gems along with access times' + 'uninstall:Uninstall gems from the local repository' + 'unpack:Unpack an installed gem to the current directory' + 'update:Update the named gems (or all installed gems) in the local repository' + 'which:Find the location of a library file you can require' +) + +local expl +local -a gems installed_gems + +_arguments \ + '(-v --version)'{-v,--version}'[show version]' \ + '(-h --help)'{-h,--help}'[show help]' \ + '*:: :->subcmds' && return 0 + +if (( CURRENT == 1 )); then + _describe -t commands "gem subcommand" _1st_arguments + return +fi + +case "$words[1]" in + list) + if [[ "$state" == forms ]]; then + _gem_installed + _requested installed_gems expl 'installed gems' compadd -a installed_gems + fi ;; + uninstall|update) + _gem_installed + _wanted installed_gems expl 'installed gems' compadd -a installed_gems ;; +esac diff --git a/plugins/gem.plugin.zsh b/plugins/gem.plugin.zsh new file mode 100644 index 00000000..0b6ef3c8 --- /dev/null +++ b/plugins/gem.plugin.zsh @@ -0,0 +1,4 @@ +# add brew completion function to path +fpath=($ZSH/functions/gem $fpath) +autoload -U compinit +compinit -i From 9aba2eed488a814214f6ed3df2c6532d1fdf6c21 Mon Sep 17 00:00:00 2001 From: Daniel Schauenberg Date: Wed, 1 Sep 2010 13:21:11 +0200 Subject: [PATCH 03/20] add pip completion and plugin --- functions/pip/_pip | 46 ++++++++++++++++++++++++++++++++++++++++++ plugins/pip.plugin.zsh | 4 ++++ 2 files changed, 50 insertions(+) create mode 100644 functions/pip/_pip create mode 100644 plugins/pip.plugin.zsh diff --git a/functions/pip/_pip b/functions/pip/_pip new file mode 100644 index 00000000..b5801017 --- /dev/null +++ b/functions/pip/_pip @@ -0,0 +1,46 @@ +#compdef pip +#autoload + +# pip zsh completion, based on homebrew completion + +_pip_installed() { + installed_pkgs=(`pip freeze`) +} + +local -a _1st_arguments +_1st_arguments=( + 'bundle:Create pybundles (archives containing multiple packages)' + 'freeze:Output all currently installed packages (exact versions) to stdout' + 'help:Show available commands' + 'install:Install packages' + 'search:Search PyPI' + 'uninstall:Uninstall packages' + 'unzip:Unzip individual packages' + 'zip:Zip individual packages' +) + +local expl +local -a pkgs installed_pkgs + +_arguments \ + '(--version)--version[Show version number of program and exit]' \ + '(-v --verbose)'{-v,--verbose}'[Give more output]' \ + '(-q --quiet)'{-q,--quiet}'[Give less output]' \ + '(-h --help)'{-h,--help}'[Show help]' \ + '*:: :->subcmds' && return 0 + +if (( CURRENT == 1 )); then + _describe -t commands "pip subcommand" _1st_arguments + return +fi + +case "$words[1]" in + list) + if [[ "$state" == forms ]]; then + _pip_installed + _requested installed_pkgs expl 'installed packages' compadd -a installed_pkgs + fi ;; + uninstall) + _pip_installed + _wanted installed_pkgs expl 'installed packages' compadd -a installed_pkgs ;; +esac diff --git a/plugins/pip.plugin.zsh b/plugins/pip.plugin.zsh new file mode 100644 index 00000000..69e21f8d --- /dev/null +++ b/plugins/pip.plugin.zsh @@ -0,0 +1,4 @@ +# add brew completion function to path +fpath=($ZSH/functions/pip $fpath) +autoload -U compinit +compinit -i From be63480e2272ad95a783357e7f2416ff67274657 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Thu, 30 Sep 2010 21:34:06 -0700 Subject: [PATCH 04/20] Reorganizing plugins so that each plugin has it's own directory now so that any plugin-specific functions can be bundled within there. --- oh-my-zsh.sh | 2 +- plugins/{ => brew}/brew.plugin.zsh | 0 plugins/{ => dirpersist}/dirpersist.plugin.zsh | 0 plugins/{ => git}/git.plugin.zsh | 0 plugins/{ => lighthouse}/lighthouse.plugin.zsh | 0 plugins/{ => macports}/macports.plugin.zsh | 0 plugins/{ => mysql}/mysql-macports.plugin.zsh | 0 plugins/{ => osx}/osx.plugin.zsh | 0 plugins/{ => rails}/rails.plugin.zsh | 0 plugins/{ => ruby}/ruby.plugin.zsh | 0 plugins/{ => ssh-agent}/ssh-agent.plugin.zsh | 0 plugins/{ => textmate}/textmate.plugin.zsh | 0 plugins/{ => vi-mode}/vi-mode.plugin.zsh | 0 13 files changed, 1 insertion(+), 1 deletion(-) rename plugins/{ => brew}/brew.plugin.zsh (100%) rename plugins/{ => dirpersist}/dirpersist.plugin.zsh (100%) rename plugins/{ => git}/git.plugin.zsh (100%) rename plugins/{ => lighthouse}/lighthouse.plugin.zsh (100%) rename plugins/{ => macports}/macports.plugin.zsh (100%) rename plugins/{ => mysql}/mysql-macports.plugin.zsh (100%) rename plugins/{ => osx}/osx.plugin.zsh (100%) rename plugins/{ => rails}/rails.plugin.zsh (100%) rename plugins/{ => ruby}/ruby.plugin.zsh (100%) rename plugins/{ => ssh-agent}/ssh-agent.plugin.zsh (100%) rename plugins/{ => textmate}/textmate.plugin.zsh (100%) rename plugins/{ => vi-mode}/vi-mode.plugin.zsh (100%) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index c46aea7a..848e48eb 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -12,7 +12,7 @@ for config_file ($ZSH/custom/*.zsh) source $config_file # Load all of the plugins that were defined in ~/.zshrc plugin=${plugin:=()} -for plugin ($plugins) source $ZSH/plugins/$plugin.plugin.zsh +for plugin ($plugins) source $ZSH/plugins/$plugin/$plugin.plugin.zsh # Check for updates on initial load... if [ "$DISABLE_AUTO_UPDATE" = "true" ] diff --git a/plugins/brew.plugin.zsh b/plugins/brew/brew.plugin.zsh similarity index 100% rename from plugins/brew.plugin.zsh rename to plugins/brew/brew.plugin.zsh diff --git a/plugins/dirpersist.plugin.zsh b/plugins/dirpersist/dirpersist.plugin.zsh similarity index 100% rename from plugins/dirpersist.plugin.zsh rename to plugins/dirpersist/dirpersist.plugin.zsh diff --git a/plugins/git.plugin.zsh b/plugins/git/git.plugin.zsh similarity index 100% rename from plugins/git.plugin.zsh rename to plugins/git/git.plugin.zsh diff --git a/plugins/lighthouse.plugin.zsh b/plugins/lighthouse/lighthouse.plugin.zsh similarity index 100% rename from plugins/lighthouse.plugin.zsh rename to plugins/lighthouse/lighthouse.plugin.zsh diff --git a/plugins/macports.plugin.zsh b/plugins/macports/macports.plugin.zsh similarity index 100% rename from plugins/macports.plugin.zsh rename to plugins/macports/macports.plugin.zsh diff --git a/plugins/mysql-macports.plugin.zsh b/plugins/mysql/mysql-macports.plugin.zsh similarity index 100% rename from plugins/mysql-macports.plugin.zsh rename to plugins/mysql/mysql-macports.plugin.zsh diff --git a/plugins/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh similarity index 100% rename from plugins/osx.plugin.zsh rename to plugins/osx/osx.plugin.zsh diff --git a/plugins/rails.plugin.zsh b/plugins/rails/rails.plugin.zsh similarity index 100% rename from plugins/rails.plugin.zsh rename to plugins/rails/rails.plugin.zsh diff --git a/plugins/ruby.plugin.zsh b/plugins/ruby/ruby.plugin.zsh similarity index 100% rename from plugins/ruby.plugin.zsh rename to plugins/ruby/ruby.plugin.zsh diff --git a/plugins/ssh-agent.plugin.zsh b/plugins/ssh-agent/ssh-agent.plugin.zsh similarity index 100% rename from plugins/ssh-agent.plugin.zsh rename to plugins/ssh-agent/ssh-agent.plugin.zsh diff --git a/plugins/textmate.plugin.zsh b/plugins/textmate/textmate.plugin.zsh similarity index 100% rename from plugins/textmate.plugin.zsh rename to plugins/textmate/textmate.plugin.zsh diff --git a/plugins/vi-mode.plugin.zsh b/plugins/vi-mode/vi-mode.plugin.zsh similarity index 100% rename from plugins/vi-mode.plugin.zsh rename to plugins/vi-mode/vi-mode.plugin.zsh From d3e391216fc09d1602fb1b2869679b4e2f9667cd Mon Sep 17 00:00:00 2001 From: Daniel Schauenberg Date: Fri, 1 Oct 2010 10:59:48 +0200 Subject: [PATCH 05/20] adapt brew,gem,pip plugin to new structure --- {functions => plugins}/brew/_brew | 0 plugins/brew/brew.plugin.zsh | 2 +- {functions => plugins}/gem/_gem | 0 plugins/{ => gem}/gem.plugin.zsh | 2 +- {functions => plugins}/pip/_pip | 0 plugins/{ => pip}/pip.plugin.zsh | 2 +- 6 files changed, 3 insertions(+), 3 deletions(-) rename {functions => plugins}/brew/_brew (100%) rename {functions => plugins}/gem/_gem (100%) rename plugins/{ => gem}/gem.plugin.zsh (67%) rename {functions => plugins}/pip/_pip (100%) rename plugins/{ => pip}/pip.plugin.zsh (67%) diff --git a/functions/brew/_brew b/plugins/brew/_brew similarity index 100% rename from functions/brew/_brew rename to plugins/brew/_brew diff --git a/plugins/brew/brew.plugin.zsh b/plugins/brew/brew.plugin.zsh index a3054096..353a1894 100644 --- a/plugins/brew/brew.plugin.zsh +++ b/plugins/brew/brew.plugin.zsh @@ -1,4 +1,4 @@ # add brew completion function to path -fpath=($ZSH/functions/brew $fpath) +fpath=($ZSH/plugins/brew $fpath) autoload -U compinit compinit -i diff --git a/functions/gem/_gem b/plugins/gem/_gem similarity index 100% rename from functions/gem/_gem rename to plugins/gem/_gem diff --git a/plugins/gem.plugin.zsh b/plugins/gem/gem.plugin.zsh similarity index 67% rename from plugins/gem.plugin.zsh rename to plugins/gem/gem.plugin.zsh index 0b6ef3c8..65d3766f 100644 --- a/plugins/gem.plugin.zsh +++ b/plugins/gem/gem.plugin.zsh @@ -1,4 +1,4 @@ # add brew completion function to path -fpath=($ZSH/functions/gem $fpath) +fpath=($ZSH/plugins/gem $fpath) autoload -U compinit compinit -i diff --git a/functions/pip/_pip b/plugins/pip/_pip similarity index 100% rename from functions/pip/_pip rename to plugins/pip/_pip diff --git a/plugins/pip.plugin.zsh b/plugins/pip/pip.plugin.zsh similarity index 67% rename from plugins/pip.plugin.zsh rename to plugins/pip/pip.plugin.zsh index 69e21f8d..bf9f2396 100644 --- a/plugins/pip.plugin.zsh +++ b/plugins/pip/pip.plugin.zsh @@ -1,4 +1,4 @@ # add brew completion function to path -fpath=($ZSH/functions/pip $fpath) +fpath=($ZSH/plugins/pip $fpath) autoload -U compinit compinit -i From d73ed29d8a9ce05c5e80ee511c9d07749c012eff Mon Sep 17 00:00:00 2001 From: Luke Randall Date: Sun, 5 Sep 2010 16:52:38 +0200 Subject: [PATCH 06/20] Add lukerandall.zsh-theme --- themes/lukerandall.zsh-theme | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 themes/lukerandall.zsh-theme diff --git a/themes/lukerandall.zsh-theme b/themes/lukerandall.zsh-theme new file mode 100644 index 00000000..24a0612b --- /dev/null +++ b/themes/lukerandall.zsh-theme @@ -0,0 +1,10 @@ +# ZSH Theme - Preview: http://cl.ly/f701d00760f8059e06dc +# Thanks to gallifrey, upon whose theme this is based + +local return_code="%(?..%{$fg_bold[red]%}%? ↵%{$reset_color%})" + +PROMPT='%{$fg_bold[green]%}%n@%m%{$reset_color%} %{$fg_bold[blue]%}%2~%{$reset_color%} $(git_prompt_info)%{$reset_color%}%B»%b ' +RPS1="${return_code}" + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}(" +ZSH_THEME_GIT_PROMPT_SUFFIX=") %{$reset_color%}" From 2c1236e047d0e82ab921876f6eb3118afe33dbe0 Mon Sep 17 00:00:00 2001 From: Jake Bell Date: Fri, 1 Oct 2010 14:15:52 -0500 Subject: [PATCH 07/20] Removing capistrano aliases/functions from rails plugin (since cap is not rails-specific). --- plugins/cap/cap.plugin.zsh | 21 +++++++++++++++++++++ plugins/rails/rails.plugin.zsh | 23 ----------------------- 2 files changed, 21 insertions(+), 23 deletions(-) create mode 100644 plugins/cap/cap.plugin.zsh diff --git a/plugins/cap/cap.plugin.zsh b/plugins/cap/cap.plugin.zsh new file mode 100644 index 00000000..a0fa21d0 --- /dev/null +++ b/plugins/cap/cap.plugin.zsh @@ -0,0 +1,21 @@ +function _cap_does_task_list_need_generating () { + if [ ! -f .cap_tasks~ ]; then return 0; + else + accurate=$(stat -f%m .cap_tasks~) + changed=$(stat -f%m config/deploy.rb) + return $(expr $accurate '>=' $changed) + fi +} + +function _cap () { + if [ -f config/deploy.rb ]; then + if _cap_does_task_list_need_generating; then + echo "\nGenerating .cap_tasks~..." > /dev/stderr + cap show_tasks -q | cut -d " " -f 1 | sed -e '/^ *$/D' -e '1,2D' +> .cap_tasks~ + fi + compadd `cat .cap_tasks~` + fi +} + +compctl -K _cap cap \ No newline at end of file diff --git a/plugins/rails/rails.plugin.zsh b/plugins/rails/rails.plugin.zsh index 45bebb72..ac8119e8 100644 --- a/plugins/rails/rails.plugin.zsh +++ b/plugins/rails/rails.plugin.zsh @@ -1,4 +1,3 @@ - alias ss='thin --stats "/thin/stats" start' alias sg='ruby script/generate' alias sd='ruby script/destroy' @@ -9,28 +8,6 @@ alias sc='ruby script/console' alias sd='ruby script/server --debugger' alias devlog='tail -f log/development.log' -function _cap_does_task_list_need_generating () { - if [ ! -f .cap_tasks~ ]; then return 0; - else - accurate=$(stat -f%m .cap_tasks~) - changed=$(stat -f%m config/deploy.rb) - return $(expr $accurate '>=' $changed) - fi -} - -function _cap () { - if [ -f config/deploy.rb ]; then - if _cap_does_task_list_need_generating; then - echo "\nGenerating .cap_tasks~..." > /dev/stderr - cap show_tasks -q | cut -d " " -f 1 | sed -e '/^ *$/D' -e '1,2D' -> .cap_tasks~ - fi - compadd `cat .cap_tasks~` - fi -} - -compctl -K _cap cap - function remote_console() { /usr/bin/env ssh $1 "( cd $2 && ruby script/console production )" } From 287585dd654b623b0f933b5c6a3cbd27ef959dd5 Mon Sep 17 00:00:00 2001 From: Phillip Ridlen Date: Tue, 5 Oct 2010 17:06:08 -0500 Subject: [PATCH 08/20] Add cloud.zsh-theme --- themes/cloud.zsh-theme | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 themes/cloud.zsh-theme diff --git a/themes/cloud.zsh-theme b/themes/cloud.zsh-theme new file mode 100644 index 00000000..ad5e2834 --- /dev/null +++ b/themes/cloud.zsh-theme @@ -0,0 +1,6 @@ +PROMPT='%{$fg_bold[cyan]%}☁ %{$fg_bold[green]%}%p %{$fg[green]%}%c %{$fg_bold[cyan]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}[%{$fg[cyan]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}] %{$fg[yellow]%}⚡%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%}]" \ No newline at end of file From aa2f553023fbb5a909edcc431b6fbcda43a39c9b Mon Sep 17 00:00:00 2001 From: Irakli Gozalishvili Date: Sat, 9 Oct 2010 01:27:40 +0200 Subject: [PATCH 09/20] Improving git plugin so it can display much more data. --- lib/git.zsh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/lib/git.zsh b/lib/git.zsh index 889dd98d..57a78e27 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -11,3 +11,31 @@ parse_git_dirty () { echo "$ZSH_THEME_GIT_PROMPT_CLEAN" fi } + +# get the status of the working tree +git_prompt_status() { + INDEX=$(git status --porcelain 2> /dev/null) + STATUS="" + if $(echo "$INDEX" | grep '^?? ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_UNTRACKED$STATUS" + fi + if $(echo "$INDEX" | grep '^A ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS" + elif $(echo "$INDEX" | grep '^M ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS" + fi + if $(echo "$INDEX" | grep '^ M ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS" + fi + if $(echo "$INDEX" | grep '^R ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_RENAMED$STATUS" + fi + if $(echo "$INDEX" | grep '^ D ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS" + fi + if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS" + fi + echo $STATUS +} + From c4322f2955a4ee9923fc8744ebec411053536d1e Mon Sep 17 00:00:00 2001 From: Irakli Gozalishvili Date: Sat, 9 Oct 2010 01:49:35 +0200 Subject: [PATCH 10/20] Adding new gozilla theme --- themes/gozilla.zsh-theme | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 themes/gozilla.zsh-theme diff --git a/themes/gozilla.zsh-theme b/themes/gozilla.zsh-theme new file mode 100644 index 00000000..3112b367 --- /dev/null +++ b/themes/gozilla.zsh-theme @@ -0,0 +1,15 @@ +PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p%{$fg[cyan]%}%c%{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' +RPROMPT='$(git_prompt_status)' + +ZSH_THEME_GIT_PROMPT_PREFIX="(%{%}" +ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[cyan]%} ✈%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[yellow]%} ✭%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✗%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%} ➦%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[magenta]%} ⚡%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[grey]%} ⚑%{$reset_color%}" + +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}" + From 3ce9bb3ef01be5057ec192a70ace8a8545f80861 Mon Sep 17 00:00:00 2001 From: Irakli Gozalishvili Date: Sat, 9 Oct 2010 02:16:10 +0200 Subject: [PATCH 11/20] Fixing some minor redrew issue --- themes/gozilla.zsh-theme | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/themes/gozilla.zsh-theme b/themes/gozilla.zsh-theme index 3112b367..97566e38 100644 --- a/themes/gozilla.zsh-theme +++ b/themes/gozilla.zsh-theme @@ -1,8 +1,12 @@ -PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p%{$fg[cyan]%}%c%{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' -RPROMPT='$(git_prompt_status)' +PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' ZSH_THEME_GIT_PROMPT_PREFIX="(%{%}" ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%}" + +RPROMPT='$(git_prompt_status)' + ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[cyan]%} ✈%{$reset_color%}" ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[yellow]%} ✭%{$reset_color%}" ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✗%{$reset_color%}" @@ -10,6 +14,3 @@ ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%} ➦%{$reset_color%}" ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[magenta]%} ⚡%{$reset_color%}" ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[grey]%} ⚑%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%}" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}" - From e7ddaaa2b06c75eb1cefc749cc8f9a44a8b22752 Mon Sep 17 00:00:00 2001 From: Brandon Philips Date: Fri, 8 Oct 2010 22:44:42 -0700 Subject: [PATCH 12/20] functions: fix title() to not match any $TERM On my linux virtual terminals, where TERM="linux", I was getting annoying output that was messing up my prompt. It turns out the title function was always matching on the elif statement for xterm/rxvt no matter what and the linux vt doesn't know what to do with the title special control sequence and thus was printing out garbage. Through experimentation I figured out that the || inside of the [[ ]] did not work: export TERM=linux $ if [[ $TERM =~ "^xterm" || $TERM == "rxvt" ]]; then echo $TERM; fi linux $ if [[ $TERM =~ "^xterm" ]] || [[ $TERM == "rxvt" ]]; then echo $TERM; fi Signed-off-by: Brandon Philips openSUSE running zsh 4.3.10 --- lib/functions.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/functions.zsh b/lib/functions.zsh index 561586cb..e494f1f4 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -5,7 +5,7 @@ function title { print -nR $'\033k'$1$'\033'\\\ print -nR $'\033]0;'$2$'\a' - elif [[ $TERM =~ "^xterm" || $TERM == "rxvt" ]]; then + elif [[ ($TERM =~ "^xterm") ]] || [[ ($TERM == "rxvt") ]]; then # Use this one instead for XTerms: print -nR $'\033]0;'$*$'\a' fi From e0789782bcafe38d38698421443e6a1608ad8afc Mon Sep 17 00:00:00 2001 From: Brandon Philips Date: Fri, 8 Oct 2010 22:57:43 -0700 Subject: [PATCH 13/20] themes: add philips theme Theme based on clean that is more suitable for white background terminals. Signed-off-by: Brandon Philips --- themes/philips.zsh-theme | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 themes/philips.zsh-theme diff --git a/themes/philips.zsh-theme b/themes/philips.zsh-theme new file mode 100644 index 00000000..fa7c5903 --- /dev/null +++ b/themes/philips.zsh-theme @@ -0,0 +1,14 @@ +if [ "$(whoami)" = "root" ]; then NCOLOR="red"; else NCOLOR="green"; fi + +PROMPT='%{$fg[$NCOLOR]%}%B%n%b%{$reset_color%}:%{$fg[blue]%}%B%c/%b%{$reset_color%} $(git_prompt_info)%(!.#.$) ' +RPROMPT='[%*]' + +# git theming +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}(%{$fg_no_bold[red]%}%B" +ZSH_THEME_GIT_PROMPT_SUFFIX="%b%{$fg_bold[blue]%})%{$reset_color%} " +ZSH_THEME_GIT_PROMPT_CLEAN="" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%}" + +# LS colors, made with http://geoff.greer.fm/lscolors/ +export LSCOLORS="Gxfxcxdxbxegedabagacad" +export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:' From 0348dc0721a8753ac058752ea81f02301d4ca1a9 Mon Sep 17 00:00:00 2001 From: Sven Lito Date: Sat, 9 Oct 2010 14:29:24 +0100 Subject: [PATCH 14/20] adding github plugin --- plugins/github/_github | 39 ++++++++++++++++++++++++++++++++ plugins/github/github.plugin.zsh | 4 ++++ 2 files changed, 43 insertions(+) create mode 100644 plugins/github/_github create mode 100644 plugins/github/github.plugin.zsh diff --git a/plugins/github/_github b/plugins/github/_github new file mode 100644 index 00000000..5295081e --- /dev/null +++ b/plugins/github/_github @@ -0,0 +1,39 @@ +#compdef github +#autoload + +# github zsh completion, based on homebrew completion + +local -a _1st_arguments +_1st_arguments=( + 'browse:Open this repo in a web browser' + 'clone:Clone a repo' + 'config:Automatically set configuration info, or pass args to specify' + 'create-from-local:Create a new GitHub repository from the current local repository' + 'create:Create a new empty GitHub repository' + 'fetch:Fetch from a remote to a local branch' + 'fetch_all:Fetch all refs from a user' + 'fork:Forks a GitHub repository' + 'home:Open this repos master branch in a web browser' + 'ignore:Ignore a SHA from github network commits' + 'info:Info about this project' + 'issues:Project issues tools' + 'network:Project network tools - sub-commands : web [user], list, fetch, commits' + 'network --after:Only show commits after a certain date' + 'network --applies:Filter commits to patches that apply cleanly' + 'open:Open the given user/project in a web browser' + 'pull-request:Generate the text for a pull request' + 'pull:Pull from a remote' + 'search:Search GitHub for the given repository name' + 'track:Track another users repository' +) + +local expl +local -a pkgs installed_pkgs + +_arguments \ + '*:: :->subcmds' && return 0 + +if (( CURRENT == 1 )); then + _describe -t commands "github subcommand" _1st_arguments + return +fi diff --git a/plugins/github/github.plugin.zsh b/plugins/github/github.plugin.zsh new file mode 100644 index 00000000..c23504b8 --- /dev/null +++ b/plugins/github/github.plugin.zsh @@ -0,0 +1,4 @@ +# add github completion function to path +fpath=($ZSH/plugins/github $fpath) +autoload -U compinit +compinit -i From 220d9533961800ba7631ec428f33d40c1d5953e8 Mon Sep 17 00:00:00 2001 From: Sven Lito Date: Sat, 9 Oct 2010 15:03:08 +0100 Subject: [PATCH 15/20] added git log incl. stats for the past 5 commits --- plugins/git/git.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 655eaf72..d317d179 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -12,7 +12,7 @@ alias gb='git branch' alias gba='git branch -a' alias gcount='git shortlog -sn' alias gcp='git cherry-pick' - +alias glg='git log --stat --max-count=5' # Git and svn mix alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk' From 2865b56b13aa558aa488d85eb38d68a727998a17 Mon Sep 17 00:00:00 2001 From: Sven Lito Date: Sat, 9 Oct 2010 15:18:35 +0100 Subject: [PATCH 16/20] adding comment and URL to github gem --- plugins/github/_github | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/github/_github b/plugins/github/_github index 5295081e..72178946 100644 --- a/plugins/github/_github +++ b/plugins/github/_github @@ -1,3 +1,6 @@ +# in order to make this work, you would need to have the github gem installed +# http://github.com/defunkt/github-gem + #compdef github #autoload From c3e72870c80fd40e13eef5dd6c8a1879b799bca4 Mon Sep 17 00:00:00 2001 From: Sven Lito Date: Sat, 9 Oct 2010 15:29:28 +0100 Subject: [PATCH 17/20] leaving out subcommands for now --- plugins/github/_github | 2 -- 1 file changed, 2 deletions(-) diff --git a/plugins/github/_github b/plugins/github/_github index 72178946..b8e1a9ad 100644 --- a/plugins/github/_github +++ b/plugins/github/_github @@ -21,8 +21,6 @@ _1st_arguments=( 'info:Info about this project' 'issues:Project issues tools' 'network:Project network tools - sub-commands : web [user], list, fetch, commits' - 'network --after:Only show commits after a certain date' - 'network --applies:Filter commits to patches that apply cleanly' 'open:Open the given user/project in a web browser' 'pull-request:Generate the text for a pull request' 'pull:Pull from a remote' From ff33d69d00b2affa1613f197f11ef33cd2d7f8bd Mon Sep 17 00:00:00 2001 From: Irakli Gozalishvili Date: Sat, 9 Oct 2010 18:06:00 +0200 Subject: [PATCH 18/20] changeing unicode characters that were causing issues --- themes/gozilla.zsh-theme | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/themes/gozilla.zsh-theme b/themes/gozilla.zsh-theme index 97566e38..c6b752e9 100644 --- a/themes/gozilla.zsh-theme +++ b/themes/gozilla.zsh-theme @@ -1,16 +1,15 @@ PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' -ZSH_THEME_GIT_PROMPT_PREFIX="(%{%}" -ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}" -ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%}" - -RPROMPT='$(git_prompt_status)' - -ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[cyan]%} ✈%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[yellow]%} ✭%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✗%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%} ➦%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[magenta]%} ⚡%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[grey]%} ⚑%{$reset_color%}" - +ZSH_THEME_GIT_PROMPT_PREFIX="(" +ZSH_THEME_GIT_PROMPT_SUFFIX=")" +ZSH_THEME_GIT_PROMPT_DIRTY="" +ZSH_THEME_GIT_PROMPT_CLEAN="" + +RPROMPT='$(git_prompt_status)%{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[cyan]%} ✈" +ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[yellow]%} ✭" +ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✗" +ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%} ➦" +ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[magenta]%} ✂" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[grey]%} ✱" From 95da4abe98f9a5f1ed2b2fbfe8f528c63b6f46db Mon Sep 17 00:00:00 2001 From: Sven Lito Date: Sat, 9 Oct 2010 18:38:01 +0100 Subject: [PATCH 19/20] bugfix - moved gem info --- plugins/github/_github | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/github/_github b/plugins/github/_github index b8e1a9ad..83e1713c 100644 --- a/plugins/github/_github +++ b/plugins/github/_github @@ -1,9 +1,9 @@ -# in order to make this work, you would need to have the github gem installed -# http://github.com/defunkt/github-gem - #compdef github #autoload +# in order to make this work, you will need to have the github gem installed +# http://github.com/defunkt/github-gem + # github zsh completion, based on homebrew completion local -a _1st_arguments From d89d3a27038b8d70b790ded71a8193bdc271e8a5 Mon Sep 17 00:00:00 2001 From: Sven Lito Date: Sat, 9 Oct 2010 19:11:07 +0100 Subject: [PATCH 20/20] merging in changes from robby's repo --- lib/functions.zsh | 1 - lib/git.zsh | 1 - 2 files changed, 2 deletions(-) diff --git a/lib/functions.zsh b/lib/functions.zsh index e494f1f4..e3c0de43 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -37,4 +37,3 @@ function take() { mkdir -p $1 cd $1 } - diff --git a/lib/git.zsh b/lib/git.zsh index 57a78e27..75fdc1f9 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -38,4 +38,3 @@ git_prompt_status() { fi echo $STATUS } -