From 6c95c4b68a97b41682084834b6e30822b6f06ab9 Mon Sep 17 00:00:00 2001 From: Ryan Doenges Date: Sun, 12 Jun 2011 13:57:00 -0700 Subject: [PATCH 001/142] use /home/ryan/d/.oh-my-zsh instead of ~/.oh-my-zsh for cache --- lib/completion.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/completion.zsh b/lib/completion.zsh index fdd0a8536..8c0e7701b 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -44,7 +44,7 @@ zstyle ':completion:*:hosts' hosts $hosts # Use caching so that commands like apt and dpkg complete are useable zstyle ':completion::complete:*' use-cache 1 -zstyle ':completion::complete:*' cache-path ~/.oh-my-zsh/cache/ +zstyle ':completion::complete:*' cache-path $ZSH/cache/ # Don't complete uninteresting users zstyle ':completion:*:*:*:users' ignored-patterns \ From 0061dda057bb3b8b67f2bf06b374ab0b786e80fe Mon Sep 17 00:00:00 2001 From: artemk Date: Sat, 6 Aug 2011 16:46:37 +0300 Subject: [PATCH 002/142] Add bundle open alias, which open gem using EDITOR var --- plugins/bundler/bundler.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index f005700ff..af5bf2b3b 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -3,6 +3,7 @@ alias bi="bundle install" alias bl="bundle list" alias bu="bundle update" alias bp="bundle package" +alias bo="bundle open" # The following is based on https://github.com/gma/bundler-exec From 914e1b52583e09298f10fab7a301711bd9613ac6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20M-B?= Date: Sat, 5 Nov 2011 00:34:15 +0100 Subject: [PATCH 003/142] Adding custom theme --- themes/essembeh.zsh-theme | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 themes/essembeh.zsh-theme diff --git a/themes/essembeh.zsh-theme b/themes/essembeh.zsh-theme new file mode 100644 index 000000000..f9cd6c241 --- /dev/null +++ b/themes/essembeh.zsh-theme @@ -0,0 +1,29 @@ +# Theme with full path names and hostname +# Handy if you work on different servers all the time; + + +local return_code="%(?..%{$fg_bold[red]%}%? ↵%{$reset_color%})" + +function my_git_prompt_info() { + ref=$(git symbolic-ref HEAD 2> /dev/null) || return + GIT_STATUS=$(git_prompt_status) + [[ -n $GIT_STATUS ]] && GIT_STATUS=" $GIT_STATUS" + echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$GIT_STATUS$ZSH_THEME_GIT_PROMPT_SUFFIX" +} + +LOGIN_COLOR=green +test -n "$SSH_CONNECTION" && LOGIN_COLOR=red +test $UID -eq 0 && LOGIN_COLOR=pink + +PROMPT='%{$fg[$LOGIN_COLOR]%}%B%n@%M:%{$fg[yellow]%}%B%~%{$reset_color%}%b $(my_git_prompt_info)%(!.#.$) ' +RPS1="${return_code}" + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}(" +ZSH_THEME_GIT_PROMPT_SUFFIX=") %{$reset_color%}" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%%" +ZSH_THEME_GIT_PROMPT_ADDED="+" +ZSH_THEME_GIT_PROMPT_MODIFIED="*" +ZSH_THEME_GIT_PROMPT_RENAMED="~" +ZSH_THEME_GIT_PROMPT_DELETED="!" +ZSH_THEME_GIT_PROMPT_UNMERGED="?" + From c4434d2ddedd62737ad3f99111ef47d722e2b74e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20M-B?= Date: Sat, 5 Nov 2011 00:34:37 +0100 Subject: [PATCH 004/142] Update completion for SSH Add all hosts found in ~/.ssh/config. Tip found on: http://www.nerux.org/wiki/OpenSSH#coupler_avec_zsh_completion --- lib/completion.zsh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/completion.zsh b/lib/completion.zsh index b3cc91822..dab9bb1d3 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -33,14 +33,17 @@ cdpath=(.) # use /etc/hosts and known_hosts for hostname completion [ -r ~/.ssh/known_hosts ] && _ssh_hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=() +[ -r ~/.ssh/config ] && _ssh_config=($(cat ~/.ssh/config | sed -ne 's/Host[=\t ]//p')) || _ssh_config=() [ -r /etc/hosts ] && : ${(A)_etc_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$( Date: Wed, 16 Nov 2011 19:44:02 +0100 Subject: [PATCH 005/142] Update theme Use different colors in case of root or ssh connection for prompt. --- themes/essembeh.zsh-theme | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/themes/essembeh.zsh-theme b/themes/essembeh.zsh-theme index f9cd6c241..8c98ea1ed 100644 --- a/themes/essembeh.zsh-theme +++ b/themes/essembeh.zsh-theme @@ -11,14 +11,16 @@ function my_git_prompt_info() { echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$GIT_STATUS$ZSH_THEME_GIT_PROMPT_SUFFIX" } -LOGIN_COLOR=green -test -n "$SSH_CONNECTION" && LOGIN_COLOR=red -test $UID -eq 0 && LOGIN_COLOR=pink - -PROMPT='%{$fg[$LOGIN_COLOR]%}%B%n@%M:%{$fg[yellow]%}%B%~%{$reset_color%}%b $(my_git_prompt_info)%(!.#.$) ' +# Colored prompt +ZSH_THEME_COLOR_USER="green" +ZSH_THEME_COLOR_HOST="green" +ZSH_THEME_COLOR_PWD="yellow" +test -n "$SSH_CONNECTION" && ZSH_THEME_COLOR_USER="red" && ZSH_THEME_COLOR_HOST="red" +test `id -u` = 0 && ZSH_THEME_COLOR_USER="magenta" && ZSH_THEME_COLOR_HOST="magenta" +PROMPT='%{$fg_bold[$ZSH_THEME_COLOR_USER]%}%n@%{$fg_bold[$ZSH_THEME_COLOR_HOST]%}%M%{$reset_color%}:%{$fg_bold[$ZSH_THEME_COLOR_PWD]%}%~%{$reset_color%} $(my_git_prompt_info)%(!.#.$) ' RPS1="${return_code}" -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}(" +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[cyan]%}(" ZSH_THEME_GIT_PROMPT_SUFFIX=") %{$reset_color%}" ZSH_THEME_GIT_PROMPT_UNTRACKED="%%" ZSH_THEME_GIT_PROMPT_ADDED="+" From 20b025ba2cd419a99630458052bfa9a9e8c99e91 Mon Sep 17 00:00:00 2001 From: Ian Yang Date: Fri, 2 Dec 2011 18:32:15 +0800 Subject: [PATCH 006/142] tmuxinator completion A utility to automate tmux session creation https://github.com/aziz/tmuxinator --- plugins/tmuxinator/_tmuxinator | 36 ++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 plugins/tmuxinator/_tmuxinator diff --git a/plugins/tmuxinator/_tmuxinator b/plugins/tmuxinator/_tmuxinator new file mode 100644 index 000000000..f0ff304dd --- /dev/null +++ b/plugins/tmuxinator/_tmuxinator @@ -0,0 +1,36 @@ +#compdef tmuxinator +#autoload + +local curcontext="$curcontext" state line ret=1 +local -a _configs + +_arguments -C \ + '1: :->cmds' \ + '2:: :->args' && ret=0 + +case $state in + cmds) + _values "tmuxinator command" \ + "start[start a tmux session using project's tmuxinator config]" \ + "open[create a new project file and open it in your editor]" \ + "copy[copy source_project project file to a new project called new_project]" \ + "delete[deletes the project called project_name]" \ + "implode[deletes all existing projects!]" \ + "list[list all existing projects]" \ + "doctor[look for problems in your configuration]" \ + "help[shows this help document]" \ + "version[shows tmuxinator version number]" + ret=0 + ;; + args) + case $line[1] in + start|open|copy|delete) + _configs=(`tmuxinator list | sed -n 's/^[ \t]\+//p'`) + _values 'configs' $_configs + ret=0 + ;; + esac + ;; +esac + +return ret \ No newline at end of file From 30890b9eb9e1b6fc4b553d94a97424049bd6003e Mon Sep 17 00:00:00 2001 From: Jason Gill Date: Wed, 16 Nov 2011 15:51:30 -0500 Subject: [PATCH 007/142] Fixes and improves the behavior of the tm command --- plugins/textmate/textmate.plugin.zsh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/plugins/textmate/textmate.plugin.zsh b/plugins/textmate/textmate.plugin.zsh index a11a097f5..773c4f8d2 100644 --- a/plugins/textmate/textmate.plugin.zsh +++ b/plugins/textmate/textmate.plugin.zsh @@ -6,7 +6,16 @@ alias etts='mate app config lib db public script spec test vendor/plugins vendor # Edit Ruby app in TextMate alias mr='mate CHANGELOG app config db lib public script spec test' +# If the tm command is called without an argument, open TextMate in the current directory +# If tm is passed a directory, cd to it and open it in TextMate +# If tm is passed a file, open it in TextMate function tm() { - cd $1 - mate $1 + if [[ -z $1 ]]; then + mate . + else + mate $1 + if [[ -d $1 ]]; then + cd $1 + fi + fi } From 730e0296640fed91b6db83745abf920428aa5abf Mon Sep 17 00:00:00 2001 From: Jordan MacDonald Date: Sat, 7 Jan 2012 15:36:58 -0500 Subject: [PATCH 008/142] Added alias for git diff. --- plugins/git/git.plugin.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index c1b382b2c..00667a215 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -3,6 +3,8 @@ alias g='git' compdef g=git alias gst='git status' compdef _git gst=git-status +alias gd='git diff' +compdef _git diff=git-diff alias gl='git pull' compdef _git gl=git-pull alias gup='git fetch && git rebase' From 49d44adb09f417fac24ea8e664b12f6546f22e9d Mon Sep 17 00:00:00 2001 From: Jordan MacDonald Date: Fri, 20 Jan 2012 13:07:03 -0500 Subject: [PATCH 009/142] Fixed compdef alias to use 'gd' as shortcut. --- 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 00667a215..a42148fd9 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -4,7 +4,7 @@ compdef g=git alias gst='git status' compdef _git gst=git-status alias gd='git diff' -compdef _git diff=git-diff +compdef _git gd=git-diff alias gl='git pull' compdef _git gl=git-pull alias gup='git fetch && git rebase' From 72aeaa9d9ee55fbfe15b371c0bf127ab3948a965 Mon Sep 17 00:00:00 2001 From: Hao Hong Date: Mon, 6 Feb 2012 15:51:31 +0800 Subject: [PATCH 010/142] added "publish" and "track" command completion for git-flow plugin --- plugins/git-flow/git-flow.plugin.zsh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/plugins/git-flow/git-flow.plugin.zsh b/plugins/git-flow/git-flow.plugin.zsh index 270bcbe38..b94f1a81f 100644 --- a/plugins/git-flow/git-flow.plugin.zsh +++ b/plugins/git-flow/git-flow.plugin.zsh @@ -88,6 +88,8 @@ __git-flow-release () 'start:Start a new release branch.' 'finish:Finish a release branch.' 'list:List all your release branches. (Alias to `git flow release`)' + 'publish: public' + 'track: track' ) _describe -t commands 'git flow release' subcommands _arguments \ @@ -113,6 +115,16 @@ __git-flow-release () ':version:__git_flow_version_list' ;; + (publish) + _arguments \ + ':version:__git_flow_version_list'\ + ;; + + (track) + _arguments \ + ':version:__git_flow_version_list'\ + ;; + *) _arguments \ -v'[Verbose (more) output]' From fbf5b0ecb6b551b7d4ee2f1e85780c9fdbe052a0 Mon Sep 17 00:00:00 2001 From: Brent Faulkner Date: Mon, 6 Feb 2012 21:50:17 -0500 Subject: [PATCH 011/142] add default rbenv_prompt_info implementation to close #878 --- lib/rbenv.zsh | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 lib/rbenv.zsh diff --git a/lib/rbenv.zsh b/lib/rbenv.zsh new file mode 100644 index 000000000..a8b6c323c --- /dev/null +++ b/lib/rbenv.zsh @@ -0,0 +1,2 @@ +# using the rbenv plugin will override this with a real implementation +function rbenv_prompt_info() {} From b62a3e89602bca23b794dd1e808d92a89880ad3f Mon Sep 17 00:00:00 2001 From: Brent Faulkner Date: Sun, 12 Feb 2012 12:27:06 -0500 Subject: [PATCH 012/142] handle case where ~/.rvm/bin/rvm-prompt is not in path, so "which" can't find it --- themes/crunch.zsh-theme | 2 +- themes/dallas.zsh-theme | 2 +- themes/macovsky-ruby.zsh-theme | 2 +- themes/macovsky.zsh-theme | 2 +- themes/superjarin.zsh-theme | 2 +- themes/zhann.zsh-theme | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/themes/crunch.zsh-theme b/themes/crunch.zsh-theme index b2759a1b0..2fc066381 100644 --- a/themes/crunch.zsh-theme +++ b/themes/crunch.zsh-theme @@ -29,7 +29,7 @@ ZSH_THEME_GIT_PROMPT_DIRTY=" $CRUNCH_GIT_DIRTY_COLOR✗" # Our elements: CRUNCH_TIME_="$CRUNCH_BRACKET_COLOR{$CRUNCH_TIME_COLOR%T$CRUNCH_BRACKET_COLOR}%{$reset_color%}" -if which rvm-prompt &> /dev/null; then +if [ -e ~/.rvm/bin/rvm-prompt ]; then CRUNCH_RVM_="$CRUNCH_BRACKET_COLOR"["$CRUNCH_RVM_COLOR\${\$(~/.rvm/bin/rvm-prompt i v g)#ruby-}$CRUNCH_BRACKET_COLOR"]"%{$reset_color%}" else if which rbenv &> /dev/null; then diff --git a/themes/dallas.zsh-theme b/themes/dallas.zsh-theme index e9b4f852a..02285df52 100644 --- a/themes/dallas.zsh-theme +++ b/themes/dallas.zsh-theme @@ -3,7 +3,7 @@ # Grab the current date (%D) and time (%T) wrapped in {}: {%D %T} DALLAS_CURRENT_TIME_="%{$fg[white]%}{%{$fg[yellow]%}%D %T%{$fg[white]%}}%{$reset_color%}" # Grab the current version of ruby in use (via RVM): [ruby-1.8.7] -if which rvm-prompt &> /dev/null; then +if [ -e ~/.rvm/bin/rvm-prompt ]; then DALLAS_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[magenta]%}\$(~/.rvm/bin/rvm-prompt i v)%{$fg[white]%}]%{$reset_color%}" else if which rbenv &> /dev/null; then diff --git a/themes/macovsky-ruby.zsh-theme b/themes/macovsky-ruby.zsh-theme index 045376761..69d80d588 100644 --- a/themes/macovsky-ruby.zsh-theme +++ b/themes/macovsky-ruby.zsh-theme @@ -1,7 +1,7 @@ # ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" -if which rvm-prompt &> /dev/null; then +if [ -e ~/.rvm/bin/rvm-prompt ]; then PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(~/.rvm/bin/rvm-prompt i v)› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b ' else if which rbenv &> /dev/null; then diff --git a/themes/macovsky.zsh-theme b/themes/macovsky.zsh-theme index b6978b929..2e6dce42d 100644 --- a/themes/macovsky.zsh-theme +++ b/themes/macovsky.zsh-theme @@ -1,7 +1,7 @@ # ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" -if which rvm-prompt &> /dev/null; then +if [ -e ~/.rvm/bin/rvm-prompt ]; then PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(~/.rvm/bin/rvm-prompt i v)› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b ' else if which rbenv &> /dev/null; then diff --git a/themes/superjarin.zsh-theme b/themes/superjarin.zsh-theme index 0be816de0..86955a560 100644 --- a/themes/superjarin.zsh-theme +++ b/themes/superjarin.zsh-theme @@ -1,5 +1,5 @@ # Grab the current version of ruby in use (via RVM): [ruby-1.8.7] -if which rvm-prompt &> /dev/null; then +if [ -e ~/.rvm/bin/rvm-prompt ]; then JARIN_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[red]%}\$(~/.rvm/bin/rvm-prompt i v)%{$fg[white]%}]%{$reset_color%}" else if which rbenv &> /dev/null; then diff --git a/themes/zhann.zsh-theme b/themes/zhann.zsh-theme index 574e0cec3..5c49fe79b 100644 --- a/themes/zhann.zsh-theme +++ b/themes/zhann.zsh-theme @@ -1,6 +1,6 @@ PROMPT='%{$fg_bold[green]%}%p %{$fg[cyan]%}%c%{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' -if which rvm-prompt &> /dev/null; then +if [ -e ~/.rvm/bin/rvm-prompt ]; then RPROMPT='%{$reset_color%} %{$fg[red]%}$(~/.rvm/bin/rvm-prompt i v g) %{$reset_color%}' else if which rbenv &> /dev/null; then From 4e0b5be145cb0f4eda769906e9e72e31aec7c236 Mon Sep 17 00:00:00 2001 From: Andrew Ash Date: Thu, 23 Feb 2012 23:12:07 -0800 Subject: [PATCH 013/142] Fix spurious correction with sudo vim user@host:~ $ sudo vim /etc/rc.conf zsh: correct 'vim' to '.vim' [nyae]? http://www.zsh.org/mla/users/2012/msg00028.html --- lib/correction.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/correction.zsh b/lib/correction.zsh index fc60dcdbd..53c477d46 100644 --- a/lib/correction.zsh +++ b/lib/correction.zsh @@ -8,3 +8,4 @@ alias gist='nocorrect gist' alias heroku='nocorrect heroku' alias ebuild='nocorrect ebuild' alias hpodder='nocorrect hpodder' +alias sudo='nocorrect sudo' \ No newline at end of file From a75aabad1e455dcbf62891ba7370f6c0ea1108b2 Mon Sep 17 00:00:00 2001 From: Corey Woodcox Date: Wed, 9 Nov 2011 14:43:32 -0700 Subject: [PATCH 014/142] add the half-life theme based on steeef and lambda --- themes/half-life.zsh-theme | 99 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 themes/half-life.zsh-theme diff --git a/themes/half-life.zsh-theme b/themes/half-life.zsh-theme new file mode 100644 index 000000000..699880027 --- /dev/null +++ b/themes/half-life.zsh-theme @@ -0,0 +1,99 @@ +# prompt style and colors based on Steve Losh's Prose theme: +# http://github.com/sjl/oh-my-zsh/blob/master/themes/prose.zsh-theme +# +# vcs_info modifications from Bart Trojanowski's zsh prompt: +# http://www.jukie.net/bart/blog/pimping-out-zsh-prompt +# +# git untracked files modification from Brian Carper: +# http://briancarper.net/blog/570/git-info-in-your-zsh-prompt + +function virtualenv_info { + [ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') ' +} +PR_GIT_UPDATE=1 + +setopt prompt_subst +autoload colors +colors + +autoload -U add-zsh-hook +autoload -Uz vcs_info + +#use extended color pallete if available +if [[ $TERM = *256color* || $TERM = *rxvt* ]]; then + turquoise="%F{81}" + orange="%F{166}" + purple="%F{135}" + hotpink="%F{161}" + limegreen="%F{118}" +else + turquoise="$fg[cyan]" + orange="$fg[yellow]" + purple="$fg[magenta]" + hotpink="$fg[red]" + limegreen="$fg[green]" +fi + +# enable VCS systems you use +zstyle ':vcs_info:*' enable git svn + +# check-for-changes can be really slow. +# you should disable it, if you work with large repositories +zstyle ':vcs_info:*:prompt:*' check-for-changes true + +# set formats +# %b - branchname +# %u - unstagedstr (see below) +# %c - stagedstr (see below) +# %a - action (e.g. rebase-i) +# %R - repository path +# %S - path in the repository +PR_RST="%{${reset_color}%}" +FMT_BRANCH="(%{$turquoise%}%b%u%c${PR_RST})" +FMT_ACTION="(%{$limegreen%}%a${PR_RST})" +FMT_UNSTAGED="%{$orange%}●" +FMT_STAGED="%{$limegreen%}●" + +zstyle ':vcs_info:*:prompt:*' unstagedstr "${FMT_UNSTAGED}" +zstyle ':vcs_info:*:prompt:*' stagedstr "${FMT_STAGED}" +zstyle ':vcs_info:*:prompt:*' actionformats "${FMT_BRANCH}${FMT_ACTION}" +zstyle ':vcs_info:*:prompt:*' formats "${FMT_BRANCH}" +zstyle ':vcs_info:*:prompt:*' nvcsformats "" + + +function steeef_preexec { + case "$(history $HISTCMD)" in + *git*) + PR_GIT_UPDATE=1 + ;; + *svn*) + PR_GIT_UPDATE=1 + ;; + esac +} +add-zsh-hook preexec steeef_preexec + +function steeef_chpwd { + PR_GIT_UPDATE=1 +} +add-zsh-hook chpwd steeef_chpwd + +function steeef_precmd { + if [[ -n "$PR_GIT_UPDATE" ]] ; then + # check for untracked files or updated submodules, since vcs_info doesn't + if [[ ! -z $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then + PR_GIT_UPDATE=1 + FMT_BRANCH="${PM_RST} on %{$turquoise%}%b%u%c%{$hotpink%}●${PR_RST}" + else + FMT_BRANCH="${PM_RST} on %{$turquoise%}%b%u%c${PR_RST}" + fi + zstyle ':vcs_info:*:prompt:*' formats "${FMT_BRANCH}" + + vcs_info 'prompt' + PR_GIT_UPDATE= + fi +} +add-zsh-hook precmd steeef_precmd + +PROMPT=$' +%{$purple%}%n%{$reset_color%} in %{$limegreen%}%~%{$reset_color%}$(rvm-prompt " with%{$fg[red]%} " v g "%{$reset_color%}")$vcs_info_msg_0_%{$orange%} λ%{$reset_color%} ' From 0b70b6d0483210b7fcc74ee1073c7de887f4f3ac Mon Sep 17 00:00:00 2001 From: Corey Woodcox Date: Wed, 4 Apr 2012 00:58:09 -0600 Subject: [PATCH 015/142] small changes to make it prettier --- themes/half-life.zsh-theme | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/half-life.zsh-theme b/themes/half-life.zsh-theme index 699880027..c8d09ce47 100644 --- a/themes/half-life.zsh-theme +++ b/themes/half-life.zsh-theme @@ -49,8 +49,8 @@ zstyle ':vcs_info:*:prompt:*' check-for-changes true # %R - repository path # %S - path in the repository PR_RST="%{${reset_color}%}" -FMT_BRANCH="(%{$turquoise%}%b%u%c${PR_RST})" -FMT_ACTION="(%{$limegreen%}%a${PR_RST})" +FMT_BRANCH=" on %{$turquoise%}%b%u%c${PR_RST}" +FMT_ACTION=" performing a %{$limegreen%}%a${PR_RST}" FMT_UNSTAGED="%{$orange%}●" FMT_STAGED="%{$limegreen%}●" From 9b05a44387f84ae0b24e24023286534d0bbdf65f Mon Sep 17 00:00:00 2001 From: "Steven G. Harms" Date: Thu, 5 Apr 2012 10:18:16 -0700 Subject: [PATCH 016/142] Adds glo; glp (arg) * glo := git log --oneline * glp := git log --pretty=arg --- plugins/git/git.plugin.zsh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index c1b382b2c..63a276d25 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -30,6 +30,8 @@ alias glg='git log --stat --max-count=5' compdef _git glg=git-log alias glgg='git log --graph --max-count=5' compdef _git glgg=git-log +alias glo='git log --oneline' +compdef _git glo=git-log alias gss='git status -s' compdef _git gss=git-status alias ga='git add' @@ -59,3 +61,12 @@ alias ggpush='git push origin $(current_branch)' compdef ggpush=git alias ggpnp='git pull origin $(current_branch) && git push origin $(current_branch)' compdef ggpnp=git + +# Pretty log messages +function _git_log_prettily(){ + if ! [ -z $1 ]; then + git log --pretty=$1 + fi +} +alias glp="_git_log_prettily" +compdef _git glp=git-log From 8942d304ff55ad9467872ecab3f343552b5c2083 Mon Sep 17 00:00:00 2001 From: Daniel Bayerlein Date: Sat, 7 Apr 2012 18:23:12 +0200 Subject: [PATCH 017/142] Add Theme "itchy" --- themes/itchy.zsh-theme | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 themes/itchy.zsh-theme diff --git a/themes/itchy.zsh-theme b/themes/itchy.zsh-theme new file mode 100644 index 000000000..afc2abf69 --- /dev/null +++ b/themes/itchy.zsh-theme @@ -0,0 +1,19 @@ +# Created by Daniel Bayerlein https://github.com/danielbayerlein +# Inspired by http://peepcode.com/blog/2012/my-command-line-prompt + +local smiley="%(?,%{$fg[green]%}☺%{$reset_color%},%{$fg[red]%}☹%{$reset_color%})" + +local user="%{$fg[cyan]%}%n%{$reset_color%}" +local host="%{$fg[cyan]%}@%m%{$reset_color%}" +local pwd="%{$fg[yellow]%}%~%{$reset_color%}" + +PROMPT='${user}${host} ${pwd} +${smiley} ' + +RPROMPT='$(rvm-prompt || rbenv version) %{$fg[white]%}$(git_prompt_info)%{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX="" +ZSH_THEME_GIT_PROMPT_SUFFIX="" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%} ✗%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%} ✔%{$reset_color%}" + From 6f4c69cb48d6fb746149afddee264509a5245305 Mon Sep 17 00:00:00 2001 From: Justin Mazzi Date: Wed, 25 Apr 2012 11:59:53 -0300 Subject: [PATCH 018/142] Add instructions on handling updates and prompts. --- README.textile | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.textile b/README.textile index bf6776665..f6b59fa26 100644 --- a/README.textile +++ b/README.textile @@ -59,6 +59,14 @@ If you want to override any of the default behavior, just add a new file (ending If you have many functions which go well together you can put them as a *.plugin.zsh file in the @custom/plugins/@ directory and then enable this plugin. If you would like to override the functionality of a plugin distributed with oh-my-zsh, create a plugin of the same name in the @custom/plugins/@ directory and it will be loaded instead of the one in @plugins/@. +h3. Updates +By default you will be prompted to check for updates. If you would like oh-my-zsh to automatically update itself without prompting you, set the following in your ~/.zshrc + +@DISABLE_UPDATE_PROMPT=true@ + +To disable updates entirely, put this in your ~/.zshrc + +@DISABLE_AUTO_UPDATE=true@ h3. Uninstalling From 7fd1bf597fd866480d41a4208fa23d04b1a79044 Mon Sep 17 00:00:00 2001 From: Justin Mazzi Date: Wed, 25 Apr 2012 11:02:17 -0400 Subject: [PATCH 019/142] Fix formatting --- README.textile | 1 + 1 file changed, 1 insertion(+) diff --git a/README.textile b/README.textile index f6b59fa26..701485690 100644 --- a/README.textile +++ b/README.textile @@ -60,6 +60,7 @@ If you have many functions which go well together you can put them as a *.plugin If you would like to override the functionality of a plugin distributed with oh-my-zsh, create a plugin of the same name in the @custom/plugins/@ directory and it will be loaded instead of the one in @plugins/@. h3. Updates + By default you will be prompted to check for updates. If you would like oh-my-zsh to automatically update itself without prompting you, set the following in your ~/.zshrc @DISABLE_UPDATE_PROMPT=true@ From 79847ad77d1613fa823b2c6e097895b3b5193074 Mon Sep 17 00:00:00 2001 From: Dr Nic Williams Date: Wed, 2 May 2012 10:32:30 -0700 Subject: [PATCH 020/142] added 'gcl'for 'git config --list'; and gd for 'git diff' --- plugins/git/git.plugin.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index e1d682508..340485104 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -9,6 +9,7 @@ alias gup='git fetch && git rebase' compdef _git gup=git-fetch alias gp='git push' compdef _git gp=git-push +alias gd='git diff' gdv() { git diff -w "$@" | view - } compdef _git gdv=git-diff alias gc='git commit -v' @@ -24,6 +25,7 @@ alias gba='git branch -a' compdef _git gba=git-branch alias gcount='git shortlog -sn' compdef gcount=git +alias gcl='git config --list' alias gcp='git cherry-pick' compdef _git gcp=git-cherry-pick alias glg='git log --stat --max-count=5' From ce4431a160350e4d2d384251a9471cfed493b834 Mon Sep 17 00:00:00 2001 From: Kir Shatrov Date: Mon, 4 Jun 2012 11:50:42 +0300 Subject: [PATCH 021/142] Added spin to bundled_commands (Bundler plugin) --- plugins/bundler/bundler.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index 2b80b76e6..7d2d1dcfd 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -6,7 +6,7 @@ alias bu="bundle update" # The following is based on https://github.com/gma/bundler-exec -bundled_commands=(annotate cap capify cucumber ey foreman guard middleman nanoc rackup rainbows rails rake rspec ruby shotgun spec spork thin thor unicorn unicorn_rails) +bundled_commands=(annotate cap capify cucumber ey foreman guard middleman nanoc rackup rainbows rails rake rspec ruby shotgun spec spin spork thin thor unicorn unicorn_rails) ## Functions From 18cb11903f8208403a0ba5a8f2ece1a0bd4ef9a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20M-B?= Date: Wed, 27 Jun 2012 00:12:21 +0200 Subject: [PATCH 022/142] Comment l alias --- lib/aliases.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/aliases.zsh b/lib/aliases.zsh index 0555be264..d33d71cf0 100644 --- a/lib/aliases.zsh +++ b/lib/aliases.zsh @@ -16,7 +16,7 @@ alias history='fc -l 1' # List direcory contents alias lsa='ls -lah' -alias l='ls -la' +#alias l='ls -la' alias ll='ls -l' alias sl=ls # often screw this up From c23392ac5b9e8655a42e827983ba93636801136b Mon Sep 17 00:00:00 2001 From: jaischeema Date: Tue, 3 Jul 2012 13:02:29 +1000 Subject: [PATCH 023/142] Add new theme : jaischeema --- themes/jaischeema.zsh-theme | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 themes/jaischeema.zsh-theme diff --git a/themes/jaischeema.zsh-theme b/themes/jaischeema.zsh-theme new file mode 100644 index 000000000..06778216d --- /dev/null +++ b/themes/jaischeema.zsh-theme @@ -0,0 +1,22 @@ +# ------------------------------------------------------------------------------ +# FILE: jaischeema.zsh-theme +# DESCRIPTION: oh-my-zsh theme file. +# AUTHOR: Jais Cheema +# VERSION: 0.0.1 +# ------------------------------------------------------------------------------ + + + +PROMPT='%{$fg_bold[magenta]%}%m%{$reset_color%} at %{$fg_bold[green]%}%~%{$reset_color%} %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%}% %{$reset_color%}%{$fg[red]%}❯%{$reset_color%} ' + +ZSH_THEME_GIT_PROMPT_PREFIX="±(%{$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]%}) " + +if which rbenv &> /dev/null; then + RPROMPT='%{$fg[red]%}$(rbenv version | sed -e "s/ (set.*$//")%{$reset_color%}' +else +if which rvm-prompt &> /dev/null; then + RPROMPT='%{$fg[red]%}$(rvm-prompt)%{$reset_color%}' +fi From 8d60f9a0d8eaf7f72eb64f600fcecbe48a26300f Mon Sep 17 00:00:00 2001 From: jais Date: Tue, 3 Jul 2012 15:12:55 +1000 Subject: [PATCH 024/142] Fix the rvm gemset right prompt:wq --- themes/jaischeema.zsh-theme | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/themes/jaischeema.zsh-theme b/themes/jaischeema.zsh-theme index 06778216d..aecc5b961 100644 --- a/themes/jaischeema.zsh-theme +++ b/themes/jaischeema.zsh-theme @@ -17,6 +17,7 @@ ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%}) " if which rbenv &> /dev/null; then RPROMPT='%{$fg[red]%}$(rbenv version | sed -e "s/ (set.*$//")%{$reset_color%}' else -if which rvm-prompt &> /dev/null; then - RPROMPT='%{$fg[red]%}$(rvm-prompt)%{$reset_color%}' + if which rvm-prompt &> /dev/null; then + RPROMPT='%{$fg[red]%}$(rvm-prompt)%{$reset_color%}' + fi fi From 0b2da8f11b2e84a73f3fbe019a086da28ae6d2a3 Mon Sep 17 00:00:00 2001 From: Justin Caratzas Date: Wed, 11 Jul 2012 23:40:12 -0400 Subject: [PATCH 025/142] Add very basic virtualenv plugin checks for $VIRTUAL_ENV and provides to basename in a function for the prompt. --- plugins/virtualenv/virtualenv.plugin.zsh | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 plugins/virtualenv/virtualenv.plugin.zsh diff --git a/plugins/virtualenv/virtualenv.plugin.zsh b/plugins/virtualenv/virtualenv.plugin.zsh new file mode 100644 index 000000000..e8458389f --- /dev/null +++ b/plugins/virtualenv/virtualenv.plugin.zsh @@ -0,0 +1,9 @@ +function virtualenv_prompt_info(){ + local virtualenv_path="$VIRTUAL_ENV" + if [[ -n $virtualenv_path ]]; then + local virtualenv_name=`basename $virtualenv_path` + printf "%s[%s] " "%{${fg[yellow]}%}" $virtualenv_name + fi +} + +export VIRTUAL_ENV_DISABLE_PROMPT=1 From 5001412f6d127d8360ea8e0d775e7184aae2091d Mon Sep 17 00:00:00 2001 From: Bob Maerten Date: Thu, 12 Jul 2012 14:19:10 +0300 Subject: [PATCH 026/142] vagrant uses 'ssh-config' command, not 'ssh_config' --- plugins/vagrant/_vagrant | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/vagrant/_vagrant b/plugins/vagrant/_vagrant index 483b29c53..1eed7f988 100644 --- a/plugins/vagrant/_vagrant +++ b/plugins/vagrant/_vagrant @@ -15,7 +15,7 @@ _1st_arguments=( 'reload:Reload the vagrant environment' 'resume:Resumes a suspend vagrant environment' 'ssh:SSH into the currently running environment' - 'ssh_config:outputs .ssh/config valid syntax for connecting to this environment via ssh.' + 'ssh-config:outputs .ssh/config valid syntax for connecting to this environment via ssh.' 'status:Shows the status of the current Vagrant environment.' 'suspend:Suspends the currently running vagrant environment' 'up:Creates the vagrant environment' From 3fea7c3b278ccf73421cbdcc61a1c1dd6d4a0a70 Mon Sep 17 00:00:00 2001 From: Andrew Vit Date: Sun, 6 Nov 2011 04:07:16 -0800 Subject: [PATCH 027/142] Added avit theme --- themes/avit.zsh-theme | 120 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 themes/avit.zsh-theme diff --git a/themes/avit.zsh-theme b/themes/avit.zsh-theme new file mode 100644 index 000000000..51f5e375a --- /dev/null +++ b/themes/avit.zsh-theme @@ -0,0 +1,120 @@ +# +# Author:: Andrew Vit () +# +# AVIT ZSH Theme +# +# Copyright 2011, Andrew Vit +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +PROMPT=' +$(_user_host)${_current_dir} $(git_prompt_info) $(_ruby_version) +▶ ' + +PROMPT2='%{$fg[grey]%}◀%{$reset_color%} ' + +RPROMPT='$(_vi_status)%{$(echotc UP 1)%}$(_git_time_since_commit) $(git_prompt_status) ${_return_status}%{$(echotc DO 1)%}' + +local _current_dir="%{$fg[blue]%}%3~%{$reset_color%} " +local _return_status="%{$fg[red]%}%(?..⍉)%{$reset_color%}" +local _hist_no="%{$fg[grey]%}%h%{$reset_color%}" + +function _user_host() { + if [[ -n $SSH_CONNECTION ]]; then + me="%n@%m" + elif [[ $LOGNAME != $USER ]]; then + me="%n" + fi + if [[ -n $me ]]; then + echo "%{$fg[cyan]%}$me%{$reset_color%}:" + fi +} + +function _vi_status() { + if {echo $fpath | grep -q "plugins/vi-mode"}; then + echo "$(vi_mode_prompt_info)" + fi +} + +function _ruby_version() { + if {echo $fpath | grep -q "plugins/rvm"}; then + echo "%{$fg[grey]%}$(rvm_prompt_info)%{$reset_color%}" + fi +} + +# Determine the time since last commit. If branch is clean, +# use a neutral color, otherwise colors will vary according to time. +function _git_time_since_commit() { + if git rev-parse --git-dir > /dev/null 2>&1; then + # Only proceed if there is actually a commit. + if [[ $(git log 2>&1 > /dev/null | grep -c "^fatal: bad default revision") == 0 ]]; then + # Get the last commit. + last_commit=$(git log --pretty=format:'%at' -1 2> /dev/null) + now=$(date +%s) + seconds_since_last_commit=$((now-last_commit)) + + # Totals + minutes=$((seconds_since_last_commit / 60)) + hours=$((seconds_since_last_commit/3600)) + + # Sub-hours and sub-minutes + days=$((seconds_since_last_commit / 86400)) + sub_hours=$((hours % 24)) + sub_minutes=$((minutes % 60)) + + if [ $hours -gt 24 ]; then + commit_age="${days}d" + elif [ $minutes -gt 60 ]; then + commit_age="${sub_hours}h${sub_minutes}m" + else + commit_age="${minutes}m" + fi + + color=$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL + echo "$color$commit_age%{$reset_color%}" + fi + fi +} + +if [[ $USER == "root" ]]; then + CARETCOLOR="red" +else + CARETCOLOR="white" +fi + +MODE_INDICATOR="%{$fg_bold[yellow]%}❮%{$reset_color%}%{$fg[yellow]%}❮❮%{$reset_color%}" + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" + +ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}✗%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN=" %{$fg[green]%}✔%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%}✚ " +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[cyan]%}§ " +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[grey]%}◒ " + +# Colors vary depending on time lapsed. +ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT="%{$fg[green]%}" +ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM="%{$fg[yellow]%}" +ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG="%{$fg[red]%}" +ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[grey]%}" + +# LS colors, made with http://geoff.greer.fm/lscolors/ +export LSCOLORS="exfxcxdxbxegedabagacad" +export LS_COLORS='di=34;40:ln=35;40:so=32;40:pi=33;40:ex=31;40:bd=34;46:cd=34;43:su=0;41:sg=0;46:tw=0;42:ow=0;43:' +export GREP_COLOR='1;33' + From 9ee4b9c8f7b21db2c20500cacd72471e8cdbf6a5 Mon Sep 17 00:00:00 2001 From: oemer Date: Thu, 26 Jul 2012 16:05:03 +0200 Subject: [PATCH 028/142] Added go completion script. Taken from /misc/zsh/go --- plugins/go/go.plugin.zsh | 151 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 plugins/go/go.plugin.zsh diff --git a/plugins/go/go.plugin.zsh b/plugins/go/go.plugin.zsh new file mode 100644 index 000000000..23afa9656 --- /dev/null +++ b/plugins/go/go.plugin.zsh @@ -0,0 +1,151 @@ +# install in /etc/zsh/zshrc or your personal .zshrc + +# gc +prefixes=(5 6 8) +for p in $prefixes; do + compctl -g "*.${p}" ${p}l + compctl -g "*.go" ${p}g +done + +# standard go tools +compctl -g "*.go" gofmt + +# gccgo +compctl -g "*.go" gccgo + +# go tool +__go_tool_complete() { + typeset -a commands build_flags + commands+=( + 'build[compile packages and dependencies]' + 'clean[remove object files]' + 'doc[run godoc on package sources]' + 'fix[run go tool fix on packages]' + 'fmt[run gofmt on package sources]' + 'get[download and install packages and dependencies]' + 'help[display help]' + 'install[compile and install packages and dependencies]' + 'list[list packages]' + 'run[compile and run Go program]' + 'test[test packages]' + 'tool[run specified go tool]' + 'version[print Go version]' + 'vet[run go tool vet on packages]' + ) + if (( CURRENT == 2 )); then + # explain go commands + _values 'go tool commands' ${commands[@]} + return + fi + build_flags=( + '-a[force reinstallation of packages that are already up-to-date]' + '-n[print the commands but do not run them]' + "-p[number of parallel builds]:number" + '-x[print the commands]' + "-work[print temporary directory name and keep it]" + "-gcflags[flags for 5g/6g/8g]:flags" + "-ldflags[flags for 5l/6l/8l]:flags" + "-gccgoflags[flags for gccgo]:flags" + ) + __go_list() { + local expl importpaths + declare -a importpaths + importpaths=($(go list ${words[$CURRENT]}... 2>/dev/null)) + _wanted importpaths expl 'import paths' compadd "$@" - "${importpaths[@]}" + } + case ${words[2]} in + clean|doc) + _arguments -s -w : '*:importpaths:__go_list' + ;; + fix|fmt|list|vet) + _alternative ':importpaths:__go_list' ':files:_path_files -g "*.go"' + ;; + install) + _arguments -s -w : ${build_flags[@]} \ + "-v[show package names]" \ + '*:importpaths:__go_list' + ;; + get) + _arguments -s -w : \ + ${build_flags[@]} + ;; + build) + _arguments -s -w : \ + ${build_flags[@]} \ + "-v[show package names]" \ + "-o[output file]:file:_files" \ + "*:args:{ _alternative ':importpaths:__go_list' ':files:_path_files -g \"*.go\"' }" + ;; + test) + _arguments -s -w : \ + ${build_flags[@]} \ + "-c[do not run, compile the test binary]" \ + "-i[do not run, install dependencies]" \ + "-v[print test output]" \ + "-x[print the commands]" \ + "-short[use short mode]" \ + "-parallel[number of parallel tests]:number" \ + "-cpu[values of GOMAXPROCS to use]:number list" \ + "-run[run tests and examples matching regexp]:regexp" \ + "-bench[run benchmarks matching regexp]:regexp" \ + "-benchtime[run each benchmark during n seconds]:duration" \ + "-timeout[kill test after that duration]:duration" \ + "-cpuprofile[write CPU profile to file]:file:_files" \ + "-memprofile[write heap profile to file]:file:_files" \ + "-memprofilerate[set heap profiling rate]:number" \ + "*:args:{ _alternative ':importpaths:__go_list' ':files:_path_files -g \"*.go\"' }" + ;; + help) + _values "${commands[@]}" \ + 'gopath[GOPATH environment variable]' \ + 'importpath[description of import paths]' \ + 'remote[remote import path syntax]' \ + 'testflag[description of testing flags]' \ + 'testfunc[description of testing functions]' + ;; + run) + _arguments -s -w : \ + ${build_flags[@]} \ + '*:file:_path_files -g "*.go"' + ;; + tool) + if (( CURRENT == 3 )); then + _values "go tool" $(go tool) + return + fi + case ${words[3]} in + [568]g) + _arguments -s -w : \ + '-I[search for packages in DIR]:includes:_path_files -/' \ + '-L[show full path in file:line prints]' \ + '-S[print the assembly language]' \ + '-V[print the compiler version]' \ + '-e[no limit on number of errors printed]' \ + '-h[panic on an error]' \ + '-l[disable inlining]' \ + '-m[print optimization decisions]' \ + '-o[file specify output file]:file' \ + '-p[assumed import path for this code]:importpath' \ + '-u[disable package unsafe]' \ + "*:file:_files -g '*.go'" + ;; + [568]l) + local O=${words[3]%l} + _arguments -s -w : \ + '-o[file specify output file]:file' \ + '-L[search for packages in DIR]:includes:_path_files -/' \ + "*:file:_files -g '*.[ao$O]'" + ;; + dist) + _values "dist tool" banner bootstrap clean env install version + ;; + *) + # use files by default + _files + ;; + esac + ;; + esac +} + +compdef __go_tool_complete go From 682961e9304c6bf7bd500d741b01640682d35ac9 Mon Sep 17 00:00:00 2001 From: Morgan Larosa Date: Sat, 28 Jul 2012 08:25:15 +1000 Subject: [PATCH 029/142] Add a configuration option to disable autocorrect --- lib/correction.zsh | 22 +++++++++++++--------- templates/zshrc.zsh-template | 3 +++ 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/lib/correction.zsh b/lib/correction.zsh index fc60dcdbd..07fbcfd36 100644 --- a/lib/correction.zsh +++ b/lib/correction.zsh @@ -1,10 +1,14 @@ -setopt correct_all +if [[ "$DISABLE_CORRECTION" == "true" ]]; then + return +else + setopt correct_all -alias man='nocorrect man' -alias mv='nocorrect mv' -alias mysql='nocorrect mysql' -alias mkdir='nocorrect mkdir' -alias gist='nocorrect gist' -alias heroku='nocorrect heroku' -alias ebuild='nocorrect ebuild' -alias hpodder='nocorrect hpodder' + alias man='nocorrect man' + alias mv='nocorrect mv' + alias mysql='nocorrect mysql' + alias mkdir='nocorrect mkdir' + alias gist='nocorrect gist' + alias heroku='nocorrect heroku' + alias ebuild='nocorrect ebuild' + alias hpodder='nocorrect hpodder' +fi diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template index e52553241..cb9c5855e 100644 --- a/templates/zshrc.zsh-template +++ b/templates/zshrc.zsh-template @@ -23,6 +23,9 @@ ZSH_THEME="robbyrussell" # Uncomment following line if you want to disable autosetting terminal title. # DISABLE_AUTO_TITLE="true" +# Uncomment following line if you want to disable command autocorrection +# DISABLE_CORRECTION="true" + # Uncomment following line if you want red dots to be displayed while waiting for completion # COMPLETION_WAITING_DOTS="true" From 55f09f89c8602efa6545411448e377aa87f64e7b Mon Sep 17 00:00:00 2001 From: Artie Kh Date: Thu, 13 Dec 2012 19:09:28 +0200 Subject: [PATCH 030/142] Added `verisions` option for `homebrew` completion --- plugins/brew/_brew | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/brew/_brew b/plugins/brew/_brew index 1dcf0a4bf..e43ba2900 100644 --- a/plugins/brew/_brew +++ b/plugins/brew/_brew @@ -35,6 +35,7 @@ _1st_arguments=( 'update:freshen up links' 'upgrade:upgrade outdated formulae' 'uses:show formulas which depend on a formula' + 'versions:show all available formula versions' ) local expl @@ -71,7 +72,7 @@ case "$words[1]" in _brew_installed_formulae _wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae fi ;; - install|home|homepage|log|info|abv|uses|cat|deps|edit|options) + install|home|homepage|log|info|abv|uses|cat|deps|edit|options|versions) _brew_all_formulae _wanted formulae expl 'all formulae' compadd -a formulae ;; remove|rm|uninstall|unlink|cleanup|link|ln) From d0842b431e9ebae66ae9373e9e5614341c6f5803 Mon Sep 17 00:00:00 2001 From: Filipe Chagas Date: Fri, 28 Dec 2012 17:37:48 -0200 Subject: [PATCH 031/142] Fix gitfast problem for untracket files When showing the char % for untracket files, it was not being escaped so there was shown a space in the place. It was also removing any char that was right just after. --- plugins/gitfast/git-prompt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/gitfast/git-prompt.sh b/plugins/gitfast/git-prompt.sh index bf20491ec..afd76e86e 100644 --- a/plugins/gitfast/git-prompt.sh +++ b/plugins/gitfast/git-prompt.sh @@ -275,7 +275,7 @@ __git_ps1 () if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ]; then if [ -n "$(git ls-files --others --exclude-standard)" ]; then - u="%" + u="%%" fi fi From 021e6de3237402aabd7e8bc0b99726a5149c33ef Mon Sep 17 00:00:00 2001 From: Filipe Chagas Date: Fri, 28 Dec 2012 18:04:15 -0200 Subject: [PATCH 032/142] added crcandy theme it's just the candy theme with a new line before. in order to make easier to see the result of the commands and to avoid confusing --- themes/crcandy.zsh-theme | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 themes/crcandy.zsh-theme diff --git a/themes/crcandy.zsh-theme b/themes/crcandy.zsh-theme new file mode 100644 index 000000000..0a63c1245 --- /dev/null +++ b/themes/crcandy.zsh-theme @@ -0,0 +1,8 @@ +PROMPT=$' +%{$fg_bold[green]%}%n@%m %{$fg[blue]%}%D{[%I:%M:%S]} %{$reset_color%}%{$fg[white]%}[%~]%{$reset_color%} $(git_prompt_info)\ +%{$fg[blue]%}->%{$fg_bold[blue]%} %#%{$reset_color%} ' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}[" +ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}*%{$fg[green]%}" +ZSH_THEME_GIT_PROMPT_CLEAN="" From 6ce08acb27f14a2e73fdbd4c92f258a7e6899f64 Mon Sep 17 00:00:00 2001 From: Artie Kh Date: Sun, 30 Dec 2012 21:18:12 +0200 Subject: [PATCH 033/142] added support for subversion 1.7 for svn plugin --- plugins/svn/svn.plugin.zsh | 110 +++++++++++++++++++++---------------- 1 file changed, 62 insertions(+), 48 deletions(-) diff --git a/plugins/svn/svn.plugin.zsh b/plugins/svn/svn.plugin.zsh index e38e8920b..4f008ba4e 100644 --- a/plugins/svn/svn.plugin.zsh +++ b/plugins/svn/svn.plugin.zsh @@ -1,62 +1,76 @@ - -function svn_prompt_info { - if [ $(in_svn) ]; then - if [ "x$SVN_SHOW_BRANCH" = "xtrue" ]; then - unset SVN_SHOW_BRANCH - _DISPLAY=$(svn_get_branch_name) - else - _DISPLAY=$(svn_get_repo_name) - fi - echo "$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_PREFIX\ -$ZSH_THEME_REPO_NAME_COLOR$_DISPLAY$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_SUFFIX$ZSH_PROMPT_BASE_COLOR$(svn_dirty)$ZSH_PROMPT_BASE_COLOR" - unset _DISPLAY +# vim:ft=zsh ts=2 sw=2 sts=2 +# +function svn_prompt_info() { + if in_svn; then + if [ "x$SVN_SHOW_BRANCH" = "xtrue" ]; then + unset SVN_SHOW_BRANCH + _DISPLAY=$(svn_get_branch_name) + else + _DISPLAY=$(svn_get_repo_name) fi + echo "$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_PREFIX\ +$ZSH_THEME_REPO_NAME_COLOR$_DISPLAY$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_SUFFIX$ZSH_PROMPT_BASE_COLOR$(svn_dirty)$ZSH_PROMPT_BASE_COLOR" + unset _DISPLAY + fi } function in_svn() { - if [[ -d .svn ]]; then - echo 1 - fi + if $(svn info >/dev/null 2>&1); then + return 0 + fi + return 1 } -function svn_get_repo_name { - if [ $(in_svn) ]; then - svn info | sed -n 's/Repository\ Root:\ .*\///p' | read SVN_ROOT - - svn info | sed -n "s/URL:\ .*$SVN_ROOT\///p" - fi +function svn_get_repo_name() { + if in_svn; then + svn info | sed -n 's/Repository\ Root:\ .*\///p' | read SVN_ROOT + svn info | sed -n "s/URL:\ .*$SVN_ROOT\///p" + fi } -function svn_get_branch_name { - _DISPLAY=$(svn info 2> /dev/null | awk -F/ '/^URL:/ { for (i=0; i<=NF; i++) { if ($i == "branches" || $i == "tags" ) { print $(i+1); break }; if ($i == "trunk") { print $i; break } } }') - if [ "x$_DISPLAY" = "x" ]; then - svn_get_repo_name +function svn_get_branch_name() { + _DISPLAY=$( + svn info 2> /dev/null | \ + awk -F/ \ + '/^URL:/ { \ + for (i=0; i<=NF; i++) { \ + if ($i == "branches" || $i == "tags" ) { \ + print $(i+1); \ + break;\ + }; \ + if ($i == "trunk") { print $i; break; } \ + } \ + }' + ) + + if [ "x$_DISPLAY" = "x" ]; then + svn_get_repo_name + else + echo $_DISPLAY + fi + unset _DISPLAY +} + +function svn_get_rev_nr() { + if in_svn; then + svn info 2> /dev/null | sed -n 's/Revision:\ //p' + fi +} + +function svn_dirty_choose() { + if in_svn; then + root=`svn info 2> /dev/null | sed -n 's/^Working Copy Root Path: //p'` + if $(svn status $root 2> /dev/null | grep -Eq '^\s*[ACDIM!?L]'); then + # Grep exits with 0 when "One or more lines were selected", return "dirty". + echo $1 else - echo $_DISPLAY + # Otherwise, no lines were found, or an error occurred. Return clean. + echo $2 fi - unset _DISPLAY + fi } -function svn_get_rev_nr { - if [ $(in_svn) ]; then - svn info 2> /dev/null | sed -n s/Revision:\ //p - fi -} - -function svn_dirty_choose { - if [ $(in_svn) ]; then - svn status 2> /dev/null | grep -Eq '^\s*[ACDIM!?L]' - if [ $pipestatus[-1] -eq 0 ]; then - # Grep exits with 0 when "One or more lines were selected", return "dirty". - echo $1 - else - # Otherwise, no lines were found, or an error occurred. Return clean. - echo $2 - fi - fi -} - -function svn_dirty { - svn_dirty_choose $ZSH_THEME_SVN_PROMPT_DIRTY $ZSH_THEME_SVN_PROMPT_CLEAN +function svn_dirty() { + svn_dirty_choose $ZSH_THEME_SVN_PROMPT_DIRTY $ZSH_THEME_SVN_PROMPT_CLEAN } From fa355a798c165fab65462238162c258394b1c7a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cosmin=20Lu=3F=C4=83?= Date: Mon, 31 Dec 2012 14:02:22 +0200 Subject: [PATCH 034/142] Fixed issue with NetBSD's ls --- lib/theme-and-appearance.zsh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/theme-and-appearance.zsh b/lib/theme-and-appearance.zsh index aec67721a..351ec22b0 100644 --- a/lib/theme-and-appearance.zsh +++ b/lib/theme-and-appearance.zsh @@ -7,7 +7,14 @@ export LSCOLORS="Gxfxcxdxbxegedabagacad" if [ "$DISABLE_LS_COLORS" != "true" ] then # Find the option for using colors in ls, depending on the version: Linux or BSD - ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty' || alias ls='ls -G' + if [[ "$(uname -s)" == "NetBSD" ]] + then + # On NetBSD, test if "gls" (GNU ls) is installed (this one supports colors); + # otherwise, leave ls as is, because NetBSD's ls doesn't support -G + gls --color -d . &>/dev/null 2>&1 && alias ls='gls --color=tty' + else + ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty' || alias ls='ls -G' + fi fi #setopt no_beep From 3362899493662ae8295521bc8fa8eccec79c7550 Mon Sep 17 00:00:00 2001 From: Ryan Neufeld Date: Tue, 1 Jan 2013 19:51:55 -0800 Subject: [PATCH 035/142] Adding torrent tools plugin. Only one tool exists right now, that is to convert a magnetlink into a torrent file. --- plugins/torrent/torrent.plugin.zsh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 plugins/torrent/torrent.plugin.zsh diff --git a/plugins/torrent/torrent.plugin.zsh b/plugins/torrent/torrent.plugin.zsh new file mode 100644 index 000000000..656e337de --- /dev/null +++ b/plugins/torrent/torrent.plugin.zsh @@ -0,0 +1,17 @@ +# +# Algorithm borrowed from http://wiki.rtorrent.org/MagnetUri and adapted to work with zsh. +# + +function magnet_to_torrent() { + [[ "$1" =~ xt=urn:btih:([^\&/]+) ]] || return 1 + + hashh=${match[1]} + + if [[ "$1" =~ dn=([^\&/]+) ]];then + filename=${match[1]} + else + filename=$hashh + fi + + echo "d10:magnet-uri${#1}:${1}e" > "$filename.torrent" +} \ No newline at end of file From e5736d39103c59b115270dcf91d31419d3f08130 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cosmin=20Lu=3F=C4=83?= Date: Thu, 3 Jan 2013 14:44:17 +0200 Subject: [PATCH 036/142] Fixed coding style --- lib/theme-and-appearance.zsh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/theme-and-appearance.zsh b/lib/theme-and-appearance.zsh index 351ec22b0..2677615c0 100644 --- a/lib/theme-and-appearance.zsh +++ b/lib/theme-and-appearance.zsh @@ -7,13 +7,12 @@ export LSCOLORS="Gxfxcxdxbxegedabagacad" if [ "$DISABLE_LS_COLORS" != "true" ] then # Find the option for using colors in ls, depending on the version: Linux or BSD - if [[ "$(uname -s)" == "NetBSD" ]] - then - # On NetBSD, test if "gls" (GNU ls) is installed (this one supports colors); - # otherwise, leave ls as is, because NetBSD's ls doesn't support -G - gls --color -d . &>/dev/null 2>&1 && alias ls='gls --color=tty' + if [[ "$(uname -s)" == "NetBSD" ]]; then + # On NetBSD, test if "gls" (GNU ls) is installed (this one supports colors); + # otherwise, leave ls as is, because NetBSD's ls doesn't support -G + gls --color -d . &>/dev/null 2>&1 && alias ls='gls --color=tty' else - ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty' || alias ls='ls -G' + ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty' || alias ls='ls -G' fi fi From 692dca07158413ae27b2064c303240f5b9621cff Mon Sep 17 00:00:00 2001 From: Stephen Zhuang Date: Sun, 6 Jan 2013 14:08:12 +0800 Subject: [PATCH 037/142] Add new plugin to autocomplete fabric commands --- plugins/fabric/fabric.plugin.zsh | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 plugins/fabric/fabric.plugin.zsh diff --git a/plugins/fabric/fabric.plugin.zsh b/plugins/fabric/fabric.plugin.zsh new file mode 100644 index 000000000..d44e2d916 --- /dev/null +++ b/plugins/fabric/fabric.plugin.zsh @@ -0,0 +1,8 @@ +#compdef fab + +_fab_list() { + reply=(`fab --shortlist`) +} +compctl -K _fab_list fab + +# DECLARION: This plugin was created by kennethreitz. What I did is just making a portal from https://github.com/kennethreitz-archive/fabric-zsh-completion. From 22da0a00b8a05652c08ba6744962c572746462ae Mon Sep 17 00:00:00 2001 From: goofansu Date: Tue, 8 Jan 2013 13:34:33 +0800 Subject: [PATCH 038/142] Add rebar to plugin --- plugins/rebar/_rebar | 79 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 plugins/rebar/_rebar diff --git a/plugins/rebar/_rebar b/plugins/rebar/_rebar new file mode 100644 index 000000000..7ac5a510c --- /dev/null +++ b/plugins/rebar/_rebar @@ -0,0 +1,79 @@ +#compdef rebar + +local curcontext=$curcontext state ret=1 +typeset -ga _rebar_global_opts + +_rebar_global_opts=( + '(--help -h)'{--help,-h}'[Show the program options]' + '(--commands -c)'{--commands,-c}'[Show available commands]' + '(--version -V)'{--version,-V}'[Show version information]' + '(-vvv -vv -v)'--verbose+'[Verbosity level. Default: 0]:verbosity level:(0 1 2 3)' + '(-vvv)-v[Slightly more verbose output]' + '(-vvv)-vv[More verbose output]' + '(-v -vv)-vvv[Most verbose output]' + '(--force -f)'{--force,-f}'[Force]' + '-D+[Define compiler macro]' + '(--jobs -j)'{--jobs+,-j+}'[Number of concurrent workers a command may use. Default: 3]:workers:(1 2 3 4 5 6 7 8 9)' + '(--config -C)'{--config,-C}'[Rebar config file to use]:files:_files' + '(--profile -p)'{--profile,-p}'[Profile this run of rebar]' + '(--keep-going -k)'{--keep-going,-k}'[Keep running after a command fails]' +) + +_rebar () { + _arguments -C $_rebar_global_opts \ + '*::command and variable:->cmd_and_var' \ + && return + + case $state in + cmd_and_var) + _values -S = 'variables' \ + 'clean[Clean]' \ + 'compile[Compile sources]' \ + 'create[Create skel based on template and vars]' \ + 'create-app[Create simple app skel]' \ + 'create-node[Create simple node skel]' \ + 'list-template[List avaiavle templates]' \ + 'doc[Generate Erlang program documentation]' \ + 'check-deps[Display to be fetched dependencies]' \ + 'get-deps[Fetch dependencies]' \ + 'update-deps[Update fetched dependencies]' \ + 'delete-deps[Delete fetched dependencies]' \ + 'list-deps[List dependencies]' \ + 'generate[Build release with reltool]' \ + 'overlay[Run reltool overlays only]' \ + 'generate-appups[Generate appup files]' \ + 'generate-upgrade[Build an upgrade package]' \ + 'eunit[Run eunit tests]' \ + 'ct[Run common_test suites]' \ + 'qc[Test QuickCheck properties]' \ + 'xref[Run cross reference analysis]' \ + 'help[Show the program options]' \ + 'version[Show version information]' \ + 'apps[Application names to process]:' \ + 'case[Common Test case]:' \ + 'dump_spec[Dump reltool spec]:' \ + 'jobs[Number of workers]::workers:(0 1 2 3 4 5 6 7 8 9)' \ + 'suites[Common Test suites]::suite name:_path_files -W "(src test)" -g "*.erl(:r)"' \ + 'verbose[Verbosity level]::verbosity level:(0 1 2 3)' \ + 'appid[Application id]:' \ + 'previous_release[Previous release path]:' \ + 'nodeid[Node id]:' \ + 'root_dir[Reltool config root directory]::directory:_files -/' \ + 'skip_deps[Skip deps]::flag:(true false)' \ + 'skip_apps[Application names to not process]::flag:(true false)' \ + 'template[Template name]:' \ + 'template_dir[Template directory]::directory:_files -/' \ + && ret=0 + ;; + esac +} + +_rebar + +# Local variables: +# mode: shell-script +# sh-basic-offset: 2 +# sh-indent-comment: t +# indent-tabs-mode: nil +# End: +# ex: sw=2 ts=2 et filetype=sh From cd9c47430349826d4461d7c9e73f6c58e567f01b Mon Sep 17 00:00:00 2001 From: Stephen Zhuang Date: Thu, 10 Jan 2013 13:56:55 +0800 Subject: [PATCH 039/142] Update to a better fab compeletion script. --- plugins/fabric/_fab | 60 ++++++++++++++++++++++++++++++++ plugins/fabric/fabric.plugin.zsh | 9 +---- 2 files changed, 61 insertions(+), 8 deletions(-) create mode 100644 plugins/fabric/_fab diff --git a/plugins/fabric/_fab b/plugins/fabric/_fab new file mode 100644 index 000000000..9628e1224 --- /dev/null +++ b/plugins/fabric/_fab @@ -0,0 +1,60 @@ +#compdef fab +#autoload + +local curcontext=$curcontext state line +declare -A opt_args + +declare target_list +target_list=(`fab --shortlist 2>/dev/null`) + +_targets() { + _describe -t commands "fabric targets" target_list +} + +output_levels=( + 'status: Status messages, i.e. noting when Fabric is done running, if the user used a keyboard interrupt, or when servers are disconnected from. These messages are almost always relevant and rarely verbose.' + 'aborts: Abort messages. Like status messages, these should really only be turned off when using Fabric as a library, and possibly not even then. Note that even if this output group is turned off, aborts will still occur – there just won’t be any output about why Fabric aborted!' + 'warnings: Warning messages. These are often turned off when one expects a given operation to fail, such as when using grep to test existence of text in a file. If paired with setting env.warn_only to True, this can result in fully silent warnings when remote programs fail. As with aborts, this setting does not control actual warning behavior, only whether warning messages are printed or hidden.' + 'running: Printouts of commands being executed or files transferred, e.g. [myserver] run: ls /var/www. Also controls printing of tasks being run, e.g. [myserver] Executing task ''foo''.' + 'stdout: Local, or remote, stdout, i.e. non-error output from commands.' + 'stderr: Local, or remote, stderr, i.e. error-related output from commands.' + 'user: User-generated output, i.e. local output printed by fabfile code via use of the fastprint or puts functions.' +) + +_arguments -w -S -C \ + '(-)'{-h,--help}'[show this help message and exit]: :->noargs' \ + '(-)'{-V,--version}'[show program''s version number and exit]: :->noargs' \ + '(-)--list[print list of possible commands and exit]: :->noargs' \ + '(-)--shortlist[print non-verbose list of possible commands and exit]: :->noargs' \ + '(--reject-unknown-hosts)--reject-unknown-hosts[reject unknown hosts]' \ + '(--no-pty)--no-pty[do not use pseudo-terminal in run/sudo]' \ + "(-d+ --display=-)"{-d+,--display=-}"[print detailed info about a given command]: :_targets" \ + '(-D --disable-known-hosts)'{-D,--disable-known-hosts}'[do not load user known_hosts file]' \ + '(-r --reject-unknown-hosts)'{-r,--reject-unknown-hosts}'[reject unknown hosts]' \ + '(-u+ --user=-)'{-u+,--user=-}'[username to use when connecting to remote hosts]: :' \ + '(-p+ --password=-)'{-p+,--password=-}'[password for use with authentication and/or sudo]: :' \ + '(-H+ --hosts=-)'{-H+,--hosts=-}'[comma separated list of hosts to operate on]: :' \ + '(-R+ --roles=-)'{-R+,--roles=-}'[comma separated list of roles to operate on]: :' \ + '(-a --no-agent)'{-a,--no-agent}'[don''t use the running SSH agent]' \ + '(-k --no-keys)'{-k,--no-keys}'[don''t load private key files from ~/.ssh/]' \ + '(-w --warn-only)'{-w,--warn-only}'[warn instead of abort, when commands fail]' \ + '-i+[path to SSH private key file. May be repeated]: :_files' \ + "(-f+ --fabfile=)"{-f+,--fabfile=}"[Python module file to import]: :_files -g *.py" \ + '(-c+ --config=-)'{-c+,--config=-}'[specify location of config file to use]: :_files' \ + '(-s+ --shell=-)'{-s+,--shell=-}'[specify a new shell, defaults to ''/bin/bash -l -c'']: :' \ + '(--hide=-)--hide=-[comma-separated list of output levels to hide]: :->levels' \ + '(--show=-)--show=-[comma-separated list of output levels to show]: :->levels' \ + '*::: :->subcmds' && return 0 + +if [[ CURRENT -ge 1 ]]; then + case $state in + noargs) + _message "nothing to complete";; + levels) + _describe -t commands "output levels" output_levels;; + *) + _targets;; + esac + + return +fi diff --git a/plugins/fabric/fabric.plugin.zsh b/plugins/fabric/fabric.plugin.zsh index d44e2d916..aca411329 100644 --- a/plugins/fabric/fabric.plugin.zsh +++ b/plugins/fabric/fabric.plugin.zsh @@ -1,8 +1 @@ -#compdef fab - -_fab_list() { - reply=(`fab --shortlist`) -} -compctl -K _fab_list fab - -# DECLARION: This plugin was created by kennethreitz. What I did is just making a portal from https://github.com/kennethreitz-archive/fabric-zsh-completion. +# DECLARION: This plugin was created by vhbit. What I did is just making a portal from https://github.com/vhbit/fabric-zsh-autocomplete. From 4c91f6d13e32d7389cae299d96f6778451a45fc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Serdar=20Dalg=C4=B1=C3=A7?= Date: Fri, 25 Jan 2013 12:58:55 +0200 Subject: [PATCH 040/142] Add autoenv plugin, which adopts using Kenneth Reitz's autoenv into oh-my-zsh. --- lib/directories.zsh | 3 +++ plugins/autoenv/autoenv.plugin.zsh | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 plugins/autoenv/autoenv.plugin.zsh diff --git a/lib/directories.zsh b/lib/directories.zsh index 6c743e40e..93c6c176f 100644 --- a/lib/directories.zsh +++ b/lib/directories.zsh @@ -29,6 +29,9 @@ cd () { cd ../../../.. elif [[ "x$*" == "x......" ]]; then cd ../../../../.. + elif [ -d ~/.autoenv ]; then + source ~/.autoenv/activate.sh + autoenv_cd "$@" else builtin cd "$@" fi diff --git a/plugins/autoenv/autoenv.plugin.zsh b/plugins/autoenv/autoenv.plugin.zsh new file mode 100644 index 000000000..ca5666979 --- /dev/null +++ b/plugins/autoenv/autoenv.plugin.zsh @@ -0,0 +1,18 @@ +# The use_env call below is a reusable command to activate/create a new Python +# virtualenv, requiring only a single declarative line of code in your .env files. +# It only performs an action if the requested virtualenv is not the current one. +use_env() { + typeset venv + venv="$1" + if [[ "${VIRTUAL_ENV:t}" != "$venv" ]]; then + if workon | grep -q "$venv"; then + workon "$venv" + else + echo -n "Create virtualenv $venv now? (Yn) " + read answer + if [[ "$answer" == "Y" ]]; then + mkvirtualenv "$venv" + fi + fi + fi +} From 2e213b9b8f96722d4978a80ae53849fec437eb10 Mon Sep 17 00:00:00 2001 From: Yoav Weiss Date: Sun, 27 Jan 2013 14:50:33 +0100 Subject: [PATCH 041/142] Faster dirty git status check (using git diff) --- lib/git.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/git.zsh b/lib/git.zsh index 3e14695bd..d818c742d 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -13,7 +13,7 @@ parse_git_dirty() { if [[ $POST_1_7_2_GIT -gt 0 ]]; then SUBMODULE_SYNTAX="--ignore-submodules=dirty" fi - if [[ -n $(git status -s ${SUBMODULE_SYNTAX} 2> /dev/null) ]]; then + if [[ -n $(git diff --ignore-submodules HEAD 2> /dev/null) ]]; then echo "$ZSH_THEME_GIT_PROMPT_DIRTY" else echo "$ZSH_THEME_GIT_PROMPT_CLEAN" From 8a463b6df7048c8507f95344c3dc5d7a1355c48d Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 30 Jan 2013 00:44:42 -0500 Subject: [PATCH 042/142] Better custom theme loading oh-my-zsh.sh now also checks for $ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme when attempting to load a theme. This way custom themes can be a bit more organized in the 'custom' dir --- oh-my-zsh.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 689a79fef..2e1d3b477 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -73,6 +73,9 @@ else if [ -f "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme" ] then source "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme" + elif [ -f "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme" ] + then + source "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme" else source "$ZSH/themes/$ZSH_THEME.zsh-theme" fi From 171a76a3c45ac031262e4eb7eaa38cc020a59812 Mon Sep 17 00:00:00 2001 From: Yoav Weiss Date: Wed, 30 Jan 2013 09:32:01 +0100 Subject: [PATCH 043/142] Closer to original status command, using SUBMODULE SYNTAX --- lib/git.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/git.zsh b/lib/git.zsh index d818c742d..ccc5d3128 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -13,7 +13,7 @@ parse_git_dirty() { if [[ $POST_1_7_2_GIT -gt 0 ]]; then SUBMODULE_SYNTAX="--ignore-submodules=dirty" fi - if [[ -n $(git diff --ignore-submodules HEAD 2> /dev/null) ]]; then + if [[ -n $(git diff ${SUBMODULE_SYNTAX} 2> /dev/null) ]]; then echo "$ZSH_THEME_GIT_PROMPT_DIRTY" else echo "$ZSH_THEME_GIT_PROMPT_CLEAN" From ef8e3a67f293ab3d4dfc67da5af321de7c019ca4 Mon Sep 17 00:00:00 2001 From: Matt Guindin Date: Wed, 30 Jan 2013 20:46:08 -0500 Subject: [PATCH 044/142] [agnoster] modifying theme to show dot for dirty files and plus for staged files in git repos --- themes/agnoster.zsh-theme | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme index c3107c06c..3ca5385be 100644 --- a/themes/agnoster.zsh-theme +++ b/themes/agnoster.zsh-theme @@ -71,7 +71,6 @@ prompt_context() { prompt_git() { local ref dirty if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then - ZSH_THEME_GIT_PROMPT_DIRTY='±' dirty=$(parse_git_dirty) ref=$(git symbolic-ref HEAD 2> /dev/null) || ref="➦ $(git show-ref --head -s --abbrev |head -n1 2> /dev/null)" if [[ -n $dirty ]]; then @@ -79,7 +78,19 @@ prompt_git() { else prompt_segment green black fi - echo -n "${ref/refs\/heads\//⭠ }$dirty" + + setopt promptsubst + autoload -Uz vcs_info + + zstyle ':vcs_info:*' enable git + zstyle ':vcs_info:*' get-revision true + zstyle ':vcs_info:*' check-for-changes true + zstyle ':vcs_info:*' stagedstr '✚' + zstyle ':vcs_info:git:*' unstagedstr '●' + zstyle ':vcs_info:*' formats ' %u%c' + zstyle ':vcs_info:*' actionformats '%u%c' + vcs_info + echo -n "${ref/refs\/heads\//⭠ }${vcs_info_msg_0_}" fi } From fe4c2379c4ce9f4140fd16d2ea77138061e4a109 Mon Sep 17 00:00:00 2001 From: Toon Claes Date: Mon, 4 Feb 2013 22:21:34 +0100 Subject: [PATCH 045/142] use pushdminus --- lib/directories.zsh | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/directories.zsh b/lib/directories.zsh index a787db9eb..4addc08fa 100644 --- a/lib/directories.zsh +++ b/lib/directories.zsh @@ -2,6 +2,7 @@ setopt auto_name_dirs setopt auto_pushd setopt pushd_ignore_dups +setopt pushdminus alias ..='cd ..' alias cd..='cd ..' @@ -11,14 +12,14 @@ alias cd.....='cd ../../../..' alias cd/='cd /' alias 1='cd -' -alias 2='cd +2' -alias 3='cd +3' -alias 4='cd +4' -alias 5='cd +5' -alias 6='cd +6' -alias 7='cd +7' -alias 8='cd +8' -alias 9='cd +9' +alias 2='cd -2' +alias 3='cd -3' +alias 4='cd -4' +alias 5='cd -5' +alias 6='cd -6' +alias 7='cd -7' +alias 8='cd -8' +alias 9='cd -9' cd () { if [[ "x$*" == "x..." ]]; then From 11576dd40bfb78379724a9519081365bbd41d7a9 Mon Sep 17 00:00:00 2001 From: Yoav Weiss Date: Wed, 13 Feb 2013 11:28:13 +0100 Subject: [PATCH 046/142] Fixed dirty check to include files added to index --- lib/git.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/git.zsh b/lib/git.zsh index ccc5d3128..fde30e2b9 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -13,7 +13,7 @@ parse_git_dirty() { if [[ $POST_1_7_2_GIT -gt 0 ]]; then SUBMODULE_SYNTAX="--ignore-submodules=dirty" fi - if [[ -n $(git diff ${SUBMODULE_SYNTAX} 2> /dev/null) ]]; then + if [[ -n $(git diff ${SUBMODULE_SYNTAX} HEAD 2> /dev/null) ]]; then echo "$ZSH_THEME_GIT_PROMPT_DIRTY" else echo "$ZSH_THEME_GIT_PROMPT_CLEAN" From 9245a3086843c20ef1880f6d26720db73d5c724d Mon Sep 17 00:00:00 2001 From: Yoav Weiss Date: Wed, 13 Feb 2013 17:14:43 +0100 Subject: [PATCH 047/142] Did a full circle and went back to # On branch master # Changes to be committed: # (use "git reset HEAD ..." to unstage) # # modified: git.zsh #, ignoring untracked files, which seems to be the primary cause for slowness --- lib/git.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/git.zsh b/lib/git.zsh index fde30e2b9..ccd329665 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -13,7 +13,7 @@ parse_git_dirty() { if [[ $POST_1_7_2_GIT -gt 0 ]]; then SUBMODULE_SYNTAX="--ignore-submodules=dirty" fi - if [[ -n $(git diff ${SUBMODULE_SYNTAX} HEAD 2> /dev/null) ]]; then + if [[ -n $(git status -s ${SUBMODULE_SYNTAX} -uno 2> /dev/null) ]]; then echo "$ZSH_THEME_GIT_PROMPT_DIRTY" else echo "$ZSH_THEME_GIT_PROMPT_CLEAN" From fb3dc24ff4aac55c5cb0cd4e448b26f223a68957 Mon Sep 17 00:00:00 2001 From: Swanand Pagnis Date: Thu, 14 Feb 2013 14:06:42 +0530 Subject: [PATCH 048/142] Support for opening tabs and windows in the same This fixed #1498 for me on Mountain Lion --- lib/termsupport.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index c056989eb..e3828da14 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -8,7 +8,7 @@ function title { fi if [[ "$TERM" == screen* ]]; then print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars - elif [[ "$TERM" == xterm* ]] || [[ $TERM == rxvt* ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then + elif [[ "$TERM" == xterm* ]] || [[ $TERM == rxvt* ]] || [[ $TERM == ansi ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then print -Pn "\e]2;$2:q\a" #set window name print -Pn "\e]1;$1:q\a" #set icon (=tab) name (will override window name on broken terminal) fi From 014ed1f0e5c85a10ab7538160e2d3421ab3dbf7e Mon Sep 17 00:00:00 2001 From: Heiko Reese Date: Thu, 21 Feb 2013 02:46:20 +0100 Subject: [PATCH 049/142] Disable ssh-agent support if another ssh-agent is already running. --- plugins/gpg-agent/gpg-agent.plugin.zsh | 35 +++++++++++++++----------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/plugins/gpg-agent/gpg-agent.plugin.zsh b/plugins/gpg-agent/gpg-agent.plugin.zsh index 8cc71fd57..63c433413 100644 --- a/plugins/gpg-agent/gpg-agent.plugin.zsh +++ b/plugins/gpg-agent/gpg-agent.plugin.zsh @@ -1,26 +1,31 @@ -# Based on ssh-agent code - local GPG_ENV=$HOME/.gnupg/gpg-agent.env -function start_agent { - /usr/bin/env gpg-agent --daemon --enable-ssh-support --write-env-file ${GPG_ENV} > /dev/null - chmod 600 ${GPG_ENV} - . ${GPG_ENV} > /dev/null +function start_agent_nossh { + eval $(/usr/bin/env gpg-agent --daemon --write-env-file ${GPG_ENV}) > /dev/null + export GPG_AGENT_INFO } -# Source GPG agent settings, if applicable +function start_agent_withssh { + eval $(/usr/bin/env gpg-agent --daemon --enable-ssh-support --write-env-file ${GPG_ENV}) > /dev/null + export GPG_AGENT_INFO + export SSH_AUTH_SOCK + export SSH_AGENT_PID +} + +# make sure all created files are u=rw only +umask 177 + +# source settings of old agent, if applicable if [ -f "${GPG_ENV}" ]; then . ${GPG_ENV} > /dev/null - ps -ef | grep ${SSH_AGENT_PID} | grep gpg-agent > /dev/null || { - start_agent; - } -else - start_agent; fi -export GPG_AGENT_INFO -export SSH_AUTH_SOCK -export SSH_AGENT_PID +# check for existing ssh-agent +if ssh-add -l > /dev/null 2> /dev/null; then + start_agent_nossh; +else + start_agent_withssh; +fi GPG_TTY=$(tty) export GPG_TTY From 174e09ca8dec0e2c393718505e9fc0cfc0996e21 Mon Sep 17 00:00:00 2001 From: Heiko Reese Date: Thu, 21 Feb 2013 03:40:32 +0100 Subject: [PATCH 050/142] Added --quiet to suppress message about gpg-agent already running. --- plugins/gpg-agent/gpg-agent.plugin.zsh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/plugins/gpg-agent/gpg-agent.plugin.zsh b/plugins/gpg-agent/gpg-agent.plugin.zsh index 63c433413..109af44c8 100644 --- a/plugins/gpg-agent/gpg-agent.plugin.zsh +++ b/plugins/gpg-agent/gpg-agent.plugin.zsh @@ -1,20 +1,19 @@ local GPG_ENV=$HOME/.gnupg/gpg-agent.env function start_agent_nossh { - eval $(/usr/bin/env gpg-agent --daemon --write-env-file ${GPG_ENV}) > /dev/null + eval $(/usr/bin/env gpg-agent --quiet --daemon --write-env-file ${GPG_ENV} 2> /dev/null) + chmod 600 ${GPG_ENV} export GPG_AGENT_INFO } function start_agent_withssh { - eval $(/usr/bin/env gpg-agent --daemon --enable-ssh-support --write-env-file ${GPG_ENV}) > /dev/null + eval $(/usr/bin/env gpg-agent --quiet --daemon --enable-ssh-support --write-env-file ${GPG_ENV} 2> /dev/null) + chmod 600 ${GPG_ENV} export GPG_AGENT_INFO export SSH_AUTH_SOCK export SSH_AGENT_PID } -# make sure all created files are u=rw only -umask 177 - # source settings of old agent, if applicable if [ -f "${GPG_ENV}" ]; then . ${GPG_ENV} > /dev/null From 8c74d80fd6cdc7e1b48e7eb321a3e3a22674c3be Mon Sep 17 00:00:00 2001 From: hacfi Date: Fri, 22 Feb 2013 17:07:15 +0100 Subject: [PATCH 051/142] Fix Symfony2 command completion 'permission denied' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit app/console by default (if you create a new Symfony project via composer create-project or by downloading it from symfony.com) is not executable. Therefore I get the following error: sf2 _symfony2_get_command_list:1: permission denied: app/console _symfony2_get_command_list:1: permission denied: app/console _symfony2_get_command_list:1: permission denied: app/console To make command completion work without changing app/console you just have to let php run it. --- plugins/symfony2/symfony2.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/symfony2/symfony2.plugin.zsh b/plugins/symfony2/symfony2.plugin.zsh index cc9ffebc0..f425c14f7 100644 --- a/plugins/symfony2/symfony2.plugin.zsh +++ b/plugins/symfony2/symfony2.plugin.zsh @@ -1,7 +1,7 @@ # Symfony2 basic command completion _symfony2_get_command_list () { - app/console --no-ansi | sed "1,/Available commands/d" | awk '/^ [a-z]+/ { print $1 }' + php app/console --no-ansi | sed "1,/Available commands/d" | awk '/^ [a-z]+/ { print $1 }' } _symfony2 () { From b979400cff17248147d95f6271edb6f2d6e36c84 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Tue, 26 Feb 2013 14:05:22 -0500 Subject: [PATCH 052/142] Starting tmux plugin with basic config variables. --- plugins/tmux/tmux.plugin.zsh | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 plugins/tmux/tmux.plugin.zsh diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh new file mode 100644 index 000000000..cc676cb92 --- /dev/null +++ b/plugins/tmux/tmux.plugin.zsh @@ -0,0 +1,12 @@ +# Configuration variables +# Automatically start tmux +[[ -n "$ZSH_TMUX_AUTOSTART" ]] || ZSH_TMUX_AUTOSTART = false +# Automatically connect to a previous session if it exists +[[ -n "$ZSH_TMUX_AUTOCONNECT" ]] || ZSH_TMUX_AUTOCONNECT = true +# Automatically close the terminal when tmux exits +[[ -n "$ZSH_TMUX_AUTOQUIT" ]] || ZSH_TMUX_AUTOQUIT = true +# Set term to screen or screen-256color based on current terminal support +[[ -n "$ZSH_TMUX_FIXTERM" ]] || ZSH_TMUX_AUTOCONNECT = true + +# Get the absolute path to the current directory +local zsh_tmux_plugin_path="$(cd "$(dirname "$0")" && pwd)" From 26ee66f179be08fab59d41a0522ad51610125c6c Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Tue, 26 Feb 2013 17:50:15 -0500 Subject: [PATCH 053/142] Adding main function and alias to tmux plugin. --- plugins/tmux/tmux.plugin.zsh | 37 ++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index cc676cb92..a2f36c0be 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -1,12 +1,41 @@ # Configuration variables # Automatically start tmux -[[ -n "$ZSH_TMUX_AUTOSTART" ]] || ZSH_TMUX_AUTOSTART = false +[[ -n "$ZSH_TMUX_AUTOSTART" ]] || ZSH_TMUX_AUTOSTART=false # Automatically connect to a previous session if it exists -[[ -n "$ZSH_TMUX_AUTOCONNECT" ]] || ZSH_TMUX_AUTOCONNECT = true +[[ -n "$ZSH_TMUX_AUTOCONNECT" ]] || ZSH_TMUX_AUTOCONNECT=true # Automatically close the terminal when tmux exits -[[ -n "$ZSH_TMUX_AUTOQUIT" ]] || ZSH_TMUX_AUTOQUIT = true +[[ -n "$ZSH_TMUX_AUTOQUIT" ]] || ZSH_TMUX_AUTOQUIT=$ZSH_TMUX_AUTOSTART # Set term to screen or screen-256color based on current terminal support -[[ -n "$ZSH_TMUX_FIXTERM" ]] || ZSH_TMUX_AUTOCONNECT = true +[[ -n "$ZSH_TMUX_FIXTERM" ]] || ZSH_TMUX_AUTOCONNECT=true # Get the absolute path to the current directory local zsh_tmux_plugin_path="$(cd "$(dirname "$0")" && pwd)" + +# Local variable to store the local config file to use, if any. +local fixed_config="" + +# Set the correct local config file to use +if [[ "$ZSH_TMUX_FIXTERM" == "true" ]] +then + if [[ -f $HOME/.tmux.conf || -h $HOME/.tmux.conf ]] + then + fixed_config=$zsh_tmux_plugin_path/tmux.extra.conf + else + fixed_config=$zsh_tmux_plugin_path/tmux.only.conf + fi +fi + +# Override tmux with our function +function zsh_tmux_plugin_start() +{ + if [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] + then + \tmux attach || tmux -f $fixed_config new-session + [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit + else + \tmux -f $fixed_config + [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit + fi +} + +alias tmux=zsh_tmux_plugin_start From 3aef6793c2bf0c0afec1fdb97a3a56e7f8d065c6 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Tue, 26 Feb 2013 18:05:58 -0500 Subject: [PATCH 054/142] Now checking for 256 color terminal in tmux plugin. --- plugins/tmux/tmux.plugin.zsh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index a2f36c0be..f67c2b8b5 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -11,6 +11,14 @@ # Get the absolute path to the current directory local zsh_tmux_plugin_path="$(cd "$(dirname "$0")" && pwd)" +# Determine if the terminal supports 256 colors +if [[ `tput colors` == "256" ]] +then + export $ZSH_TMUX_TERM="screen-256" +else + export $ZSH_TMUX_TERM="screen" +fi + # Local variable to store the local config file to use, if any. local fixed_config="" From 778ae57772a02d11c393708c4c0644fbd1ffac35 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Tue, 26 Feb 2013 18:07:25 -0500 Subject: [PATCH 055/142] Tmux plugin now just runs tmux if any extra args are given. --- plugins/tmux/tmux.plugin.zsh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index f67c2b8b5..d8fdd9255 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -36,7 +36,12 @@ fi # Override tmux with our function function zsh_tmux_plugin_start() { - if [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] + # We have other arguments, just run them + if [[ ! -n "$@" ]] + then + \tmux $@ + # Try to connect to an existing session. + elif [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] then \tmux attach || tmux -f $fixed_config new-session [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit From 0cf871d51299a4f837e6dce4d4ae827b0c09f5bd Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Tue, 26 Feb 2013 18:08:37 -0500 Subject: [PATCH 056/142] Adding comments to tmux plugin. --- plugins/tmux/tmux.plugin.zsh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index d8fdd9255..48ffc1c27 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -27,8 +27,10 @@ if [[ "$ZSH_TMUX_FIXTERM" == "true" ]] then if [[ -f $HOME/.tmux.conf || -h $HOME/.tmux.conf ]] then + #use this when they have a ~/.tmux.conf fixed_config=$zsh_tmux_plugin_path/tmux.extra.conf else + #use this when they don't have a ~/.tmux.conf fixed_config=$zsh_tmux_plugin_path/tmux.only.conf fi fi @@ -45,6 +47,7 @@ function zsh_tmux_plugin_start() then \tmux attach || tmux -f $fixed_config new-session [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit + # Just try to fix the TERM variable. else \tmux -f $fixed_config [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit From 45a4db33f81c5dbdcafa25cfe5a75490d55ec185 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Tue, 26 Feb 2013 18:09:01 -0500 Subject: [PATCH 057/142] Enabling autostart of tmux in tmux plugin. --- plugins/tmux/tmux.plugin.zsh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index 48ffc1c27..8dd208399 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -55,3 +55,8 @@ function zsh_tmux_plugin_start() } alias tmux=zsh_tmux_plugin_start + +if [[ "$ZSH_TMUX_AUTOSTART" == "true" ]] +then + zsh_tmux_plugin_start +fi From bf40d4e354ce33c0d9f42cc64372461bff14cde8 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Tue, 26 Feb 2013 18:09:17 -0500 Subject: [PATCH 058/142] Adding helper tmux config files to tmux plugin. --- plugins/tmux/tmux.extra.conf | 2 ++ plugins/tmux/tmux.only.conf | 1 + 2 files changed, 3 insertions(+) create mode 100644 plugins/tmux/tmux.extra.conf create mode 100644 plugins/tmux/tmux.only.conf diff --git a/plugins/tmux/tmux.extra.conf b/plugins/tmux/tmux.extra.conf new file mode 100644 index 000000000..beffd380c --- /dev/null +++ b/plugins/tmux/tmux.extra.conf @@ -0,0 +1,2 @@ +set -g default-terminal $ZSH_TMUX_TERM +source $HOME/.tmux.conf diff --git a/plugins/tmux/tmux.only.conf b/plugins/tmux/tmux.only.conf new file mode 100644 index 000000000..0734df3e1 --- /dev/null +++ b/plugins/tmux/tmux.only.conf @@ -0,0 +1 @@ +set -g default-terminal $ZSH_TMUX_TERM From 7b15627851983e63a5756f0b3633938c44ed7a7d Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Tue, 26 Feb 2013 21:47:11 -0500 Subject: [PATCH 059/142] Fixing typos, logic, and gremlins in tmux plugin. --- plugins/tmux/tmux.plugin.zsh | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index 8dd208399..46c142b77 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -6,7 +6,7 @@ # Automatically close the terminal when tmux exits [[ -n "$ZSH_TMUX_AUTOQUIT" ]] || ZSH_TMUX_AUTOQUIT=$ZSH_TMUX_AUTOSTART # Set term to screen or screen-256color based on current terminal support -[[ -n "$ZSH_TMUX_FIXTERM" ]] || ZSH_TMUX_AUTOCONNECT=true +[[ -n "$ZSH_TMUX_FIXTERM" ]] || ZSH_TMUX_FIXTERM=true # Get the absolute path to the current directory local zsh_tmux_plugin_path="$(cd "$(dirname "$0")" && pwd)" @@ -14,49 +14,50 @@ local zsh_tmux_plugin_path="$(cd "$(dirname "$0")" && pwd)" # Determine if the terminal supports 256 colors if [[ `tput colors` == "256" ]] then - export $ZSH_TMUX_TERM="screen-256" + export ZSH_TMUX_TERM="screen-256color" else - export $ZSH_TMUX_TERM="screen" + export ZSH_TMUX_TERM="screen" fi # Local variable to store the local config file to use, if any. local fixed_config="" -# Set the correct local config file to use +# Set the correct local config file to use. if [[ "$ZSH_TMUX_FIXTERM" == "true" ]] then if [[ -f $HOME/.tmux.conf || -h $HOME/.tmux.conf ]] then #use this when they have a ~/.tmux.conf - fixed_config=$zsh_tmux_plugin_path/tmux.extra.conf + fixed_config="$zsh_tmux_plugin_path/tmux.extra.conf" else #use this when they don't have a ~/.tmux.conf - fixed_config=$zsh_tmux_plugin_path/tmux.only.conf + fixed_config="$zsh_tmux_plugin_path/tmux.only.conf" fi fi -# Override tmux with our function -function zsh_tmux_plugin_start() +# Wrapper function for tmux. +function zsh_tmux_plugin_run() { # We have other arguments, just run them - if [[ ! -n "$@" ]] + if [[ -n "$@" ]] then \tmux $@ # Try to connect to an existing session. elif [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] then - \tmux attach || tmux -f $fixed_config new-session + \tmux attach || \tmux `[[ -n "$fixed_config" ]] && echo '-f ' $fixed_config` new-session [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit - # Just try to fix the TERM variable. + # Just run tmux, fixing the TERM variable if requested. else - \tmux -f $fixed_config + \tmux `[[ -n "$fixed_config" ]] && echo '-f ' $fixed_config` [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit fi } +# Alias tmux to our wrapper function. alias tmux=zsh_tmux_plugin_start if [[ "$ZSH_TMUX_AUTOSTART" == "true" ]] then - zsh_tmux_plugin_start + zsh_tmux_plugin_run fi From 43c50f03e3c547ec51feef7ae3c99f734a66e6a6 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Tue, 26 Feb 2013 21:52:26 -0500 Subject: [PATCH 060/142] Checking environment instead of local variable for fixing term in tmux plugin. --- plugins/tmux/tmux.plugin.zsh | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index 46c142b77..9a52e6376 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -23,16 +23,13 @@ fi local fixed_config="" # Set the correct local config file to use. -if [[ "$ZSH_TMUX_FIXTERM" == "true" ]] +if [[ -f $HOME/.tmux.conf || -h $HOME/.tmux.conf ]] then - if [[ -f $HOME/.tmux.conf || -h $HOME/.tmux.conf ]] - then - #use this when they have a ~/.tmux.conf - fixed_config="$zsh_tmux_plugin_path/tmux.extra.conf" - else - #use this when they don't have a ~/.tmux.conf - fixed_config="$zsh_tmux_plugin_path/tmux.only.conf" - fi + #use this when they have a ~/.tmux.conf + fixed_config="$zsh_tmux_plugin_path/tmux.extra.conf" +else + #use this when they don't have a ~/.tmux.conf + fixed_config="$zsh_tmux_plugin_path/tmux.only.conf" fi # Wrapper function for tmux. @@ -45,11 +42,11 @@ function zsh_tmux_plugin_run() # Try to connect to an existing session. elif [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] then - \tmux attach || \tmux `[[ -n "$fixed_config" ]] && echo '-f ' $fixed_config` new-session + \tmux attach || \tmux `[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && echo '-f '$fixed_config` new-session [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit # Just run tmux, fixing the TERM variable if requested. else - \tmux `[[ -n "$fixed_config" ]] && echo '-f ' $fixed_config` + \tmux `[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && echo '-f '$fixed_config` [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit fi } From f096644c751cb7fe566e82de531435a405d76be8 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Tue, 26 Feb 2013 22:03:22 -0500 Subject: [PATCH 061/142] Checking if already in tmux before autostarting in tmux in tmux plugin. --- plugins/tmux/tmux.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index 9a52e6376..8bdd92133 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -54,7 +54,7 @@ function zsh_tmux_plugin_run() # Alias tmux to our wrapper function. alias tmux=zsh_tmux_plugin_start -if [[ "$ZSH_TMUX_AUTOSTART" == "true" ]] +if [[ ! -n "$TMUX" && "$ZSH_TMUX_AUTOSTART" == "true" ]] then zsh_tmux_plugin_run fi From 691630a89586c86dfafa32974c5c6dbaa1356c07 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Tue, 26 Feb 2013 22:18:36 -0500 Subject: [PATCH 062/142] Adding option to prevent autostarting tmux more than once in the same session. --- plugins/tmux/tmux.plugin.zsh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index 8bdd92133..a7bf93dbd 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -1,6 +1,10 @@ # Configuration variables +# # Automatically start tmux [[ -n "$ZSH_TMUX_AUTOSTART" ]] || ZSH_TMUX_AUTOSTART=false +# Only autostart once. If set to false, tmux will attempt to +# autostart every time your zsh configs are reloaded. +[[ -n "$ZSH_TMUX_AUTOSTART_ONCE" ]] || ZSH_TMUX_AUTOSTART_ONCE=true # Automatically connect to a previous session if it exists [[ -n "$ZSH_TMUX_AUTOCONNECT" ]] || ZSH_TMUX_AUTOCONNECT=true # Automatically close the terminal when tmux exits @@ -8,6 +12,7 @@ # Set term to screen or screen-256color based on current terminal support [[ -n "$ZSH_TMUX_FIXTERM" ]] || ZSH_TMUX_FIXTERM=true + # Get the absolute path to the current directory local zsh_tmux_plugin_path="$(cd "$(dirname "$0")" && pwd)" @@ -54,7 +59,13 @@ function zsh_tmux_plugin_run() # Alias tmux to our wrapper function. alias tmux=zsh_tmux_plugin_start +# Autostart if not already in tmux and enabled. if [[ ! -n "$TMUX" && "$ZSH_TMUX_AUTOSTART" == "true" ]] then - zsh_tmux_plugin_run + # Actually don't autostart if we already did and multiple autostarts are disabled. + if [[ "$ZSH_TMUX_AUTOSTART_ONCE" == "false" || "$ZSH_TMUX_AUTOSTARTED" != "true" ]] + then + export ZSH_TMUX_AUTOSTARTED=true + zsh_tmux_plugin_run + fi fi From 56c46c4ed8339c66c671927c197eb4511b5a664c Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Tue, 26 Feb 2013 22:55:18 -0500 Subject: [PATCH 063/142] Fixing typo in alias. --- plugins/tmux/tmux.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index a7bf93dbd..982f87356 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -57,7 +57,7 @@ function zsh_tmux_plugin_run() } # Alias tmux to our wrapper function. -alias tmux=zsh_tmux_plugin_start +alias tmux=zsh_tmux_plugin_run # Autostart if not already in tmux and enabled. if [[ ! -n "$TMUX" && "$ZSH_TMUX_AUTOSTART" == "true" ]] From 86c9b32031dc28b4c6a641a4475e0e55c7ff32e5 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Tue, 26 Feb 2013 22:57:37 -0500 Subject: [PATCH 064/142] Adding compdef to maintain tmux completions. --- plugins/tmux/tmux.plugin.zsh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index 982f87356..5c4076904 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -56,6 +56,9 @@ function zsh_tmux_plugin_run() fi } +# Use the completions for tmux for our function +compdef _tmux zsh_tmux_plugin_run + # Alias tmux to our wrapper function. alias tmux=zsh_tmux_plugin_run From 4e8681c6e19f77a9b54ceee5934e3356e4ffb207 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Tue, 26 Feb 2013 23:35:45 -0500 Subject: [PATCH 065/142] Adding options to choose tmux TERM for 256 and non-256 color terminals. This may be needed on systems that don't have the proper terminfo for screen and/or screen-256color. Otherwise the defaults of screen and screen-256color should be fine. --- plugins/tmux/tmux.plugin.zsh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index 5c4076904..be92fe096 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -11,6 +11,14 @@ [[ -n "$ZSH_TMUX_AUTOQUIT" ]] || ZSH_TMUX_AUTOQUIT=$ZSH_TMUX_AUTOSTART # Set term to screen or screen-256color based on current terminal support [[ -n "$ZSH_TMUX_FIXTERM" ]] || ZSH_TMUX_FIXTERM=true +# The TERM to use for non-256 color terminals. +# Tmux states this should be screen, but you may need to change it on +# systems without the proper terminfo +[[ -n "$ZSH_TMUX_FIXTERM_WITHOUT_256COLOR" ]] || ZSH_TMUX_FIXTERM_WITHOUT_256COLOR="screen" +# The TERM to use for 256 color terminals. +# Tmux states this should be screen-256color, but you may need to change it on +# systems without the proper terminfo +[[ -n "$ZSH_TMUX_FIXTERM_WITH_256COLOR" ]] || ZSH_TMUX_FIXTERM_WITH_256COLOR="screen-256color" # Get the absolute path to the current directory @@ -19,9 +27,9 @@ local zsh_tmux_plugin_path="$(cd "$(dirname "$0")" && pwd)" # Determine if the terminal supports 256 colors if [[ `tput colors` == "256" ]] then - export ZSH_TMUX_TERM="screen-256color" + export ZSH_TMUX_TERM=$ZSH_TMUX_FIXTERM_WITH_256COLOR else - export ZSH_TMUX_TERM="screen" + export ZSH_TMUX_TERM=$ZSH_TMUX_FIXTERM_WITHOUT_256COLOR fi # Local variable to store the local config file to use, if any. From f0a920df5a4a5e5260ef45daf27d42a15cd75217 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Wed, 27 Feb 2013 10:21:19 -0500 Subject: [PATCH 066/142] Checking to make sure tmux is actually installed before running plugin. If it is not found an error message is printed. --- plugins/tmux/tmux.plugin.zsh | 152 ++++++++++++++++++----------------- 1 file changed, 79 insertions(+), 73 deletions(-) diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index be92fe096..6f0d5902a 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -1,82 +1,88 @@ -# Configuration variables -# -# Automatically start tmux -[[ -n "$ZSH_TMUX_AUTOSTART" ]] || ZSH_TMUX_AUTOSTART=false -# Only autostart once. If set to false, tmux will attempt to -# autostart every time your zsh configs are reloaded. -[[ -n "$ZSH_TMUX_AUTOSTART_ONCE" ]] || ZSH_TMUX_AUTOSTART_ONCE=true -# Automatically connect to a previous session if it exists -[[ -n "$ZSH_TMUX_AUTOCONNECT" ]] || ZSH_TMUX_AUTOCONNECT=true -# Automatically close the terminal when tmux exits -[[ -n "$ZSH_TMUX_AUTOQUIT" ]] || ZSH_TMUX_AUTOQUIT=$ZSH_TMUX_AUTOSTART -# Set term to screen or screen-256color based on current terminal support -[[ -n "$ZSH_TMUX_FIXTERM" ]] || ZSH_TMUX_FIXTERM=true -# The TERM to use for non-256 color terminals. -# Tmux states this should be screen, but you may need to change it on -# systems without the proper terminfo -[[ -n "$ZSH_TMUX_FIXTERM_WITHOUT_256COLOR" ]] || ZSH_TMUX_FIXTERM_WITHOUT_256COLOR="screen" -# The TERM to use for 256 color terminals. -# Tmux states this should be screen-256color, but you may need to change it on -# systems without the proper terminfo -[[ -n "$ZSH_TMUX_FIXTERM_WITH_256COLOR" ]] || ZSH_TMUX_FIXTERM_WITH_256COLOR="screen-256color" - - -# Get the absolute path to the current directory -local zsh_tmux_plugin_path="$(cd "$(dirname "$0")" && pwd)" - -# Determine if the terminal supports 256 colors -if [[ `tput colors` == "256" ]] -then - export ZSH_TMUX_TERM=$ZSH_TMUX_FIXTERM_WITH_256COLOR -else - export ZSH_TMUX_TERM=$ZSH_TMUX_FIXTERM_WITHOUT_256COLOR -fi - -# Local variable to store the local config file to use, if any. -local fixed_config="" - -# Set the correct local config file to use. -if [[ -f $HOME/.tmux.conf || -h $HOME/.tmux.conf ]] -then - #use this when they have a ~/.tmux.conf - fixed_config="$zsh_tmux_plugin_path/tmux.extra.conf" -else - #use this when they don't have a ~/.tmux.conf - fixed_config="$zsh_tmux_plugin_path/tmux.only.conf" -fi - -# Wrapper function for tmux. -function zsh_tmux_plugin_run() -{ - # We have other arguments, just run them - if [[ -n "$@" ]] +# Only run if tmux is actually installed +if which tmux &> /dev/null then - \tmux $@ - # Try to connect to an existing session. - elif [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] + # Configuration variables + # + # Automatically start tmux + [[ -n "$ZSH_TMUX_AUTOSTART" ]] || ZSH_TMUX_AUTOSTART=false + # Only autostart once. If set to false, tmux will attempt to + # autostart every time your zsh configs are reloaded. + [[ -n "$ZSH_TMUX_AUTOSTART_ONCE" ]] || ZSH_TMUX_AUTOSTART_ONCE=true + # Automatically connect to a previous session if it exists + [[ -n "$ZSH_TMUX_AUTOCONNECT" ]] || ZSH_TMUX_AUTOCONNECT=true + # Automatically close the terminal when tmux exits + [[ -n "$ZSH_TMUX_AUTOQUIT" ]] || ZSH_TMUX_AUTOQUIT=$ZSH_TMUX_AUTOSTART + # Set term to screen or screen-256color based on current terminal support + [[ -n "$ZSH_TMUX_FIXTERM" ]] || ZSH_TMUX_FIXTERM=true + # The TERM to use for non-256 color terminals. + # Tmux states this should be screen, but you may need to change it on + # systems without the proper terminfo + [[ -n "$ZSH_TMUX_FIXTERM_WITHOUT_256COLOR" ]] || ZSH_TMUX_FIXTERM_WITHOUT_256COLOR="screen" + # The TERM to use for 256 color terminals. + # Tmux states this should be screen-256color, but you may need to change it on + # systems without the proper terminfo + [[ -n "$ZSH_TMUX_FIXTERM_WITH_256COLOR" ]] || ZSH_TMUX_FIXTERM_WITH_256COLOR="screen-256color" + + + # Get the absolute path to the current directory + local zsh_tmux_plugin_path="$(cd "$(dirname "$0")" && pwd)" + + # Determine if the terminal supports 256 colors + if [[ `tput colors` == "256" ]] then - \tmux attach || \tmux `[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && echo '-f '$fixed_config` new-session - [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit - # Just run tmux, fixing the TERM variable if requested. + export ZSH_TMUX_TERM=$ZSH_TMUX_FIXTERM_WITH_256COLOR else - \tmux `[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && echo '-f '$fixed_config` - [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit + export ZSH_TMUX_TERM=$ZSH_TMUX_FIXTERM_WITHOUT_256COLOR fi -} -# Use the completions for tmux for our function -compdef _tmux zsh_tmux_plugin_run + # Local variable to store the local config file to use, if any. + local fixed_config="" -# Alias tmux to our wrapper function. -alias tmux=zsh_tmux_plugin_run - -# Autostart if not already in tmux and enabled. -if [[ ! -n "$TMUX" && "$ZSH_TMUX_AUTOSTART" == "true" ]] -then - # Actually don't autostart if we already did and multiple autostarts are disabled. - if [[ "$ZSH_TMUX_AUTOSTART_ONCE" == "false" || "$ZSH_TMUX_AUTOSTARTED" != "true" ]] + # Set the correct local config file to use. + if [[ -f $HOME/.tmux.conf || -h $HOME/.tmux.conf ]] then - export ZSH_TMUX_AUTOSTARTED=true - zsh_tmux_plugin_run + #use this when they have a ~/.tmux.conf + fixed_config="$zsh_tmux_plugin_path/tmux.extra.conf" + else + #use this when they don't have a ~/.tmux.conf + fixed_config="$zsh_tmux_plugin_path/tmux.only.conf" fi + + # Wrapper function for tmux. + function zsh_tmux_plugin_run() + { + # We have other arguments, just run them + if [[ -n "$@" ]] + then + \tmux $@ + # Try to connect to an existing session. + elif [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] + then + \tmux attach || \tmux `[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && echo '-f '$fixed_config` new-session + [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit + # Just run tmux, fixing the TERM variable if requested. + else + \tmux `[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && echo '-f '$fixed_config` + [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit + fi + } + + # Use the completions for tmux for our function + compdef _tmux zsh_tmux_plugin_run + + # Alias tmux to our wrapper function. + alias tmux=zsh_tmux_plugin_run + + # Autostart if not already in tmux and enabled. + if [[ ! -n "$TMUX" && "$ZSH_TMUX_AUTOSTART" == "true" ]] + then + # Actually don't autostart if we already did and multiple autostarts are disabled. + if [[ "$ZSH_TMUX_AUTOSTART_ONCE" == "false" || "$ZSH_TMUX_AUTOSTARTED" != "true" ]] + then + export ZSH_TMUX_AUTOSTARTED=true + zsh_tmux_plugin_run + fi + fi +else + print "zsh tmux plugin: tmux not found. Please install tmux before using this plugin." fi From f4b12321a9e4d5e0fa208b48a4515156865a33bb Mon Sep 17 00:00:00 2001 From: Alexey Poimtsev Date: Thu, 28 Feb 2013 00:26:03 +0400 Subject: [PATCH 067/142] Added rails4 plugin --- plugins/rails4/rails4.plugin.zsh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 plugins/rails4/rails4.plugin.zsh diff --git a/plugins/rails4/rails4.plugin.zsh b/plugins/rails4/rails4.plugin.zsh new file mode 100644 index 000000000..b6765365e --- /dev/null +++ b/plugins/rails4/rails4.plugin.zsh @@ -0,0 +1,29 @@ +# Rails 4 aliases + +function _rails_command () { + if [ -e "script/server" ]; then + ruby script/$@ + elif [ -e "script/rails" ]; then + ruby script/rails $@ + else + ruby bin/rails $@ + fi +} + +alias rc='_rails_command console' +alias rd='_rails_command destroy' +alias rdb='_rails_command dbconsole' +alias rdbm='rake db:migrate db:test:clone' +alias rg='_rails_command generate' +alias rgm='_rails_command generate migration' +alias rp='_rails_command plugin' +alias ru='_rails_command runner' +alias rs='_rails_command server' +alias rsd='_rails_command server --debugger' +alias devlog='tail -f log/development.log' +alias rdm='rake db:migrate' +alias rdr='rake db:rollback' +alias rds='rake db:seed' +alias rlc='rake log:clear' +alias rn='rake notes' +alias rr='rake routes' \ No newline at end of file From 4bb7b698cabd33bd53f89688e83cf836e4c3f50c Mon Sep 17 00:00:00 2001 From: Maxime Fabre Date: Thu, 28 Feb 2013 11:50:39 +0100 Subject: [PATCH 068/142] Add alias for "composer dump-autoload" --- plugins/composer/composer.plugin.zsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/composer/composer.plugin.zsh b/plugins/composer/composer.plugin.zsh index c9b762d07..a08c4633f 100644 --- a/plugins/composer/composer.plugin.zsh +++ b/plugins/composer/composer.plugin.zsh @@ -24,6 +24,7 @@ alias csu='composer self-update' alias cu='composer update' alias ci='composer install' alias ccp='composer create-project' +alias cdu='composer dump-autoload' # install composer in the current directory -alias cget='curl -s https://getcomposer.org/installer | php' \ No newline at end of file +alias cget='curl -s https://getcomposer.org/installer | php' From fdd46d8815f9c3a314e13d2dbb57685fd78f4e7c Mon Sep 17 00:00:00 2001 From: Sean Jones Date: Sat, 2 Mar 2013 11:09:57 +0000 Subject: [PATCH 069/142] Updated battery plugin. Displays charging time. linux battery level now refreshes after every command --- plugins/battery/battery.plugin.zsh | 33 ++++++++++++++++++------------ 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/plugins/battery/battery.plugin.zsh b/plugins/battery/battery.plugin.zsh index 95f890632..cc9342c77 100644 --- a/plugins/battery/battery.plugin.zsh +++ b/plugins/battery/battery.plugin.zsh @@ -42,17 +42,27 @@ if [[ $(uname) == "Darwin" ]] ; then fi echo "%{$fg[$color]%}[$(battery_pct_remaining)%%]%{$reset_color%}" else - echo "" + echo "∞" fi } elif [[ $(uname) == "Linux" ]] ; then - if [[ $(acpi 2&>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then - function battery_pct_remaining() { echo "$(acpi | cut -f2 -d ',' | tr -cd '[:digit:]')" } - function battery_time_remaining() { echo $(acpi | cut -f3 -d ',') } - function battery_pct_prompt() { - b=$(battery_pct_remaining) + function battery_pct_remaining() { + if [[ $(acpi 2&>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then + echo "$(acpi | cut -f2 -d ',' | tr -cd '[:digit:]')" + fi + } + + function battery_time_remaining() { + if [[ $(acpi 2&>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then + echo $(acpi | cut -f3 -d ',') + fi + } + + function battery_pct_prompt() { + b=$(battery_pct_remaining) + if [[ $(acpi 2&>/dev/null | grep -c '^Battery.*Discharging') -gt 0 ]] ; then if [ $b -gt 50 ] ; then color='green' elif [ $b -gt 20 ] ; then @@ -61,11 +71,8 @@ elif [[ $(uname) == "Linux" ]] ; then color='red' fi echo "%{$fg[$color]%}[$(battery_pct_remaining)%%]%{$reset_color%}" - } - else - error_msg='no battery' - function battery_pct_remaining() { echo $error_msg } - function battery_time_remaining() { echo $error_msg } - function battery_pct_prompt() { echo '' } - fi + else + echo "∞" + fi + } fi From 9991401aaa88c294c37dc8aaaf955d7d08b04508 Mon Sep 17 00:00:00 2001 From: Deepu Sudhakar Date: Sun, 10 Mar 2013 14:36:39 -0500 Subject: [PATCH 070/142] Escape /Users/desudhak/.oh-my-zsh path (previously broke spaces in path) --- tools/upgrade.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/upgrade.sh b/tools/upgrade.sh index b2a1c06c4..a039d32f0 100644 --- a/tools/upgrade.sh +++ b/tools/upgrade.sh @@ -1,6 +1,6 @@ current_path=`pwd` printf '\033[0;34m%s\033[0m\n' "Upgrading Oh My Zsh" -cd $ZSH +cd "$ZSH" if git pull origin master then @@ -16,4 +16,4 @@ else printf '\033[0;31m%s\033[0m\n' 'There was an error updating. Try again later?' fi -cd "$current_path" \ No newline at end of file +cd "$current_path" From 6dd286bba3fe36278ca6de45567c3842e2db7cc0 Mon Sep 17 00:00:00 2001 From: Vladimir Zakharov Date: Mon, 11 Mar 2013 14:24:12 +0400 Subject: [PATCH 071/142] Mercurial: add aliases for 'incoming' and 'outgoing' commands --- plugins/mercurial/mercurial.plugin.zsh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/mercurial/mercurial.plugin.zsh b/plugins/mercurial/mercurial.plugin.zsh index a3a6ff8b6..820e1aee9 100644 --- a/plugins/mercurial/mercurial.plugin.zsh +++ b/plugins/mercurial/mercurial.plugin.zsh @@ -7,7 +7,9 @@ alias hgco='hg checkout' alias hgd='hg diff' alias hged='hg diffmerge' # pull and update +alias hgi='hg incoming' alias hgl='hg pull -u' +alias hgo='hg outgoing' alias hgp='hg push' alias hgs='hg status' # this is the 'git commit --amend' equivalent @@ -17,4 +19,4 @@ function hg_current_branch() { if [ -d .hg ]; then echo hg:$(hg branch) fi -} \ No newline at end of file +} From 72ec24108a88d79a13cc3581f17b440418048a72 Mon Sep 17 00:00:00 2001 From: bertag Date: Mon, 11 Mar 2013 13:41:32 -0600 Subject: [PATCH 072/142] Tweaked parse_git_dirty() in lib/git.zsh to support proper dirty/clean parsing against both git 1.6 and git 1.7+ --- lib/git.zsh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/git.zsh b/lib/git.zsh index 3e14695bd..172bf4f7a 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -9,16 +9,19 @@ function git_prompt_info() { # Checks if working tree is dirty parse_git_dirty() { local SUBMODULE_SYNTAX='' + local GIT_STATUS='' + local CLEAN_MESSAGE='nothing to commit (working directory clean)' if [[ "$(git config --get oh-my-zsh.hide-status)" != "1" ]]; then if [[ $POST_1_7_2_GIT -gt 0 ]]; then SUBMODULE_SYNTAX="--ignore-submodules=dirty" - fi - if [[ -n $(git status -s ${SUBMODULE_SYNTAX} 2> /dev/null) ]]; then + fi + GIT_STATUS=$(git status -s ${SUBMODULE_SYNTAX} 2> /dev/null | tail -n1) + if [[ -n $GIT_STATUS && "$GIT_STATUS" != "$CLEAN_MESSAGE" ]]; then echo "$ZSH_THEME_GIT_PROMPT_DIRTY" else echo "$ZSH_THEME_GIT_PROMPT_CLEAN" - fi - fi + fi + fi } # get the difference between the local and remote branches From 300f94cb0e1121e7796edbedcbc6d686e755be5b Mon Sep 17 00:00:00 2001 From: Spencer Rinehart Date: Tue, 12 Mar 2013 13:11:18 -0400 Subject: [PATCH 073/142] Use [ -nt ] instead of stat -f%m to check cache files. --- plugins/ant/ant.plugin.zsh | 16 +++------------- plugins/cake/cake.plugin.zsh | 11 ++++------- plugins/gradle/gradle.plugin.zsh | 19 +++---------------- plugins/phing/phing.plugin.zsh | 9 +++------ 4 files changed, 13 insertions(+), 42 deletions(-) diff --git a/plugins/ant/ant.plugin.zsh b/plugins/ant/ant.plugin.zsh index 691d4d2db..45f2b06eb 100644 --- a/plugins/ant/ant.plugin.zsh +++ b/plugins/ant/ant.plugin.zsh @@ -1,17 +1,7 @@ -stat -f%m . > /dev/null 2>&1 -if [ "$?" = 0 ]; then - stat_cmd=(stat -f%m) -else - stat_cmd=(stat -L --format=%Y) -fi - _ant_does_target_list_need_generating () { - if [ ! -f .ant_targets ]; then return 0; - else - accurate=$($stat_cmd .ant_targets) - changed=$($stat_cmd build.xml) - return $(expr $accurate '>=' $changed) - fi + [ ! -f .ant_targets ] && return 0; + [ .ant_targets -nt build.xml ] && return 0; + return 1; } _ant () { diff --git a/plugins/cake/cake.plugin.zsh b/plugins/cake/cake.plugin.zsh index 1d0d196ee..44cc47470 100644 --- a/plugins/cake/cake.plugin.zsh +++ b/plugins/cake/cake.plugin.zsh @@ -14,12 +14,9 @@ _cake_does_target_list_need_generating () { return 1; fi - if [ ! -f ${_cake_task_cache_file} ]; then return 0; - else - accurate=$(stat -f%m $_cake_task_cache_file) - changed=$(stat -f%m Cakefile) - return $(expr $accurate '>=' $changed) - fi + [ ! -f ${_cake_task_cache_file} ] && return 0; + [ ${_cake_task_cache_file} -nt Cakefile ] && return 0; + return 1; } _cake () { @@ -33,4 +30,4 @@ _cake () { fi } -compdef _cake cake \ No newline at end of file +compdef _cake cake diff --git a/plugins/gradle/gradle.plugin.zsh b/plugins/gradle/gradle.plugin.zsh index fc4c78c50..9229512f7 100644 --- a/plugins/gradle/gradle.plugin.zsh +++ b/plugins/gradle/gradle.plugin.zsh @@ -54,27 +54,14 @@ function in_gradle() { fi } -############################################################################ -# Define the stat_cmd command based on platform behavior -########################################################################## -stat -f%m . > /dev/null 2>&1 -if [ "$?" = 0 ]; then - stat_cmd=(stat -f%m) -else - stat_cmd=(stat -L --format=%Y) -fi - ############################################################################## Examine the build.gradle file to see if its # timestamp has changed, and if so, regen # the .gradle_tasks cache file ############################################################################ _gradle_does_task_list_need_generating () { - if [ ! -f .gradletasknamecache ]; then return 0; - else - accurate=$($stat_cmd .gradletasknamecache) - changed=$($stat_cmd build.gradle) - return $(expr $accurate '>=' $changed) - fi + [ ! -f .gradletasknamecache ] && return 0; + [ .gradletasknamecache -nt build.gradle ] && return 0; + return 1; } diff --git a/plugins/phing/phing.plugin.zsh b/plugins/phing/phing.plugin.zsh index 8f4adca08..1abf0a954 100644 --- a/plugins/phing/phing.plugin.zsh +++ b/plugins/phing/phing.plugin.zsh @@ -1,10 +1,7 @@ _phing_does_target_list_need_generating () { - if [ ! -f .phing_targets ]; then return 0; - else - accurate=$(stat -f%m .phing_targets) - changed=$(stat -f%m build.xml) - return $(expr $accurate '>=' $changed) - fi + [ ! -f .phing_targets ] && return 0; + [ .phing_targets -nt build.xml ] && return 0; + return 1; } _phing () { From bdf4f5a347789069dda438e64467344b551fff00 Mon Sep 17 00:00:00 2001 From: Spencer Rinehart Date: Tue, 12 Mar 2013 13:15:05 -0400 Subject: [PATCH 074/142] Allow ":" and "-" characters in phing tasks. Tasks that included hyphens or colons were being excluded from completion. This improves the usage for this. --- plugins/phing/phing.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/phing/phing.plugin.zsh b/plugins/phing/phing.plugin.zsh index 1abf0a954..795f1db85 100644 --- a/plugins/phing/phing.plugin.zsh +++ b/plugins/phing/phing.plugin.zsh @@ -7,7 +7,7 @@ _phing_does_target_list_need_generating () { _phing () { if [ -f build.xml ]; then if _phing_does_target_list_need_generating; then - phing -l |grep -v ":" |grep -v "^$"|grep -v "\-" > .phing_targets + phing -l |grep -v ":$" |grep -v "^-*$" > .phing_targets fi compadd `cat .phing_targets` fi From 4bf174c38b2b8ff9b000accf63155d9756c63a02 Mon Sep 17 00:00:00 2001 From: hacfi Date: Wed, 13 Mar 2013 04:06:16 +0100 Subject: [PATCH 075/142] Autocomplete composer default methods if composer.json is not available MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This plugin currently doesn't autocomplete composer commands if there is no composer.json in the current dir. However, the commands create-project, init, search, selfupdate and show are still useful without a composer.json! --- plugins/composer/composer.plugin.zsh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/composer/composer.plugin.zsh b/plugins/composer/composer.plugin.zsh index c9b762d07..639677ba6 100644 --- a/plugins/composer/composer.plugin.zsh +++ b/plugins/composer/composer.plugin.zsh @@ -13,6 +13,8 @@ _composer_get_command_list () { _composer () { if [ -f composer.json ]; then compadd `_composer_get_command_list` + else + compadd create-project init search selfupdate show fi } @@ -26,4 +28,4 @@ alias ci='composer install' alias ccp='composer create-project' # install composer in the current directory -alias cget='curl -s https://getcomposer.org/installer | php' \ No newline at end of file +alias cget='curl -s https://getcomposer.org/installer | php' From 1cfd813f796e4472575daf4b51cd816bacc833e0 Mon Sep 17 00:00:00 2001 From: rylwin Date: Wed, 13 Mar 2013 22:48:28 -0500 Subject: [PATCH 076/142] last-working-dir: Use >! to overwrite $cache_file Use ">!" to overwrite $cache_file in case noclobber is set. When noclobber is set, zsh will not allow the use of ">" to overwrite the contents of a file. Instead, it displays a "file exists" error. By using ">!" instead, we tell zsh to overwrite the file without complaining. --- plugins/last-working-dir/last-working-dir.plugin.zsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/last-working-dir/last-working-dir.plugin.zsh b/plugins/last-working-dir/last-working-dir.plugin.zsh index 190bc279d..4903616e3 100644 --- a/plugins/last-working-dir/last-working-dir.plugin.zsh +++ b/plugins/last-working-dir/last-working-dir.plugin.zsh @@ -9,7 +9,8 @@ local cache_file="$ZSH/cache/last-working-dir" # Updates the last directory once directory is changed. function chpwd() { - echo "$PWD" > "$cache_file" + # Use >! in case noclobber is set to avoid "file exists" error + echo "$PWD" >! "$cache_file" } # Changes directory to the last working directory. From 4c8bba57acb0f64edde89321d5d6cbc3a5226cac Mon Sep 17 00:00:00 2001 From: Ryan Winograd Date: Wed, 13 Mar 2013 22:51:12 -0500 Subject: [PATCH 077/142] Fix whitespace That's what I get for using GitHub text editor and not checking tabs. --- plugins/last-working-dir/last-working-dir.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/last-working-dir/last-working-dir.plugin.zsh b/plugins/last-working-dir/last-working-dir.plugin.zsh index 4903616e3..ccf0f5b22 100644 --- a/plugins/last-working-dir/last-working-dir.plugin.zsh +++ b/plugins/last-working-dir/last-working-dir.plugin.zsh @@ -9,7 +9,7 @@ local cache_file="$ZSH/cache/last-working-dir" # Updates the last directory once directory is changed. function chpwd() { - # Use >! in case noclobber is set to avoid "file exists" error + # Use >! in case noclobber is set to avoid "file exists" error echo "$PWD" >! "$cache_file" } From f7f487c42666adfe7b94ebed4714ed212ed22cb9 Mon Sep 17 00:00:00 2001 From: Ben Marshall-Corser Date: Sun, 17 Mar 2013 23:00:12 +0000 Subject: [PATCH 078/142] Alias for commit and commit all with amend For the lazy and forgetful. Don't worry, a bang is fine in an alias and completion. :tada: --- plugins/git/git.plugin.zsh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 154aa6db1..15f901f86 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -14,8 +14,12 @@ gdv() { git diff -w "$@" | view - } compdef _git gdv=git-diff alias gc='git commit -v' compdef _git gc=git-commit +alias gc!='git commit -v --amend' +compdef _git gc!=git-commit alias gca='git commit -v -a' -compdef _git gca=git-commit +compdef _git gc=git-commit +alias gca!='git commit -v -a --amend' +compdef _git gca!=git-commit alias gco='git checkout' compdef _git gco=git-checkout alias gcm='git checkout master' From a91872df35d15f0544339ae9c61f87e761c19827 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Tue, 26 Mar 2013 19:41:34 +0000 Subject: [PATCH 079/142] Prefixing tmux wrapper function with '_'. --- plugins/tmux/tmux.plugin.zsh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index 6f0d5902a..ea6b4d26c 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -49,7 +49,7 @@ if which tmux &> /dev/null fi # Wrapper function for tmux. - function zsh_tmux_plugin_run() + function _zsh_tmux_plugin_run() { # We have other arguments, just run them if [[ -n "$@" ]] @@ -68,10 +68,10 @@ if which tmux &> /dev/null } # Use the completions for tmux for our function - compdef _tmux zsh_tmux_plugin_run + compdef _tmux _zsh_tmux_plugin_run # Alias tmux to our wrapper function. - alias tmux=zsh_tmux_plugin_run + alias tmux=_zsh_tmux_plugin_run # Autostart if not already in tmux and enabled. if [[ ! -n "$TMUX" && "$ZSH_TMUX_AUTOSTART" == "true" ]] @@ -80,7 +80,7 @@ if which tmux &> /dev/null if [[ "$ZSH_TMUX_AUTOSTART_ONCE" == "false" || "$ZSH_TMUX_AUTOSTARTED" != "true" ]] then export ZSH_TMUX_AUTOSTARTED=true - zsh_tmux_plugin_run + _zsh_tmux_plugin_run fi fi else From 19ae0b576c4fd0c0c4af1a5c491df867fdce39a4 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Tue, 26 Mar 2013 19:42:05 +0000 Subject: [PATCH 080/142] Exporting path to fixed config as a global variable. This is done to fix compatibility with antigen. To keep with convention, the variable has been renamed to be in all caps. --- plugins/tmux/tmux.plugin.zsh | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index ea6b4d26c..465f5b053 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -35,17 +35,14 @@ if which tmux &> /dev/null export ZSH_TMUX_TERM=$ZSH_TMUX_FIXTERM_WITHOUT_256COLOR fi - # Local variable to store the local config file to use, if any. - local fixed_config="" - # Set the correct local config file to use. if [[ -f $HOME/.tmux.conf || -h $HOME/.tmux.conf ]] then #use this when they have a ~/.tmux.conf - fixed_config="$zsh_tmux_plugin_path/tmux.extra.conf" + export _ZSH_TMUX_FIXED_CONFIG="$zsh_tmux_plugin_path/tmux.extra.conf" else #use this when they don't have a ~/.tmux.conf - fixed_config="$zsh_tmux_plugin_path/tmux.only.conf" + export _ZSH_TMUX_FIXED_CONFIG="$zsh_tmux_plugin_path/tmux.only.conf" fi # Wrapper function for tmux. @@ -58,11 +55,11 @@ if which tmux &> /dev/null # Try to connect to an existing session. elif [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] then - \tmux attach || \tmux `[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && echo '-f '$fixed_config` new-session + \tmux attach || \tmux `[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && echo '-f '$_ZSH_TMUX_FIXED_CONFIG` new-session [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit # Just run tmux, fixing the TERM variable if requested. else - \tmux `[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && echo '-f '$fixed_config` + \tmux `[[ "$ZSH_TMUX_FIXTERM" == "true" ]] && echo '-f '$_ZSH_TMUX_FIXED_CONFIG` [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]] && exit fi } From 295bac03297b3909712cdf68b3cc388d5b6feb5e Mon Sep 17 00:00:00 2001 From: Vladimir Zakharov Date: Wed, 27 Mar 2013 10:16:46 +0400 Subject: [PATCH 081/142] Mercurial: add alias for pull with rebasing --- plugins/mercurial/mercurial.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/mercurial/mercurial.plugin.zsh b/plugins/mercurial/mercurial.plugin.zsh index 820e1aee9..30e4be5b5 100644 --- a/plugins/mercurial/mercurial.plugin.zsh +++ b/plugins/mercurial/mercurial.plugin.zsh @@ -9,6 +9,7 @@ alias hged='hg diffmerge' # pull and update alias hgi='hg incoming' alias hgl='hg pull -u' +alias hglr='hg pull --rebase' alias hgo='hg outgoing' alias hgp='hg push' alias hgs='hg status' From c89afd2f6a7221152648c7c0e32879dfc98cad5b Mon Sep 17 00:00:00 2001 From: "Simeon F. Willbanks" Date: Tue, 11 Dec 2012 11:17:32 -0800 Subject: [PATCH 082/142] Fixes #1485 zeus should not be bundled --- plugins/bundler/bundler.plugin.zsh | 2 +- plugins/zeus/zeus.plugin.zsh | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index 10c221acd..bc21da134 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -6,7 +6,7 @@ alias bu="bundle update" # The following is based on https://github.com/gma/bundler-exec -bundled_commands=(annotate cap capify cucumber foreman guard middleman nanoc rackup rainbows rake rspec ruby shotgun spec spork thin thor unicorn unicorn_rails puma zeus) +bundled_commands=(annotate cap capify cucumber foreman guard middleman nanoc rackup rainbows rake rspec ruby shotgun spec spork thin thor unicorn unicorn_rails puma) ## Functions diff --git a/plugins/zeus/zeus.plugin.zsh b/plugins/zeus/zeus.plugin.zsh index 1658b34d3..eddfb4f94 100644 --- a/plugins/zeus/zeus.plugin.zsh +++ b/plugins/zeus/zeus.plugin.zsh @@ -2,12 +2,6 @@ # Zeus preloads your Rails environment and forks that process whenever # needed. This effectively speeds up Rails' boot process to under 1 sec. -# Always use bundler. -# Rails depends on bundler, so we can be pretty sure, that there are no -# problems with this command. For all the other aliases I provided an -# alternative, in case people have conflicts with other plugins (e.g. suse). -alias zeus='bundle exec zeus' - # Init alias zi='zeus init' alias zinit='zeus init' From fc67399843f26d4f7851fa0b7727183f138bdfa2 Mon Sep 17 00:00:00 2001 From: lesmyrmidons Date: Fri, 29 Mar 2013 13:35:35 +0100 Subject: [PATCH 083/142] Simplification name aliases and adding new alias --- plugins/symfony2/symfony2.plugin.zsh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/symfony2/symfony2.plugin.zsh b/plugins/symfony2/symfony2.plugin.zsh index cc9ffebc0..10406c5c0 100644 --- a/plugins/symfony2/symfony2.plugin.zsh +++ b/plugins/symfony2/symfony2.plugin.zsh @@ -14,6 +14,8 @@ compdef _symfony2 app/console compdef _symfony2 sf #Alias -alias sf2='php app/console' -alias sf2clear='php app/console cache:clear' +alias sfc='php app/console' +alias sfcl='php app/console cache:clear' +alias sfcroute='php app/console router:debug' +alias sfcgb='php app/console generate:bundle' From 55da480da17701531daf6874e17cabf460c9a75a Mon Sep 17 00:00:00 2001 From: lesmyrmidons Date: Fri, 29 Mar 2013 16:39:18 +0100 Subject: [PATCH 084/142] modify alias sfc => sf --- plugins/symfony2/symfony2.plugin.zsh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/symfony2/symfony2.plugin.zsh b/plugins/symfony2/symfony2.plugin.zsh index 10406c5c0..45d6165aa 100644 --- a/plugins/symfony2/symfony2.plugin.zsh +++ b/plugins/symfony2/symfony2.plugin.zsh @@ -14,8 +14,8 @@ compdef _symfony2 app/console compdef _symfony2 sf #Alias -alias sfc='php app/console' +alias sf='php app/console' alias sfcl='php app/console cache:clear' -alias sfcroute='php app/console router:debug' -alias sfcgb='php app/console generate:bundle' +alias sfroute='php app/console router:debug' +alias sfgb='php app/console generate:bundle' From af8d8df36cee517c55449e6aaeaa2f60a94ac9f8 Mon Sep 17 00:00:00 2001 From: KokaKiwi Date: Sat, 30 Mar 2013 16:00:40 +0100 Subject: [PATCH 085/142] Add colored man plugin. --- plugins/colored-man/colored-man.plugin.zsh | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 plugins/colored-man/colored-man.plugin.zsh diff --git a/plugins/colored-man/colored-man.plugin.zsh b/plugins/colored-man/colored-man.plugin.zsh new file mode 100644 index 000000000..56056284a --- /dev/null +++ b/plugins/colored-man/colored-man.plugin.zsh @@ -0,0 +1,11 @@ +man() { + env \ + LESS_TERMCAP_mb=$(printf "\e[1;31m") \ + LESS_TERMCAP_md=$(printf "\e[1;31m") \ + LESS_TERMCAP_me=$(printf "\e[0m") \ + LESS_TERMCAP_se=$(printf "\e[0m") \ + LESS_TERMCAP_so=$(printf "\e[1;44;33m") \ + LESS_TERMCAP_ue=$(printf "\e[0m") \ + LESS_TERMCAP_us=$(printf "\e[1;32m") \ + man "$@" +} From 3ad05df020f4ad672d99a325304a1c962991fd64 Mon Sep 17 00:00:00 2001 From: KokaKiwi Date: Sat, 30 Mar 2013 16:01:31 +0100 Subject: [PATCH 086/142] Add 'kiwi' theme --- themes/kiwi.zsh-theme | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 themes/kiwi.zsh-theme diff --git a/themes/kiwi.zsh-theme b/themes/kiwi.zsh-theme new file mode 100644 index 000000000..f93de2b75 --- /dev/null +++ b/themes/kiwi.zsh-theme @@ -0,0 +1,12 @@ +# +# Kiwi ZSH Theme +# + +PROMPT='%{$fg_bold[green]%}┌[%{$fg_bold[cyan]%}kiwish-4.2%{$fg_bold[green]%}]-(%{$fg_bold[white]%}%2~%{$fg_bold[green]%})-$(git_prompt_info)$(svn_prompt_info)$(battery_pct_prompt) +└> % %{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX="[%{$reset_color%}%{$fg[white]%}git:%{$fg_bold[white]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$fg_bold[green]%}]-" + +ZSH_THEME_SVN_PROMPT_PREFIX="[%{$reset_color%}%{$fg[white]%}svn:%{$fg_bold[white]%}/" +ZSH_THEME_SVN_PROMPT_SUFFIX="%{$fg_bold[green]%}]-" From 8d6b7573e77abf2fb114579806e6e749bef5eca5 Mon Sep 17 00:00:00 2001 From: Rostislav Raykov Date: Sun, 31 Mar 2013 15:49:51 +0200 Subject: [PATCH 087/142] Powify autocomplete --- plugins/powify/_powify | 55 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 plugins/powify/_powify diff --git a/plugins/powify/_powify b/plugins/powify/_powify new file mode 100644 index 000000000..d23c46513 --- /dev/null +++ b/plugins/powify/_powify @@ -0,0 +1,55 @@ +#compdef powify + +_powify_all_servers() { + all_servers=(`ls $HOME/.pow/`) +} + +local -a all_servers + +local -a _1st_arguments +_1st_arguments=( + 'server:server specific commands' + 'utils:manage powify' + 'create:creates a pow app from the current directory (to change the name append name as an argument)' + 'destroy:destroys the pow app linked to the current directory' + 'restart:restarts the pow app linked to the current directory' + 'always_restart:reload the pow app after each request' + 'always_restart_off:do not reload the pow app after each request' + 'rename:rename the current pow app to [NAME] or renmae [OLD] to [NEW]' + 'environment:run the this pow app in a different environment (aliased `env`)' + 'browse:opens and navigates the default browser to this app' + 'logs:tail the application logs' +) + +_arguments '*:: :->command' + +if (( CURRENT == 1 )); then + _describe -t commands "powify command" _1st_arguments + return +fi + +case "$words[1]" in + server) + _values \ + 'install[install pow server]' \ + 'reinstall[reinstall pow server]' \ + 'update[update pow server]' \ + 'uninstall[uninstall pow server]' \ + 'list[list all pow apps]' \ + 'start[start the pow server]' \ + 'stop[stop the pow server]' \ + 'restart[restart the pow server]' \ + 'host[adds all pow apps to /etc/hosts file]' \ + 'unhost[removes all pow apps from /etc/hosts file]' \ + 'status[print the current server status]' \ + 'config[print the current server configuration]' \ + 'logs[tails the pow server logs]' ;; + utils) + _values \ + 'install[install powify.dev server management tool]' \ + 'reinstall[reinstall powify.dev server management tool]' \ + 'uninstall[uninstall powify.dev server management tool]' ;; + destroy|restart|always_restart|always_restart_off|rename|browse|logs) + _powify_all_servers + _wanted all_servers expl 'all pow servers' compadd -a all_servers ;; +esac From b7608bf32de06a546ae509f872bba44a46e10f0a Mon Sep 17 00:00:00 2001 From: Adam Krebs Date: Mon, 1 Apr 2013 00:26:39 -0400 Subject: [PATCH 088/142] add bower autocompletion --- plugins/bower/_bower | 58 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 plugins/bower/_bower diff --git a/plugins/bower/_bower b/plugins/bower/_bower new file mode 100644 index 000000000..1b582a55e --- /dev/null +++ b/plugins/bower/_bower @@ -0,0 +1,58 @@ + + +# Credits to npm's. Awesome completion utility. +# +# Bower completion script, based on npm completion script. + +###-begin-bower-completion-### +# +# Installation: bower completion >> ~/.bashrc (or ~/.zshrc) +# Or, maybe: bower completion > /usr/local/etc/bash_completion.d/npm +# + +COMP_WORDBREAKS=${COMP_WORDBREAKS/=/} +COMP_WORDBREAKS=${COMP_WORDBREAKS/@/} +export COMP_WORDBREAKS + +if type complete &>/dev/null; then + _bower_completion () { + local si="$IFS" + IFS=$'\n' COMPREPLY=($(COMP_CWORD="$COMP_CWORD" \ + COMP_LINE="$COMP_LINE" \ + COMP_POINT="$COMP_POINT" \ + bower completion -- "${COMP_WORDS[@]}" \ + 2>/dev/null)) || return $? + IFS="$si" + } + complete -F _bower_completion bower +elif type compdef &>/dev/null; then + _bower_completion() { + si=$IFS + compadd -- $(COMP_CWORD=$((CURRENT-1)) \ + COMP_LINE=$BUFFER \ + COMP_POINT=0 \ + bower completion -- "${words[@]}" \ + 2>/dev/null) + IFS=$si + } + compdef _bower_completion bower +elif type compctl &>/dev/null; then + _bower_completion () { + local cword line point words si + read -Ac words + read -cn cword + let cword-=1 + read -l line + read -ln point + si="$IFS" + IFS=$'\n' reply=($(COMP_CWORD="$cword" \ + COMP_LINE="$line" \ + COMP_POINT="$point" \ + bower completion -- "${words[@]}" \ + 2>/dev/null)) || return $? + IFS="$si" + } + compctl -K _bower_completion bower +fi +###-end-bower-completion-### + From f9722174f72f3eb184159e7c77751472cb73384e Mon Sep 17 00:00:00 2001 From: Adam Krebs Date: Mon, 1 Apr 2013 00:30:35 -0400 Subject: [PATCH 089/142] fix some references from npm --> bower. --- plugins/bower/_bower | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) mode change 100644 => 100755 plugins/bower/_bower diff --git a/plugins/bower/_bower b/plugins/bower/_bower old mode 100644 new mode 100755 index 1b582a55e..ae0ca4a4e --- a/plugins/bower/_bower +++ b/plugins/bower/_bower @@ -1,13 +1,13 @@ -# Credits to npm's. Awesome completion utility. +# Credits to npm's awesome completion utility. # # Bower completion script, based on npm completion script. ###-begin-bower-completion-### # # Installation: bower completion >> ~/.bashrc (or ~/.zshrc) -# Or, maybe: bower completion > /usr/local/etc/bash_completion.d/npm +# Or, maybe: bower completion > /usr/local/etc/bash_completion.d/bower # COMP_WORDBREAKS=${COMP_WORDBREAKS/=/} From 5c1c536015ea3e87acc19653faf537c0fb22b7ba Mon Sep 17 00:00:00 2001 From: Ben Hartshorne Date: Mon, 1 Apr 2013 13:34:59 -0700 Subject: [PATCH 090/142] allowing you to override knife paths --- plugins/knife/_knife | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/plugins/knife/_knife b/plugins/knife/_knife index dec491257..ca6347957 100644 --- a/plugins/knife/_knife +++ b/plugins/knife/_knife @@ -170,11 +170,13 @@ _chef_environments_remote() { # The chef_x_local functions use the knife config to find the paths of relevant objects x to be uploaded to the server _chef_cookbooks_local() { - local knife_rb="$HOME/.chef/knife.rb" - if [ -f ./.chef/knife.rb ]; then - knife_rb="./.chef/knife.rb" - fi - (for i in $( grep cookbook_path $knife_rb | awk 'BEGIN {FS = "[" }; {print $2}' | sed 's/\,//g' | sed "s/'//g" | sed 's/\(.*\)]/\1/' ); do ls $i; done) + + local knife_rb=${KNIFE_CONF_PATH:-${HOME}/.chef/knife.rb} + if [ -f ./.chef/knife.rb ]; then + knife_rb="./.chef/knife.rb" + fi + local cookbook_path=${KNIFE_COOKBOOK_PATH:-$(grep cookbook_path $knife_rb | awk 'BEGIN {FS = "[" }; {print $2}' | sed 's/\,//g' | sed "s/'//g" | sed 's/\(.*\)]/\1/' )} + (for i in $cookbook_path; do ls $i; done) } # This function extracts the available cookbook versions on the chef server From 520b0132e943252409457b550b39d8821663da7a Mon Sep 17 00:00:00 2001 From: Ben Hartshorne Date: Mon, 1 Apr 2013 13:44:53 -0700 Subject: [PATCH 091/142] adding docs about knife path config variables --- plugins/knife/_knife | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/knife/_knife b/plugins/knife/_knife index ca6347957..9f5b406af 100644 --- a/plugins/knife/_knife +++ b/plugins/knife/_knife @@ -1,5 +1,10 @@ #compdef knife +# You can override the path to knife.rb and your cookbooks by setting +# KNIFE_CONF_PATH=/path/to/my/.chef/knife.rb +# KNIFE_COOKBOOK_PATH=/path/to/my/chef/cookbooks +# Read around where these are used for more detail. + # These flags should be available everywhere according to man knife knife_general_flags=( --help --server-url --key --config --editor --format --log_level --logfile --no-editor --user --print-after --version --yes ) From 48c0f6c2941941815bcccbed1b329f98b13c43c0 Mon Sep 17 00:00:00 2001 From: Justin Clayton Date: Tue, 2 Apr 2013 18:18:01 -0700 Subject: [PATCH 092/142] Update _vagrant updated to match new vagrant 1.1.x command list --- plugins/vagrant/_vagrant | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/vagrant/_vagrant b/plugins/vagrant/_vagrant index 9bed1e3c6..9af8cb036 100644 --- a/plugins/vagrant/_vagrant +++ b/plugins/vagrant/_vagrant @@ -8,18 +8,19 @@ _1st_arguments=( 'box:Box commands' 'destroy:Destroys the vagrant environment' 'halt:Halts the currently running vagrant environment' - 'help:[TASK] Describe available tasks or one specific task' 'init:[box_name] [box_url] Initializes current folder for Vagrant usage' 'package:Packages a vagrant environment for distribution' + 'plugin:Plugin commands' 'provision:Run the provisioner' 'reload:Reload the vagrant environment' 'resume:Resumes a suspend vagrant environment' 'ssh:SSH into the currently running environment' - 'ssh_config:outputs .ssh/config valid syntax for connecting to this environment via ssh.' + 'ssh-config:outputs .ssh/config valid syntax for connecting to this environment via ssh.' 'status:Shows the status of the current Vagrant environment.' 'suspend:Suspends the currently running vagrant environment' 'up:Creates the vagrant environment' - 'version:Prints the Vagrant version information' + '--help:[TASK] Describe available tasks or one specific task' + '--version:Prints the Vagrant version information' ) local -a _box_arguments From 8e368c1222a9ccd9203c6f19eba9db61bf4c27f8 Mon Sep 17 00:00:00 2001 From: Tima Maslyuchenko Date: Wed, 3 Apr 2013 16:43:22 +0300 Subject: [PATCH 093/142] added hub autocomplete instructions --- plugins/github/github.plugin.zsh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/plugins/github/github.plugin.zsh b/plugins/github/github.plugin.zsh index 598b059c1..66a10cfdb 100644 --- a/plugins/github/github.plugin.zsh +++ b/plugins/github/github.plugin.zsh @@ -1,5 +1,22 @@ # Setup hub function for git, if it is available; http://github.com/defunkt/hub if [ "$commands[(I)hub]" ] && [ "$commands[(I)ruby]" ]; then + # Autoload _git completion functions + if declare -f _git > /dev/null; then + _git + fi + + if declare -f _git_commands > /dev/null; then + _hub_commands=( + 'alias:show shell instructions for wrapping git' + 'pull-request:open a pull request on GitHub' + 'fork:fork origin repo on GitHub' + 'create:create new repo on GitHub for the current project' + 'browse:browse the project on GitHub' + 'compare:open GitHub compare view' + ) + # Extend the '_git_commands' function with hub commands + eval "$(declare -f _git_commands | sed -e 's/base_commands=(/base_commands=(${_hub_commands} /')" + fi # eval `hub alias -s zsh` function git(){ if ! (( $+_has_working_hub )); then From 889045068465c3aac25b212b80b07f3f1755d937 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Ho=CC=88ltje?= Date: Wed, 3 Apr 2013 20:41:05 -0400 Subject: [PATCH 094/142] This fixes checking for git untracked items The grep expression was incorrect for normal grep. Adding the `-E` option fixed the escaping of the question marks. --- lib/git.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/git.zsh b/lib/git.zsh index 67075248e..98c00bd8a 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -62,7 +62,7 @@ function git_prompt_long_sha() { git_prompt_status() { INDEX=$(git status --porcelain -b 2> /dev/null) STATUS="" - if $(echo "$INDEX" | grep '^\?\? ' &> /dev/null); then + if $(echo "$INDEX" | grep -E '^\?\? ' &> /dev/null); then STATUS="$ZSH_THEME_GIT_PROMPT_UNTRACKED$STATUS" fi if $(echo "$INDEX" | grep '^A ' &> /dev/null); then From 0707bfce5386eb7ad83e6ad8d0b09358916eeb64 Mon Sep 17 00:00:00 2001 From: Sergio Rafael Gianazza Date: Thu, 4 Apr 2013 16:18:48 -0300 Subject: [PATCH 095/142] New theme: Gianu Theme I created a theme that I feel confortable with and want to share with everyone. The prompt format is: @ ()$ --- themes/gianu.zsh-theme | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 themes/gianu.zsh-theme diff --git a/themes/gianu.zsh-theme b/themes/gianu.zsh-theme new file mode 100644 index 000000000..2eb4520ce --- /dev/null +++ b/themes/gianu.zsh-theme @@ -0,0 +1,11 @@ +# Oh-my-Zsh prompt created by gianu +# +# github.com/gianu +# sgianazza@gmail.com + +PROMPT='[%{$fg_bold[white]%}%n%{$reset_color%}@%{$fg_bold[red]%}%m%{$reset_color%} %{$fg[cyan]%}%c%{$reset_color%} %{$fg_bold[green]%}$(git_prompt_info)%{$reset_color%}]$ ' + +ZSH_THEME_GIT_PROMPT_PREFIX="(" +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]%}" From c8423eb6d7149b9e73a94f4bf0c754771e27530a Mon Sep 17 00:00:00 2001 From: Sergio Rafael Gianazza Date: Thu, 4 Apr 2013 18:11:37 -0300 Subject: [PATCH 096/142] Removed colors from parenthesis. --- themes/gianu.zsh-theme | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/themes/gianu.zsh-theme b/themes/gianu.zsh-theme index 2eb4520ce..c7fe40665 100644 --- a/themes/gianu.zsh-theme +++ b/themes/gianu.zsh-theme @@ -3,9 +3,9 @@ # github.com/gianu # sgianazza@gmail.com -PROMPT='[%{$fg_bold[white]%}%n%{$reset_color%}@%{$fg_bold[red]%}%m%{$reset_color%} %{$fg[cyan]%}%c%{$reset_color%} %{$fg_bold[green]%}$(git_prompt_info)%{$reset_color%}]$ ' +PROMPT='[%{$fg_bold[white]%}%n%{$reset_color%}@%{$fg_bold[red]%}%m%{$reset_color%} %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)%{$reset_color%}]$ ' -ZSH_THEME_GIT_PROMPT_PREFIX="(" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%})" +ZSH_THEME_GIT_PROMPT_PREFIX="(%{$fg_bold[green]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX=")" ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%} %{$fg[yellow]%}✗%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$reset_color%}" From d55262b6a1ac614b35603885f0759015dc9f59dd Mon Sep 17 00:00:00 2001 From: Henry Yan Date: Sun, 7 Apr 2013 20:58:55 +0800 Subject: [PATCH 097/142] Added $PATH to PATH in install shell --- tools/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/install.sh b/tools/install.sh index 41f83e354..a2bd5665a 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -21,7 +21,7 @@ echo "\033[0;34mUsing the Oh My Zsh template file and adding it to ~/.zshrc\033[ cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc echo "\033[0;34mCopying your current PATH and adding it to the end of ~/.zshrc for you.\033[0m" -echo "export PATH=$PATH" >> ~/.zshrc +echo "export PATH=\$PATH:$PATH" >> ~/.zshrc echo "\033[0;34mTime to change your default shell to zsh!\033[0m" chsh -s `which zsh` From 6271941a919858a05e9abec120db90ca0c131153 Mon Sep 17 00:00:00 2001 From: dsx Date: Sun, 7 Apr 2013 09:12:30 -0400 Subject: [PATCH 098/142] Prevents echo of _sublime_darwin_paths contents --- plugins/sublime/sublime.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/sublime/sublime.plugin.zsh b/plugins/sublime/sublime.plugin.zsh index bfbc45a07..7a5ada337 100755 --- a/plugins/sublime/sublime.plugin.zsh +++ b/plugins/sublime/sublime.plugin.zsh @@ -1,6 +1,6 @@ # Sublime Text 2 Aliases -local _sublime_darwin_paths +local _sublime_darwin_paths > /dev/null 2>&1 _sublime_darwin_paths=( "$HOME/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" "$HOME/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" From fc785de97b7ed1438b4d0e46d29079fb97a55338 Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Sun, 7 Apr 2013 17:18:39 -0700 Subject: [PATCH 099/142] +safe-paste plugin --- plugins/safe-paste/safe-paste.plugin.zsh | 54 ++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 plugins/safe-paste/safe-paste.plugin.zsh diff --git a/plugins/safe-paste/safe-paste.plugin.zsh b/plugins/safe-paste/safe-paste.plugin.zsh new file mode 100644 index 000000000..0aa97965f --- /dev/null +++ b/plugins/safe-paste/safe-paste.plugin.zsh @@ -0,0 +1,54 @@ +# Code from Mikael Magnusson: http://www.zsh.org/mla/users/2011/msg00367.html +# +# Requires xterm, urxvt, iTerm2 or any other terminal that supports bracketed +# paste mode as documented: http://www.xfree86.org/current/ctlseqs.html + +# create a new keymap to use while pasting +bindkey -N paste +# make everything in this keymap call our custom widget +bindkey -R -M paste "^@"-"\M-^?" paste-insert +# these are the codes sent around the pasted text in bracketed +# paste mode. +# do the first one with both -M viins and -M vicmd in vi mode +bindkey '^[[200~' _start_paste +bindkey -M paste '^[[201~' _end_paste +# insert newlines rather than carriage returns when pasting newlines +bindkey -M paste -s '^M' '^J' + +zle -N _start_paste +zle -N _end_paste +zle -N zle-line-init _zle_line_init +zle -N zle-line-finish _zle_line_finish +zle -N paste-insert _paste_insert + +# switch the active keymap to paste mode +function _start_paste() { + bindkey -A paste main +} + +# go back to our normal keymap, and insert all the pasted text in the +# command line. this has the nice effect of making the whole paste be +# a single undo/redo event. +function _end_paste() { +#use bindkey -v here with vi mode probably. maybe you want to track +#if you were in ins or cmd mode and restore the right one. + bindkey -e + LBUFFER+=$_paste_content + unset _paste_content +} + +function _paste_insert() { + _paste_content+=$KEYS +} + +function _zle_line_init() { + # Tell terminal to send escape codes around pastes. + [[ $TERM == rxvt-unicode || $TERM == xterm || $TERM = xterm-256color ]] && printf '\e[?2004h' +} + +function _zle_line_finish() { + # Tell it to stop when we leave zle, so pasting in other programs + # doesn't get the ^[[200~ codes around the pasted text. + [[ $TERM == rxvt-unicode || $TERM == xterm || $TERM = xterm-256color ]] && printf '\e[?2004l' +} + From b2421cc73fe4c531c5d8a699124a3ef62bb327bd Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Sun, 7 Apr 2013 19:26:40 -0700 Subject: [PATCH 100/142] 005d967dc4e879f304607a706ccd18886e630dc1 --- oh-my-zsh.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 689a79fef..5b8e63e73 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -1,7 +1,7 @@ # Check for updates on initial load... if [ "$DISABLE_AUTO_UPDATE" != "true" ] then - /usr/bin/env ZSH=$ZSH zsh $ZSH/tools/check_for_upgrade.sh + /usr/bin/env ZSH=$ZSH DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh $ZSH/tools/check_for_upgrade.sh fi # Initializes Oh My Zsh From 9af229539467adf010c1f81c0ac4f03dc9bc9542 Mon Sep 17 00:00:00 2001 From: Alexis Hildebrandt Date: Mon, 8 Apr 2013 09:38:15 +0200 Subject: [PATCH 101/142] Add emoji-clock plugin which displays the current time with half hour accuracy as an emoji symbol, for example in the shell prompt. --- plugins/emoji-clock/emoji-clock.plugin.zsh | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 plugins/emoji-clock/emoji-clock.plugin.zsh diff --git a/plugins/emoji-clock/emoji-clock.plugin.zsh b/plugins/emoji-clock/emoji-clock.plugin.zsh new file mode 100644 index 000000000..7351a02ec --- /dev/null +++ b/plugins/emoji-clock/emoji-clock.plugin.zsh @@ -0,0 +1,29 @@ +# ------------------------------------------------------------------------------ +# FILE: emoji-clock.plugin.zsh +# DESCRIPTION: The current time with half hour accuracy as an emoji symbol. +# Inspired by Andre Torrez' "Put A Burger In Your Shell" +# http://notes.torrez.org/2013/04/put-a-burger-in-your-shell.html +# AUTHOR: Alexis Hildebrandt (afh[at]surryhill.net) +# VERSION: 1.0.0 +# ----------------------------------------------------------------------------- + +function emoji-clock() { + hour=$(date '+%I') + minutes=$(date '+%M') + case $hour in + 01) clock="🕐"; [ $minutes -ge 30 ] && clock="🕜";; + 02) clock="🕑"; [ $minutes -ge 30 ] && clock="🕝";; + 03) clock="🕒"; [ $minutes -ge 30 ] && clock="🕞";; + 04) clock="🕓"; [ $minutes -ge 30 ] && clock="🕟";; + 05) clock="🕔"; [ $minutes -ge 30 ] && clock="🕠";; + 06) clock="🕕"; [ $minutes -ge 30 ] && clock="🕡";; + 07) clock="🕖"; [ $minutes -ge 30 ] && clock="🕢";; + 08) clock="🕗"; [ $minutes -ge 30 ] && clock="🕣";; + 09) clock="🕘"; [ $minutes -ge 30 ] && clock="🕤";; + 10) clock="🕙"; [ $minutes -ge 30 ] && clock="🕥";; + 11) clock="🕚"; [ $minutes -ge 30 ] && clock="🕦";; + 12) clock="🕛"; [ $minutes -ge 30 ] && clock="🕧";; + *) clock="⌛";; + esac + echo $clock +} From 58a6ed1eac57d3faf082070c21bc9770da90a044 Mon Sep 17 00:00:00 2001 From: Bercio Date: Mon, 8 Apr 2013 18:45:45 +0800 Subject: [PATCH 102/142] "$PWD" = "PWD", >! doesn't work, echo is redundant. Fixed all. --- plugins/last-working-dir/last-working-dir.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/last-working-dir/last-working-dir.plugin.zsh b/plugins/last-working-dir/last-working-dir.plugin.zsh index ccf0f5b22..bc36c80db 100644 --- a/plugins/last-working-dir/last-working-dir.plugin.zsh +++ b/plugins/last-working-dir/last-working-dir.plugin.zsh @@ -9,8 +9,8 @@ local cache_file="$ZSH/cache/last-working-dir" # Updates the last directory once directory is changed. function chpwd() { - # Use >! in case noclobber is set to avoid "file exists" error - echo "$PWD" >! "$cache_file" + # Use >| in case noclobber is set to avoid "file exists" error + pwd >| "$cache_file" } # Changes directory to the last working directory. From 6b6208e1416b5eb5aa5a032139d4b61f8939386b Mon Sep 17 00:00:00 2001 From: Bercio Date: Mon, 8 Apr 2013 19:02:48 +0800 Subject: [PATCH 103/142] >! doesn't work with no clobber, echo is redundant. Fixed all. --- plugins/last-working-dir/last-working-dir.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/last-working-dir/last-working-dir.plugin.zsh b/plugins/last-working-dir/last-working-dir.plugin.zsh index ccf0f5b22..bc36c80db 100644 --- a/plugins/last-working-dir/last-working-dir.plugin.zsh +++ b/plugins/last-working-dir/last-working-dir.plugin.zsh @@ -9,8 +9,8 @@ local cache_file="$ZSH/cache/last-working-dir" # Updates the last directory once directory is changed. function chpwd() { - # Use >! in case noclobber is set to avoid "file exists" error - echo "$PWD" >! "$cache_file" + # Use >| in case noclobber is set to avoid "file exists" error + pwd >| "$cache_file" } # Changes directory to the last working directory. From 9c6b88607e8f2898ba3bc83fdf5cce616c6aec83 Mon Sep 17 00:00:00 2001 From: Marko Bauhardt Date: Mon, 8 Apr 2013 22:11:22 +0200 Subject: [PATCH 104/142] a plugin (function) which copies the current directory into the clipboard --- plugins/copydir/copydir.plugin.zsh | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 plugins/copydir/copydir.plugin.zsh diff --git a/plugins/copydir/copydir.plugin.zsh b/plugins/copydir/copydir.plugin.zsh new file mode 100644 index 000000000..37bb5e086 --- /dev/null +++ b/plugins/copydir/copydir.plugin.zsh @@ -0,0 +1,3 @@ +function copydir { + pwd | tr -d "\r\n" | pbcopy +} \ No newline at end of file From 0854b18cdfa6b29b08848a23e79c3f214c5e0f8d Mon Sep 17 00:00:00 2001 From: Marko Bauhardt Date: Mon, 8 Apr 2013 22:32:00 +0200 Subject: [PATCH 105/142] a plugin (function) which copies the content of a file into the clipboard --- plugins/copyfile/copyfile.plugin.zsh | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 plugins/copyfile/copyfile.plugin.zsh diff --git a/plugins/copyfile/copyfile.plugin.zsh b/plugins/copyfile/copyfile.plugin.zsh new file mode 100644 index 000000000..944a903c6 --- /dev/null +++ b/plugins/copyfile/copyfile.plugin.zsh @@ -0,0 +1,5 @@ +function copyfile { + [[ "$#" != 1 ]] && return 1 + local file_to_copy=$1 + cat $file_to_copy | pbcopy +} From 2bae7ef4f9972d4b3accf6bd614e38d9a2410a70 Mon Sep 17 00:00:00 2001 From: Marc Paradise Date: Mon, 8 Apr 2013 17:07:06 -0400 Subject: [PATCH 106/142] initial support for chef 11 integrated knife-essentials * added new commands 'diff' and 'upload' * Add basic file completion for file-centric commands 'diff' and 'upload' --- plugins/knife/_knife | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/plugins/knife/_knife b/plugins/knife/_knife index 9f5b406af..b44283f78 100644 --- a/plugins/knife/_knife +++ b/plugins/knife/_knife @@ -31,7 +31,7 @@ _knife() { case $state in knifecmd) - compadd -Q "$@" bootstrap client configure cookbook "cookbook site" "data bag" exec environment index node recipe role search ssh status windows $cloudproviders + compadd -Q "$@" bootstrap client configure cookbook "cookbook site" "data bag" diff exec environment index node recipe role search ssh status upload windows $cloudproviders ;; knifesubcmd) case $words[2] in @@ -47,9 +47,12 @@ _knife() { cookbook) compadd -Q "$@" test list create download delete "metadata from" show "bulk delete" metadata upload ;; - environment) + diff) + _arguments '*:file or directory:_files -g "*"' + ;; + environment) compadd -Q "$@" list create delete edit show "from file" - ;; + ;; node) compadd -Q "$@" "from file" create show edit delete list run_list "bulk delete" ;; @@ -59,6 +62,9 @@ _knife() { role) compadd -Q "$@" "bulk delete" create delete edit "from file" list show ;; + upload) + _arguments '*:file or directory:_files -g "*"' + ;; windows) compadd "$@" bootstrap ;; From c8db4f81fa4716ff627b63e4f7022d01c4b712d7 Mon Sep 17 00:00:00 2001 From: Vladimir Zakharov Date: Tue, 9 Apr 2013 14:11:51 +0400 Subject: [PATCH 107/142] Add alias for 'hg bookmarks' --- plugins/mercurial/mercurial.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/mercurial/mercurial.plugin.zsh b/plugins/mercurial/mercurial.plugin.zsh index 30e4be5b5..9aa2d167a 100644 --- a/plugins/mercurial/mercurial.plugin.zsh +++ b/plugins/mercurial/mercurial.plugin.zsh @@ -3,6 +3,7 @@ alias hgc='hg commit' alias hgb='hg branch' alias hgba='hg branches' +alias hgbk='hg bookmarks' alias hgco='hg checkout' alias hgd='hg diff' alias hged='hg diffmerge' From 32a42f27b62b62bd915ab632b0b36fa939d22c0e Mon Sep 17 00:00:00 2001 From: Gaurav Misra Date: Tue, 9 Apr 2013 11:45:16 -0700 Subject: [PATCH 108/142] Escape spaces in folder name so script won't fail If the current directory has spaces, the script fails to change paths and fails. --- tools/upgrade.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/upgrade.sh b/tools/upgrade.sh index b2a1c06c4..cd689ba1f 100644 --- a/tools/upgrade.sh +++ b/tools/upgrade.sh @@ -1,4 +1,5 @@ current_path=`pwd` +current_path=${current_path/ /\\ } printf '\033[0;34m%s\033[0m\n' "Upgrading Oh My Zsh" cd $ZSH @@ -16,4 +17,4 @@ else printf '\033[0;31m%s\033[0m\n' 'There was an error updating. Try again later?' fi -cd "$current_path" \ No newline at end of file +cd "$current_path" From 872ef081d30f32fd7b38360bb0264452ebfd96eb Mon Sep 17 00:00:00 2001 From: Brian Galey Date: Tue, 9 Apr 2013 19:52:49 -0700 Subject: [PATCH 109/142] Add collectstatic to django command completions --- plugins/django/django.plugin.zsh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/plugins/django/django.plugin.zsh b/plugins/django/django.plugin.zsh index 0bbd031fe..66e0d1539 100644 --- a/plugins/django/django.plugin.zsh +++ b/plugins/django/django.plugin.zsh @@ -20,6 +20,19 @@ _managepy-createcachetable(){ $nul_args && ret=0 } +_managepy-collectstatic(){ + _arguments -s : \ + '--link=-[Create a symbolic link to each file instead of copying.]:' \ + '--noinput=-[Do NOT prompt the user for input of any kind.]:' \ + '--no-post-process=-[Do NOT post process collected files.]:' \ + '--ignore=-[Ignore files or directories matching this glob-style pattern. Use multiple times to ignore more.]:' \ + '--dry-run=-[Do everything except modify the filesystem.]:' \ + '--clear=-[Clear the existing files using the storage before trying to copy or link the original file.]:' \ + '--link=-[Create a symbolic link to each file instead of copying.]:' \ + '--no-default-ignore=-[Do not ignore the common private glob-style patterns "CVS", ".*" and "*~".]:' \ + $nul_args && ret=0 +} + _managepy-dbshell(){ _arguments -s : \ $nul_args && ret=0 @@ -163,6 +176,7 @@ _managepy-commands() { commands=( 'adminindex:prints the admin-index template snippet for the given app name(s).' 'createcachetable:creates the table needed to use the SQL cache backend.' + 'collectstatic:Collect static files in a single location.' 'dbshell:runs the command-line client for the current DATABASE_ENGINE.' "diffsettings:displays differences between the current settings.py and Django's default settings." 'dumpdata:Output the contents of the database as a fixture of the given format.' From c3b20a65415dacb87f8ea5c94144d8ed12f95341 Mon Sep 17 00:00:00 2001 From: Brian Galey Date: Tue, 9 Apr 2013 19:54:50 -0700 Subject: [PATCH 110/142] Use completions with django-admin.py --- plugins/django/django.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/django/django.plugin.zsh b/plugins/django/django.plugin.zsh index 66e0d1539..9d898edca 100644 --- a/plugins/django/django.plugin.zsh +++ b/plugins/django/django.plugin.zsh @@ -234,4 +234,5 @@ _managepy() { compdef _managepy manage.py compdef _managepy django +compdef _managepy django-admin.py compdef _managepy django-manage From 0c9b4329efd79d33dd2c21bd960d5bd9b7627b7f Mon Sep 17 00:00:00 2001 From: George Miroshnykov Date: Tue, 9 Apr 2013 17:41:48 +0300 Subject: [PATCH 111/142] Support for Sublime Text 3 --- plugins/sublime/sublime.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/sublime/sublime.plugin.zsh b/plugins/sublime/sublime.plugin.zsh index bfbc45a07..804410057 100755 --- a/plugins/sublime/sublime.plugin.zsh +++ b/plugins/sublime/sublime.plugin.zsh @@ -21,6 +21,7 @@ elif [[ $('uname') == 'Darwin' ]]; then for _sublime_path in $_sublime_darwin_paths; do if [[ -a $_sublime_path ]]; then alias st="'$_sublime_path'" + break fi done fi From c50b9a24f1d80cf38f5f299ab02b5c9409faa7c8 Mon Sep 17 00:00:00 2001 From: bertabus Date: Thu, 11 Apr 2013 14:56:22 -0600 Subject: [PATCH 112/142] Added Vundle clean to remove bundles removed from vimrc --- plugins/vundle/vundle.plugin.zsh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/vundle/vundle.plugin.zsh b/plugins/vundle/vundle.plugin.zsh index 005a58476..936c8d7d2 100644 --- a/plugins/vundle/vundle.plugin.zsh +++ b/plugins/vundle/vundle.plugin.zsh @@ -16,8 +16,12 @@ function vundle () { vim -c "execute \"BundleInstall\" | q | q" } - function vundle-update () { vundle-init vim -c "execute \"BundleInstall!\" | q | q" } + +function vundle-clean () { + vundle-init + vim -c "execute \"BundleClean!\" | q | q" +} From 07738ea86330b7b77127fc6f18474b3da2c6ecec Mon Sep 17 00:00:00 2001 From: Oleg Kandaurov Date: Fri, 12 Apr 2013 18:19:42 +0400 Subject: [PATCH 113/142] Add colorize plugin --- plugins/colorize/colorize.plugin.zsh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 plugins/colorize/colorize.plugin.zsh diff --git a/plugins/colorize/colorize.plugin.zsh b/plugins/colorize/colorize.plugin.zsh new file mode 100644 index 000000000..0696607d9 --- /dev/null +++ b/plugins/colorize/colorize.plugin.zsh @@ -0,0 +1,28 @@ +# Plugin for highligthing file content +# Plugin highlights file content based on the filename extension. +# If no highlighting method supported for given extension then it tries +# guess it by looking for file content. + +alias colorize='colorize_via_pygmentize' + +colorize_via_pygmentize() { + if [ ! -x $(which pygmentize) ]; then + echo package \'pygmentize\' is not installed! + exit -1 + fi + + if [ $# -eq 0 ]; then + pygmentize -g $@ + fi + + for FNAME in $@ + do + filename=$(basename "$FNAME") + lexer=`pygmentize -N \"$filename\"` + if [ "Z$lexer" != "Ztext" ]; then + pygmentize -l $lexer "$FNAME" + else + pygmentize -g "$FNAME" + fi + done +} \ No newline at end of file From 2d2aa641678f6cb691b67e40897c3fa185efadf8 Mon Sep 17 00:00:00 2001 From: Danyil Bohdan Date: Fri, 12 Apr 2013 18:19:09 +0300 Subject: [PATCH 114/142] Implemented UTF-8 support in fishy.zsh-theme. --- themes/fishy.zsh-theme | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/themes/fishy.zsh-theme b/themes/fishy.zsh-theme index e9f78a54e..8b24172a2 100644 --- a/themes/fishy.zsh-theme +++ b/themes/fishy.zsh-theme @@ -1,8 +1,13 @@ # ZSH Theme emulating the Fish shell's default prompt. _fishy_collapsed_wd() { - echo $(pwd | perl -pe "s|^$HOME|~|g; s|/([^/])[^/]*(?=/)|/\$1|g") -} + echo $(pwd | perl -pe " + BEGIN { + binmode STDIN, ':encoding(UTF-8)'; + binmode STDOUT, ':encoding(UTF-8)'; + }; s|^$HOME|~|g; s|/([^/])[^/]*(?=/)|/\$1|g +") +} local user_color='green'; [ $UID -eq 0 ] && user_color='red' PROMPT='%n@%m %{$fg[$user_color]%}$(_fishy_collapsed_wd)%{$reset_color%}%(!.#.>) ' From 388ae92d4755dae0f2d205dbb40fb0bbd975c9b3 Mon Sep 17 00:00:00 2001 From: toctan Date: Sun, 14 Apr 2013 13:07:17 +0800 Subject: [PATCH 115/142] command-not-found support for Arch Linux --- plugins/command-not-found/command-not-found.plugin.zsh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/command-not-found/command-not-found.plugin.zsh b/plugins/command-not-found/command-not-found.plugin.zsh index 567da1b45..f3d7ec2df 100644 --- a/plugins/command-not-found/command-not-found.plugin.zsh +++ b/plugins/command-not-found/command-not-found.plugin.zsh @@ -3,3 +3,7 @@ # this is installed in Ubuntu [[ -e /etc/zsh_command_not_found ]] && source /etc/zsh_command_not_found + +# Arch Linux command-not-found support, you must have package pkgfile installed +# https://wiki.archlinux.org/index.php/Pkgfile#.22Command_not_found.22_hook +[[ -e /usr/share/doc/pkgfile/command-not-found.zsh ]] && source /usr/share/doc/pkgfile/command-not-found.zsh From 460cb3d0e0eb79f909a46ae3c1b9d1c19c55e0dd Mon Sep 17 00:00:00 2001 From: MatthR3D Date: Sun, 14 Apr 2013 13:08:03 +0200 Subject: [PATCH 116/142] Edit some yaourt aliases and add some * yaupg now also updates AUR packages * Add yalst alias : it lists the installed packages, even from AUR * Add yaorph alias : it removes orphans using yaourt --- plugins/archlinux/archlinux.plugin.zsh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/archlinux/archlinux.plugin.zsh b/plugins/archlinux/archlinux.plugin.zsh index ae92a0b4c..bffe9657a 100644 --- a/plugins/archlinux/archlinux.plugin.zsh +++ b/plugins/archlinux/archlinux.plugin.zsh @@ -8,7 +8,7 @@ if [[ -x `which yaourt` ]]; then } alias yaconf='yaourt -C' # Fix all configuration files with vimdiff # Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips - alias yaupg='yaourt -Syu' # Synchronize with repositories before upgrading packages that are out of date on the local system. + alias yaupg='yaourt -Syua' # Synchronize with repositories before upgrading packages (AUR packages too) that are out of date on the local system. alias yasu='yaourt --sucre' # Same as yaupg, but without confirmation alias yain='yaourt -S' # Install specific package(s) from the repositories alias yains='yaourt -U' # Install specific package not from the repositories but from a file @@ -18,6 +18,8 @@ if [[ -x `which yaourt` ]]; then alias yareps='yaourt -Ss' # Search for package(s) in the repositories alias yaloc='yaourt -Qi' # Display information about a given package in the local database alias yalocs='yaourt -Qs' # Search for package(s) in the local database + alias yalst='yaourt -Qe' # List installed packages, even those installed from AUR (they're tagged as "local") + alias yaorph='yaourt -Qtd' # Remove orphans using yaourt # Additional yaourt alias examples if [[ -x `which abs` ]]; then alias yaupd='yaourt -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories From ad3f59252beaf1a28e188dfc431a267875ca50b9 Mon Sep 17 00:00:00 2001 From: Michael Nikitochkin Date: Tue, 16 Apr 2013 10:22:28 +0300 Subject: [PATCH 117/142] Added global aliases to use RAILS_ENV. --- plugins/rails/rails.plugin.zsh | 3 +++ plugins/rails3/rails3.plugin.zsh | 3 +++ 2 files changed, 6 insertions(+) diff --git a/plugins/rails/rails.plugin.zsh b/plugins/rails/rails.plugin.zsh index cd232a6ae..76522e18d 100644 --- a/plugins/rails/rails.plugin.zsh +++ b/plugins/rails/rails.plugin.zsh @@ -9,6 +9,9 @@ alias rdbtp='rake db:test:prepare' alias sc='ruby script/console' alias sd='ruby script/server --debugger' alias devlog='tail -f log/development.log' +alias -g RET='RAILS_ENV=test' +alias -g REP='RAILS_ENV=production' +alias -g RED='RAILS_ENV=development' function remote_console() { /usr/bin/env ssh $1 "( cd $2 && ruby script/console production )" diff --git a/plugins/rails3/rails3.plugin.zsh b/plugins/rails3/rails3.plugin.zsh index 237d0594b..a2697872a 100644 --- a/plugins/rails3/rails3.plugin.zsh +++ b/plugins/rails3/rails3.plugin.zsh @@ -21,3 +21,6 @@ alias rsd='_rails_command server --debugger' alias devlog='tail -f log/development.log' alias rdm='rake db:migrate' alias rdr='rake db:rollback' +alias -g RET='RAILS_ENV=test' +alias -g REP='RAILS_ENV=production' +alias -g RED='RAILS_ENV=development' From 5dae44ac5965b36da1dfc20772059561d4973cda Mon Sep 17 00:00:00 2001 From: Roman Kamyk Date: Tue, 16 Apr 2013 10:10:21 -0700 Subject: [PATCH 118/142] Return code instead of dollar sign --- themes/rkj-repos.zsh-theme | 2 +- themes/rkj.zsh-theme | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/rkj-repos.zsh-theme b/themes/rkj-repos.zsh-theme index 318c315bb..46b8e83a0 100644 --- a/themes/rkj-repos.zsh-theme +++ b/themes/rkj-repos.zsh-theme @@ -24,6 +24,6 @@ function mygit() { # alternate prompt with git & hg PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%Y-%m-%d %I:%M:%S"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} -%{\e[0;34m%}%B└─%B[%{\e[1;35m%}$%{\e[0;34m%}%B] <$(mygit)$(hg_prompt_info)>%{\e[0m%}%b ' +%{\e[0;34m%}%B└─%B[%{\e[1;35m%}%?$(retcode)%{\e[0;34m%}%B] <$(mygit)$(hg_prompt_info)>%{\e[0m%}%b ' PS2=$' \e[0;34m%}%B>%{\e[0m%}%b ' diff --git a/themes/rkj.zsh-theme b/themes/rkj.zsh-theme index 81b701e07..80122d5c6 100644 --- a/themes/rkj.zsh-theme +++ b/themes/rkj.zsh-theme @@ -3,6 +3,6 @@ # entry in a nice long thread on the Arch Linux forums: http://bbs.archlinux.org/viewtopic.php?pid=521888#p521888 PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%Y-%m-%d %I:%M:%S"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} -%{\e[0;34m%}%B└─%B[%{\e[1;35m%}$%{\e[0;34m%}%B]%{\e[0m%}%b ' +%{\e[0;34m%}%B└─%B[%{\e[1;35m%}%?$(retcode)%{\e[0;34m%}%B]%{\e[0m%}%b ' From 0b3d5608668880fd1f50f8c6a2099b4a5dd7871a Mon Sep 17 00:00:00 2001 From: Zoltan Debre Date: Wed, 17 Apr 2013 15:07:11 +0200 Subject: [PATCH 119/142] Update rvm.plugin.zsh to the latest ruby versions Ruby version numbers update: 1.8.7-p371 1.9.3-p392 2.0.0-p0 --- plugins/rvm/rvm.plugin.zsh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/rvm/rvm.plugin.zsh b/plugins/rvm/rvm.plugin.zsh index 5000a49b3..cdd0a7847 100644 --- a/plugins/rvm/rvm.plugin.zsh +++ b/plugins/rvm/rvm.plugin.zsh @@ -3,9 +3,9 @@ fpath=($rvm_path/scripts/zsh/Completion $fpath) alias rubies='rvm list rubies' alias gemsets='rvm gemset list' -local ruby18='ruby-1.8.7-p334' -local ruby19='ruby-1.9.3-p385' -local ruby20='ruby-2.0.0-rc2' +local ruby18='ruby-1.8.7-p371' +local ruby19='ruby-1.9.3-p392' +local ruby20='ruby-2.0.0-p0' function rb18 { if [ -z "$1" ]; then From 7db2b20fc4982d0b523d5ac5c59d0351229bbc32 Mon Sep 17 00:00:00 2001 From: Stefan Tatschner Date: Wed, 17 Apr 2013 15:07:53 +0200 Subject: [PATCH 120/142] Added git-flow-avh plugin. git-flow-avh is a fork of gitflow, see: https://github.com/petervanderdoes/gitflow --- plugins/git-flow-avh/git-flow-avh.plugin.zsh | 416 +++++++++++++++++++ 1 file changed, 416 insertions(+) create mode 100644 plugins/git-flow-avh/git-flow-avh.plugin.zsh diff --git a/plugins/git-flow-avh/git-flow-avh.plugin.zsh b/plugins/git-flow-avh/git-flow-avh.plugin.zsh new file mode 100644 index 000000000..d76f55ef6 --- /dev/null +++ b/plugins/git-flow-avh/git-flow-avh.plugin.zsh @@ -0,0 +1,416 @@ +#!zsh +# +# Installation +# ------------ +# +# To achieve git-flow completion nirvana: +# +# 0. Update your zsh's git-completion module to the newest verion. +# From here. http://zsh.git.sourceforge.net/git/gitweb.cgi?p=zsh/zsh;a=blob_plain;f=Completion/Unix/Command/_git;hb=HEAD +# +# 1. Install this file. Either: +# +# a. Place it in your .zshrc: +# +# b. Or, copy it somewhere (e.g. ~/.git-flow-completion.zsh) and put the following line in +# your .zshrc: +# +# source ~/.git-flow-completion.zsh +# +# c. Or, use this file as a oh-my-zsh plugin. +# + +_git-flow () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + + local -a subcommands + subcommands=( + 'init:Initialize a new git repo with support for the branching model.' + 'feature:Manage your feature branches.' + 'config:Manage your configuration.' + 'release:Manage your release branches.' + 'hotfix:Manage your hotfix branches.' + 'support:Manage your support branches.' + 'version:Shows version information.' + ) + _describe -t commands 'git flow' subcommands + ;; + + (options) + case $line[1] in + + (init) + _arguments \ + -f'[Force setting of gitflow branches, even if already configured]' + ;; + + (version) + ;; + + (hotfix) + __git-flow-hotfix + ;; + + (release) + __git-flow-release + ;; + + (feature) + __git-flow-feature + ;; + (config) + __git-flow-config + ;; + + esac + ;; + esac +} + +__git-flow-release () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + + local -a subcommands + subcommands=( + 'start:Start a new release branch.' + 'finish:Finish a release branch.' + 'list:List all your release branches. (Alias to `git flow release`)' + 'publish:Publish release branch to remote.' + 'track:Checkout remote release branch.' + 'delet:Delete a release branch.' + ) + _describe -t commands 'git flow release' subcommands + _arguments \ + -v'[Verbose (more) output]' + ;; + + (options) + case $line[1] in + + (start) + _arguments \ + -F'[Fetch from origin before performing finish]'\ + ':version:__git_flow_version_list' + ;; + + (finish) + _arguments \ + -F'[Fetch from origin before performing finish]' \ + -s'[Sign the release tag cryptographically]'\ + -u'[Use the given GPG-key for the digital signature (implies -s)]'\ + -m'[Use the given tag message]'\ + -p'[Push to $ORIGIN after performing finish]'\ + ':version:__git_flow_version_list' + ;; + + (delete) + _arguments \ + -f'[Force deletion]' \ + -r'[Delete remote branch]' \ + ':version:__git_flow_version_list' + ;; + + (publish) + _arguments \ + ':version:__git_flow_version_list' + ;; + + (track) + _arguments \ + ':version:__git_flow_version_list' + ;; + + *) + _arguments \ + -v'[Verbose (more) output]' + ;; + esac + ;; + esac +} + +__git-flow-hotfix () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + + local -a subcommands + subcommands=( + 'start:Start a new hotfix branch.' + 'finish:Finish a hotfix branch.' + 'delete:Delete a hotfix branch.' + 'list:List all your hotfix branches. (Alias to `git flow hotfix`)' + ) + _describe -t commands 'git flow hotfix' subcommands + _arguments \ + -v'[Verbose (more) output]' + ;; + + (options) + case $line[1] in + + (start) + _arguments \ + -F'[Fetch from origin before performing finish]'\ + ':hotfix:__git_flow_version_list'\ + ':branch-name:__git_branch_names' + ;; + + (finish) + _arguments \ + -F'[Fetch from origin before performing finish]' \ + -s'[Sign the release tag cryptographically]'\ + -u'[Use the given GPG-key for the digital signature (implies -s)]'\ + -m'[Use the given tag message]'\ + -p'[Push to $ORIGIN after performing finish]'\ + ':hotfix:__git_flow_hotfix_list' + ;; + + (delete) + _arguments \ + -f'[Force deletion]' \ + -r'[Delete remote branch]' \ + ':hotfix:__git_flow_hotfix_list' + ;; + + *) + _arguments \ + -v'[Verbose (more) output]' + ;; + esac + ;; + esac +} + +__git-flow-feature () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + + local -a subcommands + subcommands=( + 'start:Start a new feature branch.' + 'finish:Finish a feature branch.' + 'delete:Delete a feature branch.' + 'list:List all your feature branches. (Alias to `git flow feature`)' + 'publish:Publish feature branch to remote.' + 'track:Checkout remote feature branch.' + 'diff:Show all changes.' + 'rebase:Rebase from integration branch.' + 'checkout:Checkout local feature branch.' + 'pull:Pull changes from remote.' + ) + _describe -t commands 'git flow feature' subcommands + _arguments \ + -v'[Verbose (more) output]' + ;; + + (options) + case $line[1] in + + (start) + _arguments \ + -F'[Fetch from origin before performing finish]'\ + ':feature:__git_flow_feature_list'\ + ':branch-name:__git_branch_names' + ;; + + (finish) + _arguments \ + -F'[Fetch from origin before performing finish]' \ + -r'[Rebase instead of merge]'\ + ':feature:__git_flow_feature_list' + ;; + + (delete) + _arguments \ + -f'[Force deletion]' \ + -r'[Delete remote branch]' \ + ':feature:__git_flow_feature_list' + ;; + + (publish) + _arguments \ + ':feature:__git_flow_feature_list'\ + ;; + + (track) + _arguments \ + ':feature:__git_flow_feature_list'\ + ;; + + (diff) + _arguments \ + ':branch:__git_branch_names'\ + ;; + + (rebase) + _arguments \ + -i'[Do an interactive rebase]' \ + ':branch:__git_branch_names' + ;; + + (checkout) + _arguments \ + ':branch:__git_flow_feature_list'\ + ;; + + (pull) + _arguments \ + ':remote:__git_remotes'\ + ':branch:__git_branch_names' + ;; + + *) + _arguments \ + -v'[Verbose (more) output]' + ;; + esac + ;; + esac +} + +__git-flow-config () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + + local -a subcommands + subcommands=( + 'list:List the configuration. (Alias to `git flow config`)' + 'set:Set the configuration option' + ) + _describe -t commands 'git flow config' subcommands + ;; + + (options) + case $line[1] in + + (set) + _arguments \ + --local'[Use repository config file]' \ + --global'[Use global config file]'\ + --system'[Use system config file]'\ + --file'[Use given config file]'\ + ':option:(master develop feature hotfix release support versiontagprefix)' + ;; + + *) + _arguments \ + --local'[Use repository config file]' \ + --global'[Use global config file]'\ + --system'[Use system config file]'\ + --file'[Use given config file]' + ;; + esac + ;; + esac +} +__git_flow_version_list () +{ + local expl + declare -a versions + + versions=(${${(f)"$(_call_program versions git flow release list 2> /dev/null | tr -d ' |*')"}}) + __git_command_successful || return + + _wanted versions expl 'version' compadd $versions +} + +__git_flow_feature_list () +{ + local expl + declare -a features + + features=(${${(f)"$(_call_program features git flow feature list 2> /dev/null | tr -d ' |*')"}}) + __git_command_successful || return + + _wanted features expl 'feature' compadd $features +} + +__git_remotes () { + local expl gitdir remotes + + gitdir=$(_call_program gitdir git rev-parse --git-dir 2>/dev/null) + __git_command_successful || return + + remotes=(${${(f)"$(_call_program remotes git config --get-regexp '"^remote\..*\.url$"')"}//#(#b)remote.(*).url */$match[1]}) + __git_command_successful || return + + # TODO: Should combine the two instead of either or. + if (( $#remotes > 0 )); then + _wanted remotes expl remote compadd $* - $remotes + else + _wanted remotes expl remote _files $* - -W "($gitdir/remotes)" -g "$gitdir/remotes/*" + fi +} + +__git_flow_hotfix_list () +{ + local expl + declare -a hotfixes + + hotfixes=(${${(f)"$(_call_program hotfixes git flow hotfix list 2> /dev/null | tr -d ' |*')"}}) + __git_command_successful || return + + _wanted hotfixes expl 'hotfix' compadd $hotfixes +} + +__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_command_successful () { + if (( ${#pipestatus:#0} > 0 )); then + _message 'not a git repository' + return 1 + fi + return 0 +} + +zstyle ':completion:*:*:git:*' user-commands flow:'provide high-level repository operations' From f2b915c56741c846e845b037e9fdeb7c3f063bc3 Mon Sep 17 00:00:00 2001 From: jaseg Date: Wed, 17 Apr 2013 17:08:36 -0700 Subject: [PATCH 121/142] The safe-paste plugin now works with tmux, too --- plugins/safe-paste/safe-paste.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/safe-paste/safe-paste.plugin.zsh b/plugins/safe-paste/safe-paste.plugin.zsh index 0aa97965f..17c212c19 100644 --- a/plugins/safe-paste/safe-paste.plugin.zsh +++ b/plugins/safe-paste/safe-paste.plugin.zsh @@ -43,12 +43,12 @@ function _paste_insert() { function _zle_line_init() { # Tell terminal to send escape codes around pastes. - [[ $TERM == rxvt-unicode || $TERM == xterm || $TERM = xterm-256color ]] && printf '\e[?2004h' + [[ $TERM == rxvt-unicode || $TERM == xterm || $TERM = xterm-256color || $TERM = screen || $TERM = screen-256color ]] && printf '\e[?2004h' } function _zle_line_finish() { # Tell it to stop when we leave zle, so pasting in other programs # doesn't get the ^[[200~ codes around the pasted text. - [[ $TERM == rxvt-unicode || $TERM == xterm || $TERM = xterm-256color ]] && printf '\e[?2004l' + [[ $TERM == rxvt-unicode || $TERM == xterm || $TERM = xterm-256color || $TERM = screen || $TERM = screen-256color ]] && printf '\e[?2004l' } From 52dc3b99f9963576f50ba87a46953e92591e4d7d Mon Sep 17 00:00:00 2001 From: Chris Borgia Date: Thu, 18 Apr 2013 16:27:02 -0400 Subject: [PATCH 122/142] Edited Grammar in template file --- templates/zshrc.zsh-template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template index 2ea9934af..30399abf3 100644 --- a/templates/zshrc.zsh-template +++ b/templates/zshrc.zsh-template @@ -17,7 +17,7 @@ ZSH_THEME="robbyrussell" # Comment this out to disable bi-weekly auto-update checks # DISABLE_AUTO_UPDATE="true" -# Uncomment to change how many often would you like to wait before auto-updates occur? (in days) +# Uncomment to change how often before auto-updates occur? (in days) # export UPDATE_ZSH_DAYS=13 # Uncomment following line if you want to disable colors in ls From a08f626f1c37043cdf1e2632f283e537396a205b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Garami=20G=C3=A1bor?= Date: Sat, 20 Apr 2013 21:40:15 +0200 Subject: [PATCH 123/142] Adding undocumented clean command to completion Clean command is undocumented (not included in bundle help output), however that is very useful, especially in RVM environment you can clean up outdated gems in gemset. --- plugins/bundler/_bundler | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plugins/bundler/_bundler b/plugins/bundler/_bundler index 5d22cac9a..2ec3a5f9c 100644 --- a/plugins/bundler/_bundler +++ b/plugins/bundler/_bundler @@ -23,6 +23,7 @@ case $state in "viz[Generate a visual representation of your dependencies]" \ "init[Generate a simple Gemfile, placed in the current directory]" \ "gem[Create a simple gem, suitable for development with bundler]" \ + "clean[Cleans up unused gems in your bundler directory]" \ "help[Describe available tasks or one specific task]" ret=0 ;; @@ -62,6 +63,14 @@ case $state in exec) _normal && ret=0 ;; + clean) + _arguments \ + '(--force)--force[forces clean even if --path is not set]' \ + '(--dry-run)--dry-run[only print out changes, do not actually clean gems]' \ + '(--no-color)--no-color[Disable colorization in output]' \ + '(--verbose)--verbose[Enable verbose output mode]' + ret=0 + ;; (open|show) _gems=( $(bundle show 2> /dev/null | sed -e '/^ \*/!d; s/^ \* \([^ ]*\) .*/\1/') ) if [[ $_gems != "" ]]; then From bc385531b0e71b90b800502117bbdc8d1531e4c2 Mon Sep 17 00:00:00 2001 From: Ron Shapiro Date: Sat, 20 Apr 2013 22:37:36 -0400 Subject: [PATCH 124/142] Separate the battery_pct_remaining data into it's own function so that it can be obtained even if the battery is connected. --- plugins/battery/battery.plugin.zsh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/plugins/battery/battery.plugin.zsh b/plugins/battery/battery.plugin.zsh index 95f890632..0c7c9421f 100644 --- a/plugins/battery/battery.plugin.zsh +++ b/plugins/battery/battery.plugin.zsh @@ -10,12 +10,16 @@ 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"\ =\ //') + integer i=$(((currentcapacity/maxcapacity) * 100)) + echo $i + } + function battery_pct_remaining() { if [[ $(ioreg -rc AppleSmartBattery | grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]] ; then - typeset -F maxcapacity=$(ioreg -rc "AppleSmartBattery"| grep '^.*"MaxCapacity"\ =\ ' | sed -e 's/^.*"MaxCapacity"\ =\ //') - typeset -F currentcapacity=$(ioreg -rc "AppleSmartBattery"| grep '^.*"CurrentCapacity"\ =\ ' | sed -e 's/^.*CurrentCapacity"\ =\ //') - integer i=$(((currentcapacity/maxcapacity) * 100)) - echo $i + battery_pct else echo "External Power" fi From d615f6437408d66fa8aad031eb45942bf84fed86 Mon Sep 17 00:00:00 2001 From: Felipe Contreras Date: Sun, 21 Apr 2013 02:10:21 -0500 Subject: [PATCH 125/142] git: fix parse_git_dirty() If oh-my-zsh.hide-status is configured, the 'clean' code won't be generated, and some themes might end up distorted. Let's generate the 'clean' code even when we don't want the show the dirty status. Signed-off-by: Felipe Contreras --- lib/git.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/git.zsh b/lib/git.zsh index 76fe9b142..353c42f3c 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -21,6 +21,8 @@ parse_git_dirty() { else echo "$ZSH_THEME_GIT_PROMPT_CLEAN" fi + else + echo "$ZSH_THEME_GIT_PROMPT_CLEAN" fi } From 72a8c08cc897520ea74ae49e811cd9e34501c520 Mon Sep 17 00:00:00 2001 From: Felipe Contreras Date: Sun, 21 Apr 2013 01:34:44 -0500 Subject: [PATCH 126/142] gitfast: synchronize with upstream Up to version 1.8.2.1. Signed-off-by: Felipe Contreras --- plugins/gitfast/_git | 9 + plugins/gitfast/git-completion.bash | 447 +++++++++++++++++++++++----- plugins/gitfast/git-prompt.sh | 149 ++++++++-- 3 files changed, 503 insertions(+), 102 deletions(-) diff --git a/plugins/gitfast/_git b/plugins/gitfast/_git index 45775021f..cf8116d47 100644 --- a/plugins/gitfast/_git +++ b/plugins/gitfast/_git @@ -60,6 +60,15 @@ __gitcomp_nl () compadd -Q -S "${4- }" -p "${2-}" -- ${=1} && _ret=0 } +__gitcomp_file () +{ + emulate -L zsh + + local IFS=$'\n' + compset -P '*[=:]' + compadd -Q -p "${2-}" -f -- ${=1} && _ret=0 +} + _git () { local _ret=1 diff --git a/plugins/gitfast/git-completion.bash b/plugins/gitfast/git-completion.bash index be800e09b..93eba4675 100644 --- a/plugins/gitfast/git-completion.bash +++ b/plugins/gitfast/git-completion.bash @@ -13,6 +13,7 @@ # *) .git/remotes file names # *) git 'subcommands' # *) tree paths within 'ref:path/to/file' expressions +# *) file paths within current working directory and index # *) common --long-options # # To use these routines: @@ -23,10 +24,6 @@ # 3) Consider changing your PS1 to also show the current branch, # see git-prompt.sh for details. -if [[ -n ${ZSH_VERSION-} ]]; then - autoload -U +X bashcompinit && bashcompinit -fi - case "$COMP_WORDBREAKS" in *:*) : great ;; *) COMP_WORDBREAKS="$COMP_WORDBREAKS:" @@ -169,7 +166,6 @@ __git_reassemble_comp_words_by_ref() } if ! type _get_comp_words_by_ref >/dev/null 2>&1; then -if [[ -z ${ZSH_VERSION:+set} ]]; then _get_comp_words_by_ref () { local exclude cur_ words_ cword_ @@ -197,32 +193,6 @@ _get_comp_words_by_ref () shift done } -else -_get_comp_words_by_ref () -{ - while [ $# -gt 0 ]; do - case "$1" in - cur) - cur=${COMP_WORDS[COMP_CWORD]} - ;; - prev) - prev=${COMP_WORDS[COMP_CWORD-1]} - ;; - words) - words=("${COMP_WORDS[@]}") - ;; - cword) - cword=$COMP_CWORD - ;; - -n) - # assume COMP_WORDBREAKS is already set sanely - shift - ;; - esac - shift - done -} -fi fi # Generates completion reply with compgen, appending a space to possible @@ -264,6 +234,124 @@ __gitcomp_nl () COMPREPLY=($(compgen -P "${2-}" -S "${4- }" -W "$1" -- "${3-$cur}")) } +# Generates completion reply with compgen from newline-separated possible +# completion filenames. +# It accepts 1 to 3 arguments: +# 1: List of possible completion filenames, separated by a single newline. +# 2: A directory prefix to be added to each possible completion filename +# (optional). +# 3: Generate possible completion matches for this word (optional). +__gitcomp_file () +{ + local IFS=$'\n' + + # XXX does not work when the directory prefix contains a tilde, + # since tilde expansion is not applied. + # This means that COMPREPLY will be empty and Bash default + # completion will be used. + COMPREPLY=($(compgen -P "${2-}" -W "$1" -- "${3-$cur}")) + + # Tell Bash that compspec generates filenames. + compopt -o filenames 2>/dev/null +} + +__git_index_file_list_filter_compat () +{ + local path + + while read -r path; do + case "$path" in + ?*/*) echo "${path%%/*}/" ;; + *) echo "$path" ;; + esac + done +} + +__git_index_file_list_filter_bash () +{ + local path + + while read -r path; do + case "$path" in + ?*/*) + # XXX if we append a slash to directory names when using + # `compopt -o filenames`, Bash will append another slash. + # This is pretty stupid, and this the reason why we have to + # define a compatible version for this function. + echo "${path%%/*}" ;; + *) + echo "$path" ;; + esac + done +} + +# Process path list returned by "ls-files" and "diff-index --name-only" +# commands, in order to list only file names relative to a specified +# directory, and append a slash to directory names. +__git_index_file_list_filter () +{ + # Default to Bash >= 4.x + __git_index_file_list_filter_bash +} + +# Execute git ls-files, returning paths relative to the directory +# specified in the first argument, and using the options specified in +# the second argument. +__git_ls_files_helper () +{ + ( + test -n "${CDPATH+set}" && unset CDPATH + # NOTE: $2 is not quoted in order to support multiple options + cd "$1" && git ls-files --exclude-standard $2 + ) 2>/dev/null +} + + +# Execute git diff-index, returning paths relative to the directory +# specified in the first argument, and using the tree object id +# specified in the second argument. +__git_diff_index_helper () +{ + ( + test -n "${CDPATH+set}" && unset CDPATH + cd "$1" && git diff-index --name-only --relative "$2" + ) 2>/dev/null +} + +# __git_index_files accepts 1 or 2 arguments: +# 1: Options to pass to ls-files (required). +# Supported options are --cached, --modified, --deleted, --others, +# and --directory. +# 2: A directory path (optional). +# If provided, only files within the specified directory are listed. +# Sub directories are never recursed. Path must have a trailing +# slash. +__git_index_files () +{ + local dir="$(__gitdir)" root="${2-.}" + + if [ -d "$dir" ]; then + __git_ls_files_helper "$root" "$1" | __git_index_file_list_filter | + sort | uniq + fi +} + +# __git_diff_index_files accepts 1 or 2 arguments: +# 1) The id of a tree object. +# 2) A directory path (optional). +# If provided, only files within the specified directory are listed. +# Sub directories are never recursed. Path must have a trailing +# slash. +__git_diff_index_files () +{ + local dir="$(__gitdir)" root="${2-.}" + + if [ -d "$dir" ]; then + __git_diff_index_helper "$root" "$1" | __git_index_file_list_filter | + sort | uniq + fi +} + __git_heads () { local dir="$(__gitdir)" @@ -321,7 +409,7 @@ __git_refs () if [[ "$ref" == "$cur"* ]]; then echo "$ref" fi - done | uniq -u + done | sort | uniq -u fi return fi @@ -428,7 +516,7 @@ __git_complete_revlist_file () *) pfx="$ref:$pfx" ;; esac - __gitcomp_nl "$(git --git-dir="$(__gitdir)" ls-tree "$ls" \ + __gitcomp_nl "$(git --git-dir="$(__gitdir)" ls-tree "$ls" 2>/dev/null \ | sed '/^100... blob /{ s,^.* ,, s,$, , @@ -461,6 +549,46 @@ __git_complete_revlist_file () } +# __git_complete_index_file requires 1 argument: the options to pass to +# ls-file +__git_complete_index_file () +{ + local pfx cur_="$cur" + + case "$cur_" in + ?*/*) + pfx="${cur_%/*}" + cur_="${cur_##*/}" + pfx="${pfx}/" + + __gitcomp_file "$(__git_index_files "$1" "$pfx")" "$pfx" "$cur_" + ;; + *) + __gitcomp_file "$(__git_index_files "$1")" "" "$cur_" + ;; + esac +} + +# __git_complete_diff_index_file requires 1 argument: the id of a tree +# object +__git_complete_diff_index_file () +{ + local pfx cur_="$cur" + + case "$cur_" in + ?*/*) + pfx="${cur_%/*}" + cur_="${cur_##*/}" + pfx="${pfx}/" + + __gitcomp_file "$(__git_diff_index_files "$1" "$pfx")" "$pfx" "$cur_" + ;; + *) + __gitcomp_file "$(__git_diff_index_files "$1")" "" "$cur_" + ;; + esac +} + __git_complete_file () { __git_complete_revlist_file @@ -562,10 +690,19 @@ __git_complete_strategy () return 1 } +__git_commands () { + if test -n "${GIT_TESTING_COMMAND_COMPLETION:-}" + then + printf "%s" "${GIT_TESTING_COMMAND_COMPLETION}" + else + git help -a|egrep '^ [a-zA-Z0-9]' + fi +} + __git_list_all_commands () { local i IFS=" "$'\n' - for i in $(git help -a|egrep '^ [a-zA-Z0-9]') + for i in $(__git_commands) do case $i in *--*) : helper pattern;; @@ -585,7 +722,7 @@ __git_list_porcelain_commands () { local i IFS=" "$'\n' __git_compute_all_commands - for i in "help" $__git_all_commands + for i in $__git_all_commands do case $i in *--*) : helper pattern;; @@ -594,6 +731,7 @@ __git_list_porcelain_commands () archimport) : import;; cat-file) : plumbing;; check-attr) : plumbing;; + check-ignore) : plumbing;; check-ref-format) : plumbing;; checkout-index) : plumbing;; commit-tree) : plumbing;; @@ -753,6 +891,43 @@ __git_has_doubledash () return 1 } +# Try to count non option arguments passed on the command line for the +# specified git command. +# When options are used, it is necessary to use the special -- option to +# tell the implementation were non option arguments begin. +# XXX this can not be improved, since options can appear everywhere, as +# an example: +# git mv x -n y +# +# __git_count_arguments requires 1 argument: the git command executed. +__git_count_arguments () +{ + local word i c=0 + + # Skip "git" (first argument) + for ((i=1; i < ${#words[@]}; i++)); do + word="${words[i]}" + + case "$word" in + --) + # Good; we can assume that the following are only non + # option arguments. + ((c = 0)) + ;; + "$1") + # Skip the specified git command and discard git + # main options + ((c = 0)) + ;; + ?*) + ((c++)) + ;; + esac + done + + printf "%d" $c +} + __git_whitespacelist="nowarn warn error error-all fix" _git_am () @@ -801,8 +976,6 @@ _git_apply () _git_add () { - __git_has_doubledash && return - case "$cur" in --*) __gitcomp " @@ -811,7 +984,9 @@ _git_add () " return esac - COMPREPLY=() + + # XXX should we check for --update and --all options ? + __git_complete_index_file "--others --modified" } _git_archive () @@ -961,15 +1136,15 @@ _git_cherry_pick () _git_clean () { - __git_has_doubledash && return - case "$cur" in --*) __gitcomp "--dry-run --quiet" return ;; esac - COMPREPLY=() + + # XXX should we check for -x option ? + __git_complete_index_file "--others" } _git_clone () @@ -989,6 +1164,8 @@ _git_clone () --upload-pack --template= --depth + --single-branch + --branch " return ;; @@ -998,7 +1175,19 @@ _git_clone () _git_commit () { - __git_has_doubledash && return + case "$prev" in + -c|-C) + __gitcomp_nl "$(__git_refs)" "" "${cur}" + return + ;; + esac + + case "$prev" in + -c|-C) + __gitcomp_nl "$(__git_refs)" "" "${cur}" + return + ;; + esac case "$cur" in --cleanup=*) @@ -1027,7 +1216,13 @@ _git_commit () " return esac - COMPREPLY=() + + if git rev-parse --verify --quiet HEAD >/dev/null; then + __git_complete_diff_index_file "HEAD" + else + # This is the first commit + __git_complete_index_file "--cached" + fi } _git_describe () @@ -1043,6 +1238,8 @@ _git_describe () __gitcomp_nl "$(__git_refs)" } +__git_diff_algorithms="myers minimal patience histogram" + __git_diff_common_options="--stat --numstat --shortstat --summary --patch-with-stat --name-only --name-status --color --no-color --color-words --no-renames --check @@ -1053,10 +1250,11 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --no-ext-diff --no-prefix --src-prefix= --dst-prefix= --inter-hunk-context= - --patience + --patience --histogram --minimal --raw --dirstat --dirstat= --dirstat-by-file --dirstat-by-file= --cumulative + --diff-algorithm= " _git_diff () @@ -1064,6 +1262,10 @@ _git_diff () __git_has_doubledash && return case "$cur" in + --diff-algorithm=*) + __gitcomp "$__git_diff_algorithms" "" "${cur##--diff-algorithm=}" + return + ;; --*) __gitcomp "--cached --staged --pickaxe-all --pickaxe-regex --base --ours --theirs --no-index @@ -1116,6 +1318,14 @@ _git_fetch () __git_complete_remote_or_refspec } +__git_format_patch_options=" + --stdout --attach --no-attach --thread --thread= --output-directory + --numbered --start-number --numbered-files --keep-subject --signoff + --signature --no-signature --in-reply-to= --cc= --full-index --binary + --not --all --cover-letter --no-prefix --src-prefix= --dst-prefix= + --inline --suffix= --ignore-if-in-upstream --subject-prefix= +" + _git_format_patch () { case "$cur" in @@ -1126,21 +1336,7 @@ _git_format_patch () return ;; --*) - __gitcomp " - --stdout --attach --no-attach --thread --thread= - --output-directory - --numbered --start-number - --numbered-files - --keep-subject - --signoff --signature --no-signature - --in-reply-to= --cc= - --full-index --binary - --not --all - --cover-letter - --no-prefix --src-prefix= --dst-prefix= - --inline --suffix= --ignore-if-in-upstream - --subject-prefix= - " + __gitcomp "$__git_format_patch_options" return ;; esac @@ -1251,8 +1447,6 @@ _git_init () _git_ls_files () { - __git_has_doubledash && return - case "$cur" in --*) __gitcomp "--cached --deleted --modified --others --ignored @@ -1265,7 +1459,10 @@ _git_ls_files () return ;; esac - COMPREPLY=() + + # XXX ignore options like --modified and always suggest all cached + # files. + __git_complete_index_file "--cached" } _git_ls_remote () @@ -1397,7 +1594,14 @@ _git_mv () return ;; esac - COMPREPLY=() + + if [ $(__git_count_arguments "mv") -gt 0 ]; then + # We need to show both cached and untracked files (including + # empty directories) since this may not be the last argument. + __git_complete_index_file "--cached --others --directory" + else + __git_complete_index_file "--cached" + fi } _git_name_rev () @@ -1554,6 +1758,12 @@ _git_send_email () __gitcomp "ssl tls" "" "${cur##--smtp-encryption=}" return ;; + --thread=*) + __gitcomp " + deep shallow + " "" "${cur##--thread=}" + return + ;; --*) __gitcomp "--annotate --bcc --cc --cc-cmd --chain-reply-to --compose --confirm= --dry-run --envelope-sender @@ -1563,11 +1773,12 @@ _git_send_email () --signed-off-by-cc --smtp-pass --smtp-server --smtp-server-port --smtp-encryption= --smtp-user --subject --suppress-cc= --suppress-from --thread --to - --validate --no-validate" + --validate --no-validate + $__git_format_patch_options" return ;; esac - COMPREPLY=() + __git_complete_revlist } _git_stage () @@ -1581,7 +1792,7 @@ __git_config_get_set_variables () while [ $c -gt 1 ]; do word="${words[c]}" case "$word" in - --global|--system|--file=*) + --system|--global|--local|--file=*) config_file="$word" break ;; @@ -1687,7 +1898,7 @@ _git_config () case "$cur" in --*) __gitcomp " - --global --system --file= + --system --global --local --file= --list --replace-all --get --get-all --get-regexp --add --unset --unset-all @@ -1860,6 +2071,7 @@ _git_config () diff.suppressBlankEmpty diff.tool diff.wordRegex + diff.algorithm difftool. difftool.prompt fetch.recurseSubmodules @@ -2096,15 +2308,14 @@ _git_revert () _git_rm () { - __git_has_doubledash && return - case "$cur" in --*) __gitcomp "--cached --dry-run --ignore-unmatch --quiet" return ;; esac - COMPREPLY=() + + __git_complete_index_file "--cached" } _git_shortlog () @@ -2134,6 +2345,10 @@ _git_show () " "" "${cur#*=}" return ;; + --diff-algorithm=*) + __gitcomp "$__git_diff_algorithms" "" "${cur##--diff-algorithm=}" + return + ;; --*) __gitcomp "--pretty= --format= --abbrev-commit --oneline $__git_diff_common_options @@ -2429,20 +2644,88 @@ __gitk_main () __git_complete_revlist } +if [[ -n ${ZSH_VERSION-} ]]; then + echo "WARNING: this script is deprecated, please see git-completion.zsh" 1>&2 + + autoload -U +X compinit && compinit + + __gitcomp () + { + emulate -L zsh + + local cur_="${3-$cur}" + + case "$cur_" in + --*=) + ;; + *) + local c IFS=$' \t\n' + local -a array + for c in ${=1}; do + c="$c${4-}" + case $c in + --*=*|*.) ;; + *) c="$c " ;; + esac + array[$#array+1]="$c" + done + compset -P '*[=:]' + compadd -Q -S '' -p "${2-}" -a -- array && _ret=0 + ;; + esac + } + + __gitcomp_nl () + { + emulate -L zsh + + local IFS=$'\n' + compset -P '*[=:]' + compadd -Q -S "${4- }" -p "${2-}" -- ${=1} && _ret=0 + } + + __gitcomp_file () + { + emulate -L zsh + + local IFS=$'\n' + compset -P '*[=:]' + compadd -Q -p "${2-}" -f -- ${=1} && _ret=0 + } + + __git_zsh_helper () + { + emulate -L ksh + local cur cword prev + cur=${words[CURRENT-1]} + prev=${words[CURRENT-2]} + let cword=CURRENT-1 + __${service}_main + } + + _git () + { + emulate -L zsh + local _ret=1 + __git_zsh_helper + let _ret && _default -S '' && _ret=0 + return _ret + } + + compdef _git git gitk + return +elif [[ -n ${BASH_VERSION-} ]]; then + if ((${BASH_VERSINFO[0]} < 4)); then + # compopt is not supported + __git_index_file_list_filter () + { + __git_index_file_list_filter_compat + } + fi +fi + __git_func_wrap () { - if [[ -n ${ZSH_VERSION-} ]]; then - emulate -L bash - setopt KSH_TYPESET - - # workaround zsh's bug that leaves 'words' as a special - # variable in versions < 4.3.12 - typeset -h words - - # workaround zsh's bug that quotes spaces in the COMPREPLY - # array if IFS doesn't contain spaces. - typeset -h IFS - fi local cur words cword prev _get_comp_words_by_ref -n =: cur words cword prev $1 diff --git a/plugins/gitfast/git-prompt.sh b/plugins/gitfast/git-prompt.sh index afd76e86e..65f8368f1 100644 --- a/plugins/gitfast/git-prompt.sh +++ b/plugins/gitfast/git-prompt.sh @@ -10,9 +10,22 @@ # 1) Copy this file to somewhere (e.g. ~/.git-prompt.sh). # 2) Add the following line to your .bashrc/.zshrc: # source ~/.git-prompt.sh -# 3) Change your PS1 to also show the current branch: -# Bash: PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ ' -# ZSH: PS1='[%n@%m %c$(__git_ps1 " (%s)")]\$ ' +# 3a) Change your PS1 to call __git_ps1 as +# command-substitution: +# Bash: PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ ' +# ZSH: PS1='[%n@%m %c$(__git_ps1 " (%s)")]\$ ' +# the optional argument will be used as format string. +# 3b) Alternatively, if you are using bash, __git_ps1 can be +# used for PROMPT_COMMAND with two parameters,
 and
+#        , which are strings you would put in $PS1 before
+#        and after the status string generated by the git-prompt
+#        machinery.  e.g.
+#           PROMPT_COMMAND='__git_ps1 "\u@\h:\w" "\\\$ "'
+#        will show username, at-sign, host, colon, cwd, then
+#        various status string, followed by dollar and SP, as
+#        your prompt.
+#        Optionally, you can supply a third argument with a printf
+#        format string to finetune the output of the branch status
 #
 # The argument to __git_ps1 will be displayed only if you are currently
 # in a git repository.  The %s token will be the name of the current
@@ -30,7 +43,10 @@
 #
 # If you would like to see if there're untracked files, then you can set
 # GIT_PS1_SHOWUNTRACKEDFILES to a nonempty value. If there're untracked
-# files, then a '%' will be shown next to the branch name.
+# files, then a '%' will be shown next to the branch name.  You can
+# configure this per-repository with the bash.showUntrackedFiles
+# variable, which defaults to true once GIT_PS1_SHOWUNTRACKEDFILES is
+# enabled.
 #
 # If you would like to see the difference between HEAD and its upstream,
 # set GIT_PS1_SHOWUPSTREAM="auto".  A "<" indicates you are behind, ">"
@@ -49,6 +65,19 @@
 # find one, or @{upstream} otherwise.  Once you have set
 # GIT_PS1_SHOWUPSTREAM, you can override it on a per-repository basis by
 # setting the bash.showUpstream config variable.
+#
+# If you would like to see more information about the identity of
+# commits checked out as a detached HEAD, set GIT_PS1_DESCRIBE_STYLE
+# to one of these values:
+#
+#     contains      relative to newer annotated tag (v1.6.3.2~35)
+#     branch        relative to newer tag or branch (master~4)
+#     describe      relative to older annotated tag (v1.6.3.1-13-gdd42c2f)
+#     default       exactly matching tag
+#
+# If you would like a colored hint about the current dirty state, set
+# GIT_PS1_SHOWCOLORHINTS to a nonempty value. The colors are based on
+# the colored output of "git status -sb".
 
 # __gitdir accepts 0 or 1 arguments (i.e., location)
 # returns location of .git repo
@@ -195,11 +224,43 @@ __git_ps1_show_upstream ()
 
 
 # __git_ps1 accepts 0 or 1 arguments (i.e., format string)
-# returns text to add to bash PS1 prompt (includes branch name)
+# when called from PS1 using command substitution
+# in this mode it prints text to add to bash PS1 prompt (includes branch name)
+#
+# __git_ps1 requires 2 or 3 arguments when called from PROMPT_COMMAND (pc)
+# in that case it _sets_ PS1. The arguments are parts of a PS1 string.
+# when two arguments are given, the first is prepended and the second appended
+# to the state string when assigned to PS1.
+# The optional third parameter will be used as printf format string to further
+# customize the output of the git-status string.
+# In this mode you can request colored hints using GIT_PS1_SHOWCOLORHINTS=true
 __git_ps1 ()
 {
+	local pcmode=no
+	local detached=no
+	local ps1pc_start='\u@\h:\w '
+	local ps1pc_end='\$ '
+	local printf_format=' (%s)'
+
+	case "$#" in
+		2|3)	pcmode=yes
+			ps1pc_start="$1"
+			ps1pc_end="$2"
+			printf_format="${3:-$printf_format}"
+		;;
+		0|1)	printf_format="${1:-$printf_format}"
+		;;
+		*)	return
+		;;
+	esac
+
 	local g="$(__gitdir)"
-	if [ -n "$g" ]; then
+	if [ -z "$g" ]; then
+		if [ $pcmode = yes ]; then
+			#In PC mode PS1 always needs to be set
+			PS1="$ps1pc_start$ps1pc_end"
+		fi
+	else
 		local r=""
 		local b=""
 		if [ -f "$g/rebase-merge/interactive" ]; then
@@ -226,7 +287,7 @@ __git_ps1 ()
 			fi
 
 			b="$(git symbolic-ref HEAD 2>/dev/null)" || {
-
+				detached=yes
 				b="$(
 				case "${GIT_PS1_DESCRIBE_STYLE-}" in
 				(contains)
@@ -259,24 +320,25 @@ __git_ps1 ()
 				b="GIT_DIR!"
 			fi
 		elif [ "true" = "$(git rev-parse --is-inside-work-tree 2>/dev/null)" ]; then
-			if [ -n "${GIT_PS1_SHOWDIRTYSTATE-}" ]; then
-				if [ "$(git config --bool bash.showDirtyState)" != "false" ]; then
-					git diff --no-ext-diff --quiet --exit-code || w="*"
-					if git rev-parse --quiet --verify HEAD >/dev/null; then
-						git diff-index --cached --quiet HEAD -- || i="+"
-					else
-						i="#"
-					fi
+			if [ -n "${GIT_PS1_SHOWDIRTYSTATE-}" ] &&
+			   [ "$(git config --bool bash.showDirtyState)" != "false" ]
+			then
+				git diff --no-ext-diff --quiet --exit-code || w="*"
+				if git rev-parse --quiet --verify HEAD >/dev/null; then
+					git diff-index --cached --quiet HEAD -- || i="+"
+				else
+					i="#"
 				fi
 			fi
 			if [ -n "${GIT_PS1_SHOWSTASHSTATE-}" ]; then
 				git rev-parse --verify refs/stash >/dev/null 2>&1 && s="$"
 			fi
 
-			if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ]; then
-				if [ -n "$(git ls-files --others --exclude-standard)" ]; then
-					u="%%"
-				fi
+			if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ] &&
+			   [ "$(git config --bool bash.showUntrackedFiles)" != "false" ] &&
+			   [ -n "$(git ls-files --others --exclude-standard)" ]
+			then
+				u="%%"
 			fi
 
 			if [ -n "${GIT_PS1_SHOWUPSTREAM-}" ]; then
@@ -285,6 +347,53 @@ __git_ps1 ()
 		fi
 
 		local f="$w$i$s$u"
-		printf -- "${1:- (%s)}" "$c${b##refs/heads/}${f:+ $f}$r$p"
+		if [ $pcmode = yes ]; then
+			local gitstring=
+			if [ -n "${GIT_PS1_SHOWCOLORHINTS-}" ]; then
+				local c_red='\e[31m'
+				local c_green='\e[32m'
+				local c_lblue='\e[1;34m'
+				local c_clear='\e[0m'
+				local bad_color=$c_red
+				local ok_color=$c_green
+				local branch_color="$c_clear"
+				local flags_color="$c_lblue"
+				local branchstring="$c${b##refs/heads/}"
+
+				if [ $detached = no ]; then
+					branch_color="$ok_color"
+				else
+					branch_color="$bad_color"
+				fi
+
+				# Setting gitstring directly with \[ and \] around colors
+				# is necessary to prevent wrapping issues!
+				gitstring="\[$branch_color\]$branchstring\[$c_clear\]"
+
+				if [ -n "$w$i$s$u$r$p" ]; then
+					gitstring="$gitstring "
+				fi
+				if [ "$w" = "*" ]; then
+					gitstring="$gitstring\[$bad_color\]$w"
+				fi
+				if [ -n "$i" ]; then
+					gitstring="$gitstring\[$ok_color\]$i"
+				fi
+				if [ -n "$s" ]; then
+					gitstring="$gitstring\[$flags_color\]$s"
+				fi
+				if [ -n "$u" ]; then
+					gitstring="$gitstring\[$bad_color\]$u"
+				fi
+				gitstring="$gitstring\[$c_clear\]$r$p"
+			else
+				gitstring="$c${b##refs/heads/}${f:+ $f}$r$p"
+			fi
+			gitstring=$(printf -- "$printf_format" "$gitstring")
+			PS1="$ps1pc_start$gitstring$ps1pc_end"
+		else
+			# NO color option unless in PROMPT_COMMAND mode
+			printf -- "$printf_format" "$c${b##refs/heads/}${f:+ $f}$r$p"
+		fi
 	fi
 }

From c944f8b465e6c28f9a42ac6d71c90ddf9a5b5742 Mon Sep 17 00:00:00 2001
From: Felipe Contreras 
Date: Thu, 29 Nov 2012 15:54:17 +0100
Subject: [PATCH 127/142] gitfast: fix prompt

Certain themes need the 'clean' mark, and some people like to have the
'dirty' one, just like the original git_promp_info().

We probably shouldn't be modifying that function, there's no other clean
way to achieve our own status information, so let's try to emulate the
original as much as possible.

Signed-off-by: Felipe Contreras 
---
 plugins/gitfast/gitfast.plugin.zsh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/plugins/gitfast/gitfast.plugin.zsh b/plugins/gitfast/gitfast.plugin.zsh
index 7e50cf721..dba1b1315 100644
--- a/plugins/gitfast/gitfast.plugin.zsh
+++ b/plugins/gitfast/gitfast.plugin.zsh
@@ -3,5 +3,6 @@ source $dir/../git/git.plugin.zsh
 source $dir/git-prompt.sh
 
 function git_prompt_info() {
-  __git_ps1 "${ZSH_THEME_GIT_PROMPT_PREFIX//\%/%%}%s${ZSH_THEME_GIT_PROMPT_SUFFIX//\%/%%}"
+  dirty="$(parse_git_dirty)"
+  __git_ps1 "${ZSH_THEME_GIT_PROMPT_PREFIX//\%/%%}%s${dirty//\%/%%}${ZSH_THEME_GIT_PROMPT_SUFFIX//\%/%%}"
 }

From e41714d72c6c5629efe632b1052b590f5f8905c5 Mon Sep 17 00:00:00 2001
From: Jeremy Attali 
Date: Mon, 22 Apr 2013 10:59:08 +0200
Subject: [PATCH 128/142] Added option to allow untracked files as non dirty

In this commit, the option only works for git but it should not be to hard for
someone who knows svn to so the same.
This commit is largely inspired by @yoavweiss, I only added an option to use
it.
---
 lib/git.zsh                  | 6 +++++-
 templates/zshrc.zsh-template | 5 +++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/lib/git.zsh b/lib/git.zsh
index 76fe9b142..5f8453112 100644
--- a/lib/git.zsh
+++ b/lib/git.zsh
@@ -15,7 +15,11 @@ parse_git_dirty() {
     if [[ $POST_1_7_2_GIT -gt 0 ]]; then
           SUBMODULE_SYNTAX="--ignore-submodules=dirty"
     fi  
-    GIT_STATUS=$(git status -s ${SUBMODULE_SYNTAX} 2> /dev/null | tail -n1)
+    if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" != "true" ]]; then
+        GIT_STATUS=$(git status -s ${SUBMODULE_SYNTAX} 2> /dev/null | tail -n1)
+    else
+        GIT_STATUS=$(git status -s ${SUBMODULE_SYNTAX} -uno 2> /dev/null | tail -n1)
+    fi
     if [[ -n $GIT_STATUS && "$GIT_STATUS" != "$CLEAN_MESSAGE" ]]; then
       echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
     else
diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template
index 2ea9934af..58f193550 100644
--- a/templates/zshrc.zsh-template
+++ b/templates/zshrc.zsh-template
@@ -29,6 +29,11 @@ ZSH_THEME="robbyrussell"
 # Uncomment following line if you want red dots to be displayed while waiting for completion
 # COMPLETION_WAITING_DOTS="true"
 
+# Uncomment following line if you want to disable marking untracked files under
+# VCS as dirty. This makes repository status check for large repositories much,
+# much faster.
+# DISABLE_UNTRACKED_FILES_DIRTY="true"
+
 # Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
 # Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
 # Example format: plugins=(rails git textmate ruby lighthouse)

From 785b1c6337e1da6b2356e71b72ef6b4c93460e90 Mon Sep 17 00:00:00 2001
From: Dustin Hemmerling 
Date: Mon, 22 Apr 2013 16:01:09 -0700
Subject: [PATCH 129/142] mvn plugin was missing "redeploy" completion for
 tomcat.

---
 plugins/mvn/mvn.plugin.zsh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh
index c2d8e7ed7..799f6fc8c 100644
--- a/plugins/mvn/mvn.plugin.zsh
+++ b/plugins/mvn/mvn.plugin.zsh
@@ -114,7 +114,7 @@ function listMavenCompletions {
         # jboss
         jboss:start jboss:stop jboss:deploy jboss:undeploy jboss:redeploy
         # tomcat
-        tomcat:start tomcat:stop tomcat:deploy tomcat:undeploy tomcat:undeploy
+        tomcat:start tomcat:stop tomcat:deploy tomcat:undeploy tomcat:redeploy
         # tomcat6
         tomcat6:run tomcat6:run-war tomcat6:run-war-only tomcat6:stop tomcat6:deploy tomcat6:undeploy
         # tomcat7

From 680302c9f6ce71f69afaf7d020ed400cec2e5d58 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tobias=20Sj=C3=B6sten?= 
Date: Tue, 23 Apr 2013 09:35:27 +0300
Subject: [PATCH 130/142] Added 'jekyll' to list of bundled commands

---
 plugins/bundler/bundler.plugin.zsh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh
index bc21da134..a288cffcd 100644
--- a/plugins/bundler/bundler.plugin.zsh
+++ b/plugins/bundler/bundler.plugin.zsh
@@ -6,7 +6,7 @@ alias bu="bundle update"
 
 # The following is based on https://github.com/gma/bundler-exec
 
-bundled_commands=(annotate cap capify cucumber foreman guard middleman nanoc rackup rainbows rake rspec ruby shotgun spec spork thin thor unicorn unicorn_rails puma)
+bundled_commands=(annotate cap capify cucumber foreman guard jekyll middleman nanoc rackup rainbows rake rspec ruby shotgun spec spork thin thor unicorn unicorn_rails puma)
 
 ## Functions
 

From d537193f262d277158f01bd319bfe76d154b751d Mon Sep 17 00:00:00 2001
From: Tobias Preuss 
Date: Tue, 23 Apr 2013 10:41:58 +0200
Subject: [PATCH 131/142] Add auto-completion for zeus.

---
 plugins/zeus/_zeus | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100644 plugins/zeus/_zeus

diff --git a/plugins/zeus/_zeus b/plugins/zeus/_zeus
new file mode 100644
index 000000000..5a13bd9ec
--- /dev/null
+++ b/plugins/zeus/_zeus
@@ -0,0 +1,34 @@
+#compdef zeus
+#autoload
+
+# in order to make this work, you will need to have the gem zeus installed
+
+# zeus zsh completion, based on adb completion
+
+local -a _1st_arguments
+_1st_arguments=(
+'console:Lets you interact with your Rails application from the command line. (alias = c)'
+'cucumber:Runs cucumber.'
+'dbconsole:Figures out which database you are using and drops you into whichever command line interface.'
+'destroy:Figures out what generate did, and undoes it. (alias = d)'
+'generate:Uses templates to create a whole lot of things. (alias = g)'
+'rake:Execute rake tasks.'
+'runner:Runs Ruby code in the context of Rails non-interactively. (alias = r)'
+'server:Launches a small web server named WEBrick which comes bundled with Ruby. (alias = s)'
+'start:Preloads the zeus environment'
+'test:Runs RSpec tests. (alias = rspec, testrb)'
+'version:Shows the version number.'
+)
+
+local expl
+local -a pkgs installed_pkgs
+
+_arguments \
+	'*:: :->subcmds' && return 0
+
+if (( CURRENT == 1 )); then
+	_describe -t commands "zeus subcommand" _1st_arguments
+	return
+fi
+
+_files

From 8cd1b21b931c0f7a310fc32c43dd3288203ecd40 Mon Sep 17 00:00:00 2001
From: Alexey Poimtsev 
Date: Wed, 24 Apr 2013 01:40:09 +0400
Subject: [PATCH 132/142] Update rails4.plugin.zsh

added alias for rake db:create
---
 plugins/rails4/rails4.plugin.zsh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/plugins/rails4/rails4.plugin.zsh b/plugins/rails4/rails4.plugin.zsh
index b6765365e..fce827ee3 100644
--- a/plugins/rails4/rails4.plugin.zsh
+++ b/plugins/rails4/rails4.plugin.zsh
@@ -22,8 +22,9 @@ alias rs='_rails_command server'
 alias rsd='_rails_command server --debugger'
 alias devlog='tail -f log/development.log'
 alias rdm='rake db:migrate'
+alias rdc='rake db:create'
 alias rdr='rake db:rollback'
 alias rds='rake db:seed'
 alias rlc='rake log:clear'
 alias rn='rake notes'
-alias rr='rake routes'
\ No newline at end of file
+alias rr='rake routes'

From d4d8939410edf3b81e6cd6a63b39744262691185 Mon Sep 17 00:00:00 2001
From: JamesFerguson 
Date: Wed, 24 Apr 2013 09:11:52 +1000
Subject: [PATCH 133/142] Only trim remote names; be git-flow friendly

 - don't remove everything before the last /
 - do remove /
 - allows flow style feature/foobar branch names
---
 plugins/git-remote-branch/git-remote-branch.plugin.zsh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/plugins/git-remote-branch/git-remote-branch.plugin.zsh b/plugins/git-remote-branch/git-remote-branch.plugin.zsh
index ff98cbf87..6c5ab8f70 100644
--- a/plugins/git-remote-branch/git-remote-branch.plugin.zsh
+++ b/plugins/git-remote-branch/git-remote-branch.plugin.zsh
@@ -6,7 +6,8 @@ _git_remote_branch() {
       compadd create publish rename delete track
     elif (( CURRENT == 3 )); then
       # second arg: remote branch name
-      compadd `git branch -r | grep -v HEAD | sed "s/.*\///" | sed "s/ //g"`
+      remotes=`git remote | tr '\n' '|' | sed "s/\|$//g"`
+      compadd `git branch -r | grep -v HEAD | sed "s/$remotes\///" | sed "s/ //g"`
     elif (( CURRENT == 4 )); then
       # third arg: remote name
       compadd `git remote`

From dd6247057ea9b8e238aea5e16446dee089f11f3e Mon Sep 17 00:00:00 2001
From: Robby Russell 
Date: Tue, 23 Apr 2013 20:52:18 -0700
Subject: [PATCH 134/142] Updating the README file

---
 README.textile | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/README.textile b/README.textile
index 0a4545bac..46e69691e 100644
--- a/README.textile
+++ b/README.textile
@@ -1,5 +1,4 @@
-A handful of functions, auto-complete helpers, and stuff that makes you shout...
-
+oh-my-zsh is an open source, community-driven framework for managing your ZSH configuration. It comes bundled with a ton of helpful functions, helpers, plugins, themes, and few things that make you shout...
 
 bq. "OH MY ZSHELL!"
 
@@ -76,9 +75,7 @@ h3. (Don't) Send us your theme! (for now)
 
 -I'm hoping to collect a bunch of themes for our command prompts. You can see existing ones in the @themes/@ directory.-
 
-We have enough themes for the time being. Please fork the project and add on in there, you can let people know how to grab it from there. 
-
-
+We have enough themes for the time being. Please fork the project and add on in there, you can let people know how to grab it from there.
 
 h2. Contributors
 

From 17a092b0ffa1ecf4ef9f727054a414e26f9e1edd Mon Sep 17 00:00:00 2001
From: Kaiwen Xu 
Date: Mon, 29 Apr 2013 03:19:31 -0400
Subject: [PATCH 135/142] Change sublime text path select priority on mac.

User changed symbolic link for sublime binary is now top priority,
since this allows users to actually specify which version of sublime
they want to use. Sublime text 2 binary has higher priority over
sublime text (3) binary, since sublime text 2 is considered more
stable.
---
 plugins/sublime/sublime.plugin.zsh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/plugins/sublime/sublime.plugin.zsh b/plugins/sublime/sublime.plugin.zsh
index e74695de0..82faf87c9 100755
--- a/plugins/sublime/sublime.plugin.zsh
+++ b/plugins/sublime/sublime.plugin.zsh
@@ -2,10 +2,11 @@
 
 local _sublime_darwin_paths > /dev/null 2>&1
 _sublime_darwin_paths=(
-	"$HOME/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl"
+	"/usr/local/bin/subl"
 	"$HOME/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl"
-	"/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl"
+	"$HOME/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl"
 	"/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl"
+	"/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl"
 )
 
 if [[ $('uname') == 'Linux' ]]; then

From 39b46f526c83a5d4704bd25eff03c7678230ec78 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcus=20M=C3=BCller?= 
Date: Mon, 29 Apr 2013 09:51:21 +0200
Subject: [PATCH 136/142] eliminated unnecessary cd and failing substitution

Changing the working directory in a sub-subshell
does not change the working directory of the executing
shell.

The substitution was broken for me on _all_ my machines,
so I started looking into the business.
---
 tools/upgrade.sh | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/tools/upgrade.sh b/tools/upgrade.sh
index 0aeebdebf..3624a88e5 100644
--- a/tools/upgrade.sh
+++ b/tools/upgrade.sh
@@ -1,8 +1,5 @@
-current_path=`pwd`
-current_path=${current_path/ /\\ }
 printf '\033[0;34m%s\033[0m\n' "Upgrading Oh My Zsh"
 cd "$ZSH"
-
 if git pull origin master
 then
   printf '\033[0;32m%s\033[0m\n' '         __                                     __   '
@@ -17,4 +14,3 @@ else
   printf '\033[0;31m%s\033[0m\n' 'There was an error updating. Try again later?'
 fi
 
-cd "$current_path"

From f28e16a15856baf92163dba8ac6eec1e02cf6c1f Mon Sep 17 00:00:00 2001
From: Lindolfo 'Lorn' Rodrigues 
Date: Tue, 30 Apr 2013 01:51:09 -0300
Subject: [PATCH 137/142] Cache for fasd --init

Using cache technique for faster fasd --init as shown at:
 https://github.com/clvv/fasdi#install
---
 plugins/fasd/fasd.plugin.zsh | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/plugins/fasd/fasd.plugin.zsh b/plugins/fasd/fasd.plugin.zsh
index d42584f1a..8ad43fc23 100644
--- a/plugins/fasd/fasd.plugin.zsh
+++ b/plugins/fasd/fasd.plugin.zsh
@@ -1,5 +1,10 @@
 if [ $commands[fasd] ]; then # check if fasd is installed
-  eval "$(fasd --init auto)"
+  fasd_cache="$HOME/.fasd-init-cache"
+  if [ "$(command -v fasd)" -nt "$fasd_cache" -o ! -s "$fasd_cache" ]; then
+    fasd --init auto >| "$fasd_cache"
+  fi
+  source "$fasd_cache"
+  unset fasd_cache
   alias v='f -e vim'
   alias o='a -e open'
 fi

From 6de78ad2ba8688532b116de8322d7aaecbbcebbe Mon Sep 17 00:00:00 2001
From: bebugz 
Date: Thu, 9 May 2013 13:12:11 +0400
Subject: [PATCH 138/142] gentoo linux support

---
 plugins/autojump/autojump.plugin.zsh | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/plugins/autojump/autojump.plugin.zsh b/plugins/autojump/autojump.plugin.zsh
index 3894ccd2f..f856f2f01 100644
--- a/plugins/autojump/autojump.plugin.zsh
+++ b/plugins/autojump/autojump.plugin.zsh
@@ -3,6 +3,8 @@ if [ $commands[autojump] ]; then # check if autojump is installed
     . /usr/share/autojump/autojump.zsh
   elif [ -f /etc/profile.d/autojump.zsh ]; then # manual installation
     . /etc/profile.d/autojump.zsh
+  elif [ -f /etc/profile.d/autojump.sh ]; then # gentoo installation
+    . /etc/profile.d/autojump.sh
   elif [ -f $HOME/.autojump/etc/profile.d/autojump.zsh ]; then # manual user-local installation
     . $HOME/.autojump/etc/profile.d/autojump.zsh
   elif [ -f /opt/local/etc/profile.d/autojump.zsh ]; then # mac os x with ports

From 4ff861ee115fdba24033f945dcf3cacea3120074 Mon Sep 17 00:00:00 2001
From: Christopher Roach 
Date: Sun, 19 May 2013 12:55:10 -0700
Subject: [PATCH 139/142] Adding a fix for the DISABLE_UNTRACKED_FILES_DIRTY
 option.

---
 lib/git.zsh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/git.zsh b/lib/git.zsh
index 96598cf5f..c4b5b5d62 100644
--- a/lib/git.zsh
+++ b/lib/git.zsh
@@ -15,12 +15,12 @@ parse_git_dirty() {
     if [[ $POST_1_7_2_GIT -gt 0 ]]; then
           SUBMODULE_SYNTAX="--ignore-submodules=dirty"
     fi
-    if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" != "true" ]]; then
-        GIT_STATUS=$(git status -s ${SUBMODULE_SYNTAX} 2> /dev/null | tail -n1)
-    else
+    if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" == "true" ]]; then
         GIT_STATUS=$(git status -s ${SUBMODULE_SYNTAX} -uno 2> /dev/null | tail -n1)
+    else
+        GIT_STATUS=$(git status -s ${SUBMODULE_SYNTAX} 2> /dev/null | tail -n1)
     fi
-    if [[ -n $(git status -s ${SUBMODULE_SYNTAX} -uno  2> /dev/null) ]]; then
+    if [[ -n $GIT_STATUS ]]; then
       echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
     else
       echo "$ZSH_THEME_GIT_PROMPT_CLEAN"

From 25313814775c08c64dc541fbadceb38c669c541a Mon Sep 17 00:00:00 2001
From: Hong Xu 
Date: Mon, 20 May 2013 22:18:07 -0700
Subject: [PATCH 140/142] Add web-search plugin.

This plugin adds google, bing and yahoo commands to launch the default
web browser to do web search:

e.g.

    google oh-my-zsh
    bing what is zsh
---
 plugins/web-search/web-search.plugin.zsh | 43 ++++++++++++++++++++++++
 1 file changed, 43 insertions(+)
 create mode 100644 plugins/web-search/web-search.plugin.zsh

diff --git a/plugins/web-search/web-search.plugin.zsh b/plugins/web-search/web-search.plugin.zsh
new file mode 100644
index 000000000..6b6de2b15
--- /dev/null
+++ b/plugins/web-search/web-search.plugin.zsh
@@ -0,0 +1,43 @@
+# web_search from terminal
+
+function web_search() {
+
+  # get the open command
+  local open_cmd
+  if [[ $(uname -s) == 'Darwin' ]]; then
+    open_cmd='open'
+  else
+    open_cmd='xdg-open'
+  fi
+
+  # check whether the search engine is supported
+  if [[ ! $1 =~ '(google|bing|yahoo)' ]];
+  then
+    echo "Search engine $1 not supported."
+    return 1
+  fi
+
+  local url="http://www.$1.com"
+
+  # no keyword provided, simply open the search engine homepage
+  if [[ $# -le 1 ]]; then
+    $open_cmd "$url"
+    return
+  fi
+
+  url="${url}/search?q="
+  shift   # shift out $1
+
+  while [[ $# -gt 0 ]]; do
+    url="${url}$1+"
+    shift
+  done
+
+  url="${url%?}" # remove the last '+'
+
+  $open_cmd "$url"
+}
+
+alias bing='web_search bing'
+alias google='web_search google'
+alias yahoo='web_search yahoo'

From 69116fa806f5a7405d33cc1f7c66d4c26ad4253b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Germ=C3=A1n=20M=2E=20Bravo?= 
Date: Tue, 21 May 2013 14:20:28 -0400
Subject: [PATCH 141/142] Fixed recursion. Git not needed for it to work.

Avoid infinite `cd` loops under certain conditions. Try getting `.venv` from the current directory (not necessarily always using git)
---
 .../virtualenvwrapper.plugin.zsh              | 36 ++++++++++++-------
 1 file changed, 23 insertions(+), 13 deletions(-)

diff --git a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
index 0ed2565b4..35de50874 100644
--- a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
+++ b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
@@ -8,26 +8,36 @@ if [[ -f "$wrapsource" ]]; then
     # directory name of the project. Virtual environment name can be overridden
     # by placing a .venv file in the project root with a virtualenv name in it
     function workon_cwd {
-        # Check that this is a Git repo
-        PROJECT_ROOT=`git rev-parse --show-toplevel 2> /dev/null`
-        if (( $? == 0 )); then
+        if [ ! $WORKON_CWD ]; then
+            WORKON_CWD=1
+            # Check if this is a Git repo
+            PROJECT_ROOT=`git rev-parse --show-toplevel 2> /dev/null`
+            if (( $? != 0 )); then
+                PROJECT_ROOT="."
+            fi
             # Check for virtualenv name override
-            ENV_NAME=`basename "$PROJECT_ROOT"`
             if [[ -f "$PROJECT_ROOT/.venv" ]]; then
                 ENV_NAME=`cat "$PROJECT_ROOT/.venv"`
+            elif [[ "$PROJECT_ROOT" != "." ]]; then
+                ENV_NAME=`basename "$PROJECT_ROOT"`
+            else
+                ENV_NAME=""
             fi
-            # Activate the environment only if it is not already active
-            if [[ "$VIRTUAL_ENV" != "$WORKON_HOME/$ENV_NAME" ]]; then
-                if [[ -e "$WORKON_HOME/$ENV_NAME/bin/activate" ]]; then
-                    workon "$ENV_NAME" && export CD_VIRTUAL_ENV="$ENV_NAME"
+            if [[ "$ENV_NAME" != "" ]]; then
+                # Activate the environment only if it is not already active
+                if [[ "$VIRTUAL_ENV" != "$WORKON_HOME/$ENV_NAME" ]]; then
+                    if [[ -e "$WORKON_HOME/$ENV_NAME/bin/activate" ]]; then
+                        workon "$ENV_NAME" && export CD_VIRTUAL_ENV="$ENV_NAME"
+                    fi
                 fi
+            elif [ $CD_VIRTUAL_ENV ]; then
+                # We've just left the repo, deactivate the environment
+                # Note: this only happens if the virtualenv was activated automatically
+                deactivate && unset CD_VIRTUAL_ENV
             fi
-        elif [ $CD_VIRTUAL_ENV ]; then
-            # We've just left the repo, deactivate the environment
-            # Note: this only happens if the virtualenv was activated automatically
-            deactivate && unset CD_VIRTUAL_ENV
+            unset PROJECT_ROOT
+            unset WORKON_CWD
         fi
-        unset PROJECT_ROOT
     }
 
     # New cd function that does the virtualenv magic

From bd38c50241647a1d0b0e2ca49fb1d6b9a2b88806 Mon Sep 17 00:00:00 2001
From: Marc-Antoine Lemieux 
Date: Mon, 27 May 2013 09:23:14 -0400
Subject: [PATCH 142/142] fix the open command in linux using xdg-open

---
 plugins/jira/jira.plugin.zsh | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/plugins/jira/jira.plugin.zsh b/plugins/jira/jira.plugin.zsh
index b91f93c95..bea726a54 100644
--- a/plugins/jira/jira.plugin.zsh
+++ b/plugins/jira/jira.plugin.zsh
@@ -11,6 +11,13 @@
 # Usage: jira           # opens a new issue
 #        jira ABC-123   # Opens an existing issue
 open_jira_issue () {
+  local open_cmd
+  if [[ $(uname -s) == 'Darwin' ]]; then
+    open_cmd='open'
+  else
+    open_cmd='xdg-open'
+  fi
+
   if [ -f .jira-url ]; then
     jira_url=$(cat .jira-url)
   elif [ -f ~/.jira-url ]; then
@@ -28,9 +35,9 @@ open_jira_issue () {
   else
     echo "Opening issue #$1"
     if [[ "x$JIRA_RAPID_BOARD" = "yes" ]]; then
-      `open $jira_url/issues/$1`
+      $open_cmd  "$jira_url/issues/$1"
     else
-      `open $jira_url/browse/$1`
+      $open_cmd  "$jira_url/browse/$1"
     fi
   fi
 }