From c24936ece51940536f3e62fc9e458b74c2affe68 Mon Sep 17 00:00:00 2001 From: steeef Date: Thu, 30 Sep 2010 19:56:56 -0700 Subject: [PATCH 001/184] added steeef theme --- themes/steeef.zsh-theme | 68 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 themes/steeef.zsh-theme diff --git a/themes/steeef.zsh-theme b/themes/steeef.zsh-theme new file mode 100644 index 000000000..a54cdce14 --- /dev/null +++ b/themes/steeef.zsh-theme @@ -0,0 +1,68 @@ +# 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 + +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 + + +# 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="(%{$fg[magenta]%}%b%u%c${PR_RST})" +FMT_ACTION="(%{$fg[green]%}%a${PR_RST})" +FMT_UNSTAGED="%{$fg[yellow]%}!" +FMT_STAGED="%{$fg[yellow]%}?" + +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 + ;; + 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 + vcs_info 'prompt' + PR_GIT_UPDATE= + fi +} +add-zsh-hook precmd steeef_precmd + +PROMPT=$' +%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%}%~%{$reset_color%} $vcs_info_msg_0_ +$(virtualenv_info)$ ' From 7fb0b210e88bcbdb71d2cb0022c35b2cc3810327 Mon Sep 17 00:00:00 2001 From: steeef Date: Fri, 1 Oct 2010 14:11:53 -0700 Subject: [PATCH 002/184] merge steeef.zsh-theme from master --- themes/steeef.zsh-theme | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/themes/steeef.zsh-theme b/themes/steeef.zsh-theme index a54cdce14..abb8f2994 100644 --- a/themes/steeef.zsh-theme +++ b/themes/steeef.zsh-theme @@ -3,6 +3,9 @@ # # 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`') ' @@ -17,6 +20,9 @@ autoload -U add-zsh-hook autoload -Uz vcs_info +# 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 @@ -31,8 +37,8 @@ zstyle ':vcs_info:*:prompt:*' check-for-changes true PR_RST="%{${reset_color}%}" FMT_BRANCH="(%{$fg[magenta]%}%b%u%c${PR_RST})" FMT_ACTION="(%{$fg[green]%}%a${PR_RST})" -FMT_UNSTAGED="%{$fg[yellow]%}!" -FMT_STAGED="%{$fg[yellow]%}?" +FMT_UNSTAGED="%{$fg[yellow]%}●" +FMT_STAGED="%{$fg[green]%}●" zstyle ':vcs_info:*:prompt:*' unstagedstr "${FMT_UNSTAGED}" zstyle ':vcs_info:*:prompt:*' stagedstr "${FMT_STAGED}" @@ -46,6 +52,9 @@ function steeef_preexec { *git*) PR_GIT_UPDATE=1 ;; + *svn*) + PR_GIT_UPDATE=1 + ;; esac } add-zsh-hook preexec steeef_preexec @@ -56,6 +65,15 @@ function steeef_chpwd { add-zsh-hook chpwd steeef_chpwd function steeef_precmd { + # check for untracked files or updated submodules, since vcs_info doesn't + if [[ -n $(git ls-files --other --exclude-standard 2> /dev/null) || -n $(git ls-files -m --exclude-standard 2> /dev/null) ]]; then + PR_GIT_UPDATE=1 + FMT_BRANCH="(%{$fg[magenta]%}%b%u%c%{$fg[red]%}●${PR_RST})" + else + FMT_BRANCH="(%{$fg[magenta]%}%b%u%c${PR_RST})" + fi + zstyle ':vcs_info:*:prompt:*' formats "${FMT_BRANCH}" + if [[ -n "$PR_GIT_UPDATE" ]] ; then vcs_info 'prompt' PR_GIT_UPDATE= From 6fcf9393c31a51cef688b591de73817c5988c405 Mon Sep 17 00:00:00 2001 From: steeef Date: Fri, 1 Oct 2010 14:17:13 -0700 Subject: [PATCH 003/184] merge steeef.zsh-theme from master (removed submodule check) --- themes/steeef.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/steeef.zsh-theme b/themes/steeef.zsh-theme index abb8f2994..a43192743 100644 --- a/themes/steeef.zsh-theme +++ b/themes/steeef.zsh-theme @@ -66,7 +66,7 @@ add-zsh-hook chpwd steeef_chpwd function steeef_precmd { # check for untracked files or updated submodules, since vcs_info doesn't - if [[ -n $(git ls-files --other --exclude-standard 2> /dev/null) || -n $(git ls-files -m --exclude-standard 2> /dev/null) ]]; then + if [[ -n $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then PR_GIT_UPDATE=1 FMT_BRANCH="(%{$fg[magenta]%}%b%u%c%{$fg[red]%}●${PR_RST})" else From 7405f5d9ff29f42e934fa5f3c87401437c16aedd Mon Sep 17 00:00:00 2001 From: steeef Date: Fri, 1 Oct 2010 14:40:06 -0700 Subject: [PATCH 004/184] fix untracked files checking --- themes/steeef.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/steeef.zsh-theme b/themes/steeef.zsh-theme index a43192743..8c4c80265 100644 --- a/themes/steeef.zsh-theme +++ b/themes/steeef.zsh-theme @@ -66,7 +66,7 @@ add-zsh-hook chpwd steeef_chpwd function steeef_precmd { # check for untracked files or updated submodules, since vcs_info doesn't - if [[ -n $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then + if [[ ! -z $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then PR_GIT_UPDATE=1 FMT_BRANCH="(%{$fg[magenta]%}%b%u%c%{$fg[red]%}●${PR_RST})" else From f2f49f9571cf56b2fa672f16260c000050f9349b Mon Sep 17 00:00:00 2001 From: atom smith Date: Sun, 3 Oct 2010 17:41:45 -0400 Subject: [PATCH 005/184] adding my zsh-theme --- themes/re5et.zsh-theme | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 themes/re5et.zsh-theme diff --git a/themes/re5et.zsh-theme b/themes/re5et.zsh-theme new file mode 100644 index 000000000..fadb1fef8 --- /dev/null +++ b/themes/re5et.zsh-theme @@ -0,0 +1,15 @@ +if [ "$(whoami)" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="magenta"; fi + +local return_code="%(?..%{$fg_bold[red]%}:( %?%{$reset_color%})" + +PROMPT=' +%{$fg_bold[cyan]%}%n%{$reset_color%}%{$fg[yellow]%}@%{$reset_color%}%{$fg_bold[blue]%}%m%{$reset_color%}:%{${fg_bold[green]}%}%~%{$reset_color%}$(git_prompt_info) +%{${fg[$CARETCOLOR]}%}%# %{${reset_color}%}' + +RPS1='${return_code} %D - %*' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[magenta]%}^%{$reset_color%}%{$fg_bold[yellow]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%} ±" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ?" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[red]%} ♥" \ No newline at end of file From ba9ae6a1e5fe1b45a58e655ab3413bb95a82573e Mon Sep 17 00:00:00 2001 From: atom smith Date: Sun, 3 Oct 2010 17:42:57 -0400 Subject: [PATCH 006/184] should have newline at end of file. --- themes/re5et.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/re5et.zsh-theme b/themes/re5et.zsh-theme index fadb1fef8..5bded76a3 100644 --- a/themes/re5et.zsh-theme +++ b/themes/re5et.zsh-theme @@ -12,4 +12,4 @@ ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[magenta]%}^%{$reset_color%}%{$fg_bold[ye ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%} ±" ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ?" -ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[red]%} ♥" \ No newline at end of file +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[red]%} ♥" From 6d5e4eaebcde1c48413f89b4554983f489e4b017 Mon Sep 17 00:00:00 2001 From: steeef Date: Mon, 4 Oct 2010 18:05:01 -0700 Subject: [PATCH 007/184] use 256 colors, if available --- themes/steeef.zsh-theme | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/themes/steeef.zsh-theme b/themes/steeef.zsh-theme index 8c4c80265..d8f9306cd 100644 --- a/themes/steeef.zsh-theme +++ b/themes/steeef.zsh-theme @@ -19,6 +19,20 @@ colors autoload -U add-zsh-hook autoload -Uz vcs_info +#use extended color pallete if available +if [ $TERM = "xterm-256color" ]; 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 @@ -35,10 +49,10 @@ zstyle ':vcs_info:*:prompt:*' check-for-changes true # %R - repository path # %S - path in the repository PR_RST="%{${reset_color}%}" -FMT_BRANCH="(%{$fg[magenta]%}%b%u%c${PR_RST})" -FMT_ACTION="(%{$fg[green]%}%a${PR_RST})" -FMT_UNSTAGED="%{$fg[yellow]%}●" -FMT_STAGED="%{$fg[green]%}●" +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}" @@ -68,9 +82,9 @@ function steeef_precmd { # 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="(%{$fg[magenta]%}%b%u%c%{$fg[red]%}●${PR_RST})" + FMT_BRANCH="(%{$turquoise%}%b%u%c%{$hotpink%}●${PR_RST})" else - FMT_BRANCH="(%{$fg[magenta]%}%b%u%c${PR_RST})" + FMT_BRANCH="(%{$turquoise%}%b%u%c${PR_RST})" fi zstyle ':vcs_info:*:prompt:*' formats "${FMT_BRANCH}" @@ -82,5 +96,5 @@ function steeef_precmd { add-zsh-hook precmd steeef_precmd PROMPT=$' -%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%}%~%{$reset_color%} $vcs_info_msg_0_ +%{$purple%}%n%{$reset_color%} at %{$orange%}%m%{$reset_color%} in %{$limegreen%}%~%{$reset_color%} $vcs_info_msg_0_ $(virtualenv_info)$ ' From c6b339f532b05e907b0c554000643db5e896a75f Mon Sep 17 00:00:00 2001 From: steeef Date: Mon, 4 Oct 2010 22:08:38 -0700 Subject: [PATCH 008/184] merge master --- themes/steeef.zsh-theme | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/themes/steeef.zsh-theme b/themes/steeef.zsh-theme index d8f9306cd..a5cf0f9a1 100644 --- a/themes/steeef.zsh-theme +++ b/themes/steeef.zsh-theme @@ -79,16 +79,16 @@ function steeef_chpwd { add-zsh-hook chpwd steeef_chpwd function steeef_precmd { - # 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="(%{$turquoise%}%b%u%c%{$hotpink%}●${PR_RST})" - else - FMT_BRANCH="(%{$turquoise%}%b%u%c${PR_RST})" - fi - zstyle ':vcs_info:*:prompt:*' formats "${FMT_BRANCH}" - 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="(%{$turquoise%}%b%u%c%{$hotpink%}●${PR_RST})" + else + FMT_BRANCH="(%{$turquoise%}%b%u%c${PR_RST})" + fi + zstyle ':vcs_info:*:prompt:*' formats "${FMT_BRANCH}" + vcs_info 'prompt' PR_GIT_UPDATE= fi From 8b4858b6646ef2ce1bf4ab33ba94db33a95559b4 Mon Sep 17 00:00:00 2001 From: Brandon Philips Date: Sat, 9 Oct 2010 16:52:53 -0700 Subject: [PATCH 009/184] themes: philips customize git/ls for developers - Customize LS_COLORS for developers working on C code bases like the Kernel. - Add a * to the dirty prompt. Missed this accidently. Oops. Signed-off-by: Brandon Philips --- themes/philips.zsh-theme | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/philips.zsh-theme b/themes/philips.zsh-theme index fa7c59035..c79525590 100644 --- a/themes/philips.zsh-theme +++ b/themes/philips.zsh-theme @@ -7,8 +7,8 @@ RPROMPT='[%*]' ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}(%{$fg_no_bold[red]%}%B" ZSH_THEME_GIT_PROMPT_SUFFIX="%b%{$fg_bold[blue]%})%{$reset_color%} " ZSH_THEME_GIT_PROMPT_CLEAN="" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%}" +ZSH_THEME_GIT_PROMPT_DIRTY="*" # LS colors, made with http://geoff.greer.fm/lscolors/ export LSCOLORS="Gxfxcxdxbxegedabagacad" -export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:' +export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:*.patch=00;34:*.o=00;32:*.so=01;35:*.ko=01;31:*.la=00;33' From 4e433eb6bb578c864116cbcf0aa201227f80e4aa Mon Sep 17 00:00:00 2001 From: Florian Walch Date: Fri, 15 Oct 2010 11:05:47 +0200 Subject: [PATCH 010/184] Added own theme (based on robbyrussell) --- themes/fwalch.zsh-theme | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 themes/fwalch.zsh-theme diff --git a/themes/fwalch.zsh-theme b/themes/fwalch.zsh-theme new file mode 100644 index 000000000..24edf55c0 --- /dev/null +++ b/themes/fwalch.zsh-theme @@ -0,0 +1,6 @@ +PROMPT='%{$fg_bold[green]%}%p %{$fg[cyan]%}%c%{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$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]%})" From 60b560fc9ace116cde7e56954f386b1098751648 Mon Sep 17 00:00:00 2001 From: Florian Walch Date: Fri, 15 Oct 2010 16:50:39 +0200 Subject: [PATCH 011/184] Added gpg-agent plugin Based on ssh-agent plugin. --- plugins/gpg-agent/gpg-agent.plugin.zsh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 plugins/gpg-agent/gpg-agent.plugin.zsh diff --git a/plugins/gpg-agent/gpg-agent.plugin.zsh b/plugins/gpg-agent/gpg-agent.plugin.zsh new file mode 100644 index 000000000..8cc71fd57 --- /dev/null +++ b/plugins/gpg-agent/gpg-agent.plugin.zsh @@ -0,0 +1,26 @@ +# 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 +} + +# Source GPG agent settings, 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 + +GPG_TTY=$(tty) +export GPG_TTY From 9b6dd1cd48a549d2868cfe16073bbd04357e27e5 Mon Sep 17 00:00:00 2001 From: steeef Date: Fri, 22 Oct 2010 10:39:33 -0700 Subject: [PATCH 012/184] merge with master --- themes/steeef.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/steeef.zsh-theme b/themes/steeef.zsh-theme index a5cf0f9a1..07c1d3def 100644 --- a/themes/steeef.zsh-theme +++ b/themes/steeef.zsh-theme @@ -20,7 +20,7 @@ autoload -U add-zsh-hook autoload -Uz vcs_info #use extended color pallete if available -if [ $TERM = "xterm-256color" ]; then +if [ $TERM = "xterm-256color" || $TERM = "linux" || $TERM = "rxvt-256color" || $TERM = "rxvt-unicode-256color" ]; then turquoise="%F{81}" orange="%F{166}" purple="%F{135}" From 810b8f5ce8a58b03afba4e6ec5937e2cd0bcab5c Mon Sep 17 00:00:00 2001 From: steeef Date: Fri, 22 Oct 2010 10:42:49 -0700 Subject: [PATCH 013/184] merge with master --- themes/steeef.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/steeef.zsh-theme b/themes/steeef.zsh-theme index 07c1d3def..6bca57eec 100644 --- a/themes/steeef.zsh-theme +++ b/themes/steeef.zsh-theme @@ -20,7 +20,7 @@ autoload -U add-zsh-hook autoload -Uz vcs_info #use extended color pallete if available -if [ $TERM = "xterm-256color" || $TERM = "linux" || $TERM = "rxvt-256color" || $TERM = "rxvt-unicode-256color" ]; then +if [ [ $TERM = "xterm-256color" ] || [ $TERM = "linux"] || [ $TERM = "rxvt-256color" ] || [ $TERM = "rxvt-unicode-256color" ] ]; then turquoise="%F{81}" orange="%F{166}" purple="%F{135}" From d2bfdc2d89cb08a870169af4f394f27d2b9c0aed Mon Sep 17 00:00:00 2001 From: steeef Date: Fri, 22 Oct 2010 10:51:58 -0700 Subject: [PATCH 014/184] merge theme fixes from master --- themes/steeef.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/steeef.zsh-theme b/themes/steeef.zsh-theme index 6bca57eec..f81300242 100644 --- a/themes/steeef.zsh-theme +++ b/themes/steeef.zsh-theme @@ -20,7 +20,7 @@ autoload -U add-zsh-hook autoload -Uz vcs_info #use extended color pallete if available -if [ [ $TERM = "xterm-256color" ] || [ $TERM = "linux"] || [ $TERM = "rxvt-256color" ] || [ $TERM = "rxvt-unicode-256color" ] ]; then +if [[ $TERM = *256color* || $TERM = "linux" ]]; then turquoise="%F{81}" orange="%F{166}" purple="%F{135}" From 4ff0136079b8ffe29e0990d0a0ce8876554aa0d5 Mon Sep 17 00:00:00 2001 From: steeef Date: Fri, 22 Oct 2010 11:34:52 -0700 Subject: [PATCH 015/184] merge from master --- themes/steeef.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/steeef.zsh-theme b/themes/steeef.zsh-theme index f81300242..a2583b028 100644 --- a/themes/steeef.zsh-theme +++ b/themes/steeef.zsh-theme @@ -20,7 +20,7 @@ autoload -U add-zsh-hook autoload -Uz vcs_info #use extended color pallete if available -if [[ $TERM = *256color* || $TERM = "linux" ]]; then +if [[ $TERM = *256color* || $TERM = *rxvt* ]]; then turquoise="%F{81}" orange="%F{166}" purple="%F{135}" From bdaf872ce6e411f881e5e6138fc61a9c1645e67a Mon Sep 17 00:00:00 2001 From: Claus Witt Date: Wed, 17 Nov 2010 11:17:03 +0100 Subject: [PATCH 016/184] Removed the echo statement - no need for that. --- plugins/phing/phing.plugin.zsh | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/phing/phing.plugin.zsh b/plugins/phing/phing.plugin.zsh index 80e334629..8f4adca08 100644 --- a/plugins/phing/phing.plugin.zsh +++ b/plugins/phing/phing.plugin.zsh @@ -10,7 +10,6 @@ _phing_does_target_list_need_generating () { _phing () { if [ -f build.xml ]; then if _phing_does_target_list_need_generating; then - echo "\nGenerating .phing_targets..." > /dev/stderr phing -l |grep -v ":" |grep -v "^$"|grep -v "\-" > .phing_targets fi compadd `cat .phing_targets` From fa7036b4eef177f25478091e660fca52b9ac725d Mon Sep 17 00:00:00 2001 From: Claus Witt Date: Thu, 25 Nov 2010 21:48:07 +0100 Subject: [PATCH 017/184] Added ant plugin --- plugins/ant/ant.plugin.zsh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 plugins/ant/ant.plugin.zsh diff --git a/plugins/ant/ant.plugin.zsh b/plugins/ant/ant.plugin.zsh new file mode 100644 index 000000000..0544ac92c --- /dev/null +++ b/plugins/ant/ant.plugin.zsh @@ -0,0 +1,19 @@ +_ant_does_target_list_need_generating () { + if [ ! -f .ant_targets ]; then return 0; + else + accurate=$(stat -f%m .ant_targets) + changed=$(stat -f%m build.xml) + return $(expr $accurate '>=' $changed) + fi +} + +_ant () { + if [ -f build.xml ]; then + if _ant_does_target_list_need_generating; then + sed -n '/ .ant_targets + fi + compadd `cat .ant_targets` + fi +} + +compdef _ant ant From 1a673fc1d582463c17168557b95fe6a55e0757e5 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Wed, 1 Dec 2010 18:07:28 +0100 Subject: [PATCH 018/184] Don't export oh-my-zsh configuration paramaters to the environment These variables are only used by oh-my-zsh, so there's no need to populate the environment of all children with them. --- templates/zshrc.zsh-template | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template index 8022b3506..69cbbb0fe 100644 --- a/templates/zshrc.zsh-template +++ b/templates/zshrc.zsh-template @@ -1,18 +1,18 @@ # Path to your oh-my-zsh configuration. -export ZSH=$HOME/.oh-my-zsh +ZSH=$HOME/.oh-my-zsh # Set to the name theme to load. # Look in ~/.oh-my-zsh/themes/ -export ZSH_THEME="robbyrussell" +ZSH_THEME="robbyrussell" # Set to this to use case-sensitive completion -# export CASE_SENSITIVE="true" +# CASE_SENSITIVE="true" # Comment this out to disable weekly auto-update checks -# export DISABLE_AUTO_UPDATE="true" +# DISABLE_AUTO_UPDATE="true" # Uncomment following line if you want to disable colors in ls -# export DISABLE_LS_COLORS="true" +# DISABLE_LS_COLORS="true" # Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) # Example format: plugins=(rails git textmate ruby lighthouse) From 06472515e137df32ad2f898962a3ca05c24ad8d0 Mon Sep 17 00:00:00 2001 From: Jarin Udom Date: Mon, 20 Dec 2010 13:51:29 -0800 Subject: [PATCH 019/184] Add superjarin theme that shows current Ruby version via RVM --- themes/superjarin.zsh-theme | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 themes/superjarin.zsh-theme diff --git a/themes/superjarin.zsh-theme b/themes/superjarin.zsh-theme new file mode 100644 index 000000000..16eeb5316 --- /dev/null +++ b/themes/superjarin.zsh-theme @@ -0,0 +1,18 @@ +# Grab the current version of ruby in use (via RVM): [ruby-1.8.7] +JARIN_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[red]%}\$(~/.rvm/bin/rvm-prompt i v)%{$fg[white]%}]%{$reset_color%}" + +# Grab the current filepath, use shortcuts: ~/Desktop +# Append the current git branch, if in a git repository +JARIN_CURRENT_LOCA_="%{$fg_bold[cyan]%}%~\$(git_prompt_info)%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[white]%} <%{$fg[magenta]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" + +# Do nothing if the branch is clean (no changes). +ZSH_THEME_GIT_PROMPT_CLEAN="%{$reset_color%}>" + +# Add a yellow ✗ if the branch is dirty +ZSH_THEME_GIT_PROMPT_DIRTY="%{$reset_color%}> %{$fg[yellow]%}✗" + +# Put it all together! +PROMPT="$JARIN_CURRENT_RUBY_ $JARIN_CURRENT_LOCA_ " + From fcc7801435fd2c5c6defcfbfc736e22341500a9d Mon Sep 17 00:00:00 2001 From: Lorenzo Manacorda Date: Mon, 24 Jan 2011 15:49:49 +0100 Subject: [PATCH 020/184] add missing unrar flag --- lib/functions.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/functions.zsh b/lib/functions.zsh index 914f2ef25..86545c7b6 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -52,7 +52,7 @@ function extract() { *.tar.xz) tar xvJf $1;; *.tar.lzma) tar --lzma -xvf $1;; *.bz2) bunzip $1;; - *.rar) unrar $1;; + *.rar) unrar x $1;; *.gz) gunzip $1;; *.tar) tar xvf $1;; *.tbz2) tar xvjf $1;; From 4b7038f8f46f842df02acdce9b8fb21f6f2b3050 Mon Sep 17 00:00:00 2001 From: Murilo Soares Pereira Date: Tue, 23 Nov 2010 02:05:33 -0200 Subject: [PATCH 021/184] Added my theme. --- themes/murilo.zsh-theme | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 themes/murilo.zsh-theme diff --git a/themes/murilo.zsh-theme b/themes/murilo.zsh-theme new file mode 100644 index 000000000..310357b45 --- /dev/null +++ b/themes/murilo.zsh-theme @@ -0,0 +1,14 @@ +local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" +local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}' +local current_dir='%{$terminfo[bold]$fg[blue]%}%~%{$reset_color%}' +local rvm_ruby='%{$fg[red]%}$(rvm_prompt_info)%{$reset_color%}' +local git_branch='%{$fg[blue]%}$(git_prompt_info)%{$reset_color%}' + +PROMPT="${user_host}:${current_dir} ${rvm_ruby} +${git_branch} %B$%b " +RPS1="${return_code}" + +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 e0ab7f9fb5774381d846cd90d06a501ec91a3ee9 Mon Sep 17 00:00:00 2001 From: Murilo Soares Pereira Date: Wed, 24 Nov 2010 02:22:55 -0200 Subject: [PATCH 022/184] Renamed theme. --- themes/{murilo.zsh-theme => murilasso.zsh-theme} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename themes/{murilo.zsh-theme => murilasso.zsh-theme} (100%) diff --git a/themes/murilo.zsh-theme b/themes/murilasso.zsh-theme similarity index 100% rename from themes/murilo.zsh-theme rename to themes/murilasso.zsh-theme From 7f69551498a78a6b30d706c89808fcd2ba000045 Mon Sep 17 00:00:00 2001 From: Christopher Chow Date: Wed, 23 Feb 2011 02:56:25 +1100 Subject: [PATCH 023/184] Add tab completion for rvm. --- plugins/rvm/_rvm | 147 +++++++++++++++++++++++++++++++++++++ plugins/rvm/rvm.plugin.zsh | 3 + 2 files changed, 150 insertions(+) create mode 100644 plugins/rvm/_rvm create mode 100644 plugins/rvm/rvm.plugin.zsh diff --git a/plugins/rvm/_rvm b/plugins/rvm/_rvm new file mode 100644 index 000000000..bba5304a0 --- /dev/null +++ b/plugins/rvm/_rvm @@ -0,0 +1,147 @@ +#compdef rvm + +local curcontext="$curcontext" state line cmds ret=1 + +_arguments -C \ + '(- 1 *)'{-v,--version}'[display version information]' \ + '(-l|--level)'{-l,--level}'+[patch level to use with rvm use / install]:number' \ + '(--prefix)--prefix[path for all rvm files (~/.rvm/), with trailing slash!]:path:_files' \ + '(--bin)--bin[path for binaries to be placed (~/.rvm/bin/)]:path:_files' \ + '(--source)--source[src directory to use (~/.rvm/src/)]:path:_files' \ + '(--archives)--archives[directory for downladed files (~/.rvm/archives/)]:path:_files' \ + '-S[Specify a script file to attempt to load and run (rubydo)]:file:_files' \ + '-e[Execute code from the command line]:code' \ + '(-G)-G[root gem path to use]:path:_files' \ + '(--gems)--gems[Used to set the gems_flag, use with remove to remove gems]' \ + '(--archive)--archive[Used to set the archive_flag, use with remove to remove archive]' \ + '(--patch)--patch[With MRI Rubies you may specify one or more full paths to patches]' \ + '(-C|--configure)'{-C,--configure}'=[custom configure options]' \ + '(--nice)--nice[process niceness (for slow computers, default 0)]:number' \ + '(--ree)--ree-options[Options passed directly to ree ./installer on the command line]:options' \ + '(--head)--head[with update, updates rvm to git head version]' \ + '(--rubygems)--rubygems[with update, updates rubygems for selected ruby]' \ + '(--default)--default[with ruby select, sets a default ruby for new shells]' \ + '(--debug)--debug[Toggle debug mode on for very verbose output]' \ + '(--trace)--trace[Toggle trace mode on to see EVERYTHING rvm is doing]' \ + '(--force)--force[Force install, removes old install & source before install]' \ + '(--summary)--summary[Used with rubydo to print out a summary of the commands run]' \ + '(--latest)--latest[with gemset --dump skips version strings for latest gem]' \ + '(--gems)--gems[with uninstall/remove removes gems with the interpreter]' \ + '(--docs)--docs[with install, attempt to generate ri after installation]' \ + '(--reconfigure)--reconfigure[Force ./configure on install even if Makefile already exists]' \ + '1: :->cmds' \ + '*: :->args' && ret=0 + +case $state in + cmds) + cmds=( + "version:show the rvm version installed in rvm_path" + "use:setup current shell to use a specific ruby version" + "reload:reload rvm source itself (useful after changing rvm source)" + "implode:(seppuku) removes the rvm installation completely. This means everything in $rvm_path (~/.rvm)." + "update:upgrades rvm to the latest version." + "reset:remove current and stored default & system settings." + "info :show the *current* environment information for current ruby" + "current:print the *current* ruby version and the name of any gemset being used." + "debug:show info plus additional information for common issues" + "install:install one or many ruby versions" + "uninstall:uninstall one or many ruby versions, leaves their sources" + "remove:uninstall one or many ruby versions and remove their sources" + "migrate:Lets you migrate all gemsets from one ruby to another." + "upgrade:Lets you upgrade from one version of a ruby to another, including migrating your gemsets semi-automatically." + "wrapper:generates a set of wrapper executables for a given ruby with the specified ruby and gemset combination. Used under the hood for passenger support and the like." + "cleanup:Lets you remove stale source folders / archives and other miscellaneous data associated with rvm." + "repair:Lets you repair parts of your environment e.g. wrappers, env files and and similar files (e.g. general maintenance)." + "snapshot:Lets your backup / restore an rvm installation in a lightweight manner." + "disk-usage:Tells you how much disk space rvm install is using." + "tools:Provides general information about the ruby environment, primarily useful when scripting rvm." + "docs:Tools to make installing ri and rdoc documentation easier." + "rvmrc:Tools related to managing rvmrc trust and loading." + "exec:runs an arbitrary command as a set operation." + "ruby:runs a named ruby file against specified and/or all rubies" + "gem:runs a gem command using selected ruby's 'gem'" + "rake:runs a rake task against specified and/or all rubies" + "tests:runs 'rake test' across selected ruby versions" + "specs:runs 'rake spec' across selected ruby versions" + "monitor:Monitor cwd for testing, run rake {spec,test} on changes." + "gemset:gemsets: http://rvm.beginrescueend.com/gemsets/" + "rubygems:Switches the installed version of rubygems for the current ruby." + "gemdir:display the path to the current gem directory (GEM_HOME)." + "srcdir:display the path to rvm source directory (may be yanked)" + "fetch:Performs an archive / src fetch only of the selected ruby." + "list:show currently installed rubies, interactive output." + "package:Install a dependency package {readline,iconv,zlib,openssl}" + "notes:Display notes, with operating system specifics." + "export:Temporarily set an environment variable in the current shell." + "unexport:Undo changes made to the environment by 'rvm export'." + ) + _describe -t commands 'rvm command' cmds && ret=0 + ;; + args) + case $line[1] in + (use|uninstall|remove|list) + _values -S , 'rubies' $(rvm list strings | sed -e 's/ruby-\([^) ]*\)-\([^) ]*\)/ruby-\1-\2 \1-\2 \1/g') default system && ret=0 + ;; + (install|fetch) + _values -S , 'rubies' $(rvm list known_strings) && ret=0 + ;; + gemset) + if (( CURRENT == 3 )); then + _values 'gemset_commands' \ + 'import' \ + 'export' \ + 'create' \ + 'copy' \ + 'rename' \ + 'empty' \ + 'delete' \ + 'name' \ + 'dir' \ + 'list' \ + 'list_all' \ + 'gemdir' \ + 'install' \ + 'pristine' \ + 'clear' \ + 'use' \ + 'update' \ + 'unpack' \ + 'globalcache' + else + _values -S , 'gemsets' $(rvm gemset list | grep -v gemset 2>/dev/null) + fi + ret=0 + ;; + package) + if (( CURRENT == 3 )); then + _values 'package_commands' \ + 'install' \ + 'uninstall' + else + _values 'packages' \ + 'readline' \ + 'iconv' \ + 'curl' \ + 'openssl' \ + 'zlib' \ + 'autoconf' \ + 'ncurses' \ + 'pkgconfig' \ + 'gettext' \ + 'glib' \ + 'mono' \ + 'llvm' \ + 'libxml2' \ + 'libxslt' \ + 'libyaml' + fi + ret=0 + ;; + *) + (( ret )) && _message 'no more arguments' + ;; + esac + ;; +esac + +return ret diff --git a/plugins/rvm/rvm.plugin.zsh b/plugins/rvm/rvm.plugin.zsh new file mode 100644 index 000000000..ef934d547 --- /dev/null +++ b/plugins/rvm/rvm.plugin.zsh @@ -0,0 +1,3 @@ +fpath=($ZSH/plugins/rvm $fpath) +autoload -U compinit +compinit -i From 7cc4ab9b3f79ed2e56c8bebeb6fbd4b870b53de2 Mon Sep 17 00:00:00 2001 From: James Frasca Date: Thu, 17 Mar 2011 11:22:51 -0700 Subject: [PATCH 024/184] Added the Frisk theme --- themes/frisk.zsh-theme | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 themes/frisk.zsh-theme diff --git a/themes/frisk.zsh-theme b/themes/frisk.zsh-theme new file mode 100644 index 000000000..f181aec90 --- /dev/null +++ b/themes/frisk.zsh-theme @@ -0,0 +1,10 @@ +PROMPT=$' +%{$fg[blue]%}%/%{$reset_color%} $(git_prompt_info)%{$fg[white]%}[%n@%m]%{$reset_color%} %{$fg[white]%}[%T]%{$reset_color%} +%{$fg_bold[black]%}>%{$reset_color%} ' + +PROMPT2="%{$fg_blod[black]%}%_> %{$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 4facba9824b7c3d0115c5f66e5b1517bd5674027 Mon Sep 17 00:00:00 2001 From: Joakim Ekberg Date: Thu, 17 Mar 2011 22:29:58 +0100 Subject: [PATCH 025/184] Added terminal party theme. --- themes/terminalparty.zsh-theme | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 themes/terminalparty.zsh-theme diff --git a/themes/terminalparty.zsh-theme b/themes/terminalparty.zsh-theme new file mode 100644 index 000000000..73653aca8 --- /dev/null +++ b/themes/terminalparty.zsh-theme @@ -0,0 +1,9 @@ +PROMPT='%{$fg[green]%} %% ' +# RPS1='%{$fg[blue]%}%~%{$reset_color%} ' +RPS1='%{$fg[white]%}%2~$(git_prompt_info) %{$fg_bold[blue]%}%m%{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX=" (%{$fg[yellow]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%} ⚡%{$fg[yellow]%}" + From d03a6176aacd583993c02c7e837d10751c431875 Mon Sep 17 00:00:00 2001 From: Sankara Rameswaran Date: Wed, 2 Mar 2011 15:20:43 +0530 Subject: [PATCH 026/184] Lein completion --- plugins/lein/lein.plugin.zsh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 plugins/lein/lein.plugin.zsh diff --git a/plugins/lein/lein.plugin.zsh b/plugins/lein/lein.plugin.zsh new file mode 100644 index 000000000..19af3556a --- /dev/null +++ b/plugins/lein/lein.plugin.zsh @@ -0,0 +1,27 @@ +function _lein_commands() { + local ret=1 state + _arguments ':subcommand:->subcommand' && ret=0 + + case $state in + subcommand) + subcommands=( + "clean:remove compiled files and dependencies from project" + "compile:ahead-of-time compile the project" + "deps:download and install all dependencies" + "help:display a list of tasks or help for a given task" + "install:install the project and its dependencies in your local repository" + "jar:create a jar file containing the compiled .class files" + "new:create a new project skeleton" + "pom:write a pom.xml file to disk for maven interop" + "test:run the project's tests" + "uberjar:Create a jar including the contents of each of deps" + "upgrade:upgrade leiningen to the latest stable release" + "version:print leiningen's version" + ) + _describe -t subcommands 'leiningen subcommands' subcommands && ret=0 + esac + + return ret +} + +compdef _lein_commands lein From 06063ab695ecfe6fa7737511a070b24412ee1b2a Mon Sep 17 00:00:00 2001 From: Lorrin Nelson Date: Wed, 23 Mar 2011 21:20:08 -0700 Subject: [PATCH 027/184] Introduce DISABLE_AUTO_TITLE option --- lib/termsupport.zsh | 10 +++++++--- templates/zshrc.zsh-template | 3 +++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index e1e536690..b250833ed 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -16,11 +16,15 @@ ZSH_THEME_TERM_TITLE_IDLE="%n@%m: %~" #Appears when you have the prompt function precmd { - title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE + if [ "$DISABLE_AUTO_TITLE" != "true" ]; then + title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE + fi } #Appears at the beginning of (and during) of command execution function preexec { - local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd - title "$CMD" "%100>...>$2%<<" + if [ "$DISABLE_AUTO_TITLE" != "true" ]; then + local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd + title "$CMD" "%100>...>$2%<<" + fi } diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template index 8022b3506..506daa9a2 100644 --- a/templates/zshrc.zsh-template +++ b/templates/zshrc.zsh-template @@ -14,6 +14,9 @@ export ZSH_THEME="robbyrussell" # Uncomment following line if you want to disable colors in ls # export DISABLE_LS_COLORS="true" +# Uncomment following line if you want to disable autosetting terminal title. +# export DISABLE_AUTO_TITLE="true" + # Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) # Example format: plugins=(rails git textmate ruby lighthouse) plugins=(git) From 2497c57976b1e5002ebecd7ffa5c35bc87ada903 Mon Sep 17 00:00:00 2001 From: Simon Elsbrock Date: Thu, 24 Mar 2011 09:47:48 +0100 Subject: [PATCH 028/184] fixed wget command in readme github uses a wildcard certificate which is not accepted by wget --- README.textile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.textile b/README.textile index 0659aded8..86d2652bb 100644 --- a/README.textile +++ b/README.textile @@ -8,7 +8,7 @@ h2. Setup h3. The automatic installer... (do you trust me?) -@wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh@ +@wget --no-check-certificate https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh@ h3. The manual way @@ -66,4 +66,4 @@ I'm far from being a zsh-expert and suspect there are many ways to improve. If y h3. Send us your theme! -I'm hoping to collect a bunch of themes for our command prompts. You can see existing ones in the @themes/@ directory. \ No newline at end of file +I'm hoping to collect a bunch of themes for our command prompts. You can see existing ones in the @themes/@ directory. From d5ce689a0c10f71967dcc163cd66ef9bd2778416 Mon Sep 17 00:00:00 2001 From: Daniel Wehner Date: Sat, 26 Mar 2011 15:06:30 +0100 Subject: [PATCH 029/184] Add a plugin to support kate the kde texteditor --- plugins/kate/kate.plugin.zsh | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 plugins/kate/kate.plugin.zsh diff --git a/plugins/kate/kate.plugin.zsh b/plugins/kate/kate.plugin.zsh new file mode 100644 index 000000000..eb16522ac --- /dev/null +++ b/plugins/kate/kate.plugin.zsh @@ -0,0 +1,9 @@ + +# Kate +# Start kate always silent +alias kate='kate >/dev/null 2>&1' + +function kt () { + cd $1 + kate $1 +} \ No newline at end of file From 16f9dfb3aa6d301d4345df9af017bd6982273919 Mon Sep 17 00:00:00 2001 From: "Matthew M. Nelson" Date: Thu, 31 Mar 2011 13:51:29 -0500 Subject: [PATCH 030/184] Adding dogenpunk theme --- themes/dogenpunk.zsh-theme | 85 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 themes/dogenpunk.zsh-theme diff --git a/themes/dogenpunk.zsh-theme b/themes/dogenpunk.zsh-theme new file mode 100644 index 000000000..f4d65ab74 --- /dev/null +++ b/themes/dogenpunk.zsh-theme @@ -0,0 +1,85 @@ +# ----------------------------------------------------------------------------- +# FILE: dogenpunk.zsh-theme +# DESCRIPTION: oh-my-zsh theme file. +# AUTHOR: Matthew Nelson (dogenpunk@gmail.com) +# VERSION: 0.1 +# SCREENSHOT: coming soon +# ----------------------------------------------------------------------------- + +MODE_INDICATOR="%{$fg_bold[red]%}❮%{$reset_color%}%{$fg[red]%}❮❮%{$reset_color%}" +local return_status="%{$fg[red]%}%(?..⏎)%{$reset_color%}" + +PROMPT='%{$fg[blue]%}%m%{$reset_color%}%{$fg_bold[white]%} ओम् %{$reset_color%}%{$fg[cyan]%}%~:%{$reset_color%}$(git_time_since_commit)$(git_prompt_info) +%{$fg[red]%}%!%{$reset_color%} $(prompt_char) ' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[green]%}git%{$reset_color%}@%{$bg[white]%}%{$fg[black]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%})" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}!%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="" + +RPROMPT='${return_status}$(git_prompt_status)%{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} ✚" +ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} ✹" +ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖" +ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜" +ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭" + +function prompt_char() { + git branch >/dev/null 2>/dev/null && echo "%{$fg[green]%}±%{$reset_color%}" && return + hg root >/dev/null 2>/dev/null && echo "%{$fg_bold[red]%}☿%{$reset_color%}" && return + echo "%{$fg[cyan]%}◯ %{$reset_color%}" +} + +# 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[cyan]%}" + +# 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 [[ -n $(git status -s 2> /dev/null) ]]; then + if [ "$MINUTES" -gt 30 ]; then + COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG" + elif [ "$MINUTES" -gt 10 ]; then + COLOR="$ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM" + else + COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT" + fi + else + COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL" + fi + + if [ "$HOURS" -gt 24 ]; then + echo "($COLOR${DAYS}d${SUB_HOURS}h${SUB_MINUTES}m%{$reset_color%}|" + elif [ "$MINUTES" -gt 60 ]; then + echo "($COLOR${HOURS}h${SUB_MINUTES}m%{$reset_color%}|" + else + echo "($COLOR${MINUTES}m%{$reset_color%}|" + fi + else + COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL" + echo "($COLOR~|" + fi + fi +} From 57f55e69ed967e93c0fd44a6a7e470781eb38029 Mon Sep 17 00:00:00 2001 From: Jakub Nawalaniec Date: Sun, 3 Apr 2011 13:50:05 +0200 Subject: [PATCH 031/184] Zsh will now complete git aliases with git stuff --- plugins/git/git.plugin.zsh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 71a62819b..fc4e56fac 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -1,19 +1,34 @@ # Aliases alias g='git' +compdef g=git alias gst='git status' +compdef gst=git alias gl='git pull' +compdef gl=git alias gup='git fetch && git rebase' +compdef gup=git alias gp='git push' +compdef gp=git alias gd='git diff | mate' +compdef gd=git alias gdv='git diff -w "$@" | vim -R -' +compdef gdv=git alias gc='git commit -v' +compdef gc=git alias gca='git commit -v -a' +compdef gca=git alias gco='git checkout' +compdef gco=git alias gb='git branch' +compdef gb=git alias gba='git branch -a' +compdef gba=git alias gcount='git shortlog -sn' +compdef gcount=git alias gcp='git cherry-pick' +compdef gcp=git alias glg='git log --stat --max-count=5' +compdef glg=git # Git and svn mix alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk' @@ -29,5 +44,8 @@ function current_branch() { # these aliases take advantage of the previous function alias ggpull='git pull origin $(current_branch)' +compdef ggpull=git 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 From 2e9492969b0ea90932ad3f4298330b75ef8cf2ce Mon Sep 17 00:00:00 2001 From: Jakub Nawalaniec Date: Sun, 3 Apr 2011 15:43:39 +0200 Subject: [PATCH 032/184] Completions are git subdommand-aware now --- plugins/git/git.plugin.zsh | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index fc4e56fac..8470c28a4 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -2,15 +2,16 @@ alias g='git' compdef g=git alias gst='git status' -compdef gst=git +compdef _git gst=git-status alias gl='git pull' -compdef gl=git +compdef _git gl=git-pull alias gup='git fetch && git rebase' compdef gup=git alias gp='git push' -compdef gp=git +compdef _git gp=git-push alias gd='git diff | mate' -compdef gd=git +# WTF is mate?? +compdef _git gd=git-diff alias gdv='git diff -w "$@" | vim -R -' compdef gdv=git alias gc='git commit -v' @@ -18,20 +19,21 @@ compdef gc=git alias gca='git commit -v -a' compdef gca=git alias gco='git checkout' -compdef gco=git +compdef _git gco=git-checkout alias gb='git branch' -compdef gb=git +compdef _git gb=git-branch alias gba='git branch -a' compdef gba=git alias gcount='git shortlog -sn' compdef gcount=git alias gcp='git cherry-pick' -compdef gcp=git +compdef _git gcp=git-cherry-pick alias glg='git log --stat --max-count=5' -compdef glg=git +compdef _git glg=git-log # Git and svn mix alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk' +compdef git-svn-dcommit-push=git # # Will return the current branch name From 4cd4167c8d988656eed4896d6d1343e311ce078c Mon Sep 17 00:00:00 2001 From: Jakub Nawalaniec Date: Sun, 3 Apr 2011 21:28:19 +0200 Subject: [PATCH 033/184] Further git completion improovements In detail: gup - now completes with remotes like git fetch would gdv - got git diff completions gc/gca - now zsh will suggest files in staging area gba - suggestions as for git branch --- plugins/git/git.plugin.zsh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 8470c28a4..9fe7a6467 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -6,24 +6,24 @@ compdef _git gst=git-status alias gl='git pull' compdef _git gl=git-pull alias gup='git fetch && git rebase' -compdef gup=git +compdef _git gup=git-fetch alias gp='git push' compdef _git gp=git-push alias gd='git diff | mate' # WTF is mate?? compdef _git gd=git-diff alias gdv='git diff -w "$@" | vim -R -' -compdef gdv=git +compdef _git gdv=git-diff alias gc='git commit -v' -compdef gc=git +compdef _git gc=git-commit alias gca='git commit -v -a' -compdef gca=git +compdef _git gca=git-commit alias gco='git checkout' compdef _git gco=git-checkout alias gb='git branch' compdef _git gb=git-branch alias gba='git branch -a' -compdef gba=git +compdef _git gba=git-branch alias gcount='git shortlog -sn' compdef gcount=git alias gcp='git cherry-pick' From d138751cbd721bf7036e88cb1a2bafc9ebb87366 Mon Sep 17 00:00:00 2001 From: "Renaud (Nel) Morvan" Date: Mon, 4 Apr 2011 13:30:39 +0200 Subject: [PATCH 034/184] Escape characters used in escape sequence to avoid triggering bugs in Apple Terminal Closes #45 #57 #58 #86. --- lib/termsupport.zsh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index b250833ed..494ef8923 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -4,10 +4,10 @@ #Limited support for Apple Terminal (Terminal can't set window or tab separately) function title { if [[ "$TERM" == "screen" ]]; then - print -Pn "\ek$1\e\\" #set screen hardstatus, usually truncated at 20 chars + print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars elif [[ ($TERM =~ "^xterm") ]] || [[ ($TERM == "rxvt") ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then - print -Pn "\e]2;$2\a" #set window name - print -Pn "\e]1;$1\a" #set icon (=tab) name (will override window name on broken terminal) + 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 a3e92892bbc95acc270d93b45be05c55348da55c Mon Sep 17 00:00:00 2001 From: "Renaud (Nel) Morvan" Date: Mon, 4 Apr 2011 13:44:48 +0200 Subject: [PATCH 035/184] Command title behavior no longer depend on local zsh configuration Fix by derekjw. closes #52. --- lib/termsupport.zsh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index 494ef8923..42bbb9ef2 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -3,7 +3,7 @@ #Fully support screen, iterm, and probably most modern xterm and rxvt #Limited support for Apple Terminal (Terminal can't set window or tab separately) function title { - if [[ "$TERM" == "screen" ]]; then + 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 print -Pn "\e]2;$2:q\a" #set window name @@ -24,6 +24,8 @@ function precmd { #Appears at the beginning of (and during) of command execution function preexec { if [ "$DISABLE_AUTO_TITLE" != "true" ]; then + emulate -L zsh + setopt extended_glob local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd title "$CMD" "%100>...>$2%<<" fi From 0cc0915bf83c1915575182d1287abfc6dd3e6f3c Mon Sep 17 00:00:00 2001 From: "Renaud (Nel) Morvan" Date: Mon, 4 Apr 2011 14:02:50 +0200 Subject: [PATCH 036/184] Refactor DISABLE_AUTO_TITLE to be more DRY --- lib/termsupport.zsh | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index 42bbb9ef2..3152751e4 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -3,6 +3,7 @@ #Fully support screen, iterm, and probably most modern xterm and rxvt #Limited support for Apple Terminal (Terminal can't set window or tab separately) function title { + [ "$DISABLE_AUTO_TITLE" != "true" ] || return 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 @@ -16,17 +17,13 @@ ZSH_THEME_TERM_TITLE_IDLE="%n@%m: %~" #Appears when you have the prompt function precmd { - if [ "$DISABLE_AUTO_TITLE" != "true" ]; then - title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE - fi + title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE } #Appears at the beginning of (and during) of command execution function preexec { - if [ "$DISABLE_AUTO_TITLE" != "true" ]; then - emulate -L zsh - setopt extended_glob - local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd - title "$CMD" "%100>...>$2%<<" - fi + emulate -L zsh + setopt extended_glob + local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd + title "$CMD" "%100>...>$2%<<" } From 993e05da50543b9c2dcc5e4fedb93afd1c8b020c Mon Sep 17 00:00:00 2001 From: Pat Regan Date: Fri, 8 Apr 2011 10:12:22 -0400 Subject: [PATCH 037/184] Replace redundant calls to compinit with a single call. --- lib/completion.zsh | 3 --- lib/key-bindings.zsh | 2 -- oh-my-zsh.sh | 4 ++++ plugins/brew/brew.plugin.zsh | 2 -- plugins/cpanm/cpanm.plugin.zsh | 2 -- plugins/gem/gem.plugin.zsh | 2 -- plugins/github/github.plugin.zsh | 2 -- plugins/macports/macports.plugin.zsh | 2 -- plugins/pip/pip.plugin.zsh | 2 -- plugins/vagrant/vagrant.plugin.zsh | 2 -- 10 files changed, 4 insertions(+), 19 deletions(-) diff --git a/lib/completion.zsh b/lib/completion.zsh index e8e9776a5..3c5a41e14 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -9,9 +9,6 @@ setopt always_to_end WORDCHARS='' -autoload -U compinit -compinit -i - zmodload -i zsh/complist ## case-insensitive (all),partial-word and then substring completion diff --git a/lib/key-bindings.zsh b/lib/key-bindings.zsh index 7196a88ff..c7ad907d7 100644 --- a/lib/key-bindings.zsh +++ b/lib/key-bindings.zsh @@ -1,6 +1,4 @@ # TODO: Explain what some of this does.. -autoload -U compinit -compinit -i bindkey -e bindkey '\ew' kill-region diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 291772dfe..805e92428 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -17,6 +17,10 @@ for plugin ($plugins) source $ZSH/plugins/$plugin/$plugin.plugin.zsh # Load the theme source "$ZSH/themes/$ZSH_THEME.zsh-theme" +# Load and run compinit +autoload -U compinit +compinit -i + # Check for updates on initial load... if [ "$DISABLE_AUTO_UPDATE" = "true" ] then diff --git a/plugins/brew/brew.plugin.zsh b/plugins/brew/brew.plugin.zsh index 353a18942..079c0fba0 100644 --- a/plugins/brew/brew.plugin.zsh +++ b/plugins/brew/brew.plugin.zsh @@ -1,4 +1,2 @@ # add brew completion function to path fpath=($ZSH/plugins/brew $fpath) -autoload -U compinit -compinit -i diff --git a/plugins/cpanm/cpanm.plugin.zsh b/plugins/cpanm/cpanm.plugin.zsh index af52d3e8b..8425b5ad8 100644 --- a/plugins/cpanm/cpanm.plugin.zsh +++ b/plugins/cpanm/cpanm.plugin.zsh @@ -1,4 +1,2 @@ # add cpanm completion function to path fpath=($ZSH/plugins/cpanm $fpath) -autoload -U compinit -compinit -i diff --git a/plugins/gem/gem.plugin.zsh b/plugins/gem/gem.plugin.zsh index d4e5c6584..cdfad7ad6 100644 --- a/plugins/gem/gem.plugin.zsh +++ b/plugins/gem/gem.plugin.zsh @@ -1,4 +1,2 @@ # add gem completion function to path fpath=($ZSH/plugins/gem $fpath) -autoload -U compinit -compinit -i diff --git a/plugins/github/github.plugin.zsh b/plugins/github/github.plugin.zsh index c23504b85..0858783cc 100644 --- a/plugins/github/github.plugin.zsh +++ b/plugins/github/github.plugin.zsh @@ -1,4 +1,2 @@ # add github completion function to path fpath=($ZSH/plugins/github $fpath) -autoload -U compinit -compinit -i diff --git a/plugins/macports/macports.plugin.zsh b/plugins/macports/macports.plugin.zsh index cbbc49265..492a665b5 100644 --- a/plugins/macports/macports.plugin.zsh +++ b/plugins/macports/macports.plugin.zsh @@ -8,5 +8,3 @@ alias pup="psu && puo" # add macports completion function to path fpath=($ZSH/plugins/macports $fpath) -autoload -U compinit -compinit -i diff --git a/plugins/pip/pip.plugin.zsh b/plugins/pip/pip.plugin.zsh index bf9f23968..740f96207 100644 --- a/plugins/pip/pip.plugin.zsh +++ b/plugins/pip/pip.plugin.zsh @@ -1,4 +1,2 @@ # add brew completion function to path fpath=($ZSH/plugins/pip $fpath) -autoload -U compinit -compinit -i diff --git a/plugins/vagrant/vagrant.plugin.zsh b/plugins/vagrant/vagrant.plugin.zsh index 5e9bcf10a..98d2d705c 100644 --- a/plugins/vagrant/vagrant.plugin.zsh +++ b/plugins/vagrant/vagrant.plugin.zsh @@ -1,3 +1 @@ fpath=($ZSH/plugins/vagrant $fpath) -autoload -U compinit -compinit -i From ef4175981b78ca6ef24f7776ab213f3b71488472 Mon Sep 17 00:00:00 2001 From: Pat Regan Date: Fri, 8 Apr 2011 11:10:14 -0400 Subject: [PATCH 038/184] Moved the single compinit call from oh-my-zsh.sh to lib/completion.zsh --- lib/completion.zsh | 4 ++++ oh-my-zsh.sh | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/completion.zsh b/lib/completion.zsh index 3c5a41e14..21735e7e9 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -60,3 +60,7 @@ zstyle ':completion:*:*:*:users' ignored-patterns \ # ... unless we really want to. zstyle '*' single-ignored show +# Load and run compinit +autoload -U compinit +compinit -i + diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 805e92428..3970a497e 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -18,8 +18,8 @@ for plugin ($plugins) source $ZSH/plugins/$plugin/$plugin.plugin.zsh source "$ZSH/themes/$ZSH_THEME.zsh-theme" # Load and run compinit -autoload -U compinit -compinit -i +#autoload -U compinit +#compinit -i # Check for updates on initial load... if [ "$DISABLE_AUTO_UPDATE" = "true" ] From 235733e5e224539cf5002a02694d021902fd9550 Mon Sep 17 00:00:00 2001 From: Pat Regan Date: Fri, 8 Apr 2011 11:12:21 -0400 Subject: [PATCH 039/184] Removed commented out code. --- oh-my-zsh.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 3970a497e..291772dfe 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -17,10 +17,6 @@ for plugin ($plugins) source $ZSH/plugins/$plugin/$plugin.plugin.zsh # Load the theme source "$ZSH/themes/$ZSH_THEME.zsh-theme" -# Load and run compinit -#autoload -U compinit -#compinit -i - # Check for updates on initial load... if [ "$DISABLE_AUTO_UPDATE" = "true" ] then From 91e4f3d667cc04148fafc4675174424daf5f6b5a Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Mon, 4 Apr 2011 00:54:43 +0200 Subject: [PATCH 040/184] Fix `gdv`: make it a function, and use `view`. I've changed it to use `view` instead of `vim -R` to make it hopefully more editor-agnostic. --- 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 8470c28a4..b21c6a8e0 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -12,7 +12,7 @@ compdef _git gp=git-push alias gd='git diff | mate' # WTF is mate?? compdef _git gd=git-diff -alias gdv='git diff -w "$@" | vim -R -' +gdv() { git diff -w "$@" | view - } compdef gdv=git alias gc='git commit -v' compdef gc=git From b3a78d2b287cc9789d1c791a91448c40dcab2e23 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Tue, 12 Apr 2011 10:19:15 +0200 Subject: [PATCH 041/184] Using git-diff instead of git diff --- 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 85eabced0..bc340e86b 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -9,7 +9,7 @@ alias gup='git fetch && git rebase' compdef _git gup=git-fetch alias gp='git push' compdef _git gp=git-push -gdv() { git diff -w "$@" | view - } +gdv() { git-diff -w "$@" | view - } compdef _git gdv=git-diff alias gc='git commit -v' compdef _git gc=git-commit From f9282283822771a7f471547569de481a66a70b0f Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sun, 20 Mar 2011 16:29:00 -0400 Subject: [PATCH 042/184] Added npm plugin. --- plugins/npm/_npm | 19 +++++++++++++++++++ plugins/npm/npm.plugin.zsh | 4 ++++ 2 files changed, 23 insertions(+) create mode 100644 plugins/npm/_npm create mode 100644 plugins/npm/npm.plugin.zsh diff --git a/plugins/npm/_npm b/plugins/npm/_npm new file mode 100644 index 000000000..24b536188 --- /dev/null +++ b/plugins/npm/_npm @@ -0,0 +1,19 @@ +#compdef npm + +# Node Package Manager 0.3.15 completion, letting npm do all the completion work + +_npm() { + compadd -- $(_npm_complete $words) +} + +# We want to show all errors of any substance, but never the "npm (not )ok" one. +# (Also doesn't consider "ERR! no match found" worth breaking the terminal for.) +_npm_complete() { + local ask_npm + ask_npm=(npm completion --color false --loglevel error -- $@) + { _call_program npm $ask_npm 2>&1 >&3 \ + | egrep -v '^(npm (not |)ok|ERR! no match found)$' >&2; \ + } 3>&1 +} + +_npm "$@" diff --git a/plugins/npm/npm.plugin.zsh b/plugins/npm/npm.plugin.zsh new file mode 100644 index 000000000..826f0f7b0 --- /dev/null +++ b/plugins/npm/npm.plugin.zsh @@ -0,0 +1,4 @@ +# add npm completion function to path +fpath=($ZSH/plugins/npm $fpath) +autoload -U compinit +compinit -i From 8883ace767997d1a629c165780af303f715ee78d Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Tue, 12 Apr 2011 10:24:06 +0200 Subject: [PATCH 043/184] Revert "Enable alias completion, do not limit completion to just files" This reverts commit c3a58b00040018743ead1e6672910433fc1ca7c2. --- lib/completion.zsh | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/completion.zsh b/lib/completion.zsh index e8e9776a5..9c2dfecca 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -4,7 +4,6 @@ unsetopt menu_complete # do not autoselect the first completion entry unsetopt flowcontrol setopt auto_menu # show completion menu on succesive tab press setopt complete_in_word -setopt complete_aliases setopt always_to_end WORDCHARS='' From 0447a0ec11ad56d24ad391e9149c8d7e0429b205 Mon Sep 17 00:00:00 2001 From: Theodore Robert Campbell Jr Date: Tue, 1 Mar 2011 01:04:10 -0500 Subject: [PATCH 044/184] added hub plugin from defunkt --- plugins/hub/hub.plugin.zsh | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 plugins/hub/hub.plugin.zsh diff --git a/plugins/hub/hub.plugin.zsh b/plugins/hub/hub.plugin.zsh new file mode 100644 index 000000000..e82a0ec25 --- /dev/null +++ b/plugins/hub/hub.plugin.zsh @@ -0,0 +1,5 @@ +# hub alias from defunkt +# https://github.com/defunkt/hub +if [ $( which hub > /dev/null 2>&1 ; echo -n $? ) -lt 1 ]; then + eval $( hub alias -s $( ps -o comm= -p $$ ) ) +fi From 8ed33a8ccc5e926e84bf522951ecf80e97e2a8e6 Mon Sep 17 00:00:00 2001 From: Theodore Robert Campbell Jr Date: Tue, 1 Mar 2011 21:34:25 -0500 Subject: [PATCH 045/184] no need for an extra fork --- plugins/hub/hub.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/hub/hub.plugin.zsh b/plugins/hub/hub.plugin.zsh index e82a0ec25..9f95c6361 100644 --- a/plugins/hub/hub.plugin.zsh +++ b/plugins/hub/hub.plugin.zsh @@ -1,5 +1,5 @@ # hub alias from defunkt # https://github.com/defunkt/hub if [ $( which hub > /dev/null 2>&1 ; echo -n $? ) -lt 1 ]; then - eval $( hub alias -s $( ps -o comm= -p $$ ) ) + eval $( hub alias -s zsh ) fi From 2717e147b303beef0f84e6dfbb2db562c8fc6740 Mon Sep 17 00:00:00 2001 From: Theodore Robert Campbell Jr Date: Wed, 2 Mar 2011 20:00:40 -0500 Subject: [PATCH 046/184] blueyed's ZSH-fu is much stronger than mine. --- plugins/hub/hub.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/hub/hub.plugin.zsh b/plugins/hub/hub.plugin.zsh index 9f95c6361..48e1fa4ad 100644 --- a/plugins/hub/hub.plugin.zsh +++ b/plugins/hub/hub.plugin.zsh @@ -1,5 +1,5 @@ # hub alias from defunkt # https://github.com/defunkt/hub -if [ $( which hub > /dev/null 2>&1 ; echo -n $? ) -lt 1 ]; then - eval $( hub alias -s zsh ) +if which hub > /dev/null; then + eval $(hub alias -s zsh) fi From 277057cb6399769340d41bba9421464c58742026 Mon Sep 17 00:00:00 2001 From: Theodore Robert Campbell Jr Date: Thu, 3 Mar 2011 21:36:35 -0500 Subject: [PATCH 047/184] Moved this to the existing github plugin --- plugins/hub/hub.plugin.zsh | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 plugins/hub/hub.plugin.zsh diff --git a/plugins/hub/hub.plugin.zsh b/plugins/hub/hub.plugin.zsh deleted file mode 100644 index 48e1fa4ad..000000000 --- a/plugins/hub/hub.plugin.zsh +++ /dev/null @@ -1,5 +0,0 @@ -# hub alias from defunkt -# https://github.com/defunkt/hub -if which hub > /dev/null; then - eval $(hub alias -s zsh) -fi From 9406ae7929bc1d3a063b65e7559a28268aaf0a7a Mon Sep 17 00:00:00 2001 From: Theodore Robert Campbell Jr Date: Thu, 3 Mar 2011 21:38:56 -0500 Subject: [PATCH 048/184] Whoops, this was supposed to be in the last commit! --- plugins/github/github.plugin.zsh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/github/github.plugin.zsh b/plugins/github/github.plugin.zsh index c23504b85..72e9b07b9 100644 --- a/plugins/github/github.plugin.zsh +++ b/plugins/github/github.plugin.zsh @@ -1,3 +1,9 @@ +# hub alias from defunkt +# https://github.com/defunkt/hub +if which hub > /dev/null; then + eval $(hub alias -s zsh) +fi + # add github completion function to path fpath=($ZSH/plugins/github $fpath) autoload -U compinit From f0922006aba68e485480a81d83ba53b201270a69 Mon Sep 17 00:00:00 2001 From: Theodore Robert Campbell Jr Date: Sat, 19 Mar 2011 10:29:22 -0400 Subject: [PATCH 049/184] changes recommended by blueyed --- plugins/github/github.plugin.zsh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/github/github.plugin.zsh b/plugins/github/github.plugin.zsh index 72e9b07b9..8d4580654 100644 --- a/plugins/github/github.plugin.zsh +++ b/plugins/github/github.plugin.zsh @@ -1,7 +1,8 @@ # hub alias from defunkt # https://github.com/defunkt/hub -if which hub > /dev/null; then - eval $(hub alias -s zsh) +if [ "$commands[(I)hub]" ]; then + # eval `hub alias -s zsh` + function git(){hub "$@"} fi # add github completion function to path From 7d71148490511ae2ef849a9d95de07ec4a751121 Mon Sep 17 00:00:00 2001 From: Dmitry Maksimov Date: Sat, 26 Feb 2011 10:04:45 +0300 Subject: [PATCH 050/184] kolo.zsh-theme --- themes/kolo.zsh-theme | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 themes/kolo.zsh-theme diff --git a/themes/kolo.zsh-theme b/themes/kolo.zsh-theme new file mode 100644 index 000000000..6e04e1595 --- /dev/null +++ b/themes/kolo.zsh-theme @@ -0,0 +1,21 @@ +autoload -U colors && colors + +autoload -Uz vcs_info + +zstyle ':vcs_info:*' stagedstr '%F{green}●' +zstyle ':vcs_info:*' unstagedstr '%F{yellow}●' +zstyle ':vcs_info:*' check-for-changes true +zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{11}%r' +zstyle ':vcs_info:*' enable git svn +precmd () { + if [[ -z $(git ls-files --other --exclude-standard 2> /dev/null) ]] { + zstyle ':vcs_info:*' formats ' [%b%c%u%B%F{green}]' + } else { + zstyle ':vcs_info:*' formats ' [%b%c%u%B%F{red}●%F{green}]' + } + + vcs_info +} + +setopt prompt_subst +PROMPT='%B%F{magenta}%c%B%F{green}${vcs_info_msg_0_}%B%F{magenta} %{$reset_color%}%% ' From 849e2834fb1e4fe27a0b5f997733fd2ae4d8f9b7 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Tue, 12 Apr 2011 10:36:45 +0200 Subject: [PATCH 051/184] Updating the README... now links to contributors page --- README.textile | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/README.textile b/README.textile index 86d2652bb..d01c3310a 100644 --- a/README.textile +++ b/README.textile @@ -54,12 +54,6 @@ h3. Uninstalling If you want to uninstall it, just run @uninstall_oh_my_zsh@ from the command line and it'll remove itself and revert you to bash (or your previous zsh config). -h2. Thanks - -* Rick Olson (technoweenie) might remember some of the configuration, which I took from a pastie a few years ago. -* Marcel (noradio) provided Rick the original zsh configuration. -* Nicholas (ulysses) for the "rake autocompletion code":http://weblog.rubyonrails.org/2006/3/9/fast-rake-task-completion-for-zsh. - h2. Help out! I'm far from being a zsh-expert and suspect there are many ways to improve. If you have ideas on how to make the configuration easier to maintain (and faster), don't hesitate to fork and send pull requests! @@ -67,3 +61,11 @@ I'm far from being a zsh-expert and suspect there are many ways to improve. If y h3. Send us your theme! I'm hoping to collect a bunch of themes for our command prompts. You can see existing ones in the @themes/@ directory. + +h2. Contributors + +This project wouldn't exist without all of our awesome users and contributors. + +* "View our growing list of contributors":https://github.com/robbyrussell/oh-my-zsh/contributors + +Thank you so much! \ No newline at end of file From 6cbd15f4035ffd79e6e325a256f87443c106c2c6 Mon Sep 17 00:00:00 2001 From: James Frasca Date: Thu, 17 Mar 2011 11:22:51 -0700 Subject: [PATCH 052/184] Added the Frisk theme --- themes/frisk.zsh-theme | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 themes/frisk.zsh-theme diff --git a/themes/frisk.zsh-theme b/themes/frisk.zsh-theme new file mode 100644 index 000000000..f181aec90 --- /dev/null +++ b/themes/frisk.zsh-theme @@ -0,0 +1,10 @@ +PROMPT=$' +%{$fg[blue]%}%/%{$reset_color%} $(git_prompt_info)%{$fg[white]%}[%n@%m]%{$reset_color%} %{$fg[white]%}[%T]%{$reset_color%} +%{$fg_bold[black]%}>%{$reset_color%} ' + +PROMPT2="%{$fg_blod[black]%}%_> %{$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 971b071dc67f423d8b2a6f476e1dd58819049f41 Mon Sep 17 00:00:00 2001 From: kphoen Date: Mon, 7 Mar 2011 15:15:46 +0100 Subject: [PATCH 053/184] Add: new theme --- themes/kphoen.zsh-theme | 50 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 themes/kphoen.zsh-theme diff --git a/themes/kphoen.zsh-theme b/themes/kphoen.zsh-theme new file mode 100644 index 000000000..0e9b5e73c --- /dev/null +++ b/themes/kphoen.zsh-theme @@ -0,0 +1,50 @@ +# ------------------------------------------------------------------------------ +# FILE: kphoen.zsh-theme +# DESCRIPTION: oh-my-zsh theme file. +# AUTHOR: Kévin Gomez (geek63@gmail.com) +# VERSION: 1.0.0 +# SCREENSHOT: +# ------------------------------------------------------------------------------ + + +if [[ "$TERM" != "dumb" ]] && [[ "$DISABLE_LS_COLORS" != "true" ]]; then + PROMPT='[%{$fg[red]%}%n%{$reset_color%}@%{$fg[magenta]%}%m%{$reset_color%}:%{$fg[blue]%}%~%{$reset_color%}$(git_prompt_info)] +%# ' + + ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[green]%}" + ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" + ZSH_THEME_GIT_PROMPT_DIRTY="" + ZSH_THEME_GIT_PROMPT_CLEAN="" + + # display exitcode on the right when >0 + return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" + + RPROMPT='${return_code}$(git_prompt_status)%{$reset_color%}' + + ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} ✚" + ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} ✹" + ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖" + ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜" + ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═" + ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭" +else + PROMPT='[%n@%m:%~$(git_prompt_info)] +%# ' + + ZSH_THEME_GIT_PROMPT_PREFIX=" on" + ZSH_THEME_GIT_PROMPT_SUFFIX="" + ZSH_THEME_GIT_PROMPT_DIRTY="" + ZSH_THEME_GIT_PROMPT_CLEAN="" + + # display exitcode on the right when >0 + return_code="%(?..%? ↵)" + + RPROMPT='${return_code}$(git_prompt_status)' + + ZSH_THEME_GIT_PROMPT_ADDED=" ✚" + ZSH_THEME_GIT_PROMPT_MODIFIED=" ✹" + ZSH_THEME_GIT_PROMPT_DELETED=" ✖" + ZSH_THEME_GIT_PROMPT_RENAMED=" ➜" + ZSH_THEME_GIT_PROMPT_UNMERGED=" ═" + ZSH_THEME_GIT_PROMPT_UNTRACKED=" ✭" +fi From 16ac094a43052fb57eda9503174006a84a61a414 Mon Sep 17 00:00:00 2001 From: Pat Regan Date: Tue, 12 Apr 2011 09:28:15 -0400 Subject: [PATCH 054/184] Moved compinit call back to oh-my-zsh.sh, after plugins are loaded --- lib/completion.zsh | 4 ---- oh-my-zsh.sh | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/completion.zsh b/lib/completion.zsh index 21735e7e9..3c5a41e14 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -60,7 +60,3 @@ zstyle ':completion:*:*:*:users' ignored-patterns \ # ... unless we really want to. zstyle '*' single-ignored show -# Load and run compinit -autoload -U compinit -compinit -i - diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 291772dfe..84a850ca3 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -14,6 +14,10 @@ for config_file ($ZSH/custom/*.zsh) source $config_file plugin=${plugin:=()} for plugin ($plugins) source $ZSH/plugins/$plugin/$plugin.plugin.zsh +# Load and run compinit +autoload -U compinit +compinit -i + # Load the theme source "$ZSH/themes/$ZSH_THEME.zsh-theme" From 6bf906a2622ddea1e9aae5d23c544d37fc4b6a76 Mon Sep 17 00:00:00 2001 From: Pat Regan Date: Tue, 12 Apr 2011 17:41:09 -0400 Subject: [PATCH 055/184] Optimize plugin loading so that only one call to compinit is required --- oh-my-zsh.sh | 13 +++++++++++-- plugins/brew/brew.plugin.zsh | 2 -- plugins/cpanm/cpanm.plugin.zsh | 2 -- plugins/gem/gem.plugin.zsh | 2 -- plugins/github/github.plugin.zsh | 2 -- plugins/macports/macports.plugin.zsh | 2 -- plugins/pip/pip.plugin.zsh | 2 -- plugins/vagrant/vagrant.plugin.zsh | 1 - 8 files changed, 11 insertions(+), 15 deletions(-) delete mode 100644 plugins/brew/brew.plugin.zsh delete mode 100644 plugins/cpanm/cpanm.plugin.zsh delete mode 100644 plugins/gem/gem.plugin.zsh delete mode 100644 plugins/github/github.plugin.zsh delete mode 100644 plugins/pip/pip.plugin.zsh delete mode 100644 plugins/vagrant/vagrant.plugin.zsh diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 84a850ca3..0c85de714 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -10,14 +10,23 @@ for config_file ($ZSH/lib/*.zsh) source $config_file # Load all of your custom configurations from custom/ for config_file ($ZSH/custom/*.zsh) source $config_file -# Load all of the plugins that were defined in ~/.zshrc +# Add all defined plugins to fpath plugin=${plugin:=()} -for plugin ($plugins) source $ZSH/plugins/$plugin/$plugin.plugin.zsh +for plugin ($plugins) fpath=($ZSH/plugins/$plugin $fpath) # Load and run compinit autoload -U compinit compinit -i +# Load all of the plugins that were defined in ~/.zshrc +for plugin ($plugins) +do + if [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ] + then + source $ZSH/plugins/$plugin/$plugin.plugin.zsh + fi +done + # Load the theme source "$ZSH/themes/$ZSH_THEME.zsh-theme" diff --git a/plugins/brew/brew.plugin.zsh b/plugins/brew/brew.plugin.zsh deleted file mode 100644 index 079c0fba0..000000000 --- a/plugins/brew/brew.plugin.zsh +++ /dev/null @@ -1,2 +0,0 @@ -# add brew completion function to path -fpath=($ZSH/plugins/brew $fpath) diff --git a/plugins/cpanm/cpanm.plugin.zsh b/plugins/cpanm/cpanm.plugin.zsh deleted file mode 100644 index 8425b5ad8..000000000 --- a/plugins/cpanm/cpanm.plugin.zsh +++ /dev/null @@ -1,2 +0,0 @@ -# add cpanm completion function to path -fpath=($ZSH/plugins/cpanm $fpath) diff --git a/plugins/gem/gem.plugin.zsh b/plugins/gem/gem.plugin.zsh deleted file mode 100644 index cdfad7ad6..000000000 --- a/plugins/gem/gem.plugin.zsh +++ /dev/null @@ -1,2 +0,0 @@ -# add gem completion function to path -fpath=($ZSH/plugins/gem $fpath) diff --git a/plugins/github/github.plugin.zsh b/plugins/github/github.plugin.zsh deleted file mode 100644 index 0858783cc..000000000 --- a/plugins/github/github.plugin.zsh +++ /dev/null @@ -1,2 +0,0 @@ -# add github completion function to path -fpath=($ZSH/plugins/github $fpath) diff --git a/plugins/macports/macports.plugin.zsh b/plugins/macports/macports.plugin.zsh index 492a665b5..277352e32 100644 --- a/plugins/macports/macports.plugin.zsh +++ b/plugins/macports/macports.plugin.zsh @@ -6,5 +6,3 @@ alias puni="sudo port uninstall inactive" alias puo="sudo port upgrade outdated" alias pup="psu && puo" -# add macports completion function to path -fpath=($ZSH/plugins/macports $fpath) diff --git a/plugins/pip/pip.plugin.zsh b/plugins/pip/pip.plugin.zsh deleted file mode 100644 index 740f96207..000000000 --- a/plugins/pip/pip.plugin.zsh +++ /dev/null @@ -1,2 +0,0 @@ -# add brew completion function to path -fpath=($ZSH/plugins/pip $fpath) diff --git a/plugins/vagrant/vagrant.plugin.zsh b/plugins/vagrant/vagrant.plugin.zsh deleted file mode 100644 index 98d2d705c..000000000 --- a/plugins/vagrant/vagrant.plugin.zsh +++ /dev/null @@ -1 +0,0 @@ -fpath=($ZSH/plugins/vagrant $fpath) From 757ebfcbd20b0893d8c9529eed2dfd428868f431 Mon Sep 17 00:00:00 2001 From: Pat Regan Date: Tue, 12 Apr 2011 17:50:15 -0400 Subject: [PATCH 056/184] Moved the plugin fpath loop and compinit so they happen before custom scripts are loaded. --- oh-my-zsh.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 0c85de714..ad4b268ae 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -7,9 +7,6 @@ fpath=($ZSH/functions $fpath) # TIP: Add files you don't want in git to .gitignore for config_file ($ZSH/lib/*.zsh) source $config_file -# Load all of your custom configurations from custom/ -for config_file ($ZSH/custom/*.zsh) source $config_file - # Add all defined plugins to fpath plugin=${plugin:=()} for plugin ($plugins) fpath=($ZSH/plugins/$plugin $fpath) @@ -18,6 +15,9 @@ for plugin ($plugins) fpath=($ZSH/plugins/$plugin $fpath) autoload -U compinit compinit -i +# Load all of your custom configurations from custom/ +for config_file ($ZSH/custom/*.zsh) source $config_file + # Load all of the plugins that were defined in ~/.zshrc for plugin ($plugins) do From 796f5164f306da2f4e6ab7cbadc17b78f5f683af Mon Sep 17 00:00:00 2001 From: Pat Regan Date: Tue, 12 Apr 2011 19:53:55 -0400 Subject: [PATCH 057/184] Minor reformatting --- oh-my-zsh.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index ad4b268ae..c7a4c320a 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -19,10 +19,8 @@ compinit -i for config_file ($ZSH/custom/*.zsh) source $config_file # Load all of the plugins that were defined in ~/.zshrc -for plugin ($plugins) -do - if [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ] - then +for plugin ($plugins); do + if [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then source $ZSH/plugins/$plugin/$plugin.plugin.zsh fi done From 60bae66bbfebe7bf78378564ffe9aed00c3342b4 Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 7 Apr 2011 10:23:06 +0200 Subject: [PATCH 058/184] new yum plugin with useful aliases --- plugins/yum/yum.plugin.zsh | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 plugins/yum/yum.plugin.zsh diff --git a/plugins/yum/yum.plugin.zsh b/plugins/yum/yum.plugin.zsh new file mode 100644 index 000000000..d6ba7ed62 --- /dev/null +++ b/plugins/yum/yum.plugin.zsh @@ -0,0 +1,12 @@ +## Aliases + +alias ys="yum search" # search package +alias yp="yum info" # show package info +alias yl="yum list" # list packages +alias yli="yum list installed" # print all installed packages + +alias yu="sudo yum update" # upgrate packages +alias yi="sudo yum install" # install package +alias yr="sudo yum remove" # remove package +alias yrl="sudo yum remove --remove-leaves" # remove package and leaves +alias yc="sudo yum clean all" # clean cache From 14f07ebc68da8b06cdb0a4fdb435ac928ff419f1 Mon Sep 17 00:00:00 2001 From: alexandru Date: Thu, 14 Apr 2011 16:22:18 -0700 Subject: [PATCH 059/184] redis-cli completion plugin --- plugins/redis-cli/_redis-cli | 142 +++++++++++++++++++++++++ plugins/redis-cli/redis-cli.plugin.zsh | 4 + 2 files changed, 146 insertions(+) create mode 100644 plugins/redis-cli/_redis-cli create mode 100644 plugins/redis-cli/redis-cli.plugin.zsh diff --git a/plugins/redis-cli/_redis-cli b/plugins/redis-cli/_redis-cli new file mode 100644 index 000000000..3789add18 --- /dev/null +++ b/plugins/redis-cli/_redis-cli @@ -0,0 +1,142 @@ +#compdef redis-cli rec +#autoload + +#redis cli completion, based off homebrew completion (ref. 2011-04-14) + +local -a _1st_arguments +_1st_arguments=( + 'append:append a value to a key' + 'auth:authenticate to the server' + 'bgrewriteeaof:asynchronously rewrite the append-only file' + 'bgsave:asynchornously save the dataset to disk' + 'blpop:remove and get the first element in a list, or block until one is available' + 'brpop:remove and get the last element in a list, or block until one is available' + 'brpoplpush:pop a value from a list, push it to another list and return it; or block until one is available' + # 'config get:get the value of a configuration parameter' + # 'config set:set a configuration parameter to the given value' + # 'config resetstat: reset the stats returned by INFO' + 'dbsize:return the number of keys in the selected database' + # 'debug object:get debugging information about a key' + # 'debug setgfault:make the server crash' + 'decr:decrement the integer value of a key by one' + 'decrby:decrement the integet value of a key by the given number' + 'del:delete a key' + 'discard:discard all commands issued after MULTI' + 'echo:echo the given string' + 'exec:execute all commands issued after a MULTI' + 'exists:determine if a key exists' + 'expire:set the time to live for a key, in seconds' + 'expireat:set the expiration for a key as a UNIX timestamp' + 'flushall:remove all keys from all databases' + 'flushdb:remove all keys from the current database' + 'get:get the value of a key' + 'getbit:returns the bit value at offset in the string value stored at key' + 'getrange:get a substring of the string stored at a key' + 'getset:set the string value of a key and return its old value' + 'hdel:delete a hash field' + 'hexists:determine if a hash field exists' + 'hget:get the value of a hash field' + 'hgetall:get all the fields and values in a hash' + 'hincrby:increment the integer value of a hash field by the given number' + 'hkeys:get all the fields in a hash' + 'hlen:get the number of fields in a hash' + 'hmget:get the values of all the given hash fields' + 'hmset:set multiple hash fields to multiple values' + 'hset:set the string value of a hash field' + 'hsetnx:set the value of a hash field, only if the field does not exist' + 'hvals:get all the values in a hash' + 'incr:increment the integer value of a key by one' + 'incrby:increment the integer value of a key by the given number' + 'info:get information and statistics about the server' + 'keys:find all keys matching the given pattern' + 'lastsave:get the UNIX timestamp of the last successful save to disk' + 'lindex:get an element from a list by its index' + 'linset:insert an element before or after another element in a list' + 'llen:get the length of a list' + 'lpop:remove and get the first element in a list' + 'lpush:prepend a value to a list' + 'lpushx:prepend a value to a list, only if the list exists' + 'lrange:get a range of elements from a list' + 'lrem:remove elements from a list' + 'lset:set the value of an element in a list by its index' + 'ltrim:trim a list to the specified range' + 'mget:get the values of all the given keys' + 'monitor:listen for all requests received by the server in real time' + 'move:move a key to another database' + 'mset:set multiple keys to muliple values' + 'msetnx:set multiple keys tom ultiple values, only if none of the keys exist' + 'multi:mark the start of a transaction block' + 'object:inspect the internals of Redis objects' + 'persist:remove the expiration from a key' + 'ping:ping the server' + 'psubscribe:listen for messages published to channels matching the given patterns' + 'publish:post a message to a channel' + 'punsubscribe:stop listening for messages posted to channels matching the given patterns' + 'quit:close the connection' + 'randomkey:return a random key from the keyspace' + 'rename:rename a key' + 'renamenx:rename a key, only if the new key does not exist' + 'rpop:remove and get the last element in a list' + 'rpoplpush:remove the last element in a list, append it to another list and return it' + 'rpush:append a value to a list' + 'rpushx:append a value to a list, only if the list exists' + 'sadd:add a member to a set' + 'save:synchronously save the dataset to disk' + 'scard:get the number of members in a set' + 'sdiff:subtract multiple sets' + 'sdiffstore:subtract multiple sets and store the resulting set in a key' + 'select:change the selected database for the current connection' + 'set:set the string value of a key' + 'setbit:sets or clears the bit at offset in the string value stored at key' + 'setex:set the value and expiration of a key' + 'setnx:set the value of a key, only if the key does not exist' + 'setrange:overwrite part of a string at key starting at the specified offset' + 'shutdown:synchronously save the dataset to disk and then shut down the server' + 'sinter:intersect multiple sets' + 'sinterstore:intersect multiple sets and store the resulting set in a key' + 'sismember:determine if a given value is a member of a set' + 'slaveof:make the server a slave of another instance, or promote it as master' + 'smembers:get all the members in a set' + 'smove:move a member from one set to another' + 'sort:sort the elements in a list, set or sorted set' + 'spop:remove and return a random member from a set' + 'srandmember:get a random member from a set' + 'srem:remove a member from a set' + 'strlen:get the length of the value stored in a key' + 'subscribe:listen for messages published to the given channels' + 'sunion:add multiple sets' + 'sunionstore:add multiple sets and store the resulting set in a key' + 'ttl:get the time to live for a key' + 'type:determine the type stored at key' + 'unsubscribe:stop listening for messages posted to the given channels' + 'unwatch:forget about all watched keys' + 'watch:watch the given keys to determine execution of the MULTI/EXEC block' + 'zadd:add a member to a sorted set, or update its score if it already exists' + 'zcard:get the number of members in a sorted set' + 'zcount:count the members in a sorted set with scores within the given values' + 'zincrby:increment the score of a member in a sorted set' + 'zinterstore:intersect multiple sorted sets and store the resulting sorted set in a new key' + 'zrange:return a range of members in a sorted set, by index' + 'zrangebyscore:return a range of members in a sorted set, by score' + 'zrank:determine the index of a member in a sorted set' + 'zrem:remove a member from a sorted set' + 'zremrangebyrank:remove all members in a sorted set within the given indexes' + 'zremrangebyscore:remove all members in a sorted set within the given scores' + 'zrevrange:return a range of membrs in a sorted set, by index, with scores ordered from high to low' + 'zrevrangebyscore:return a range of members in a sorted set, by score, with scores ordered from high to low' + 'zrevrank:determine the index of a member in a sorted set, with scores ordered from high to low' + 'zscore:get the score associated with the given member in a sorted set' + 'zunionstore:add multiple sorted sets and store te resulting sorted set in a new key' +) + +local expl + +_arguments \ + '(-v --version)'{-v,--version}'[show version]' \ + '(-h --help)'{-h,--help}'[show help]' \ + '*:: :->subcmds' && return 0 + +if (( CURRENT == 1 )); then + _describe -t commands "redis-cli subcommand" _1st_arguments + return +fi \ No newline at end of file diff --git a/plugins/redis-cli/redis-cli.plugin.zsh b/plugins/redis-cli/redis-cli.plugin.zsh new file mode 100644 index 000000000..af5a843c9 --- /dev/null +++ b/plugins/redis-cli/redis-cli.plugin.zsh @@ -0,0 +1,4 @@ +# add redis completion function to path +fpath=($ZSH/plugins/redis-cli $fpath) +autoload -U compinit +compinit -i From 5bcfab37312511a7ffc3e8242ba8b8a622ecf061 Mon Sep 17 00:00:00 2001 From: Jonathan Tron Date: Sat, 16 Apr 2011 14:44:38 +0200 Subject: [PATCH 060/184] Add new jonathan theme --- themes/jonathan.zsh-theme | 137 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 themes/jonathan.zsh-theme diff --git a/themes/jonathan.zsh-theme b/themes/jonathan.zsh-theme new file mode 100644 index 000000000..add485279 --- /dev/null +++ b/themes/jonathan.zsh-theme @@ -0,0 +1,137 @@ +function precmd { + local TERMWIDTH + (( TERMWIDTH = ${COLUMNS} - 1 )) + + + ### + # Truncate the path if it's too long. + + PR_FILLBAR="" + PR_PWDLEN="" + + local promptsize=${#${(%):---(%n@%m:%l)---()--}} + local rubyprompt=`rvm_prompt_info` + local rubypromptsize=${#${rubyprompt}} + local pwdsize=${#${(%):-%~}} + + if [[ "$promptsize + $rubypromptsize + $pwdsize" -gt $TERMWIDTH ]]; then + ((PR_PWDLEN=$TERMWIDTH - $promptsize)) + else + PR_FILLBAR="\${(l.(($TERMWIDTH - ($promptsize + $rubypromptsize + $pwdsize)))..${PR_HBAR}.)}" + fi + +} + + +setopt extended_glob +preexec () { + if [[ "$TERM" == "screen" ]]; then + local CMD=${1[(wr)^(*=*|sudo|-*)]} + echo -n "\ek$CMD\e\\" + fi +} + + +setprompt () { + ### + # Need this so the prompt will work. + + setopt prompt_subst + + + ### + # See if we can use colors. + + autoload colors zsh/terminfo + if [[ "$terminfo[colors]" -ge 8 ]]; then + colors + fi + for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE GREY; do + eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}' + eval PR_LIGHT_$color='%{$fg[${(L)color}]%}' + (( count = $count + 1 )) + done + PR_NO_COLOUR="%{$terminfo[sgr0]%}" + + ### + # Modify Git prompt + ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[green]%}" + ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" + ZSH_THEME_GIT_PROMPT_DIRTY="" + ZSH_THEME_GIT_PROMPT_CLEAN="" + + ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} ✚" + ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} ✹" + ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖" + ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜" + ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═" + ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭" + + ### + # See if we can use extended characters to look nicer. + + typeset -A altchar + set -A altchar ${(s..)terminfo[acsc]} + PR_SET_CHARSET="%{$terminfo[enacs]%}" + PR_SHIFT_IN="%{$terminfo[smacs]%}" + PR_SHIFT_OUT="%{$terminfo[rmacs]%}" + PR_HBAR=${altchar[q]:--} + PR_ULCORNER=${altchar[l]:--} + PR_LLCORNER=${altchar[m]:--} + PR_LRCORNER=${altchar[j]:--} + PR_URCORNER=${altchar[k]:--} + + + ### + # Decide if we need to set titlebar text. + + case $TERM in + xterm*) + PR_TITLEBAR=$'%{\e]0;%(!.-=*[ROOT]*=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\a%}' + ;; + screen) + PR_TITLEBAR=$'%{\e_screen \005 (\005t) | %(!.-=[ROOT]=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\e\\%}' + ;; + *) + PR_TITLEBAR='' + ;; + esac + + + ### + # Decide whether to set a screen title + if [[ "$TERM" == "screen" ]]; then + PR_STITLE=$'%{\ekzsh\e\\%}' + else + PR_STITLE='' + fi + + + ### + # Finally, the prompt. + + PROMPT='$PR_SET_CHARSET$PR_STITLE${(e)PR_TITLEBAR}\ +$PR_CYAN$PR_SHIFT_IN$PR_ULCORNER$PR_HBAR$PR_SHIFT_OUT$PR_GREY(\ +$PR_GREEN%$PR_PWDLEN<...<%~%<<\ +$PR_GREY)`rvm_prompt_info`$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_HBAR${(e)PR_FILLBAR}$PR_HBAR$PR_SHIFT_OUT$PR_GREY(\ +$PR_CYAN%(!.%SROOT%s.%n)$PR_GREY@$PR_GREEN%m:%l\ +$PR_GREY)$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_URCORNER$PR_SHIFT_OUT\ + +$PR_CYAN$PR_SHIFT_IN$PR_LLCORNER$PR_BLUE$PR_HBAR$PR_SHIFT_OUT(\ +$PR_YELLOW%D{%H:%M:%S}\ +$PR_LIGHT_BLUE%{$reset_color%}`git_prompt_info``git_prompt_status`$PR_BLUE)$PR_CYAN$PR_SHIFT_IN$PR_HBAR\ +$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT\ +>$PR_NO_COLOUR ' + + # display exitcode on the right when >0 + return_code="%(?..%{$fg[red]%}%? ↵ %{$reset_color%})" + RPROMPT=' $return_code$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_BLUE$PR_HBAR$PR_SHIFT_OUT\ +($PR_YELLOW%D{%a,%b%d}$PR_BLUE)$PR_SHIFT_IN$PR_HBAR$PR_CYAN$PR_LRCORNER$PR_SHIFT_OUT$PR_NO_COLOUR' + + PS2='$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT\ +$PR_BLUE$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT(\ +$PR_LIGHT_GREEN%_$PR_BLUE)$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT\ +$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT$PR_NO_COLOUR ' +} + +setprompt From 1e2152fcf3103c3acbae49caa0f6184b55c7bb17 Mon Sep 17 00:00:00 2001 From: Arthur Kalmenson Date: Mon, 18 Apr 2011 07:48:35 -0400 Subject: [PATCH 061/184] Make the chsh more reliable. --- tools/install.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/install.sh b/tools/install.sh index 6e3872bb9..2d5fde4c8 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -22,7 +22,12 @@ echo "Copying your current PATH and adding it to the end of ~/.zshrc for you." echo "export PATH=$PATH" >> ~/.zshrc echo "Time to change your default shell to zsh!" -chsh -s "/usr/bin/env zsh" +if [ -f /bin/zsh ] +then + chsh -s /bin/zsh +else + chsh -s "/usr/bin/env zsh" +fi echo ' __ __ ' echo ' ____ / /_ ____ ___ __ __ ____ _____/ /_ ' From 5f415c465a576a78d7e1577e472309fdd4c7621f Mon Sep 17 00:00:00 2001 From: Arthur Kalmenson Date: Mon, 18 Apr 2011 07:50:14 -0400 Subject: [PATCH 062/184] Change URL to https since most corporate environments block git port. --- tools/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/install.sh b/tools/install.sh index 2d5fde4c8..1b8c80f21 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -5,7 +5,7 @@ then fi echo "Cloning Oh My Zsh..." -/usr/bin/env git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh +/usr/bin/env git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh echo "Looking for an existing zsh config..." if [ -f ~/.zshrc ] || [ -h ~/.zshrc ] From 1354eb124893df9c8f60f668550efcafb94eb05f Mon Sep 17 00:00:00 2001 From: Arthur Kalmenson Date: Mon, 18 Apr 2011 22:51:28 -0400 Subject: [PATCH 063/184] Changed to use which. --- tools/install.sh | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/tools/install.sh b/tools/install.sh index 1b8c80f21..8ed1403af 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -22,12 +22,7 @@ echo "Copying your current PATH and adding it to the end of ~/.zshrc for you." echo "export PATH=$PATH" >> ~/.zshrc echo "Time to change your default shell to zsh!" -if [ -f /bin/zsh ] -then - chsh -s /bin/zsh -else - chsh -s "/usr/bin/env zsh" -fi +chsh -s `which zsh` echo ' __ __ ' echo ' ____ / /_ ____ ___ __ __ ____ _____/ /_ ' From c7c959de60add8371e08926d642b2bbb7406ce84 Mon Sep 17 00:00:00 2001 From: Arthur Kalmenson Date: Tue, 19 Apr 2011 19:01:18 -0400 Subject: [PATCH 064/184] Make the delete key work correctly, instead of outputting a ~ --- lib/key-bindings.zsh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/key-bindings.zsh b/lib/key-bindings.zsh index 7196a88ff..e12d8010e 100644 --- a/lib/key-bindings.zsh +++ b/lib/key-bindings.zsh @@ -22,6 +22,10 @@ bindkey ' ' magic-space # also do history expansion on space bindkey '^[[Z' reverse-menu-complete +# Make the delete key (or Fn + Delete on the Mac) work instead of outputting a ~ +bindkey "^[[3~" delete-char +bindkey "^[3;5~" delete-char + # consider emacs keybindings: #bindkey -e ## emacs key bindings From 7d9628b2dcccb5627c59380de331e3c906c8164d Mon Sep 17 00:00:00 2001 From: Arthur Kalmenson Date: Tue, 19 Apr 2011 22:40:46 -0400 Subject: [PATCH 065/184] Added bindings for Gnome terminal. --- lib/key-bindings.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/key-bindings.zsh b/lib/key-bindings.zsh index e12d8010e..a7d5095ec 100644 --- a/lib/key-bindings.zsh +++ b/lib/key-bindings.zsh @@ -25,6 +25,7 @@ bindkey '^[[Z' reverse-menu-complete # Make the delete key (or Fn + Delete on the Mac) work instead of outputting a ~ bindkey "^[[3~" delete-char bindkey "^[3;5~" delete-char +bindkey "\e[3~" delete-char # consider emacs keybindings: From 886af72125a108c2f928474c7f817dd2c164795e Mon Sep 17 00:00:00 2001 From: Pat Regan Date: Wed, 20 Apr 2011 01:30:52 -0400 Subject: [PATCH 066/184] Remove fpath/compinit code from github and npm plugins --- plugins/github/github.plugin.zsh | 4 ---- plugins/npm/npm.plugin.zsh | 4 ---- 2 files changed, 8 deletions(-) delete mode 100644 plugins/npm/npm.plugin.zsh diff --git a/plugins/github/github.plugin.zsh b/plugins/github/github.plugin.zsh index 8d4580654..df7053ba7 100644 --- a/plugins/github/github.plugin.zsh +++ b/plugins/github/github.plugin.zsh @@ -5,7 +5,3 @@ if [ "$commands[(I)hub]" ]; then function git(){hub "$@"} fi -# add github completion function to path -fpath=($ZSH/plugins/github $fpath) -autoload -U compinit -compinit -i diff --git a/plugins/npm/npm.plugin.zsh b/plugins/npm/npm.plugin.zsh deleted file mode 100644 index 826f0f7b0..000000000 --- a/plugins/npm/npm.plugin.zsh +++ /dev/null @@ -1,4 +0,0 @@ -# add npm completion function to path -fpath=($ZSH/plugins/npm $fpath) -autoload -U compinit -compinit -i From 96ec1e12498fb2c3200fef941ad6eadece723a0d Mon Sep 17 00:00:00 2001 From: Alexander Rinass Date: Wed, 20 Apr 2011 15:50:55 +0200 Subject: [PATCH 067/184] Fixed folder naming for mysql-macports plugin and improved start/stop scripts. --- plugins/mysql-macports/mysql-macports.plugin.zsh | 8 ++++++++ plugins/mysql/mysql-macports.plugin.zsh | 6 ------ 2 files changed, 8 insertions(+), 6 deletions(-) create mode 100644 plugins/mysql-macports/mysql-macports.plugin.zsh delete mode 100644 plugins/mysql/mysql-macports.plugin.zsh diff --git a/plugins/mysql-macports/mysql-macports.plugin.zsh b/plugins/mysql-macports/mysql-macports.plugin.zsh new file mode 100644 index 000000000..c39563fe4 --- /dev/null +++ b/plugins/mysql-macports/mysql-macports.plugin.zsh @@ -0,0 +1,8 @@ +# commands to control local mysql-server installation +# paths are for osx installation via macports + +alias mysqlstart='sudo /opt/local/share/mysql5/mysql/mysql.server start' +alias mysqlstop='sudo /opt/local/share/mysql5/mysql/mysql.server stop' +alias mysqlrestart='sudo /opt/local/share/mysql5/mysql/mysql.server restart' + +alias mysqlstatus='mysqladmin5 -u root -p ping' diff --git a/plugins/mysql/mysql-macports.plugin.zsh b/plugins/mysql/mysql-macports.plugin.zsh deleted file mode 100644 index 63b881c9f..000000000 --- a/plugins/mysql/mysql-macports.plugin.zsh +++ /dev/null @@ -1,6 +0,0 @@ -# commands to control local mysql-server installation -# paths are for osx installtion via macports - -alias mysqlstart='sudo /opt/local/bin/mysqld_safe5' -alias mysqlstop='/opt/local/bin/mysqladmin5 -u root -p shutdown' -alias mysqlstatus='mysqladmin5 -u root -p ping' \ No newline at end of file From 34f1944016a7671fe47aca99f18f25d19f6ff5dc Mon Sep 17 00:00:00 2001 From: Alexander Rinass Date: Wed, 20 Apr 2011 15:54:51 +0200 Subject: [PATCH 068/184] Added start/stop aliases for Apache 2 installation via macports. --- plugins/apache2-macports/apache2-macports.plugin.zsh | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 plugins/apache2-macports/apache2-macports.plugin.zsh diff --git a/plugins/apache2-macports/apache2-macports.plugin.zsh b/plugins/apache2-macports/apache2-macports.plugin.zsh new file mode 100644 index 000000000..1caa4cf9d --- /dev/null +++ b/plugins/apache2-macports/apache2-macports.plugin.zsh @@ -0,0 +1,6 @@ +# commands to control local apache2 server installation +# paths are for osx installation via macports + +alias apache2start='sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper start' +alias apache2stop='sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper stop' +alias apache2restart='sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper restart' From eb3d1576bf593c900d0e0fd9465ca3a076779fe0 Mon Sep 17 00:00:00 2001 From: Christopher Chow Date: Thu, 21 Apr 2011 21:40:34 +1000 Subject: [PATCH 069/184] Made my them display the current rvm gemset and check for detached head state in git. --- themes/Soliah.zsh-theme | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/themes/Soliah.zsh-theme b/themes/Soliah.zsh-theme index 1c0ab3cc9..237e70fda 100644 --- a/themes/Soliah.zsh-theme +++ b/themes/Soliah.zsh-theme @@ -1,4 +1,4 @@ -PROMPT='%{$fg[blue]%}%n%{$reset_color%} on %{$fg[red]%}%M%{$reset_color%} in %{$fg[blue]%}%~%b%{$reset_color%}$(git_time_since_commit)$(git_prompt_info) +PROMPT='%{$fg[blue]%}%n%{$reset_color%} on %{$fg[red]%}%M%{$reset_color%} in %{$fg[blue]%}%~%b%{$reset_color%}$(git_time_since_commit)$(check_git_prompt_info) $ ' ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[white]%}" @@ -16,6 +16,29 @@ 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[cyan]%}" + +# Git sometimes goes into a detached head state. git_prompt_info doesn't +# return anything in this case. So wrap it in another function and check +# for an empty string. +function check_git_prompt_info() { + if git rev-parse --git-dir > /dev/null 2>&1; then + if [[ -z $(git_prompt_info) ]]; then + echo "%{$fg[magenta]%}detached-head%{$reset_color%})" + else + echo "$(git_prompt_info)" + fi + fi +} + +# Determine if we are using a gemset. +function rvm_gemset() { + GEMSET=`rvm gemset list | grep '=>' | cut -b4-` + if [[ -n $GEMSET ]]; then + echo "%{$fg[yellow]%}$GEMSET%{$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() { @@ -49,15 +72,15 @@ function git_time_since_commit() { fi if [ "$HOURS" -gt 24 ]; then - echo "($COLOR${DAYS}d${SUB_HOURS}h${SUB_MINUTES}m%{$reset_color%}|" + echo "($(rvm_gemset)$COLOR${DAYS}d${SUB_HOURS}h${SUB_MINUTES}m%{$reset_color%}|" elif [ "$MINUTES" -gt 60 ]; then - echo "($COLOR${HOURS}h${SUB_MINUTES}m%{$reset_color%}|" + echo "($(rvm_gemset)$COLOR${HOURS}h${SUB_MINUTES}m%{$reset_color%}|" else - echo "($COLOR${MINUTES}m%{$reset_color%}|" + echo "($(rvm_gemset)$COLOR${MINUTES}m%{$reset_color%}|" fi else COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL" - echo "($COLOR~|" + echo "($(rvm_gemset)$COLOR~|" fi fi } From 6f53b3130d5aee8461b0be30e5589e5673929318 Mon Sep 17 00:00:00 2001 From: Ilmari Vacklin Date: Fri, 22 Apr 2011 00:16:29 +0300 Subject: [PATCH 070/184] Add 'upgrade' to brew completions. --- plugins/brew/_brew | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/brew/_brew b/plugins/brew/_brew index 4e590ac63..cee1e25f0 100644 --- a/plugins/brew/_brew +++ b/plugins/brew/_brew @@ -31,6 +31,7 @@ _1st_arguments=( 'search:search for a formula (/regex/ or string)' 'unlink:unlink a formula' 'update:freshen up links' + 'upgrade:upgrade outdated formulae' 'uses:show formulas which depend on a formula' ) From 5a957c4d2ecc12e90304d13b3ae724843f0fcb7b Mon Sep 17 00:00:00 2001 From: Corey Donohoe Date: Thu, 21 Apr 2011 15:53:44 -0700 Subject: [PATCH 071/184] support non-standard rvm install prefixes --- themes/bira.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/bira.zsh-theme b/themes/bira.zsh-theme index f0ee6a5bd..5642eaeb8 100644 --- a/themes/bira.zsh-theme +++ b/themes/bira.zsh-theme @@ -3,7 +3,7 @@ local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}' local current_dir='%{$terminfo[bold]$fg[blue]%} %~%{$reset_color%}' -local rvm_ruby='%{$fg[red]%}‹$(~/.rvm/bin/rvm-prompt i v g)›%{$reset_color%}' +local rvm_ruby='%{$fg[red]%}‹$(rvm-prompt i v g)›%{$reset_color%}' local git_branch='$(git_prompt_info)%{$reset_color%}' PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch} From 07cee28e31753f8cf424e413aa5f9754720d367b Mon Sep 17 00:00:00 2001 From: Felipe Gallois Date: Sat, 23 Apr 2011 17:31:15 -0300 Subject: [PATCH 072/184] added custom theme, based on eastwood --- themes/gallois.zsh-theme | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 themes/gallois.zsh-theme diff --git a/themes/gallois.zsh-theme b/themes/gallois.zsh-theme new file mode 100644 index 000000000..259640ba4 --- /dev/null +++ b/themes/gallois.zsh-theme @@ -0,0 +1,19 @@ +ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}[" +ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="" + +#Customized git status, oh-my-zsh currently does not allow render dirty status before branch +git_custom_status() { + local cb=$(current_branch) + if [ -n "$cb" ]; then + echo "$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_PREFIX$(current_branch)$ZSH_THEME_GIT_PROMPT_SUFFIX" + fi +} + +#RVM and git settings +if [[ -s ~/.rvm/scripts/rvm ]] ; then + RPS1='$(git_custom_status)%{$fg[red]%}[`~/.rvm/bin/rvm-prompt`]%{$reset_color%} $EPS1' +fi + +PROMPT='%{$fg[cyan]%}[%~% ]%(?.%{$fg[green]%}.%{$fg[red]%})%B$%b ' From 1783b16d25029b72bdd1aa164f3e76fd29702e70 Mon Sep 17 00:00:00 2001 From: Florian Adamsky Date: Tue, 26 Apr 2011 23:22:42 +0200 Subject: [PATCH 073/184] added alias for apt-cache search --- plugins/deb/deb.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/deb/deb.plugin.zsh b/plugins/deb/deb.plugin.zsh index 732294a87..1b35a0646 100644 --- a/plugins/deb/deb.plugin.zsh +++ b/plugins/deb/deb.plugin.zsh @@ -9,4 +9,5 @@ alias ar="sudo apt-get remove --purge && \ sudo apt-get autoremove --purge" # remove package alias ap="apt-cache policy" # apt policy alias av="apt-cache show" # show package info +alias acs="apt-cache search" # search package alias ac="sudo apt-get clean && sudo apt-get autoclean" # clean apt cache From 57d699ee33e5d4673d8c6a2a9ba42bd25d7b737c Mon Sep 17 00:00:00 2001 From: Pat Regan Date: Wed, 27 Apr 2011 19:46:23 -0400 Subject: [PATCH 074/184] redis-cli.plugin.zsh removed, adding to the fpath isn't needed now --- plugins/redis-cli/redis-cli.plugin.zsh | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 plugins/redis-cli/redis-cli.plugin.zsh diff --git a/plugins/redis-cli/redis-cli.plugin.zsh b/plugins/redis-cli/redis-cli.plugin.zsh deleted file mode 100644 index af5a843c9..000000000 --- a/plugins/redis-cli/redis-cli.plugin.zsh +++ /dev/null @@ -1,4 +0,0 @@ -# add redis completion function to path -fpath=($ZSH/plugins/redis-cli $fpath) -autoload -U compinit -compinit -i From 14404eb7a00dcbafcaf81402844f0eb24243cbbb Mon Sep 17 00:00:00 2001 From: Justin Riley Date: Thu, 28 Apr 2011 15:29:27 -0400 Subject: [PATCH 075/184] add my custom zsh prompt --- themes/jtriley.zsh-theme | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 themes/jtriley.zsh-theme diff --git a/themes/jtriley.zsh-theme b/themes/jtriley.zsh-theme new file mode 100644 index 000000000..ec62a2208 --- /dev/null +++ b/themes/jtriley.zsh-theme @@ -0,0 +1,8 @@ +#PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' +PROMPT="%{$fg_bold[cyan]%}%T%{$fg_bold[green]%} %{$fg_bold[white]%}%n%{$fg[magenta]%}@%{$fg_bold[white]%}%m %{$fg_bold[green]%}%d +%{$fg_bold[yellow]%}%% $(git_prompt_info)%{$reset_color%}" + +#ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" +#ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +#ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}" +#ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" From 58a7cf19b7af136c5f59ee706ffe4772871f00fa Mon Sep 17 00:00:00 2001 From: Pat Regan Date: Thu, 28 Apr 2011 19:12:05 -0400 Subject: [PATCH 076/184] Move sourcing of custom to below plugins --- oh-my-zsh.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index c7a4c320a..bf108afce 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -15,9 +15,6 @@ for plugin ($plugins) fpath=($ZSH/plugins/$plugin $fpath) autoload -U compinit compinit -i -# Load all of your custom configurations from custom/ -for config_file ($ZSH/custom/*.zsh) source $config_file - # Load all of the plugins that were defined in ~/.zshrc for plugin ($plugins); do if [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then @@ -25,6 +22,9 @@ for plugin ($plugins); do fi done +# Load all of your custom configurations from custom/ +for config_file ($ZSH/custom/*.zsh) source $config_file + # Load the theme source "$ZSH/themes/$ZSH_THEME.zsh-theme" From 077baa7bb1aba75d3005b7c6e5df4f53e0ea15d1 Mon Sep 17 00:00:00 2001 From: "Juan G. Hurtado" Date: Fri, 29 Apr 2011 09:22:56 +0200 Subject: [PATCH 077/184] Adds new prompt methods on Git lib Modifies the Git lib file (lib/git.zsh), adding three new prompt methods: - git_prompt_ahead(): Shows the content of the custom var $ZSH_THEME_GIT_PROMPT_AHEAD if the local repository has commits ahead from the remote origin repository - git_prompt_short_sha(): Shows last commit SHA hash in short mode wrapped between the content of the custom vars $ZSH_THEME_GIT_PROMPT_SHA_BEFORE and $ZSH_THEME_GIT_PROMPT_SHA_AFTER - git_prompt_long_sha(): Shows last commit SHA hash in long mode wrapped between the content of the custom vars $ZSH_THEME_GIT_PROMPT_SHA_BEFORE and $ZSH_THEME_GIT_PROMPT_SHA_AFTER --- lib/git.zsh | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/lib/git.zsh b/lib/git.zsh index 8512de8a4..e96f075be 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -4,7 +4,8 @@ function git_prompt_info() { echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX" } -parse_git_dirty () { +# Checks if working tree is dirty +parse_git_dirty() { if [[ -n $(git status -s 2> /dev/null) ]]; then echo "$ZSH_THEME_GIT_PROMPT_DIRTY" else @@ -12,7 +13,24 @@ parse_git_dirty () { fi } -# get the status of the working tree +# Checks if there are commits ahead from remote +function git_prompt_ahead() { + if $(echo "$(git log origin/master..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then + echo "$ZSH_THEME_GIT_PROMPT_AHEAD" + fi +} + +# Formats prompt string for current git commit short SHA +function git_prompt_short_sha() { + SHA=$(git rev-parse --short HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER" +} + +# Formats prompt string for current git commit long SHA +function git_prompt_long_sha() { + SHA=$(git rev-parse HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER" +} + +# Get the status of the working tree git_prompt_status() { INDEX=$(git status --porcelain 2> /dev/null) STATUS="" @@ -41,4 +59,4 @@ git_prompt_status() { STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS" fi echo $STATUS -} +} \ No newline at end of file From 6f7d51c68d4de102f295d3b543ccb5c61dea2c3c Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Fri, 29 Apr 2011 11:24:29 +0200 Subject: [PATCH 078/184] Feature: Random themes now supported. Just set your theme to 'random' and it'll load a different theme each time oh-my-zsh is started. Closes #309 --- oh-my-zsh.sh | 14 +++++++++++++- templates/zshrc.zsh-template | 4 +++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 291772dfe..1e735b058 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -15,7 +15,19 @@ plugin=${plugin:=()} for plugin ($plugins) source $ZSH/plugins/$plugin/$plugin.plugin.zsh # Load the theme -source "$ZSH/themes/$ZSH_THEME.zsh-theme" +# Check for updates on initial load... +if [ "$ZSH_THEME" = "random" ] +then + themes=($ZSH/themes/*zsh-theme) + N=${#themes[@]} + ((N=RANDOM%N)) + RANDOM_THEME=${themes[$N]} + source "$RANDOM_THEME" + echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..." +else + source "$ZSH/themes/$ZSH_THEME.zsh-theme" +fi + # Check for updates on initial load... if [ "$DISABLE_AUTO_UPDATE" = "true" ] diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template index 506daa9a2..576d45eaa 100644 --- a/templates/zshrc.zsh-template +++ b/templates/zshrc.zsh-template @@ -1,8 +1,10 @@ # Path to your oh-my-zsh configuration. export ZSH=$HOME/.oh-my-zsh -# Set to the name theme to load. +# Set name of the theme to load. # Look in ~/.oh-my-zsh/themes/ +# Optionally, if you set this to "random", it'll load a random theme each +# time that oh-my-zsh is loaded. export ZSH_THEME="robbyrussell" # Set to this to use case-sensitive completion From 7377ba3f7a08bb11114ddae1b421599e4073da96 Mon Sep 17 00:00:00 2001 From: Kevin Daudt Date: Fri, 29 Apr 2011 11:54:31 +0200 Subject: [PATCH 079/184] Added git-flow plugin --- .gitignore | 3 +- plugins/git-flow/git-flow.plugin.zsh | 332 +++++++++++++++++++++++++++ 2 files changed, 334 insertions(+), 1 deletion(-) create mode 100644 plugins/git-flow/git-flow.plugin.zsh diff --git a/.gitignore b/.gitignore index 8d19d100c..4b555067e 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ locals.zsh log/.zsh_history projects.zsh custom/* -!custom/example.zsh \ No newline at end of file +!custom/example.zsh +cache diff --git a/plugins/git-flow/git-flow.plugin.zsh b/plugins/git-flow/git-flow.plugin.zsh new file mode 100644 index 000000000..270bcbe38 --- /dev/null +++ b/plugins/git-flow/git-flow.plugin.zsh @@ -0,0 +1,332 @@ +#!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.' + '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 + ;; + 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`)' + ) + _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' + ;; + + *) + _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.' + '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' + ;; + + *) + _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.' + 'list:List all your feature branches. (Alias to `git flow feature`)' + 'publish: public' + 'track: track' + 'diff: diff' + 'rebase: rebase' + 'checkout: checkout' + 'pull: pull' + ) + _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' + ;; + + (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_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:'description for foo' \ No newline at end of file From 86fa4385c51d6778b1358d6f7134c1243feace87 Mon Sep 17 00:00:00 2001 From: Hakan Ensari Date: Fri, 29 Apr 2011 10:59:59 +0100 Subject: [PATCH 080/184] Rails 3 aliases now work with Rails 2 as well. --- plugins/rails3/rails3.plugin.zsh | 34 +++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/plugins/rails3/rails3.plugin.zsh b/plugins/rails3/rails3.plugin.zsh index 6bf2ba088..f669ef047 100644 --- a/plugins/rails3/rails3.plugin.zsh +++ b/plugins/rails3/rails3.plugin.zsh @@ -1,10 +1,30 @@ -alias rs='ruby script/rails server' -alias rg='ruby script/rails generate' -alias rd='ruby script/rails destroy' -alias rp='ruby script/rails plugin' +# Rails 3 aliases, backwards-compatible with Rails 2. + +function _bundle_command { + if command -v bundle && [ -e "Gemfile" ]; then + bundle exec $@ + else + $@ + fi +} + +function _rails_command () { + if [ -e "script/server" ]; then + ruby script/$@ + else + ruby script/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 rdbmr='rake db:migrate && rake db:migrate:redo' -alias rc='ruby script/rails console' -alias rd='ruby script/rails server --debugger' +alias rg='_rails_command generate' +alias rp='_rails_command plugin' +alias rs='_rails_command server' +alias rsd='_rails_command server --debugger' alias devlog='tail -f log/development.log' +alias rspec='_bundle_command rspec' +alias cuke='_bundle_command cucumber' From 208b225a2f12076099255c329abbb3569723b39b Mon Sep 17 00:00:00 2001 From: "Juan G. Hurtado" Date: Fri, 29 Apr 2011 13:11:38 +0200 Subject: [PATCH 081/184] Custom theme with Git support This is my personal oh-my-zsh theme. It has Git support through methods found in Git lib file of oh-my-zsh. It uses: - parse_git_dirty() - git_prompt_ahead() - current_branch() - git_prompt_short_sha() - git_prompt_status() It also shows user name, machine name and current path. You can take a look at a screenshot at http://goo.gl/ZVoyk --- themes/juanghurtado.zsh-theme | 46 +++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 themes/juanghurtado.zsh-theme diff --git a/themes/juanghurtado.zsh-theme b/themes/juanghurtado.zsh-theme new file mode 100644 index 000000000..2f715cc9e --- /dev/null +++ b/themes/juanghurtado.zsh-theme @@ -0,0 +1,46 @@ +# ------------------------------------------------------------------------ +# Juan G. Hurtado oh-my-zsh theme +# (Needs Git plugin for current_branch method) +# ------------------------------------------------------------------------ + +# Color shortcuts +RED=$fg[red] +YELLOW=$fg[yellow] +GREEN=$fg[green] +WHITE=$fg[white] +BLUE=$fg[blue] +RED_BOLD=$fg_bold[red] +YELLOW_BOLD=$fg_bold[yellow] +GREEN_BOLD=$fg_bold[green] +WHITE_BOLD=$fg_bold[white] +BLUE_BOLD=$fg_bold[blue] +RESET_COLOR=$reset_color + +# Format for git_prompt_info() +ZSH_THEME_GIT_PROMPT_PREFIX="" +ZSH_THEME_GIT_PROMPT_SUFFIX="" + +# Format for parse_git_dirty() +ZSH_THEME_GIT_PROMPT_DIRTY=" %{$RED%}(*)" +ZSH_THEME_GIT_PROMPT_CLEAN="" + +# Format for git_prompt_status() +ZSH_THEME_GIT_PROMPT_UNMERGED=" %{$RED%}unmerged" +ZSH_THEME_GIT_PROMPT_DELETED=" %{$RED%}deleted" +ZSH_THEME_GIT_PROMPT_RENAMED=" %{$YELLOW%}renamed" +ZSH_THEME_GIT_PROMPT_MODIFIED=" %{$YELLOW%}modified" +ZSH_THEME_GIT_PROMPT_ADDED=" %{$GREEN%}added" +ZSH_THEME_GIT_PROMPT_UNTRACKED=" %{$WHITE%}untracked" + +# Format for git_prompt_ahead() +ZSH_THEME_GIT_PROMPT_AHEAD=" %{$RED%}(!)" + +# Format for git_prompt_long_sha() and git_prompt_short_sha() +ZSH_THEME_GIT_PROMPT_SHA_BEFORE=" %{$WHITE%}[%{$YELLOW%}" +ZSH_THEME_GIT_PROMPT_SHA_AFTER="%{$WHITE%}]" + +# Prompt format +PROMPT=' +%{$GREEN_BOLD%}%n@%m%{$WHITE%}:%{$YELLOW%}%~%u$(parse_git_dirty)$(git_prompt_ahead)%{$RESET_COLOR%} +%{$BLUE%}>%{$RESET_COLOR%} ' +RPROMPT='%{$GREEN_BOLD%}$(current_branch)$(git_prompt_short_sha)$(git_prompt_status)%{$RESET_COLOR%}' \ No newline at end of file From 6d899e23917ea9278b06f60df6b5cc4fcd5b60c3 Mon Sep 17 00:00:00 2001 From: Matt Sacks Date: Fri, 29 Apr 2011 08:28:46 -0400 Subject: [PATCH 082/184] Add muse theme for 256 color terminals --- themes/muse.zsh-theme | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 themes/muse.zsh-theme diff --git a/themes/muse.zsh-theme b/themes/muse.zsh-theme new file mode 100644 index 000000000..4bd8fb825 --- /dev/null +++ b/themes/muse.zsh-theme @@ -0,0 +1,30 @@ +#!/usr/bin/env zsh +#local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" + +setopt promptsubst + +autoload -U add-zsh-hook + +PROMPT_SUCCESS_COLOR=$FG[117] +PROMPT_FAILURE_COLOR=$FG[124] +PROMPT_VCS_INFO_COLOR=$FG[242] +PROMPT_PROMPT=$FG[077] +GIT_DIRTY_COLOR=$FG[133] +GIT_CLEAN_COLOR=$FG[118] +GIT_PROMPT_INFO=$FG[012] + +PROMPT='%{$PROMPT_SUCCESS_COLOR%}%~%{$reset_color%} %{$GIT_PROMPT_INFO%}$(git_prompt_info)%{$GIT_DIRTY_COLOR%}$(git_prompt_status) %{$reset_color%}%{$PROMPT_PROMPT%}ᐅ%{$reset_color%} ' + +#RPS1="${return_code}" + +ZSH_THEME_GIT_PROMPT_PREFIX="(" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$GIT_PROMPT_INFO%})" +ZSH_THEME_GIT_PROMPT_DIRTY=" %{$GIT_DIRTY_COLOR%}✘" +ZSH_THEME_GIT_PROMPT_CLEAN=" %{$GIT_CLEAN_COLOR%}✔" + +ZSH_THEME_GIT_PROMPT_ADDED="%{$FG[082]%}✚%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_MODIFIED="%{$FG[166]%}✹%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DELETED="%{$FG[160]%}✖%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_RENAMED="%{$FG[220]%}➜%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_UNMERGED="%{$FG[082]%}═%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$FG[190]%}✭%{$reset_color%}" From 626fa5b1d83abb145452deaa610fc8f7a59293c1 Mon Sep 17 00:00:00 2001 From: nebirhos Date: Fri, 29 Apr 2011 17:12:40 +0200 Subject: [PATCH 083/184] fixed autoupdate --- tools/check_for_upgrade.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh index 4643739ca..e1e4eb99f 100644 --- a/tools/check_for_upgrade.sh +++ b/tools/check_for_upgrade.sh @@ -25,10 +25,11 @@ then if [ "$line" = Y ] || [ "$line" = y ] then /bin/sh $ZSH/tools/upgrade.sh + # update the zsh file + _update_zsh_update fi fi +else + # create the zsh file + _update_zsh_update fi - -# update the zsh file -_update_zsh_update - From 5f103c750891b926aab9f24f896853ea2a0493d5 Mon Sep 17 00:00:00 2001 From: Luke Randall Date: Wed, 13 Oct 2010 16:54:12 +0200 Subject: [PATCH 084/184] Add fine-grained git prompt status to lukerandall.zsh-theme --- themes/lukerandall.zsh-theme | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/themes/lukerandall.zsh-theme b/themes/lukerandall.zsh-theme index 24a0612b7..f4045bd8e 100644 --- a/themes/lukerandall.zsh-theme +++ b/themes/lukerandall.zsh-theme @@ -3,8 +3,22 @@ local return_code="%(?..%{$fg_bold[red]%}%? ↵%{$reset_color%})" -PROMPT='%{$fg_bold[green]%}%n@%m%{$reset_color%} %{$fg_bold[blue]%}%2~%{$reset_color%} $(git_prompt_info)%{$reset_color%}%B»%b ' +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" +} + +PROMPT='%{$fg_bold[green]%}%n@%m%{$reset_color%} %{$fg_bold[blue]%}%2~%{$reset_color%} $(my_git_prompt_info)%{$reset_color%}%B»%b ' 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 e3cede37a0ac1ef427fb07b6f79839b8c6a64780 Mon Sep 17 00:00:00 2001 From: "Renaud (Nel) Morvan" Date: Mon, 2 May 2011 13:51:16 +0200 Subject: [PATCH 085/184] Relax pattern matching on TERM. Closes #320. --- lib/termsupport.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index 3152751e4..22e7f372f 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -4,9 +4,9 @@ #Limited support for Apple Terminal (Terminal can't set window or tab separately) function title { [ "$DISABLE_AUTO_TITLE" != "true" ] || return - if [[ $TERM =~ "^screen" ]]; then + 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_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 e1210cdfaab6baba2eeb62599fea832ea446af85 Mon Sep 17 00:00:00 2001 From: Jonas Huckestein Date: Tue, 3 May 2011 14:07:35 -0700 Subject: [PATCH 086/184] added my theme --- themes/jispwoso.zsh-theme | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 themes/jispwoso.zsh-theme diff --git a/themes/jispwoso.zsh-theme b/themes/jispwoso.zsh-theme new file mode 100644 index 000000000..cdfef3871 --- /dev/null +++ b/themes/jispwoso.zsh-theme @@ -0,0 +1,4 @@ +PROMPT=$'%{$fg[green]%}%n@%m: %{$reset_color%}%{$fg[blue]%}%/%{$reset_color%} +%{$fg_bold[red]%}➜ %{$reset_color%} ' + +PROMPT2="%{$fg_blod[black]%}%_> %{$reset_color%}" From bd1a78ae34cc3ce81a7b858f459ad0ad8da2cf62 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 5 May 2011 18:41:05 -0400 Subject: [PATCH 087/184] Added Compleat - Completion for Human Beings plugin. --- plugins/compleat/compleat.plugin.zsh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 plugins/compleat/compleat.plugin.zsh diff --git a/plugins/compleat/compleat.plugin.zsh b/plugins/compleat/compleat.plugin.zsh new file mode 100644 index 000000000..8d16a5687 --- /dev/null +++ b/plugins/compleat/compleat.plugin.zsh @@ -0,0 +1,22 @@ +# ------------------------------------------------------------------------------ +# FILE: compleat.plugin.zsh +# DESCRIPTION: oh-my-zsh plugin file. +# AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com) +# VERSION: 1.0.0 +# ------------------------------------------------------------------------------ + + +if (( ${+commands[compleat]} )); then + local prefix="${commands[compleat]:h:h}" + local setup="${prefix}/share/compleat-1.0/compleat_setup" + + if [[ -f "$setup" ]]; then + if ! bashcompinit >/dev/null 2>&1; then + autoload -U bashcompinit + bashcompinit -i + fi + + source "$setup" + fi +fi + From e129fc5a285ccc8ff3c6ae9770908a0b5c2836e7 Mon Sep 17 00:00:00 2001 From: "Juan G. Hurtado" Date: Mon, 9 May 2011 13:32:42 +0200 Subject: [PATCH 088/184] Adds support for $(current_branch) on git_parse_ahead() Changes method git_parse_ahead() on git.zsh lib file. Before this change it checked directly against origin/master branch. Now it uses $(current_branch) to check for not pushed changes against the current remote branch. --- lib/git.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/git.zsh b/lib/git.zsh index e96f075be..2ace3d0e0 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -15,7 +15,7 @@ parse_git_dirty() { # Checks if there are commits ahead from remote function git_prompt_ahead() { - if $(echo "$(git log origin/master..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then + if $(echo "$(git log origin/$(current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then echo "$ZSH_THEME_GIT_PROMPT_AHEAD" fi } From 5440815c8303e715f04da48fb85e5d05400afb7d Mon Sep 17 00:00:00 2001 From: Justin Riley Date: Mon, 9 May 2011 10:19:10 -0400 Subject: [PATCH 089/184] remove git status from prompt --- themes/jtriley.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/jtriley.zsh-theme b/themes/jtriley.zsh-theme index ec62a2208..15d77ed23 100644 --- a/themes/jtriley.zsh-theme +++ b/themes/jtriley.zsh-theme @@ -1,6 +1,6 @@ #PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' PROMPT="%{$fg_bold[cyan]%}%T%{$fg_bold[green]%} %{$fg_bold[white]%}%n%{$fg[magenta]%}@%{$fg_bold[white]%}%m %{$fg_bold[green]%}%d -%{$fg_bold[yellow]%}%% $(git_prompt_info)%{$reset_color%}" +%{$fg_bold[yellow]%}%% %{$reset_color%}" #ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" #ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" From 31ef6199675be846e473c20681da339b6ea864cd Mon Sep 17 00:00:00 2001 From: Jacob Atzen Date: Thu, 19 May 2011 16:20:30 +0200 Subject: [PATCH 090/184] Add autojump plugin --- plugins/autojump/autojump.plugin.zsh | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 plugins/autojump/autojump.plugin.zsh diff --git a/plugins/autojump/autojump.plugin.zsh b/plugins/autojump/autojump.plugin.zsh new file mode 100644 index 000000000..da0a12765 --- /dev/null +++ b/plugins/autojump/autojump.plugin.zsh @@ -0,0 +1,3 @@ +if [ -f `brew --prefix`/etc/autojump ]; then + . `brew --prefix`/etc/autojump +fi From bde77af40d28ed7a308a843d8bcad556d8115f84 Mon Sep 17 00:00:00 2001 From: Jacob Atzen Date: Thu, 19 May 2011 16:33:29 +0200 Subject: [PATCH 091/184] TextMate automatically forks into the background --- plugins/textmate/textmate.plugin.zsh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/textmate/textmate.plugin.zsh b/plugins/textmate/textmate.plugin.zsh index 7b73e2751..7c4c14a5f 100644 --- a/plugins/textmate/textmate.plugin.zsh +++ b/plugins/textmate/textmate.plugin.zsh @@ -1,9 +1,9 @@ # TextMate -alias et='mate . &' -alias ett='mate app config lib db public spec test Rakefile Capfile Todo &' -alias etp='mate app config lib db public spec test vendor/plugins vendor/gems Rakefile Capfile Todo &' -alias etts='mate app config lib db public script spec test vendor/plugins vendor/gems Rakefile Capfile Todo &' +alias et='mate .' +alias ett='mate app config lib db public spec test Rakefile Capfile Todo' +alias etp='mate app config lib db public spec test vendor/plugins vendor/gems Rakefile Capfile Todo' +alias etts='mate app config lib db public script spec test vendor/plugins vendor/gems Rakefile Capfile Todo' # Editor Ruby file in TextMate alias mr='mate CHANGELOG app config db lib public script spec test' From 210c1ef86deed805b3c5b25833d4b128f758b610 Mon Sep 17 00:00:00 2001 From: Jan-Oliver Jahner Date: Fri, 20 May 2011 15:14:10 +0200 Subject: [PATCH 092/184] Added 'simple' theme. --- themes/simple.zsh-theme | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 themes/simple.zsh-theme diff --git a/themes/simple.zsh-theme b/themes/simple.zsh-theme new file mode 100644 index 000000000..a88d9d72a --- /dev/null +++ b/themes/simple.zsh-theme @@ -0,0 +1,6 @@ +PROMPT='%{$fg[green]%}%~%{$fg_bold[blue]%}$(git_prompt_info)%{$reset_color%} ' + +ZSH_THEME_GIT_PROMPT_PREFIX="(" +ZSH_THEME_GIT_PROMPT_SUFFIX=")" +ZSH_THEME_GIT_PROMPT_DIRTY=" ✗" +ZSH_THEME_GIT_PROMPT_CLEAN=" ✔" From 093f9077f5b358803a810d65fb0d4729477905cf Mon Sep 17 00:00:00 2001 From: Oliver Braun Date: Fri, 20 May 2011 22:26:45 +0200 Subject: [PATCH 093/184] Added obraun theme which is a slightly modified version of an already existing theme. --- themes/obraun.zsh-theme | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 themes/obraun.zsh-theme diff --git a/themes/obraun.zsh-theme b/themes/obraun.zsh-theme new file mode 100644 index 000000000..08d137665 --- /dev/null +++ b/themes/obraun.zsh-theme @@ -0,0 +1,11 @@ +if [ "$(whoami)" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="blue"; fi + +local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" + +PROMPT='%{$fg[green]%}[%*]%{$reset_color%} %{$fg_no_bold[cyan]%}%n %{${fg_bold[blue]}%}::%{$reset_color%} %{$fg[yellow]%}%m%{$reset_color%} %{$fg_no_bold[magenta]%} ➜ %{$reset_color%} %{${fg[green]}%}%3~ $(git_prompt_info)%{${fg_bold[$CARETCOLOR]}%}»%{${reset_color}%} ' + +RPS1="${return_code}" + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[red]%}‹" +ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}" + From 1aacb74caf6800fe895ab3a40584c08bfded451e Mon Sep 17 00:00:00 2001 From: Guten Date: Sun, 22 May 2011 21:27:30 +0800 Subject: [PATCH 094/184] add custom completion support --- 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 3ea88e924..a3d276df5 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -1,7 +1,7 @@ # Initializes Oh My Zsh # add a function path -fpath=($ZSH/functions $fpath) +fpath=($ZSH/functions $ZSH/completions $fpath) # Load all of the config files in ~/oh-my-zsh that end in .zsh # TIP: Add files you don't want in git to .gitignore From 5c1b341132119f08047a506e2c2b06fa0c0db52e Mon Sep 17 00:00:00 2001 From: Casey Watson Date: Tue, 24 May 2011 12:15:58 -0600 Subject: [PATCH 095/184] Fix to random theme selection - themes array is 1-based - theme files names are located in indicies 1 through N inclusive - this resolves an issue where you would occasionally see: "no such file or directory. Random theme '' loaded..." --- 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 3ea88e924..2a206798d 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -31,7 +31,7 @@ if [ "$ZSH_THEME" = "random" ] then themes=($ZSH/themes/*zsh-theme) N=${#themes[@]} - ((N=RANDOM%N)) + ((N=(RANDOM%N)+1)) RANDOM_THEME=${themes[$N]} source "$RANDOM_THEME" echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..." From f78218f625846afe2b6a487d18b0d7c65daa4edf Mon Sep 17 00:00:00 2001 From: Pete Clark Date: Tue, 24 May 2011 15:25:18 -0400 Subject: [PATCH 096/184] Adds compl .swp caches to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 4b555067e..ecb8e46bd 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ projects.zsh custom/* !custom/example.zsh cache +*.swp From 5da609e2c96c100c3c862e83f96e618d693c934f Mon Sep 17 00:00:00 2001 From: Pete Clark Date: Tue, 24 May 2011 15:28:42 -0400 Subject: [PATCH 097/184] Adds the _task script included with TaskWarrior On my Ubuntu system this file was found in /usr/share/doc/task/scripts/zsh/_task.gz --- plugins/taskwarrior/_task | 280 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 280 insertions(+) create mode 100644 plugins/taskwarrior/_task diff --git a/plugins/taskwarrior/_task b/plugins/taskwarrior/_task new file mode 100644 index 000000000..5bffa9119 --- /dev/null +++ b/plugins/taskwarrior/_task @@ -0,0 +1,280 @@ +#compdef task +# +# zsh completion for taskwarrior +# +# Copyright 2010 - 2011 Johannes Schlatow +# Copyright 2009 P.C. Shyamshankar +# All rights reserved. +# +# This script is part of the taskwarrior project. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the +# +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA +# 02110-1301 +# USA +# +typeset -g _task_cmds _task_projects _task_tags _task_config _task_modifiers +_task_projects=($(task _projects)) +_task_tags=($(task _tags)) +_task_ids=($(task _ids)) +_task_config=($(task _config)) +_task_modifiers=( + 'before' \ + 'after' \ + 'none' \ + 'any' \ + 'is' \ + 'isnt' \ + 'has' \ + 'hasnt' \ + 'startswith' \ + 'endswith' \ + 'word' \ + 'noword' +) +_task_cmds=($(task _commands)) +_task_zshcmds=( ${(f)"$(task _zshcommands)"} ) + + +_task_idCmds=( + 'append' \ + 'prepend' \ + 'annotate' \ + 'denotate' \ + 'edit' \ + 'duplicate' \ + 'info' \ + 'start' \ + 'stop' \ + 'done' +) + +_task_idCmdsDesc=( + 'append:Appends more description to an existing task.' \ + 'prepend:Prepends more description to an existing task.' \ + 'annotate:Adds an annotation to an existing task.' \ + 'denotate:Deletes an annotation of an existing task.' \ + 'edit:Launches an editor to let you modify a task directly.' \ + 'duplicate:Duplicates the specified task, and allows modifications.' \ + 'info:Shows all data, metadata for specified task.' \ + 'start:Marks specified task as started.' \ + 'stop:Removes the start time from a task.' \ + 'done:Marks the specified task as completed.' +) + +_task() { + _arguments -s -S \ + "*::task command:_task_commands" + return 0 +} + +local -a reply args word +word=$'[^\0]#\0' + +# priorities +local -a task_priorities +_regex_words values 'task priorities' \ + 'H:High' \ + 'M:Middle' \ + 'L:Low' +task_priorities=("$reply[@]") + +# projects +local -a task_projects +task_projects=( + /"$word"/ + ":values:task projects:compadd -a _task_projects" +) + +local -a _task_dates +_regex_words values 'task dates' \ + 'tod*ay:Today' \ + 'yes*terday:Yesterday' \ + 'tom*orrow:Tomorrow' \ + 'sow:Start of week' \ + 'soww:Start of work week' \ + 'socw:Start of calendar week' \ + 'som:Start of month' \ + 'soy:Start of year' \ + 'eow:End of week' \ + 'eoww:End of work week' \ + 'eocw:End of calendar week' \ + 'eom:End of month' \ + 'eoy:End of year' \ + 'mon:Monday' \ + 'tue:Tuesday'\ + 'wed:Wednesday' \ + 'thu:Thursday' \ + 'fri:Friday' \ + 'sat:Saturday' \ + 'sun:Sunday' +_task_dates=("$reply[@]") + +local -a _task_reldates +_regex_words values 'task reldates' \ + 'hrs:n hours' \ + 'day:n days' \ + '1st:first' \ + '2nd:second' \ + '3rd:third' \ + 'th:4th, 5th, etc.' \ + 'wks:weeks' +_task_reldates=("$reply[@]") + +task_dates=( + \( "$_task_dates[@]" \| + \( /$'[0-9][0-9]#'/- \( "$_task_reldates[@]" \) \) + \) +) + +_regex_words values 'task frequencies' \ + 'daily:Every day' \ + 'day:Every day' \ + 'weekdays:Every day skipping weekend days' \ + 'weekly:Every week' \ + 'biweekly:Every two weeks' \ + 'fortnight:Every two weeks' \ + 'quarterly:Every three months' \ + 'semiannual:Every six months' \ + 'annual:Every year' \ + 'yearly:Every year' \ + 'biannual:Every two years' \ + 'biyearly:Every two years' +_task_freqs=("$reply[@]") + +local -a _task_frequencies +_regex_words values 'task frequencies' \ + 'd:days' \ + 'w:weeks' \ + 'q:quarters' \ + 'y:years' +_task_frequencies=("$reply[@]") + +task_freqs=( + \( "$_task_freqs[@]" \| + \( /$'[0-9][0-9]#'/- \( "$_task_frequencies[@]" \) \) + \) +) + +# attributes +local -a task_attributes +_regex_words -t ':' default 'task attributes' \ + 'pro*ject:Project name:$task_projects' \ + 'du*e:Due date:$task_dates' \ + 'wa*it:Date until task becomes pending:$task_dates' \ + 're*cur:Recurrence frequency:$task_freqs' \ + 'pri*ority:priority:$task_priorities' \ + 'un*til:Recurrence end date:$task_dates' \ + 'fg:Foreground color' \ + 'bg:Background color' \ + 'li*mit:Desired number of rows in report' +task_attributes=("$reply[@]") + +args=( + \( "$task_attributes[@]" \| + \( /'(project|due|wait|recur|priority|until|fg|bg|limit).'/- \( /$'[^:]#:'/ ":default:modifiers:compadd -S ':' -a _task_modifiers" \) \) \| + \( /'(rc).'/- \( /$'[^:]#:'/ ":arguments:config:compadd -S ':' -a _task_config" \) \) \| + \( /'(+|-)'/- \( /"$word"/ ":values:remove tag:compadd -a _task_tags" \) \) \| + \( /"$word"/ \) + \) \# +) +_regex_arguments _task_attributes "${args[@]}" + +## task commands + +# default completion +(( $+functions[_task_default] )) || +_task_default() { + _task_attributes "$@" +} + +# commands expecting an ID +(( $+functions[_task_id] )) || +_task_id() { + if (( CURRENT < 3 )); then + # update IDs + _task_zshids=( ${(f)"$(task _zshids)"} ) + _describe -t values 'task IDs' _task_zshids + else + _task_attributes "$@" + fi +} + +# merge completion +(( $+functions[_task_merge] )) || +_task_merge() { + # TODO match URIs in .taskrc + _files +} + +# push completion +(( $+functions[_task_push] )) || +_task_push() { + # TODO match URIs in .taskrc + _files +} + +# pull completion +(( $+functions[_task_pull] )) || +_task_pull() { + # TODO match URIs in .taskrc + _files +} + + +# modify (task [0-9]* ...) completion +(( $+functions[_task_modify] )) || +_task_modify() { + _describe -t commands 'task command' _task_idCmdsDesc + _task_attributes "$@" +} + +## first level completion => task sub-command completion +(( $+functions[_task_commands] )) || +_task_commands() { + local cmd ret=1 + if (( CURRENT == 1 )); then + # update IDs + _task_zshids=( ${(f)"$(task _zshids)"} ) + + _describe -t commands 'task command' _task_zshcmds + _describe -t values 'task IDs' _task_zshids + # TODO match more than one ID + elif [[ $words[1] =~ ^[0-9]*$ ]] then + _call_function ret _task_modify + return ret + else +# local curcontext="${curcontext}" +# cmd="${_task_cmds[(r)$words[1]:*]%%:*}" + cmd="${_task_cmds[(r)$words[1]]}" + idCmd="${(M)_task_idCmds[@]:#$words[1]}" + if (( $#cmd )); then +# curcontext="${curcontext%:*:*}:task-${cmd}" + + if (( $#idCmd )); then + _call_function ret _task_id + else + _call_function ret _task_${cmd} || + _call_function ret _task_default || + _message "No command remaining." + fi + else + _message "Unknown subcommand ${cmd}" + fi + return ret + fi +} From 1e86678f9d3c8c979ff8d3c8b5aac19e9e611441 Mon Sep 17 00:00:00 2001 From: Pete Clark Date: Tue, 24 May 2011 15:29:05 -0400 Subject: [PATCH 098/184] Adds oh-my-zsh plugin to load TaskWarrior completions --- plugins/taskwarrior/taskwarrior.plugin.zsh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 plugins/taskwarrior/taskwarrior.plugin.zsh diff --git a/plugins/taskwarrior/taskwarrior.plugin.zsh b/plugins/taskwarrior/taskwarrior.plugin.zsh new file mode 100644 index 000000000..c1830042e --- /dev/null +++ b/plugins/taskwarrior/taskwarrior.plugin.zsh @@ -0,0 +1,21 @@ +################################################################################ +# Author: Pete Clark +# Email: pete[dot]clark[at]gmail[dot]com +# Version: 0.1 (05/24/2011) +# License: WTFPL +# +# This oh-my-zsh plugin adds smart tab completion for +# TaskWarrior. It uses the zsh tab completion +# script (_task) distributed with TaskWarrior for the completion definitions. +# +# Typing task[tabtab] will give you a list of current tasks, task 66[tabtab] +# gives a list of available modifications for that task, etc. +################################################################################ + +zstyle ':completion:*:*:task:*' verbose yes +zstyle ':completion:*:*:task:*:descriptions' format '%U%B%d%b%u' + +zstyle ':completion:*:*:task:*' group-name '' + +alias t=task +compdef _task t=task From 21276546e9614576ce6e1a6be1393abce393d04f Mon Sep 17 00:00:00 2001 From: "Suraj N. Kurapati" Date: Wed, 23 Feb 2011 00:38:15 -0800 Subject: [PATCH 099/184] fishy theme: text indicators for $? and git status The git status indicators were taken from sorin.zsh-theme and changed to use ASCII symbols instead of Unicode ones because my preferred terminal font, DejaVu Sans Mono, renders Unicode symbols poorly and also because Unicode rendering is not available in standard Linux virtual terminals. --- themes/fishy.zsh-theme | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/themes/fishy.zsh-theme b/themes/fishy.zsh-theme index f22eda868..f9e506cae 100644 --- a/themes/fishy.zsh-theme +++ b/themes/fishy.zsh-theme @@ -3,7 +3,18 @@ local user_color='green'; [ $UID -eq 0 ] && user_color='red' PROMPT='%n@%m %{$fg[$user_color]%}%~%{$reset_color%}%(!.#.>) ' PROMPT2='%{$fg[red]%}\ %{$reset_color%}' -RPS1='%(?..%{$fg[red]%}%? ↵%{$reset_color%})$(git_prompt_info)' -ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[cyan]%}" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +local return_status="%{$fg_bold[red]%}%(?..%?)%{$reset_color%}" +RPROMPT='${return_status}$(git_prompt_info)$(git_prompt_status)%{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX=" " +ZSH_THEME_GIT_PROMPT_SUFFIX="" +ZSH_THEME_GIT_PROMPT_DIRTY="" +ZSH_THEME_GIT_PROMPT_CLEAN="" + +ZSH_THEME_GIT_PROMPT_ADDED="%{$fg_bold[green]%}+" +ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg_bold[blue]%}!" +ZSH_THEME_GIT_PROMPT_DELETED="%{$fg_bold[red]%}-" +ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg_bold[magenta]%}>" +ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg_bold[yellow]%}#" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg_bold[cyan]%}?" From f8aae64e478066be7d05f5eb6970c356cafcfd36 Mon Sep 17 00:00:00 2001 From: Jake Bell Date: Thu, 26 May 2011 12:34:37 -0500 Subject: [PATCH 100/184] Adding ability to override plugins from the custom directory. --- .gitignore | 1 + README.textile | 6 ++++-- custom/example/example.plugin.zsh | 2 ++ oh-my-zsh.sh | 4 +++- 4 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 custom/example/example.plugin.zsh diff --git a/.gitignore b/.gitignore index 4b555067e..8fdfae286 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,6 @@ locals.zsh log/.zsh_history projects.zsh custom/* +!custom/example !custom/example.zsh cache diff --git a/README.textile b/README.textile index d01c3310a..2dbfbe5a6 100644 --- a/README.textile +++ b/README.textile @@ -48,7 +48,9 @@ the "refcard":http://www.bash2zsh.com/zsh_refcard/refcard.pdf is pretty tasty fo h3. Customization If you want to override any of the default behavior, just add a new file (ending in @.zsh@) into the @custom/@ directory. -If you have many functions which go good together you can put them as a *.plugin.zsh file in the @plugin/@ directory and then enable this plugin. +If you have many functions which go good 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. Uninstalling @@ -68,4 +70,4 @@ This project wouldn't exist without all of our awesome users and contributors. * "View our growing list of contributors":https://github.com/robbyrussell/oh-my-zsh/contributors -Thank you so much! \ No newline at end of file +Thank you so much! diff --git a/custom/example/example.plugin.zsh b/custom/example/example.plugin.zsh new file mode 100644 index 000000000..406f27445 --- /dev/null +++ b/custom/example/example.plugin.zsh @@ -0,0 +1,2 @@ +# Add your own custom plugins in the custom/plugins directory. Plugins placed +# here will override ones with the same name in the main plugins directory. diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index c8f1a33b8..dbff1ced9 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -17,7 +17,9 @@ compinit -i # Load all of the plugins that were defined in ~/.zshrc for plugin ($plugins); do - if [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then + if [ -f $ZSH/custom/plugins/$plugin/$plugin.plugin.zsh ]; then + source $ZSH/custom/plugins/$plugin/$plugin.plugin.zsh + elif [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then source $ZSH/plugins/$plugin/$plugin.plugin.zsh fi done From 1816e957770f8e3f0ad22658f741c5f0492da982 Mon Sep 17 00:00:00 2001 From: alanpeabody Date: Thu, 26 May 2011 23:56:45 -0400 Subject: [PATCH 101/184] Added my own theme. --- themes/alanpeabody.zsh-theme | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 themes/alanpeabody.zsh-theme diff --git a/themes/alanpeabody.zsh-theme b/themes/alanpeabody.zsh-theme new file mode 100644 index 000000000..1f66f1ec3 --- /dev/null +++ b/themes/alanpeabody.zsh-theme @@ -0,0 +1,22 @@ + +local user='%{$fg[magenta]%}%n@%{$fg[magenta]%}%m%{$reset_color%}' +local pwd='%{$fg[blue]%}%~%{$reset_color%}' +local rvm='%{$fg[green]%}‹$(rvm-prompt i v g)›%{$reset_color%}' +local return_code='%(?..%{$fg[red]%}%? ↵%{$reset_color%})' +local git_branch='$(git_prompt_status)%{$reset_color%}$(git_prompt_info)%{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="" +ZSH_THEME_GIT_PROMPT_CLEAN="" + +ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} ✚" +ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} ✹" +ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖" +ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜" +ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭" + +PROMPT="${user} ${pwd}$ " +RPROMPT="${return_code} ${git_branch} ${rvm}" + From 04573324d52aaadf947f3a80190e4f54d8580932 Mon Sep 17 00:00:00 2001 From: Martin Thurau Date: Fri, 27 May 2011 16:58:14 +0200 Subject: [PATCH 102/184] Added compatibility for the linux 'stat' command for the ant plugin --- plugins/ant/ant.plugin.zsh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/plugins/ant/ant.plugin.zsh b/plugins/ant/ant.plugin.zsh index 0544ac92c..23bc7756a 100644 --- a/plugins/ant/ant.plugin.zsh +++ b/plugins/ant/ant.plugin.zsh @@ -1,8 +1,15 @@ +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 -f%m .ant_targets) - changed=$(stat -f%m build.xml) + accurate=$($stat_cmd -f%m .ant_targets) + changed=$($stat_cmd -f%m build.xml) return $(expr $accurate '>=' $changed) fi } From 3e433165502a01028fcd0368161a2193eaeb386c Mon Sep 17 00:00:00 2001 From: Andrew Hodges Date: Sat, 28 May 2011 10:16:06 -0400 Subject: [PATCH 103/184] Ruby Switching Helpers Add helper functions to switch gemsets on ruby-1.8.7-p334 and ruby-1.9.2-p180. Add completion definitions for helper functions. --- plugins/rvm/rvm.plugin.zsh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/plugins/rvm/rvm.plugin.zsh b/plugins/rvm/rvm.plugin.zsh index ef934d547..274123836 100644 --- a/plugins/rvm/rvm.plugin.zsh +++ b/plugins/rvm/rvm.plugin.zsh @@ -1,3 +1,28 @@ fpath=($ZSH/plugins/rvm $fpath) autoload -U compinit compinit -i + +local ruby18='ruby-1.8.7-p334' +local ruby19='ruby-1.9.2-p180' + +function rb18 { + if [ -z "$1" ]; then + rvm use "$ruby18" + else + rvm use "$ruby18@$1" + fi +} + +_rb18() {compadd `ls -1 $rvm_path/gems | grep "^$ruby18@" | sed -e "s/^$ruby18@//" | awk '{print $1}'`} +compdef _rb18 rb18 + +function rb19 { + if [ -z "$1" ]; then + rvm use "$ruby19" + else + rvm use "$ruby19@$1" + fi +} + +_rb19() {compadd `ls -1 $rvm_path/gems | grep "^$ruby19@" | sed -e "s/^$ruby19@//" | awk '{print $1}'`} +compdef _rb19 rb19 From e703c9591c64cd23bb0f0e1a892fbed0efe74fa7 Mon Sep 17 00:00:00 2001 From: Andrew Hodges Date: Sat, 28 May 2011 10:23:06 -0400 Subject: [PATCH 104/184] Helpful Listing Aliases Add alias to list installed rubies. Add alias to list gemsets in active ruby. --- plugins/rvm/rvm.plugin.zsh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/rvm/rvm.plugin.zsh b/plugins/rvm/rvm.plugin.zsh index 274123836..ba780c97d 100644 --- a/plugins/rvm/rvm.plugin.zsh +++ b/plugins/rvm/rvm.plugin.zsh @@ -2,6 +2,9 @@ fpath=($ZSH/plugins/rvm $fpath) autoload -U compinit compinit -i +alias rubies='rvm list rubies' +alias gemsets='rvm gemset list' + local ruby18='ruby-1.8.7-p334' local ruby19='ruby-1.9.2-p180' From 9f34bbedc8d4843b0ed50f76d38b63e5aa48cc8b Mon Sep 17 00:00:00 2001 From: Andrew Hodges Date: Sat, 28 May 2011 10:35:54 -0400 Subject: [PATCH 105/184] RVM Update Helpers Add helper function to get rvm head. Add helper function to link zsh completion that comes with rvm into om-my-zsh plugin directory, but don't overwrite the completion that comes with oh-my-zsh (oh-my-zsh's completion is better, but I want to be able to compare). --- plugins/rvm/rvm.plugin.zsh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plugins/rvm/rvm.plugin.zsh b/plugins/rvm/rvm.plugin.zsh index ba780c97d..509dcbd98 100644 --- a/plugins/rvm/rvm.plugin.zsh +++ b/plugins/rvm/rvm.plugin.zsh @@ -29,3 +29,12 @@ function rb19 { _rb19() {compadd `ls -1 $rvm_path/gems | grep "^$ruby19@" | sed -e "s/^$ruby19@//" | awk '{print $1}'`} compdef _rb19 rb19 + +function rvm-update { + rvm get head + rvm reload # TODO: Reload rvm completion? +} + +function rvm-link-completion { + ln -s "$rvm_path/scripts/zsh/Completion/_rvm" "$ZSH/plugins/rvm/_rvm.official" +} From 572b27b75724d00fbc99ef64de3dbd21a28c8194 Mon Sep 17 00:00:00 2001 From: Andrew Hodges Date: Sat, 28 May 2011 10:50:06 -0400 Subject: [PATCH 106/184] Gem List Helper Add helper function to list gems in a pretty way (only with rvm, for now). Add missng EOF newline and a todo to the ruby plugin. --- plugins/ruby/ruby.plugin.zsh | 4 +++- plugins/rvm/rvm.plugin.zsh | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/plugins/ruby/ruby.plugin.zsh b/plugins/ruby/ruby.plugin.zsh index 82bf5d49d..08ca9c601 100644 --- a/plugins/ruby/ruby.plugin.zsh +++ b/plugins/ruby/ruby.plugin.zsh @@ -1,4 +1,6 @@ +# TODO: Make this compatible with rvm. +# Run sudo gem on the system ruby, not the active ruby. alias sgem='sudo gem' # Find ruby file -alias rfind='find . -name *.rb | xargs grep -n' \ No newline at end of file +alias rfind='find . -name *.rb | xargs grep -n' diff --git a/plugins/rvm/rvm.plugin.zsh b/plugins/rvm/rvm.plugin.zsh index 509dcbd98..8a3ec788a 100644 --- a/plugins/rvm/rvm.plugin.zsh +++ b/plugins/rvm/rvm.plugin.zsh @@ -38,3 +38,15 @@ function rvm-update { function rvm-link-completion { ln -s "$rvm_path/scripts/zsh/Completion/_rvm" "$ZSH/plugins/rvm/_rvm.official" } + +# TODO: Make this usable w/o rvm. +function gems { + local current_ruby=`rvm-prompt i v p` + local current_gemset=`rvm-prompt g` + + gem list $@ | sed \ + -Ee "s/\([0-9\.]+( .+)?\)/$fg[blue]&$reset_color/g" \ + -Ee "s|$(echo $rvm_path)|$fg[magenta]\$rvm_path$reset_color|g" \ + -Ee "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \ + -Ee "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g" +} From e263f1f0057f6cac15ef588c681e6f49713c3975 Mon Sep 17 00:00:00 2001 From: Andrew Hodges Date: Sat, 28 May 2011 10:57:48 -0400 Subject: [PATCH 107/184] Brew Plugin Merge completion with official brew completion. Add a helper to link official completion into oh-my-zsh plugin (without overwriting). Add an alias to list installed brews. Add brews to the path (in a somewhat strange way). --- plugins/brew/_brew | 24 +++++++++++++++++------- plugins/brew/brew.plugin.zsh | 13 +++++++++++++ 2 files changed, 30 insertions(+), 7 deletions(-) create mode 100644 plugins/brew/brew.plugin.zsh diff --git a/plugins/brew/_brew b/plugins/brew/_brew index cee1e25f0..1dcf0a4bf 100644 --- a/plugins/brew/_brew +++ b/plugins/brew/_brew @@ -25,10 +25,12 @@ _1st_arguments=( 'link:link a formula' 'list:list files in a formula or not-installed formulae' 'log:git commit log for a formula' + 'missing:check all installed formuale for missing dependencies.' 'outdated:list formulas for which a newer version is available' 'prune:remove dead links' 'remove:remove a formula' 'search:search for a formula (/regex/ or string)' + 'server:start a local web app that lets you browse formulae (requires Sinatra)' 'unlink:unlink a formula' 'update:freshen up links' 'upgrade:upgrade outdated formulae' @@ -36,10 +38,14 @@ _1st_arguments=( ) local expl -local -a formula installed_formulae +local -a formulae installed_formulae _arguments \ - '(-v --verbose)'{-v,--verbose}'[verbose]' \ + '(-v)-v[verbose]' \ + '(--cellar)--cellar[brew cellar]' \ + '(--config)--config[brew configuration]' \ + '(--env)--env[brew environment]' \ + '(--repository)--repository[brew repository]' \ '(--version)--version[version information]' \ '(--prefix)--prefix[where brew lives on this system]' \ '(--cache)--cache[brew cache]' \ @@ -51,20 +57,24 @@ if (( CURRENT == 1 )); then fi case "$words[1]" in - list) + search|-S) + _arguments \ + '(--macports)--macports[search the macports repository]' \ + '(--fink)--fink[search the fink repository]' ;; + list|ls) _arguments \ '(--unbrewed)--unbrewed[files in brew --prefix not controlled by brew]' \ + '(--versions)--versions[list all installed versions of a formula]' \ '1: :->forms' && return 0 if [[ "$state" == forms ]]; then _brew_installed_formulae - _requested installed_formulae expl 'installed formulae' compadd -a installed_formulae + _wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae fi ;; - install|home|log|info|uses|cat|deps) + install|home|homepage|log|info|abv|uses|cat|deps|edit|options) _brew_all_formulae _wanted formulae expl 'all formulae' compadd -a formulae ;; - remove|edit|xo) + remove|rm|uninstall|unlink|cleanup|link|ln) _brew_installed_formulae _wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae ;; esac - diff --git a/plugins/brew/brew.plugin.zsh b/plugins/brew/brew.plugin.zsh new file mode 100644 index 000000000..f584a4684 --- /dev/null +++ b/plugins/brew/brew.plugin.zsh @@ -0,0 +1,13 @@ +# Move /usr/local/bin (path where brews are linked) to the front of the path +# This will allow us to override system binaries like ruby with our brews +# TODO: Do this in a more compatible way. +# What if someone doesn't have /usr/bin in their path? +export PATH=`echo $PATH | sed -e 's|/usr/local/bin||' -e 's|::|:|g'` # Remove /usr/local/bin +export PATH=`echo $PATH | sed -e 's|/usr/bin|/usr/local/bin:&|'` # Add it in front of /usr/bin +export PATH=`echo $PATH | sed -e 's|/usr/bin|/usr/local/sbin:&|'` # Add /usr/local/sbin + +alias brews='brew list -1' + +function brew-link-completion { + ln -s "$(brew --prefix)/Library/Contributions/brew_zsh_completion.zsh" "$ZSH/plugins/brew/_brew.official" +} From befb02e3da0573fa788114e1c18c70b75f787f1f Mon Sep 17 00:00:00 2001 From: Andrew Hodges Date: Sat, 28 May 2011 11:09:37 -0400 Subject: [PATCH 108/184] Pow! Restart Helper Add helper function to restart an app running on Pow! --- plugins/pow/pow.plugin.zsh | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 plugins/pow/pow.plugin.zsh diff --git a/plugins/pow/pow.plugin.zsh b/plugins/pow/pow.plugin.zsh new file mode 100644 index 000000000..6b2a6f2be --- /dev/null +++ b/plugins/pow/pow.plugin.zsh @@ -0,0 +1,10 @@ +# Thanks to Christopher Sexton +# https://gist.github.com/965032 +function kapow { + touch ~/.pow/$1/tmp/restart.txt + if [ $? -eq 0 ]; then + echo "$fg[yellow]Pow restarting $1...$reset_color" + fi +} + +compctl -W ~/.pow -/ kapow From d72b9c5ec5d55765998bb301b3425fbe84012c1f Mon Sep 17 00:00:00 2001 From: Andrew Hodges Date: Sat, 28 May 2011 11:20:48 -0400 Subject: [PATCH 109/184] Node.js Helpers Add helper function to open node api in browser. Add binaries installed via npm to path. Tell node where to find things (what things?). --- plugins/node/node.plugin.zsh | 8 ++++++++ plugins/npm/npm.plugin.zsh | 2 ++ 2 files changed, 10 insertions(+) create mode 100644 plugins/node/node.plugin.zsh create mode 100644 plugins/npm/npm.plugin.zsh diff --git a/plugins/node/node.plugin.zsh b/plugins/node/node.plugin.zsh new file mode 100644 index 000000000..18f35333c --- /dev/null +++ b/plugins/node/node.plugin.zsh @@ -0,0 +1,8 @@ +# This works if you installed node via homebrew. +export NODE_PATH="/usr/local/lib/node" + +# Open the node api for your current version to the optional section. +# TODO: Make the section part easier to use. +function node-api { + open "http://nodejs.org/docs/$(node --version)/api/all.html#$1" +} diff --git a/plugins/npm/npm.plugin.zsh b/plugins/npm/npm.plugin.zsh new file mode 100644 index 000000000..0b0a30e11 --- /dev/null +++ b/plugins/npm/npm.plugin.zsh @@ -0,0 +1,2 @@ +# TODO: Don't do this in such a weird way. +export PATH=`echo $PATH | sed -e 's|/usr/bin|/usr/local/share/npm/bin:&|'` From 18293cd724224282d6ca473fcbe6e7439d3eac0c Mon Sep 17 00:00:00 2001 From: Andrew Hodges Date: Sat, 28 May 2011 11:27:50 -0400 Subject: [PATCH 110/184] OS X Helpers Add helper aliases for show/hide files. Add helper alias to recursively delete .DS_Store files. --- plugins/osx/osx.plugin.zsh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh index 81eed5e92..a65ca642a 100644 --- a/plugins/osx/osx.plugin.zsh +++ b/plugins/osx/osx.plugin.zsh @@ -1,3 +1,9 @@ +alias showfiles='defaults write com.apple.finder AppleShowAllFiles TRUE; killall Finder' +alias hidefiles='defaults write com.apple.finder AppleShowAllFiles FALSE; killall Finder' + +# Recursively delete .DS_Store files +alias rm-dsstore="find . -name '*.DS_Store' -type f -delete" + function savepath() { pwd > ~/.current_path~ } From 18ab94bccd3cfe64f81ab2ea0e09ce4a630a21bc Mon Sep 17 00:00:00 2001 From: brian tse Date: Sat, 28 May 2011 23:57:32 +0800 Subject: [PATCH 111/184] Add new 'minimal' theme --- themes/minimal.zsh-theme | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 themes/minimal.zsh-theme diff --git a/themes/minimal.zsh-theme b/themes/minimal.zsh-theme new file mode 100644 index 000000000..ee3ab6b22 --- /dev/null +++ b/themes/minimal.zsh-theme @@ -0,0 +1,15 @@ +ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[white]%}[" +ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}●%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="" + +#Customized git status, oh-my-zsh currently does not allow render dirty status before branch +git_custom_status() { + local cb=$(current_branch) + if [ -n "$cb" ]; then + echo "- $ZSH_THEME_GIT_PROMPT_PREFIX$(current_branch)$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX" + fi +} + + +PROMPT='%2~ $(git_custom_status) »%b ' \ No newline at end of file From ace84c8b7eb8b50842798bac9811d02928f58dd3 Mon Sep 17 00:00:00 2001 From: Andrew Hodges Date: Sat, 28 May 2011 13:06:03 -0400 Subject: [PATCH 112/184] Cleanup Add missing newlines at EOF. Remove redundant comment. Fix grammar in comment. --- plugins/cap/cap.plugin.zsh | 2 +- plugins/compleat/compleat.plugin.zsh | 2 -- plugins/github/github.plugin.zsh | 1 - plugins/textmate/textmate.plugin.zsh | 4 +--- 4 files changed, 2 insertions(+), 7 deletions(-) diff --git a/plugins/cap/cap.plugin.zsh b/plugins/cap/cap.plugin.zsh index a0fa21d00..8336182d5 100644 --- a/plugins/cap/cap.plugin.zsh +++ b/plugins/cap/cap.plugin.zsh @@ -18,4 +18,4 @@ function _cap () { fi } -compctl -K _cap cap \ No newline at end of file +compctl -K _cap cap diff --git a/plugins/compleat/compleat.plugin.zsh b/plugins/compleat/compleat.plugin.zsh index 8d16a5687..38f1b396a 100644 --- a/plugins/compleat/compleat.plugin.zsh +++ b/plugins/compleat/compleat.plugin.zsh @@ -5,7 +5,6 @@ # VERSION: 1.0.0 # ------------------------------------------------------------------------------ - if (( ${+commands[compleat]} )); then local prefix="${commands[compleat]:h:h}" local setup="${prefix}/share/compleat-1.0/compleat_setup" @@ -19,4 +18,3 @@ if (( ${+commands[compleat]} )); then source "$setup" fi fi - diff --git a/plugins/github/github.plugin.zsh b/plugins/github/github.plugin.zsh index df7053ba7..1eb338113 100644 --- a/plugins/github/github.plugin.zsh +++ b/plugins/github/github.plugin.zsh @@ -4,4 +4,3 @@ if [ "$commands[(I)hub]" ]; then # eval `hub alias -s zsh` function git(){hub "$@"} fi - diff --git a/plugins/textmate/textmate.plugin.zsh b/plugins/textmate/textmate.plugin.zsh index 7c4c14a5f..aa2f75f4f 100644 --- a/plugins/textmate/textmate.plugin.zsh +++ b/plugins/textmate/textmate.plugin.zsh @@ -1,11 +1,9 @@ - -# TextMate alias et='mate .' alias ett='mate app config lib db public spec test Rakefile Capfile Todo' alias etp='mate app config lib db public spec test vendor/plugins vendor/gems Rakefile Capfile Todo' alias etts='mate app config lib db public script spec test vendor/plugins vendor/gems Rakefile Capfile Todo' -# Editor Ruby file in TextMate +# Edit Ruby app in TextMate alias mr='mate CHANGELOG app config db lib public script spec test' function tm() { From 18bfb14a2f774b115c8634cdaa3864cbdee91a94 Mon Sep 17 00:00:00 2001 From: Andrew Hodges Date: Sat, 28 May 2011 13:12:03 -0400 Subject: [PATCH 113/184] Thor Add plugin with completion for thor. --- plugins/thor/_thor | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 plugins/thor/_thor diff --git a/plugins/thor/_thor b/plugins/thor/_thor new file mode 100644 index 000000000..9f7ed5aef --- /dev/null +++ b/plugins/thor/_thor @@ -0,0 +1,4 @@ +#compdef thor +#autoload + +compadd `thor list | grep thor | cut -d " " -f 2` From 205e2f4842d1d1808b0d8d16bcfd1daeadb111d9 Mon Sep 17 00:00:00 2001 From: Magnus Woldrich Date: Sun, 29 May 2011 11:55:24 +0200 Subject: [PATCH 114/184] add trapd00r theme --- themes/trapd00r.zsh-theme | 95 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 themes/trapd00r.zsh-theme diff --git a/themes/trapd00r.zsh-theme b/themes/trapd00r.zsh-theme new file mode 100644 index 000000000..cba14c42c --- /dev/null +++ b/themes/trapd00r.zsh-theme @@ -0,0 +1,95 @@ +# Name: trapd00r zsh theme +# Author: Magnus Woldrich +# +# This theme needs a terminal supporting 256 colors as well as unicode. It also +# needs the script that splits up the current path and makes it fancy as located +# here: https://github.com/trapd00r/utils/blob/master/zsh_path +# +# By default it spans over two lines like so: +# +# scp1@shiva:pts/9-> /home » scp1 (0) +# > +# +# that's user@host:pts/-> splitted path (return status) +# +# If the current directory is a git repository, we span 3 lines; +# +# git❨ master ❩ DIRTY +# scp1@shiva:pts/4-> /home » scp1 » dev » utils (0) +# > + +autoload -U add-zsh-hook +autoload -Uz vcs_info + +local c0=$( printf "\e[m") +local c1=$( printf "\e[38;5;245m") +local c2=$( printf "\e[38;5;250m") +local c3=$( printf "\e[38;5;242m") +local c4=$( printf "\e[38;5;197m") +local c5=$( printf "\e[38;5;225m") +local c6=$( printf "\e[38;5;240m") +local c7=$( printf "\e[38;5;242m") +local c8=$( printf "\e[38;5;244m") +local c9=$( printf "\e[38;5;162m") +local c10=$(printf "\e[1m") +local c11=$(printf "\e[38;5;208m\e[1m") +local c12=$(printf "\e[38;5;142m\e[1m") +local c13=$(printf "\e[38;5;196m\e[1m") + + +# We dont want to use the extended colorset in the TTY / VC. +if [ "$TERM" = "linux" ]; then + c1=$( printf "\e[34;1m") + c2=$( printf "\e[35m") + c3=$( printf "\e[31m") + c4=$( printf "\e[31;1m") + c5=$( printf "\e[32m") + c6=$( printf "\e[32;1m") + c7=$( printf "\e[33m") + c8=$( printf "\e[33;1m") + c9=$( printf "\e[34m") + + c11=$(printf "\e[35;1m") + c12=$(printf "\e[36m") + c13=$(printf "\e[31;1m") +fi + +zstyle ':vcs_info:*' actionformats \ + '%{$c8%}(%f%s)%{$c7%}-%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f ' + +zstyle ':vcs_info:*' formats \ + "%{$c8%}%s%%{$c7%}❨ %{$c9%}%{$c11%}%b%{$c7%} ❩%{$reset_color%}%f " + +zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r' +zstyle ':vcs_info:*' enable git + +add-zsh-hook precmd prompt_jnrowe_precmd + +prompt_jnrowe_precmd () { + vcs_info + if [ "${vcs_info_msg_0_}" = "" ]; then + dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})" + PROMPT='%{$fg_bold[green]%}%p%{$reset_color%}${vcs_info_msg_0_}${dir_status} ${ret_status}%{$reset_color%} +> ' + +# modified, to be commited + elif [[ $(git diff --cached --name-status 2>/dev/null ) != "" ]]; then + dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})" + PROMPT='${vcs_info_msg_0_}%{$30%} %{$bg_bold[red]%}%{$fg_bold[cyan]%}C%{$fg_bold[black]%}OMMIT%{$reset_color%} +%{$fg_bold[green]%}%p%{$reset_color%}${dir_status}%{$reset_color%} +> ' + + elif [[ $(git diff --name-status 2>/dev/null ) != "" ]]; then + dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})" + PROMPT='${vcs_info_msg_0_}%{$bg_bold[red]%}%{$fg_bold[blue]%}D%{$fg_bold[black]%}IRTY%{$reset_color%} +%{$fg_bold[green]%}%p%{$reset_color%}${dir_status}%{$reset_color%} +%{$c13%}>%{$c0%} ' + else + dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})" + PROMPT='${vcs_info_msg_0_} +%{$fg_bold[green]%}%p%{$reset_color%}${dir_status} ${vcs_info_msg_0_}%{$reset_color%} +> ' +fi +} + +# vim: set ft=zsh sw=2 et tw=0: From 1c2eb40e876db3d2bfad22a0b52f0d410e1d51f3 Mon Sep 17 00:00:00 2001 From: nebirhos Date: Thu, 26 May 2011 20:00:23 +0200 Subject: [PATCH 115/184] Added nebirhos theme --- themes/nebirhos.zsh-theme | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 themes/nebirhos.zsh-theme diff --git a/themes/nebirhos.zsh-theme b/themes/nebirhos.zsh-theme new file mode 100644 index 000000000..c49df972e --- /dev/null +++ b/themes/nebirhos.zsh-theme @@ -0,0 +1,17 @@ +# Based on robbyrussell's theme, with host and rvm indicators. Example: +# @host ➜ currentdir rvm:(rubyversion@gemset) git:(branchname) + +# Get the current ruby version in use with RVM: +if [ -e ~/.rvm/bin/rvm-prompt ]; then + RUBY_PROMPT_="%{$fg_bold[blue]%}rvm:(%{$fg[green]%}\$(~/.rvm/bin/rvm-prompt s i v g)%{$fg_bold[blue]%})%{$reset_color%} " +fi + +# Get the host name (first 4 chars) +HOST_PROMPT_="%{$fg_bold[red]%}@$HOST[0,4] ➜ %{$fg_bold[cyan]%}%c " +GIT_PROMPT="%{$fg_bold[blue]%}\$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}" +PROMPT="$HOST_PROMPT_$RUBY_PROMPT_$GIT_PROMPT" + +ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" From 1e3b441ce7e0b8706867801c1e5e7ca6760ff17e Mon Sep 17 00:00:00 2001 From: Andrew Hodges Date: Mon, 30 May 2011 10:07:15 -0400 Subject: [PATCH 116/184] Rollback of Pull #366 sorin-ionescu had some good points. --- plugins/brew/brew.plugin.zsh | 12 ------------ plugins/node/node.plugin.zsh | 5 +---- plugins/npm/npm.plugin.zsh | 2 -- plugins/rvm/rvm.plugin.zsh | 9 ++------- 4 files changed, 3 insertions(+), 25 deletions(-) delete mode 100644 plugins/npm/npm.plugin.zsh diff --git a/plugins/brew/brew.plugin.zsh b/plugins/brew/brew.plugin.zsh index f584a4684..c2e95884e 100644 --- a/plugins/brew/brew.plugin.zsh +++ b/plugins/brew/brew.plugin.zsh @@ -1,13 +1 @@ -# Move /usr/local/bin (path where brews are linked) to the front of the path -# This will allow us to override system binaries like ruby with our brews -# TODO: Do this in a more compatible way. -# What if someone doesn't have /usr/bin in their path? -export PATH=`echo $PATH | sed -e 's|/usr/local/bin||' -e 's|::|:|g'` # Remove /usr/local/bin -export PATH=`echo $PATH | sed -e 's|/usr/bin|/usr/local/bin:&|'` # Add it in front of /usr/bin -export PATH=`echo $PATH | sed -e 's|/usr/bin|/usr/local/sbin:&|'` # Add /usr/local/sbin - alias brews='brew list -1' - -function brew-link-completion { - ln -s "$(brew --prefix)/Library/Contributions/brew_zsh_completion.zsh" "$ZSH/plugins/brew/_brew.official" -} diff --git a/plugins/node/node.plugin.zsh b/plugins/node/node.plugin.zsh index 18f35333c..519bc18da 100644 --- a/plugins/node/node.plugin.zsh +++ b/plugins/node/node.plugin.zsh @@ -1,8 +1,5 @@ -# This works if you installed node via homebrew. -export NODE_PATH="/usr/local/lib/node" - # Open the node api for your current version to the optional section. # TODO: Make the section part easier to use. -function node-api { +function node-docs { open "http://nodejs.org/docs/$(node --version)/api/all.html#$1" } diff --git a/plugins/npm/npm.plugin.zsh b/plugins/npm/npm.plugin.zsh deleted file mode 100644 index 0b0a30e11..000000000 --- a/plugins/npm/npm.plugin.zsh +++ /dev/null @@ -1,2 +0,0 @@ -# TODO: Don't do this in such a weird way. -export PATH=`echo $PATH | sed -e 's|/usr/bin|/usr/local/share/npm/bin:&|'` diff --git a/plugins/rvm/rvm.plugin.zsh b/plugins/rvm/rvm.plugin.zsh index 8a3ec788a..40fd88c1a 100644 --- a/plugins/rvm/rvm.plugin.zsh +++ b/plugins/rvm/rvm.plugin.zsh @@ -1,6 +1,5 @@ -fpath=($ZSH/plugins/rvm $fpath) -autoload -U compinit -compinit -i +# What does this really do? +# fpath=($ZSH/plugins/rvm $fpath) alias rubies='rvm list rubies' alias gemsets='rvm gemset list' @@ -35,10 +34,6 @@ function rvm-update { rvm reload # TODO: Reload rvm completion? } -function rvm-link-completion { - ln -s "$rvm_path/scripts/zsh/Completion/_rvm" "$ZSH/plugins/rvm/_rvm.official" -} - # TODO: Make this usable w/o rvm. function gems { local current_ruby=`rvm-prompt i v p` From 9801ad6453caa05925847f63401e6266378eb2de Mon Sep 17 00:00:00 2001 From: Andrew Hodges Date: Mon, 30 May 2011 11:10:08 -0400 Subject: [PATCH 117/184] Remove Uneeded Lines --- plugins/rvm/rvm.plugin.zsh | 3 --- 1 file changed, 3 deletions(-) diff --git a/plugins/rvm/rvm.plugin.zsh b/plugins/rvm/rvm.plugin.zsh index 40fd88c1a..24621fe0b 100644 --- a/plugins/rvm/rvm.plugin.zsh +++ b/plugins/rvm/rvm.plugin.zsh @@ -1,6 +1,3 @@ -# What does this really do? -# fpath=($ZSH/plugins/rvm $fpath) - alias rubies='rvm list rubies' alias gemsets='rvm gemset list' From 93dab36fcb7f138aba32e5102c621180055d67fe Mon Sep 17 00:00:00 2001 From: Second Planet Date: Mon, 30 May 2011 19:10:26 -0400 Subject: [PATCH 118/184] added humza.zsh-theme --- themes/humza.zsh-theme | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 themes/humza.zsh-theme diff --git a/themes/humza.zsh-theme b/themes/humza.zsh-theme new file mode 100644 index 000000000..107886295 --- /dev/null +++ b/themes/humza.zsh-theme @@ -0,0 +1,26 @@ +# ZSH THEME Preview: https://skitch.com/huyy/rk979/humza.zshtheme + +let TotalBytes=0 +for Bytes in $(ls -l | grep "^-" | awk '{ print $5 }') +do + let TotalBytes=$TotalBytes+$Bytes +done + # should it say b, kb, Mb, or Gb +if [ $TotalBytes -lt 1024 ]; then + TotalSize=$(echo -e "scale=3 \n$TotalBytes \nquit" | bc) + suffix="b" +elif [ $TotalBytes -lt 1048576 ]; then + TotalSize=$(echo -e "scale=3 \n$TotalBytes/1024 \nquit" | bc) + suffix="kb" +elif [ $TotalBytes -lt 1073741824 ]; then + TotalSize=$(echo -e "scale=3 \n$TotalBytes/1048576 \nquit" | bc) + suffix="Mb" +else + TotalSize=$(echo -e "scale=3 \n$TotalBytes/1073741824 \nquit" | bc) + suffix="Gb" +fi + +PROMPT='%{$reset_color%}%n %{$fg[green]%}{%{$reset_color%}%~%{$fg[green]%}}%{$reset_color%}$(git_prompt_info) greetings, earthling %{$fg[green]%}[%{$reset_color%}%{$TotalSize%}%{$suffix%}%{$fg[green]%}]%{$fg[red]%}$%{$reset_color%} ☞ ' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[red]%}±(" +ZSH_THEME_GIT_PROMPT_SUFFIX=");%{$reset_color%}" From 714cfb1db2966ddfc0330a09e620164189233b49 Mon Sep 17 00:00:00 2001 From: Adam Lindberg Date: Tue, 31 May 2011 11:46:26 +0200 Subject: [PATCH 119/184] Add guru theme --- themes/guru.zsh-theme | 98 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 themes/guru.zsh-theme diff --git a/themes/guru.zsh-theme b/themes/guru.zsh-theme new file mode 100644 index 000000000..2a2223528 --- /dev/null +++ b/themes/guru.zsh-theme @@ -0,0 +1,98 @@ +#------------------------------------------------------------------------------- +# Guru theme for oh-my-zsh by Adam Lindberg +# (Needs Git plugin for current_branch method) +#------------------------------------------------------------------------------- + + +# Color shortcuts +R=$fg[red] +Y=$fg[yellow] +G=$fg[green] +M=$fg[magenta] +W=$fg[white] +B=$fg[black] +RB=$fg_bold[red] +YB=$fg_bold[yellow] +GB=$fg_bold[green] +MB=$fg_bold[magenta] +WB=$fg_bold[white] +BB=$fg_bold[black] +RESET=$reset_color + +if [ "$(whoami)" = "root" ]; then + PROMPTCOLOR="%{$RB%}" PREFIX="-!-"; +else + PROMPTCOLOR="%{$BB%}" PREFIX="---"; +fi + +local return_code="%(?..%{$R%}%? ↵%{$RESET%})" + +GIT_PREFIX="%{$YB%}‹" +GIT_SUFFIX="%{$YB%}›" + +# Get the status of the working tree (copied and modified from git.zsh) +custom_git_prompt_status() { + INDEX=$(git status --porcelain 2> /dev/null) + STATUS="" + # Non-staged + if $(echo "$INDEX" | grep '^?? ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_UNTRACKED$STATUS" + fi + if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS" + fi + if $(echo "$INDEX" | grep '^ D ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS" + fi + if $(echo "$INDEX" | grep '^ M ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS" + elif $(echo "$INDEX" | grep '^AM ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS" + elif $(echo "$INDEX" | grep '^ T ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS" + fi + # Staged + if $(echo "$INDEX" | grep '^D ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_STAGED_DELETED$STATUS" + fi + if $(echo "$INDEX" | grep '^R ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_STAGED_RENAMED$STATUS" + fi + if $(echo "$INDEX" | grep '^M ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_STAGED_MODIFIED$STATUS" + fi + if $(echo "$INDEX" | grep '^A' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_STAGED_ADDED$STATUS" + fi + echo $STATUS +} + +# get the name of the branch we are on (copied and modified from git.zsh) +function custom_git_prompt() { + ref=$(git symbolic-ref HEAD 2> /dev/null) || return + echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(git_prompt_ahead)$(parse_git_dirty)$(custom_git_prompt_status)$ZSH_THEME_GIT_PROMPT_SUFFIX" +} + +PROMPT='${PROMPTCOLOR}$PREFIX %2~ $(custom_git_prompt)%{$M%}%B»%b%{$RESET%} ' +RPS1="${return_code}" + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$YB%}‹" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$YB%}›%{$RESET%} " + +ZSH_THEME_GIT_PROMPT_AHEAD="%{$BB%}➝" + +# Staged +ZSH_THEME_GIT_PROMPT_STAGED_ADDED="%{$G%}A" +ZSH_THEME_GIT_PROMPT_STAGED_MODIFIED="%{$G%}M" +ZSH_THEME_GIT_PROMPT_STAGED_RENAMED="%{$G%}R" +ZSH_THEME_GIT_PROMPT_STAGED_DELETED="%{$G%}D" + +# Not-staged +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$R%}??" +ZSH_THEME_GIT_PROMPT_MODIFIED="%{$R%}M" +ZSH_THEME_GIT_PROMPT_DELETED="%{$R%}D" +ZSH_THEME_GIT_PROMPT_UNMERGED="%{$R%}UU" + +ZSH_THEME_GIT_PROMPT_DIRTY="%{$R%}* " + +ZSH_THEME_GIT_PROMPT_CLEAN="" From 9c306670a73ec3e313666fc497952153bdc16220 Mon Sep 17 00:00:00 2001 From: Adam Lindberg Date: Tue, 31 May 2011 14:07:38 +0200 Subject: [PATCH 120/184] Improve unicode characters and git status --- themes/guru.zsh-theme | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/themes/guru.zsh-theme b/themes/guru.zsh-theme index 2a2223528..c63f1082a 100644 --- a/themes/guru.zsh-theme +++ b/themes/guru.zsh-theme @@ -64,13 +64,18 @@ custom_git_prompt_status() { if $(echo "$INDEX" | grep '^A' &> /dev/null); then STATUS="$ZSH_THEME_GIT_PROMPT_STAGED_ADDED$STATUS" fi + + if $(echo "$STATUS" &> /dev/null); then + STATUS="$ZSH_THEME_GIT_STATUS_PREFIX$STATUS" + fi + echo $STATUS } # get the name of the branch we are on (copied and modified from git.zsh) function custom_git_prompt() { ref=$(git symbolic-ref HEAD 2> /dev/null) || return - echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(git_prompt_ahead)$(parse_git_dirty)$(custom_git_prompt_status)$ZSH_THEME_GIT_PROMPT_SUFFIX" + echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$(git_prompt_ahead)$(custom_git_prompt_status)$ZSH_THEME_GIT_PROMPT_SUFFIX" } PROMPT='${PROMPTCOLOR}$PREFIX %2~ $(custom_git_prompt)%{$M%}%B»%b%{$RESET%} ' @@ -79,7 +84,12 @@ RPS1="${return_code}" ZSH_THEME_GIT_PROMPT_PREFIX="%{$YB%}‹" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$YB%}›%{$RESET%} " -ZSH_THEME_GIT_PROMPT_AHEAD="%{$BB%}➝" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$R%}*" +ZSH_THEME_GIT_PROMPT_CLEAN="" + +ZSH_THEME_GIT_PROMPT_AHEAD="%{$BB%}➔" + +ZSH_THEME_GIT_STATUS_PREFIX=" " # Staged ZSH_THEME_GIT_PROMPT_STAGED_ADDED="%{$G%}A" @@ -88,11 +98,7 @@ ZSH_THEME_GIT_PROMPT_STAGED_RENAMED="%{$G%}R" ZSH_THEME_GIT_PROMPT_STAGED_DELETED="%{$G%}D" # Not-staged -ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$R%}??" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$R%}⁇" ZSH_THEME_GIT_PROMPT_MODIFIED="%{$R%}M" ZSH_THEME_GIT_PROMPT_DELETED="%{$R%}D" ZSH_THEME_GIT_PROMPT_UNMERGED="%{$R%}UU" - -ZSH_THEME_GIT_PROMPT_DIRTY="%{$R%}* " - -ZSH_THEME_GIT_PROMPT_CLEAN="" From f4878971752b6d76743c29d6f478d20c84755b8e Mon Sep 17 00:00:00 2001 From: Brian Riddle Date: Tue, 31 May 2011 14:16:43 +0200 Subject: [PATCH 121/184] fix double -f and corrected format. -f%m was getting called twice in the stat_cmd corrected format of stat command from y to Y. --- plugins/ant/ant.plugin.zsh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/ant/ant.plugin.zsh b/plugins/ant/ant.plugin.zsh index 23bc7756a..691d4d2db 100644 --- a/plugins/ant/ant.plugin.zsh +++ b/plugins/ant/ant.plugin.zsh @@ -2,14 +2,14 @@ stat -f%m . > /dev/null 2>&1 if [ "$?" = 0 ]; then stat_cmd=(stat -f%m) else - stat_cmd=(stat -L --format=%y) + stat_cmd=(stat -L --format=%Y) fi _ant_does_target_list_need_generating () { if [ ! -f .ant_targets ]; then return 0; else - accurate=$($stat_cmd -f%m .ant_targets) - changed=$($stat_cmd -f%m build.xml) + accurate=$($stat_cmd .ant_targets) + changed=$($stat_cmd build.xml) return $(expr $accurate '>=' $changed) fi } From c014dca141588737a13c4e3974adb4afd58c09bb Mon Sep 17 00:00:00 2001 From: Michael Hanson Date: Tue, 31 May 2011 15:13:23 -0700 Subject: [PATCH 122/184] Fix deleted in git.zsh --- lib/git.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/git.zsh b/lib/git.zsh index 2ace3d0e0..ce4de5598 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -52,11 +52,11 @@ git_prompt_status() { if $(echo "$INDEX" | grep '^R ' &> /dev/null); then STATUS="$ZSH_THEME_GIT_PROMPT_RENAMED$STATUS" fi - if $(echo "$INDEX" | grep '^ D ' &> /dev/null); then + if $(echo "$INDEX" | grep '^D ' &> /dev/null); then STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS" fi if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS" fi echo $STATUS -} \ No newline at end of file +} From 23a082df129b12b6edf8ea04432b0cb2be0588fd Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Wed, 1 Jun 2011 09:33:12 +0200 Subject: [PATCH 123/184] Revert "Added my zsh theme file, heavily based on sjl's" as it relies on a dotfile to be in ~/bin. This reverts commit f2f34f5404e8ab674a0e345a709783b6c56a3b72. --- themes/thomasjbradley.zsh-theme | 29 ----------------------------- 1 file changed, 29 deletions(-) delete mode 100644 themes/thomasjbradley.zsh-theme diff --git a/themes/thomasjbradley.zsh-theme b/themes/thomasjbradley.zsh-theme deleted file mode 100644 index 857301d19..000000000 --- a/themes/thomasjbradley.zsh-theme +++ /dev/null @@ -1,29 +0,0 @@ -function prompt_char { - git branch >/dev/null 2>/dev/null && echo '±' && return - hg root >/dev/null 2>/dev/null && echo '☿' && return - echo '○' -} - -function virtualenv_info { - [ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') ' -} - -function hg_prompt_info { - hg prompt --angle-brackets "\ -< on %{$fg[magenta]%}%{$reset_color%}>\ -< at %{$fg[yellow]%}%{$reset_color%}>\ -%{$fg[green]%}%{$reset_color%}< -patches: >" 2>/dev/null -} - -PROMPT=' -%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$(hg_prompt_info)$(git_prompt_info) -$(virtualenv_info)$(prompt_char) ' - -ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}!" -ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[green]%}?" -ZSH_THEME_GIT_PROMPT_CLEAN="" - -. ~/bin/dotfiles/zsh/aliases From a9b6f081b4a405dd1365df9c35aa3603196e3fc7 Mon Sep 17 00:00:00 2001 From: Adam Lindberg Date: Wed, 1 Jun 2011 10:11:06 +0200 Subject: [PATCH 124/184] Remove extra space when no status --- themes/guru.zsh-theme | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/themes/guru.zsh-theme b/themes/guru.zsh-theme index c63f1082a..aa7b28b34 100644 --- a/themes/guru.zsh-theme +++ b/themes/guru.zsh-theme @@ -27,9 +27,6 @@ fi local return_code="%(?..%{$R%}%? ↵%{$RESET%})" -GIT_PREFIX="%{$YB%}‹" -GIT_SUFFIX="%{$YB%}›" - # Get the status of the working tree (copied and modified from git.zsh) custom_git_prompt_status() { INDEX=$(git status --porcelain 2> /dev/null) @@ -65,7 +62,7 @@ custom_git_prompt_status() { STATUS="$ZSH_THEME_GIT_PROMPT_STAGED_ADDED$STATUS" fi - if $(echo "$STATUS" &> /dev/null); then + if $(echo -n "$STATUS" | grep '.*' &> /dev/null); then STATUS="$ZSH_THEME_GIT_STATUS_PREFIX$STATUS" fi From 0d476e02cd1b5660b09acde25725191044f062ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milo=C5=A1=20Had=C5=BEi=C4=87?= Date: Wed, 1 Jun 2011 12:45:15 +0200 Subject: [PATCH 125/184] Adds my theme --- themes/miloshadzic.zsh-theme | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 themes/miloshadzic.zsh-theme diff --git a/themes/miloshadzic.zsh-theme b/themes/miloshadzic.zsh-theme new file mode 100644 index 000000000..ad5394423 --- /dev/null +++ b/themes/miloshadzic.zsh-theme @@ -0,0 +1,8 @@ +# Yay! High voltage and arrows! + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}⚡%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="" + +PROMPT='%{$fg[cyan]%}%1~%{$reset_color%}%{$fg[red]%}|%{$reset_color%}$(git_prompt_info)%{$fg[cyan]%}⇒%{$reset_color%} ' From f401d6ef78a94b723ce841b77151eaac477b8074 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Tue, 22 Feb 2011 23:32:50 -0500 Subject: [PATCH 126/184] Vastly improved osx plugin. --- plugins/osx/osx.plugin.zsh | 138 +++++++++++++++++++++++-------------- 1 file changed, 87 insertions(+), 51 deletions(-) diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh index a65ca642a..682bb2667 100644 --- a/plugins/osx/osx.plugin.zsh +++ b/plugins/osx/osx.plugin.zsh @@ -1,63 +1,99 @@ -alias showfiles='defaults write com.apple.finder AppleShowAllFiles TRUE; killall Finder' -alias hidefiles='defaults write com.apple.finder AppleShowAllFiles FALSE; killall Finder' +# ------------------------------------------------------------------------------ +# FILE: osx.plugin.zsh +# DESCRIPTION: oh-my-zsh plugin file. +# AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com) +# VERSION: 1.0.1 +# ------------------------------------------------------------------------------ -# Recursively delete .DS_Store files -alias rm-dsstore="find . -name '*.DS_Store' -type f -delete" - -function savepath() { - pwd > ~/.current_path~ -} function tab() { -savepath -osascript >/dev/null < 0 )) && command="${command}; $*" + + the_app=$( + osascript 2>/dev/null </dev/null </dev/null </dev/null </dev/null </dev/null < 0 )) && qlmanage -p $* &>/dev/null & +} + +function man-preview() { + man -t "$@" | open -f -a Preview +} + +function trash() { + local trash_dir="${HOME}/.Trash" + local temp_ifs=$IFS + IFS=$'\n' + for item in "$@"; do + if [[ -e "$item" ]]; then + item_name="$(basename $item)" + if [[ -e "${trash_dir}/${item_name}" ]]; then + mv -f "$item" "${trash_dir}/${item_name} $(date "+%H-%M-%S")" + else + mv -f "$item" "${trash_dir}/" + fi + fi + done + IFS=$temp_ifs +} + From 5e5096dad60ef0f41aea384c1e249a3bf0377be6 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Fri, 22 Apr 2011 19:13:37 -0400 Subject: [PATCH 127/184] Added man-preview completion suggested by @webflo. --- plugins/osx/_man-preview | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 plugins/osx/_man-preview diff --git a/plugins/osx/_man-preview b/plugins/osx/_man-preview new file mode 100644 index 000000000..6cc344ad4 --- /dev/null +++ b/plugins/osx/_man-preview @@ -0,0 +1,5 @@ +#compdef man-preview +#autoload + +_man + From 1db6575f14d07b9ed3b0ce530837a8a0713b69d0 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 3 Feb 2011 22:46:52 -0500 Subject: [PATCH 128/184] Added extract plugin. --- lib/aliases.zsh | 1 - lib/functions.zsh | 35 ------------- plugins/extract/_extract | 8 +++ plugins/extract/extract.plugin.zsh | 83 ++++++++++++++++++++++++++++++ 4 files changed, 91 insertions(+), 36 deletions(-) create mode 100644 plugins/extract/_extract create mode 100644 plugins/extract/extract.plugin.zsh diff --git a/lib/aliases.zsh b/lib/aliases.zsh index b47de5bde..0555be264 100644 --- a/lib/aliases.zsh +++ b/lib/aliases.zsh @@ -22,4 +22,3 @@ alias sl=ls # often screw this up alias afind='ack-grep -il' -alias x=extract diff --git a/lib/functions.zsh b/lib/functions.zsh index b29d3e482..ef7cc6383 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -15,38 +15,3 @@ function take() { cd $1 } -function extract() { - unset REMOVE_ARCHIVE - - if test "$1" = "-r"; then - REMOVE=1 - shift - fi - if [[ -f $1 ]]; then - case $1 in - *.tar.bz2) tar xvjf $1;; - *.tar.gz) tar xvzf $1;; - *.tar.xz) tar xvJf $1;; - *.tar.lzma) tar --lzma -xvf $1;; - *.bz2) bunzip $1;; - *.rar) unrar x $1;; - *.gz) gunzip $1;; - *.tar) tar xvf $1;; - *.tbz2) tar xvjf $1;; - *.tgz) tar xvzf $1;; - *.zip) unzip $1;; - *.Z) uncompress $1;; - *.7z) 7z x $1;; - *) echo "'$1' cannot be extracted via >extract<";; - esac - - if [[ $REMOVE_ARCHIVE -eq 1 ]]; then - echo removing "$1"; - /bin/rm "$1"; - fi - - else - echo "'$1' is not a valid file" - fi -} - diff --git a/plugins/extract/_extract b/plugins/extract/_extract new file mode 100644 index 000000000..dca890954 --- /dev/null +++ b/plugins/extract/_extract @@ -0,0 +1,8 @@ +#compdef extract +#autoload + +_arguments \ + '(-r --remove)'{-r,--remove}'[Remove archive.]' \ + "*::archive file:_files -g '(#i)*.(tar|tgz|tbz|tbz2|txz|tlz|gz|bz2|xz|lzma|Z|zip|rar|7z|deb)(-.)'" && return 0 + + diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh new file mode 100644 index 000000000..c58692fbf --- /dev/null +++ b/plugins/extract/extract.plugin.zsh @@ -0,0 +1,83 @@ +# ------------------------------------------------------------------------------ +# FILE: extract.plugin.zsh +# DESCRIPTION: oh-my-zsh plugin file. +# AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com) +# VERSION: 1.0.0 +# ------------------------------------------------------------------------------ + + +function extract() { + local remove_archive + local success + local file_name + local extract_dir + + if (( $# == 0 )); then + echo "Usage: extract [-option] [file ...]" + echo + echo Options: + echo " -r, --remove Remove archive." + echo + echo "Report bugs to ." + fi + + remove_archive=1 + if [[ "$1" == "-r" ]] || [[ "$1" == "--remove" ]]; then + remove_archive=0 + shift + fi + + while (( $# > 0 )); do + if [[ ! -f "$1" ]]; then + echo "extract: '$1' is not a valid file" 1>&2 + shift + continue + fi + + success=0 + file_name="$( basename "$1" )" + extract_dir="$( echo "$file_name" | sed "s/\.${1##*.}//g" )" + case "$1" in + (*.tar.gz|*.tgz) tar xvzf "$1" ;; + (*.tar.bz2|*.tbz|*.tbz2) tar xvjf "$1" ;; + (*.tar.xz|*.txz) tar xvJf "$1" ;; + # (*.tar.xz|*.txz) xzcat "$1" | tar xvf - ;; + (*.tar.lzma|*.tlz) tar --lzma -xvf "$1" ;; + # (*.tar.lzma|*.tlz) lzcat "$1" | tar xvf - ;; + (*.tar) tar xvf "$1" ;; + (*.gz) gunzip "$1" ;; + (*.bz2) bunzip2 "$1" ;; + (*.xz) unxz "$1" ;; + (*.lzma) unlzma "$1" ;; + (*.Z) uncompress "$1" ;; + (*.zip) unzip "$1" -d $extract_dir ;; + (*.rar) unrar e -ad "$1" ;; + (*.7z) 7za x "$1" ;; + (*.deb) + mkdir -p "$extract_dir/control" + mkdir -p "$extract_dir/data" + cd "$extract_dir"; ar vx "../${1}" > /dev/null + cd control; tar xzvf ../control.tar.gz + cd ../data; tar xzvf ../data.tar.gz + cd ..; rm *.tar.gz debian-binary + cd .. + ;; + (*) + echo "extract: '$1' cannot be extracted" 1>&2 + success=1 + ;; + esac + + (( success = $success > 0 ? $success : $? )) + (( $success == 0 )) && (( $remove_archive == 0 )) && rm "$1" + shift + done +} + +alias x=extract + +# add extract completion function to path +fpath=($ZSH/plugins/extract $fpath) +autoload -U compinit +compinit -i + From a5c383258b760ad1c34d550edb86d7d63e8f5877 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sun, 17 Apr 2011 23:17:48 -0400 Subject: [PATCH 129/184] Handle tar.xz and tar.lzma better (credit: @gwjo). --- plugins/extract/extract.plugin.zsh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh index c58692fbf..8cc17f7d4 100644 --- a/plugins/extract/extract.plugin.zsh +++ b/plugins/extract/extract.plugin.zsh @@ -2,7 +2,7 @@ # FILE: extract.plugin.zsh # DESCRIPTION: oh-my-zsh plugin file. # AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com) -# VERSION: 1.0.0 +# VERSION: 1.0.1 # ------------------------------------------------------------------------------ @@ -40,10 +40,12 @@ function extract() { case "$1" in (*.tar.gz|*.tgz) tar xvzf "$1" ;; (*.tar.bz2|*.tbz|*.tbz2) tar xvjf "$1" ;; - (*.tar.xz|*.txz) tar xvJf "$1" ;; - # (*.tar.xz|*.txz) xzcat "$1" | tar xvf - ;; - (*.tar.lzma|*.tlz) tar --lzma -xvf "$1" ;; - # (*.tar.lzma|*.tlz) lzcat "$1" | tar xvf - ;; + (*.tar.xz|*.txz) tar --xz --help &> /dev/null \ + && tar --xz -xvf "$1" \ + || xzcat "$1" | tar xvf - ;; + (*.tar.zma|*.tlz) tar --lzma --help &> /dev/null \ + && tar --lzma -xvf "$1" \ + || lzcat "$1" | tar xvf - ;; (*.tar) tar xvf "$1" ;; (*.gz) gunzip "$1" ;; (*.bz2) bunzip2 "$1" ;; From c1b5d72830629c737f40abebf87fcca797bf730c Mon Sep 17 00:00:00 2001 From: "Suraj N. Kurapati" Date: Wed, 1 Jun 2011 20:38:25 -0700 Subject: [PATCH 130/184] add "sunaku" theme, see http://ompldr.org/vOHcwZg --- themes/sunaku.zsh-theme | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 themes/sunaku.zsh-theme diff --git a/themes/sunaku.zsh-theme b/themes/sunaku.zsh-theme new file mode 100644 index 000000000..440fa90b4 --- /dev/null +++ b/themes/sunaku.zsh-theme @@ -0,0 +1,26 @@ +# Git-centric variation of the "fishy" theme. +# See screenshot at http://ompldr.org/vOHcwZg + +ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%}+" +ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[magenta]%}!" +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[yellow]%}?" + +ZSH_THEME_GIT_PROMPT_PREFIX="" +ZSH_THEME_GIT_PROMPT_SUFFIX=" " +ZSH_THEME_GIT_PROMPT_DIRTY="" +ZSH_THEME_GIT_PROMPT_CLEAN="" + +local user_color='green' +test $UID -eq 0 && user_color='red' + +PROMPT='%(?..%{$fg_bold[red]%}exit %? +%{$reset_color%})'\ +'%{$bold_color%}$(git_prompt_status)%{$reset_color%}'\ +'$(git_prompt_info)'\ +'%{$fg[$user_color]%}%~%{$reset_color%}'\ +'%(!.#.>) ' + +PROMPT2='%{$fg[red]%}\ %{$reset_color%}' From 9b63a03bcfb7a6c34281d7d905575c5647e9c8d2 Mon Sep 17 00:00:00 2001 From: Matt Doran Date: Sat, 4 Jun 2011 00:32:05 +1000 Subject: [PATCH 131/184] Fix typos in the svn plugin that would cause calls to 'svn' when not in an svn working copy. --- plugins/svn/svn.plugin.zsh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/svn/svn.plugin.zsh b/plugins/svn/svn.plugin.zsh index 45d461306..86050227d 100644 --- a/plugins/svn/svn.plugin.zsh +++ b/plugins/svn/svn.plugin.zsh @@ -13,7 +13,7 @@ function in_svn() { } function svn_get_repo_name { - if [ is_svn ]; then + if [ in_svn ]; then svn info | sed -n 's/Repository\ Root:\ .*\///p' | read SVN_ROOT svn info | sed -n "s/URL:\ .*$SVN_ROOT\///p" | sed "s/\/.*$//" @@ -21,13 +21,13 @@ function svn_get_repo_name { } function svn_get_rev_nr { - if [ is_svn ]; then + if [ in_svn ]; then svn info 2> /dev/null | sed -n s/Revision:\ //p fi } function svn_dirty_choose { - if [ is_svn ]; then + if [ in_svn ]; then s=$(svn status 2>/dev/null) if [ $s ]; then echo $1 @@ -39,4 +39,4 @@ function svn_dirty_choose { function svn_dirty { svn_dirty_choose $ZSH_THEME_SVN_PROMPT_DIRTY $ZSH_THEME_SVN_PROMPT_CLEAN -} \ No newline at end of file +} From 0c41b1cdc3ff7b00ffb2310b91becb91b31704f7 Mon Sep 17 00:00:00 2001 From: Andrew Hodges Date: Fri, 3 Jun 2011 14:05:25 -0400 Subject: [PATCH 132/184] Colorize Install & Upgrade Scripts Make tools/install.sh and tools/upgrade.sh pretty. --- tools/install.sh | 28 ++++++++++++++-------------- tools/upgrade.sh | 21 +++++++++++---------- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/tools/install.sh b/tools/install.sh index 8ed1403af..aedb706da 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -1,36 +1,36 @@ if [ -d ~/.oh-my-zsh ] then - echo "You already have Oh My Zsh installed. You'll need to remove ~/.oh-my-zsh if you want to install" + echo "\033[0;33mYou already have Oh My Zsh installed.\033[0m You'll need to remove ~/.oh-my-zsh if you want to install" exit fi -echo "Cloning Oh My Zsh..." +echo "\033[0;34mCloning Oh My Zsh...\033[0m" /usr/bin/env git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh -echo "Looking for an existing zsh config..." +echo "\033[0;34mLooking for an existing zsh config...\033[0m" if [ -f ~/.zshrc ] || [ -h ~/.zshrc ] then - echo "Found ~/.zshrc. Backing up to ~/.zshrc.pre-oh-my-zsh"; + echo "\033[0;33mFound ~/.zshrc.\033[0m \033[0;32]Backing up to ~/.zshrc.pre-oh-my-zsh\033[0m"; cp ~/.zshrc ~/.zshrc.pre-oh-my-zsh; rm ~/.zshrc; fi -echo "Using the Oh My Zsh template file and adding it to ~/.zshrc" +echo "\033[0;34mUsing the Oh My Zsh template file and adding it to ~/.zshrc\033[0m" cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc -echo "Copying your current PATH and adding it to the end of ~/.zshrc for you." +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 "Time to change your default shell to zsh!" +echo "\033[0;34mTime to change your default shell to zsh!\033[0m" chsh -s `which zsh` -echo ' __ __ ' -echo ' ____ / /_ ____ ___ __ __ ____ _____/ /_ ' -echo ' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ ' -echo '/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / ' -echo '\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ ' -echo ' /____/' +echo "\033[0;32m"' __ __ '"\033[0m" +echo "\033[0;32m"' ____ / /_ ____ ___ __ __ ____ _____/ /_ '"\033[0m" +echo "\033[0;32m"' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '"\033[0m" +echo "\033[0;32m"'/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '"\033[0m" +echo "\033[0;32m"'\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '"\033[0m" +echo "\033[0;32m"' /____/ '"\033[0m" -echo "\n\n ....is now installed." +echo "\n\n \033[0;32m....is now installed.\033[0m" /usr/bin/env zsh source ~/.zshrc diff --git a/tools/upgrade.sh b/tools/upgrade.sh index 6bdd02e38..7e5cc7655 100644 --- a/tools/upgrade.sh +++ b/tools/upgrade.sh @@ -1,12 +1,13 @@ current_path=`pwd` -echo "Upgrading Oh My Zsh" +echo "\033[0;34mUpgrading Oh My Zsh\033[0m" ( cd $ZSH && git pull origin master ) -echo ' __ __ ' -echo ' ____ / /_ ____ ___ __ __ ____ _____/ /_ ' -echo ' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ ' -echo '/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / ' -echo '\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ ' -echo ' /____/' -echo "Hooray! Oh My Zsh has been updated and/or is at the current version. \nAny new updates will be reflected when you start your next terminal session." -echo "To keep up on the latest, be sure to follow Oh My Zsh on twitter: http://twitter.com/ohmyzsh" -cd $current_path \ No newline at end of file +echo "\033[0;32m"' __ __ '"\033[0m" +echo "\033[0;32m"' ____ / /_ ____ ___ __ __ ____ _____/ /_ '"\033[0m" +echo "\033[0;32m"' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '"\033[0m" +echo "\033[0;32m"'/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '"\033[0m" +echo "\033[0;32m"'\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '"\033[0m" +echo "\033[0;32m"' /____/ '"\033[0m" +echo "\033[0;34mHooray! Oh My Zsh has been updated and/or is at the current version.\033[0m" +echo "\033[0;34mAny new updates will be reflected when you start your next terminal session.\033[0m" +echo "\033[0;34mTo keep up on the latest, be sure to follow Oh My Zsh on twitter: \033[1mhttp://twitter.com/ohmyzsh\033[0m" +cd $current_path From 7c9474508cade14102a2fe1c63ad845fda521bec Mon Sep 17 00:00:00 2001 From: vguerci Date: Sat, 4 Jun 2011 11:02:25 +0200 Subject: [PATCH 133/184] [upgrade] before init (no reload needed unless oh-my-zsh.sh has been modified) --- oh-my-zsh.sh | 17 ++++++++--------- tools/upgrade.sh | 1 - 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index dbff1ced9..2157c38a0 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -1,3 +1,11 @@ +# Check for updates on initial load... +if [ "$DISABLE_AUTO_UPDATE" = "true" ] +then + return +else + /usr/bin/env zsh $ZSH/tools/check_for_upgrade.sh +fi + # Initializes Oh My Zsh # add a function path @@ -28,7 +36,6 @@ done for config_file ($ZSH/custom/*.zsh) source $config_file # Load the theme -# Check for updates on initial load... if [ "$ZSH_THEME" = "random" ] then themes=($ZSH/themes/*zsh-theme) @@ -41,11 +48,3 @@ else source "$ZSH/themes/$ZSH_THEME.zsh-theme" fi - -# Check for updates on initial load... -if [ "$DISABLE_AUTO_UPDATE" = "true" ] -then - return -else - /usr/bin/env zsh $ZSH/tools/check_for_upgrade.sh -fi diff --git a/tools/upgrade.sh b/tools/upgrade.sh index 7e5cc7655..e30488822 100644 --- a/tools/upgrade.sh +++ b/tools/upgrade.sh @@ -8,6 +8,5 @@ echo "\033[0;32m"'/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '"\033[0m echo "\033[0;32m"'\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '"\033[0m" echo "\033[0;32m"' /____/ '"\033[0m" echo "\033[0;34mHooray! Oh My Zsh has been updated and/or is at the current version.\033[0m" -echo "\033[0;34mAny new updates will be reflected when you start your next terminal session.\033[0m" echo "\033[0;34mTo keep up on the latest, be sure to follow Oh My Zsh on twitter: \033[1mhttp://twitter.com/ohmyzsh\033[0m" cd $current_path From 9b4a89f327a045ed5e756ae4e75d1aac68803164 Mon Sep 17 00:00:00 2001 From: Michael Komitee Date: Sat, 4 Jun 2011 14:03:10 -0400 Subject: [PATCH 134/184] Fix bug from Pull request #395 #395 broke oh-my-zsh for users who disable check-for-updates --- oh-my-zsh.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 2157c38a0..d72d90cf9 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -1,8 +1,6 @@ # Check for updates on initial load... -if [ "$DISABLE_AUTO_UPDATE" = "true" ] +if [ "$DISABLE_AUTO_UPDATE" != "true" ] then - return -else /usr/bin/env zsh $ZSH/tools/check_for_upgrade.sh fi From 35b879a17b965b0ea28009c4561962c9ed17ef1f Mon Sep 17 00:00:00 2001 From: gwjo Date: Sat, 4 Jun 2011 21:07:55 -0400 Subject: [PATCH 135/184] Add support for agent forwarding --- plugins/ssh-agent/ssh-agent.plugin.zsh | 52 ++++++++++++++++++++------ 1 file changed, 40 insertions(+), 12 deletions(-) diff --git a/plugins/ssh-agent/ssh-agent.plugin.zsh b/plugins/ssh-agent/ssh-agent.plugin.zsh index 0efc4546f..0f5b03d26 100644 --- a/plugins/ssh-agent/ssh-agent.plugin.zsh +++ b/plugins/ssh-agent/ssh-agent.plugin.zsh @@ -1,23 +1,51 @@ -# Based on code from Joseph M. Reagle -# http://www.cygwin.com/ml/cygwin/2001-06/msg00537.html +# +# INSTRUCTIONS +# +# To enabled agent forwarding support add the following to +# your .zshrc file: +# +# zstyle :omz:plugins:ssh-agent agent-forwarding on +# +# +# CREDITS +# +# Based on code from Joseph M. Reagle +# http://www.cygwin.com/ml/cygwin/2001-06/msg00537.html +# +# Agent forwarding support based on ideas from +# Florent Thoumie and Jonas Pfenniger +# -local SSH_ENV=$HOME/.ssh/environment-$HOST +local _plugin__ssh_env=$HOME/.ssh/environment-$HOST +local _plugin__forwarding -function start_agent { - /usr/bin/env ssh-agent | sed 's/^echo/#echo/' > ${SSH_ENV} - chmod 600 ${SSH_ENV} - . ${SSH_ENV} > /dev/null +function _plugin__start_agent() +{ + /usr/bin/env ssh-agent | sed 's/^echo/#echo/' > ${_plugin__ssh_env} + chmod 600 ${_plugin__ssh_env} + . ${_plugin__ssh_env} > /dev/null /usr/bin/ssh-add; } -# Source SSH settings, if applicable +# test if agent-forwarding is enabled +zstyle -b :omz:plugins:ssh-agent agent-forwarding _plugin__forwarding +if [[ ${_plugin__forwarding} == "yes" && -z $SSH_AGENT_PID && -n "$SSH_AUTH_SOCK" ]]; then + # No PID but a AUTH_SOCK means agent forwarding is enabled + # Add a nifty symlink for screen/tmux + [[ -L $SSH_AUTH_SOCK ]] || ln -sf "$SSH_AUTH_SOCK" /tmp/ssh-agent-$USER-screen -if [ -f "${SSH_ENV}" ]; then - . ${SSH_ENV} > /dev/null +elif [ -f "${_plugin__ssh_env}" ]; then + # Source SSH settings, if applicable + . ${_plugin__ssh_env} > /dev/null ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || { - start_agent; + _plugin__start_agent; } else - start_agent; + _plugin__start_agent; fi +# tidy up after ourselves +unfunction _plugin__start_agent +unset _plugin__forwarding +unset _plugin__ssh_env + From 40b7f2099d393950e26d1a9720743e161b1abe49 Mon Sep 17 00:00:00 2001 From: gwjo Date: Sat, 4 Jun 2011 22:16:10 -0400 Subject: [PATCH 136/184] Add support for loading mulitple identities --- plugins/ssh-agent/ssh-agent.plugin.zsh | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/plugins/ssh-agent/ssh-agent.plugin.zsh b/plugins/ssh-agent/ssh-agent.plugin.zsh index 0f5b03d26..c4e92a1fe 100644 --- a/plugins/ssh-agent/ssh-agent.plugin.zsh +++ b/plugins/ssh-agent/ssh-agent.plugin.zsh @@ -6,6 +6,11 @@ # # zstyle :omz:plugins:ssh-agent agent-forwarding on # +# To load multiple identies use the identities style, For +# example: +# +# zstyle :omz:plugins:ssh-agent id_rsa id_rsa2 id_github +# # # CREDITS # @@ -21,17 +26,23 @@ local _plugin__forwarding function _plugin__start_agent() { + local -a identities + + # start ssh-agent and setup environment /usr/bin/env ssh-agent | sed 's/^echo/#echo/' > ${_plugin__ssh_env} chmod 600 ${_plugin__ssh_env} . ${_plugin__ssh_env} > /dev/null - /usr/bin/ssh-add; + + # load identies + zstyle -a :omz:plugins:ssh-agent identities identities + echo starting... + /usr/bin/ssh-add $HOME/.ssh/${^identities} } # test if agent-forwarding is enabled zstyle -b :omz:plugins:ssh-agent agent-forwarding _plugin__forwarding -if [[ ${_plugin__forwarding} == "yes" && -z $SSH_AGENT_PID && -n "$SSH_AUTH_SOCK" ]]; then - # No PID but a AUTH_SOCK means agent forwarding is enabled - # Add a nifty symlink for screen/tmux +if [[ ${_plugin__forwarding} == "yes" && -n "$SSH_AUTH_SOCK" ]]; then + # Add a nifty symlink for screen/tmux if agent forwarding [[ -L $SSH_AUTH_SOCK ]] || ln -sf "$SSH_AUTH_SOCK" /tmp/ssh-agent-$USER-screen elif [ -f "${_plugin__ssh_env}" ]; then From 715be61966acecb4d30953e3dd4c9d8a3f8637eb Mon Sep 17 00:00:00 2001 From: Clement Girault Date: Mon, 6 Jun 2011 01:37:07 +1000 Subject: [PATCH 137/184] New theme, Read contents for further customising. --- themes/wedisagree.zsh-theme | 107 ++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 themes/wedisagree.zsh-theme diff --git a/themes/wedisagree.zsh-theme b/themes/wedisagree.zsh-theme new file mode 100644 index 000000000..7cb27934d --- /dev/null +++ b/themes/wedisagree.zsh-theme @@ -0,0 +1,107 @@ +# On a mac with snow leopard, for nicer terminal colours: + +# - Install SIMBL: http://www.culater.net/software/SIMBL/SIMBL.php +# - Download'Terminal-Colours': http://bwaht.net/code/TerminalColours.bundle.zip +# - Place that bundle in ~/Library/Application\ Support/SIMBL/Plugins (create that folder if it doesn't exist) +# - Open Terminal preferences. Go to Settings -> Text -> More +# - Change default colours to your liking. +# +# Here are the colours from Textmate's Monokai theme: +# +# Black: 0, 0, 0 +# Red: 229, 34, 34 +# Green: 166, 227, 45 +# Yellow: 252, 149, 30 +# Blue: 196, 141, 255 +# Magenta: 250, 37, 115 +# Cyan: 103, 217, 240 +# White: 242, 242, 242 + +# Thanks to Steve Losh: http://stevelosh.com/blog/2009/03/candy-colored-terminal/ + +# The prompt + +PROMPT='%{$fg[magenta]%}[%c] %{$reset_color%}' + +# The right-hand prompt + +RPROMPT='${time} %{$fg[magenta]%}$(git_prompt_info)%{$reset_color%}$(git_prompt_status)%{$reset_color%}' + +# Add this at the start of RPROMPT to include rvm info showing ruby-version@gemset-name +# %{$fg[yellow]%}$(~/.rvm/bin/rvm-prompt)%{$reset_color%} + +# local time, color coded by last return code +time_enabled="%(?.%{$fg[green]%}.%{$fg[red]%})%*%{$reset_color%}" +time_disabled="%{$fg[green]%}%*%{$reset_color%}" +time=$time_enabled + +ZSH_THEME_GIT_PROMPT_PREFIX=" ☁ %{$fg[red]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%} ☂" # Ⓓ +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭" # ⓣ +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%} ☀" # Ⓞ + +ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[cyan]%} ✚" # ⓐ ⑃ +ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[yellow]%} ⚡" # ⓜ ⑁ +ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖" # ⓧ ⑂ +ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%} ➜" # ⓡ ⑄ +ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[magenta]%} ♒" # ⓤ ⑊ + +# More symbols to choose from: +# ☀ ✹ ☄ ♆ ♀ ♁ ♐ ♇ ♈ ♉ ♚ ♛ ♜ ♝ ♞ ♟ ♠ ♣ ⚢ ⚲ ⚳ ⚴ ⚥ ⚤ ⚦ ⚒ ⚑ ⚐ ♺ ♻ ♼ ☰ ☱ ☲ ☳ ☴ ☵ ☶ ☷ +# ✡ ✔ ✖ ✚ ✱ ✤ ✦ ❤ ➜ ➟ ➼ ✂ ✎ ✐ ⨀ ⨁ ⨂ ⨍ ⨎ ⨏ ⨷ ⩚ ⩛ ⩡ ⩱ ⩲ ⩵ ⩶ ⨠ +# ⬅ ⬆ ⬇ ⬈ ⬉ ⬊ ⬋ ⬒ ⬓ ⬔ ⬕ ⬖ ⬗ ⬘ ⬙ ⬟ ⬤ 〒 ǀ ǁ ǂ ĭ Ť Ŧ + +# Determine if we are using a gemset. +function rvm_gemset() { + GEMSET=`rvm gemset list | grep '=>' | cut -b4-` + if [[ -n $GEMSET ]]; then + echo "%{$fg[yellow]%}$GEMSET%{$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 [[ -n $(git status -s 2> /dev/null) ]]; then + if [ "$MINUTES" -gt 30 ]; then + COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG" + elif [ "$MINUTES" -gt 10 ]; then + COLOR="$ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM" + else + COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT" + fi + else + COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL" + fi + + if [ "$HOURS" -gt 24 ]; then + echo "($(rvm_gemset)$COLOR${DAYS}d${SUB_HOURS}h${SUB_MINUTES}m%{$reset_color%}|" + elif [ "$MINUTES" -gt 60 ]; then + echo "($(rvm_gemset)$COLOR${HOURS}h${SUB_MINUTES}m%{$reset_color%}|" + else + echo "($(rvm_gemset)$COLOR${MINUTES}m%{$reset_color%}|" + fi + else + COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL" + echo "($(rvm_gemset)$COLOR~|" + fi + fi +} \ No newline at end of file From 70cb607b7bee04ceef74d6f7aa80589e009e4c78 Mon Sep 17 00:00:00 2001 From: Adam Lindberg Date: Tue, 7 Jun 2011 15:28:43 +0200 Subject: [PATCH 138/184] Remove unused colors and use original prompt color --- themes/guru.zsh-theme | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/themes/guru.zsh-theme b/themes/guru.zsh-theme index aa7b28b34..b99cd816e 100644 --- a/themes/guru.zsh-theme +++ b/themes/guru.zsh-theme @@ -6,23 +6,17 @@ # Color shortcuts R=$fg[red] -Y=$fg[yellow] G=$fg[green] M=$fg[magenta] -W=$fg[white] -B=$fg[black] RB=$fg_bold[red] YB=$fg_bold[yellow] -GB=$fg_bold[green] -MB=$fg_bold[magenta] -WB=$fg_bold[white] -BB=$fg_bold[black] +BB=$fg_bold[blue] RESET=$reset_color if [ "$(whoami)" = "root" ]; then PROMPTCOLOR="%{$RB%}" PREFIX="-!-"; else - PROMPTCOLOR="%{$BB%}" PREFIX="---"; + PROMPTCOLOR="" PREFIX="---"; fi local return_code="%(?..%{$R%}%? ↵%{$RESET%})" @@ -75,7 +69,8 @@ function custom_git_prompt() { echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$(git_prompt_ahead)$(custom_git_prompt_status)$ZSH_THEME_GIT_PROMPT_SUFFIX" } -PROMPT='${PROMPTCOLOR}$PREFIX %2~ $(custom_git_prompt)%{$M%}%B»%b%{$RESET%} ' +# %B sets bold text +PROMPT='%B$PREFIX %2~ $(custom_git_prompt)%{$M%}%B»%b%{$RESET%} ' RPS1="${return_code}" ZSH_THEME_GIT_PROMPT_PREFIX="%{$YB%}‹" From 915c28752eb8bfb9610e14f62161ab3bd573d218 Mon Sep 17 00:00:00 2001 From: Adam Lindberg Date: Tue, 7 Jun 2011 15:32:48 +0200 Subject: [PATCH 139/184] Add email address --- themes/guru.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/guru.zsh-theme b/themes/guru.zsh-theme index b99cd816e..cbd56194f 100644 --- a/themes/guru.zsh-theme +++ b/themes/guru.zsh-theme @@ -1,5 +1,5 @@ #------------------------------------------------------------------------------- -# Guru theme for oh-my-zsh by Adam Lindberg +# Guru theme for oh-my-zsh by Adam Lindberg (eproxus@gmail.com) # (Needs Git plugin for current_branch method) #------------------------------------------------------------------------------- From 73946a6066fa8bf740b4765b7e204df9599f9689 Mon Sep 17 00:00:00 2001 From: Adam Lindberg Date: Tue, 7 Jun 2011 15:40:18 +0200 Subject: [PATCH 140/184] Add note about Solarized color theme --- themes/guru.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/guru.zsh-theme b/themes/guru.zsh-theme index cbd56194f..a5ffdb722 100644 --- a/themes/guru.zsh-theme +++ b/themes/guru.zsh-theme @@ -1,9 +1,9 @@ #------------------------------------------------------------------------------- # Guru theme for oh-my-zsh by Adam Lindberg (eproxus@gmail.com) +# Intended to be used with Solarized: http://ethanschoonover.com/solarized # (Needs Git plugin for current_branch method) #------------------------------------------------------------------------------- - # Color shortcuts R=$fg[red] G=$fg[green] From 4a7392fdd0be8fafcaffccc206f23c7746129fb8 Mon Sep 17 00:00:00 2001 From: Adam Lindberg Date: Tue, 7 Jun 2011 15:40:32 +0200 Subject: [PATCH 141/184] Fix git R and M status when used together --- themes/guru.zsh-theme | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/guru.zsh-theme b/themes/guru.zsh-theme index a5ffdb722..dfec3dfb5 100644 --- a/themes/guru.zsh-theme +++ b/themes/guru.zsh-theme @@ -35,7 +35,7 @@ custom_git_prompt_status() { if $(echo "$INDEX" | grep '^ D ' &> /dev/null); then STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS" fi - if $(echo "$INDEX" | grep '^ M ' &> /dev/null); then + if $(echo "$INDEX" | grep '^.M ' &> /dev/null); then STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS" elif $(echo "$INDEX" | grep '^AM ' &> /dev/null); then STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS" @@ -46,7 +46,7 @@ custom_git_prompt_status() { if $(echo "$INDEX" | grep '^D ' &> /dev/null); then STATUS="$ZSH_THEME_GIT_PROMPT_STAGED_DELETED$STATUS" fi - if $(echo "$INDEX" | grep '^R ' &> /dev/null); then + if $(echo "$INDEX" | grep '^R' &> /dev/null); then STATUS="$ZSH_THEME_GIT_PROMPT_STAGED_RENAMED$STATUS" fi if $(echo "$INDEX" | grep '^M ' &> /dev/null); then From d99284f6b569a0860ed14330c8c9eaf5f0441fe8 Mon Sep 17 00:00:00 2001 From: Adam Lindberg Date: Tue, 7 Jun 2011 15:42:55 +0200 Subject: [PATCH 142/184] Rename guru theme to sunrise --- themes/{guru.zsh-theme => sunrise.zsh-theme} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename themes/{guru.zsh-theme => sunrise.zsh-theme} (97%) diff --git a/themes/guru.zsh-theme b/themes/sunrise.zsh-theme similarity index 97% rename from themes/guru.zsh-theme rename to themes/sunrise.zsh-theme index dfec3dfb5..15004084d 100644 --- a/themes/guru.zsh-theme +++ b/themes/sunrise.zsh-theme @@ -1,5 +1,5 @@ #------------------------------------------------------------------------------- -# Guru theme for oh-my-zsh by Adam Lindberg (eproxus@gmail.com) +# Sunrise theme for oh-my-zsh by Adam Lindberg (eproxus@gmail.com) # Intended to be used with Solarized: http://ethanschoonover.com/solarized # (Needs Git plugin for current_branch method) #------------------------------------------------------------------------------- From 3eae652a6d4bc5f280bb7f9d33000f378becf13c Mon Sep 17 00:00:00 2001 From: Adam Lindberg Date: Wed, 8 Jun 2011 16:33:29 +0100 Subject: [PATCH 143/184] Fix MM lines being read correctly --- themes/sunrise.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/sunrise.zsh-theme b/themes/sunrise.zsh-theme index 15004084d..88b371d79 100644 --- a/themes/sunrise.zsh-theme +++ b/themes/sunrise.zsh-theme @@ -49,7 +49,7 @@ custom_git_prompt_status() { if $(echo "$INDEX" | grep '^R' &> /dev/null); then STATUS="$ZSH_THEME_GIT_PROMPT_STAGED_RENAMED$STATUS" fi - if $(echo "$INDEX" | grep '^M ' &> /dev/null); then + if $(echo "$INDEX" | grep '^M' &> /dev/null); then STATUS="$ZSH_THEME_GIT_PROMPT_STAGED_MODIFIED$STATUS" fi if $(echo "$INDEX" | grep '^A' &> /dev/null); then From f9bf396e4ac68299f1370ed54350cc14ce954eea Mon Sep 17 00:00:00 2001 From: Marc Abramowitz Date: Thu, 9 Jun 2011 21:22:33 -0700 Subject: [PATCH 144/184] Add Django plugin. This is a slight modification of the Django zsh completions that I found at https://raw.github.com/technolize/zsh-completion-funcs/master/_manage.py --- plugins/django/django.plugin.zsh | 222 +++++++++++++++++++++++++++++++ 1 file changed, 222 insertions(+) create mode 100644 plugins/django/django.plugin.zsh diff --git a/plugins/django/django.plugin.zsh b/plugins/django/django.plugin.zsh new file mode 100644 index 000000000..1d72a2f2c --- /dev/null +++ b/plugins/django/django.plugin.zsh @@ -0,0 +1,222 @@ +#compdef manage.py + +typeset -ga nul_args +nul_args=( + '--settings=-[the Python path to a settings module.]:file:_files' + '--pythonpath=-[a directory to add to the Python path.]::directory:_directories' + '--traceback[print traceback on exception.]' + "--version[show program's version number and exit.]" + {-h,--help}'[show this help message and exit.]' +) + +_managepy-adminindex(){ + _arguments -s : \ + $nul_args \ + '*::directory:_directories' && ret=0 +} + +_managepy-createcachetable(){ + _arguments -s : \ + $nul_args && ret=0 +} + +_managepy-dbshell(){ + _arguments -s : \ + $nul_args && ret=0 +} + +_managepy-diffsettings(){ + _arguments -s : \ + $nul_args && ret=0 +} + +_managepy-dumpdata(){ + _arguments -s : \ + '--format=-[specifies the output serialization format for fixtures.]:format:(json yaml xml)' \ + '--indent=-[specifies the indent level to use when pretty-printing output.]:' \ + $nul_args \ + '*::appname:_applist' && ret=0 +} + +_managepy-flush(){ + _arguments -s : \ + '--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' \ + '--noinput[tells Django to NOT prompt the user for input of any kind.]' \ + $nul_args && ret=0 +} + +_managepy-help(){ + _arguments -s : \ + '*:command:_managepy_cmds' \ + $nul_args && ret=0 +} + +_managepy_cmds(){ + local line + local -a cmd + _call_program help-command ./manage.py help \ + |& sed -n '/^ /s/[(), ]/ /gp' \ + | while read -A line; do cmd=($line $cmd) done + _describe -t managepy-command 'manage.py command' cmd +} + +_managepy-inspectdb(){ + _arguments -s : \ + $nul_args && ret=0 +} + +_managepy-loaddata(){ + _arguments -s : \ + '--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' \ + '*::file:_files' \ + $nul_args && ret=0 +} + +_managepy-reset(){ + _arguments -s : \ + '--noinput[tells Django to NOT prompt the user for input of any kind.]' \ + '*::appname:_applist' \ + $nul_args && ret=0 +} + +_managepy-runfcgi(){ + local state + + local fcgi_opts + fcgi_opts=( + 'protocol[fcgi, scgi, ajp, ... (default fcgi)]:protocol:(fcgi scgi ajp)' + 'host[hostname to listen on..]:' + 'port[port to listen on.]:' + 'socket[UNIX socket to listen on.]::file:_files' + 'method[prefork or threaded (default prefork)]:method:(prefork threaded)' + 'maxrequests[number of requests a child handles before it is killed and a new child is forked (0 = no limit).]:' + 'maxspare[max number of spare processes / threads.]:' + 'minspare[min number of spare processes / threads.]:' + 'maxchildren[hard limit number of processes / threads.]:' + 'daemonize[whether to detach from terminal.]:boolean:(False True)' + 'pidfile[write the spawned process-id to this file.]:file:_files' + 'workdir[change to this directory when daemonizing.]:directory:_files' + 'outlog[write stdout to this file.]:file:_files' + 'errlog[write stderr to this file.]:file:_files' + ) + + _arguments -s : \ + $nul_args \ + '*: :_values "FCGI Setting" $fcgi_opts' && ret=0 +} + +_managepy-runserver(){ + _arguments -s : \ + '--noreload[tells Django to NOT use the auto-reloader.]' \ + '--adminmedia[specifies the directory from which to serve admin media.]:directory:_files' \ + $nul_args && ret=0 +} + +_managepy-shell(){ + _arguments -s : \ + '--plain[tells Django to use plain Python, not IPython.]' \ + $nul_args && ret=0 +} + +_managepy-sql(){} +_managepy-sqlall(){} +_managepy-sqlclear(){} +_managepy-sqlcustom(){} +_managepy-sqlflush(){} +_managepy-sqlindexes(){} +_managepy-sqlinitialdata(){} +_managepy-sqlreset(){} +_managepy-sqlsequencereset(){} +_managepy-startapp(){} + +_managepy-syncdb() { + _arguments -s : \ + '--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' \ + '--noinput[tells Django to NOT prompt the user for input of any kind.]' \ + $nul_args && ret=0 +} + +_managepy-test() { + _arguments -s : \ + '--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' \ + '--noinput[tells Django to NOT prompt the user for input of any kind.]' \ + '*::appname:_applist' \ + $nul_args && ret=0 +} + +_managepy-testserver() { + _arguments -s : \ + '--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' \ + '--addrport=-[port number or ipaddr:port to run the server on.]' \ + '*::fixture:_files' \ + $nul_args && ret=0 +} + +_managepy-validate() { + _arguments -s : \ + $nul_args && ret=0 +} + +_managepy-commands() { + local -a 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.' + '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.' + 'flush:Executes ``sqlflush`` on the current database.' + 'help:manage.py help.' + 'inspectdb:Introspects the database tables in the given database and outputs a Django model module.' + 'loaddata:Installs the named fixture(s) in the database.' + 'reset:Executes ``sqlreset`` for the given app(s) in the current database.' + 'runfcgi:Run this project as a fastcgi (or some other protocol supported by flup) application,' + 'runserver:Starts a lightweight Web server for development.' + 'shell:Runs a Python interactive interpreter.' + 'sql:Prints the CREATE TABLE SQL statements for the given app name(s).' + 'sqlall:Prints the CREATE TABLE, custom SQL and CREATE INDEX SQL statements for the given model module name(s).' + 'sqlclear:Prints the DROP TABLE SQL statements for the given app name(s).' + 'sqlcustom:Prints the custom table modifying SQL statements for the given app name(s).' + 'sqlflush:Returns a list of the SQL statements required to return all tables in the database to the state they were in just after they were installed.' + 'sqlindexes:Prints the CREATE INDEX SQL statements for the given model module name(s).' + "sqlinitialdata:RENAMED: see 'sqlcustom'" + 'sqlreset:Prints the DROP TABLE SQL, then the CREATE TABLE SQL, for the given app name(s).' + 'sqlsequencereset:Prints the SQL statements for resetting sequences for the given app name(s).' + "startapp:Creates a Django app directory structure for the given app name in this project's directory." + "syncdb:Create the database tables for all apps in INSTALLED_APPS whose tables haven't already been created." + 'test:Runs the test suite for the specified applications, or the entire site if no apps are specified.' + 'testserver:Runs a development server with data from the given fixture(s).' + 'validate:Validates all installed models.' + ) + + _describe -t commands 'manage.py command' commands && ret=0 +} + +_applist() { + local line + local -a apps + _call_program help-command "python -c \"import os.path as op, re, django.conf, sys;\\ + bn=op.basename(op.abspath(op.curdir));[sys\\ + .stdout.write(str(re.sub(r'^%s\.(.*?)$' % + bn, r'\1', i)) + '\n') for i in django.conf.settings.\\ + INSTALLED_APPS if re.match(r'^%s' % bn, i)]\"" \ + | while read -A line; do apps=($line $apps) done + _values 'Application' $apps && ret=0 +} + +_managepy() { + local curcontext=$curcontext ret=1 + + if ((CURRENT == 2)); then + _managepy-commands + else + shift words + (( CURRENT -- )) + curcontext="${curcontext%:*:*}:managepy-$words[1]:" + _call_function ret _managepy-$words[1] + fi +} + +compdef _managepy manage.py +compdef _managepy django From 527355eae3c8b019ce203c38b6aa5ffd818c3640 Mon Sep 17 00:00:00 2001 From: Marius Ghita Date: Wed, 15 Jun 2011 01:17:22 +0300 Subject: [PATCH 145/184] When the theme choice is left out, oh-my-zsh will not try to load it --- oh-my-zsh.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index d72d90cf9..c4522491b 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -43,6 +43,9 @@ then source "$RANDOM_THEME" echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..." else - source "$ZSH/themes/$ZSH_THEME.zsh-theme" + if [ ! "$ZSH_THEME" = "" ] + then + source "$ZSH/themes/$ZSH_THEME.zsh-theme" + fi fi From f22460f18125421a73a60893ae97ed545465bca7 Mon Sep 17 00:00:00 2001 From: Stephen Tudor Date: Sat, 18 Jun 2011 19:24:55 -0400 Subject: [PATCH 146/184] Add ohmyzsh theme, my version of dogenpunk --- themes/smt.zsh-theme | 91 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 themes/smt.zsh-theme diff --git a/themes/smt.zsh-theme b/themes/smt.zsh-theme new file mode 100644 index 000000000..fcb4858de --- /dev/null +++ b/themes/smt.zsh-theme @@ -0,0 +1,91 @@ +# ----------------------------------------------------------------------------- +# FILE: smt.zsh-theme +# DESCRIPTION: oh-my-zsh theme file, based on dogenpunk by Matthew Nelson. +# AUTHOR: Stephen Tudor (stephen@tudorstudio.com +# VERSION: 0.1 +# SCREENSHOT: coming soon +# ----------------------------------------------------------------------------- + +MODE_INDICATOR="%{$fg_bold[red]%}❮%{$reset_color%}%{$fg[red]%}❮❮%{$reset_color%}" +local return_status="%{$fg[red]%}%(?..⏎)%{$reset_color%} " + +ZSH_THEME_GIT_PROMPT_PREFIX="|" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%}⚡%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_AHEAD="%{$fg_bold[red]%}!%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%}✓%{$reset_color%}" + +ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} ✚" +ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} ✹" +ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖" +ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜" +ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭" + +# Format for git_prompt_long_sha() and git_prompt_short_sha() +ZSH_THEME_GIT_PROMPT_SHA_BEFORE="➤ %{$fg_bold[yellow]%}" +ZSH_THEME_GIT_PROMPT_SHA_AFTER="%{$reset_color%}" + +function prompt_char() { + git branch >/dev/null 2>/dev/null && echo "%{$fg[green]%}±%{$reset_color%}" && return + hg root >/dev/null 2>/dev/null && echo "%{$fg_bold[red]%}☿%{$reset_color%}" && return + echo "%{$fg[cyan]%}◯%{$reset_color%}" +} + +# 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[cyan]%}" + +# 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 [[ -n $(git status -s 2> /dev/null) ]]; then + if [ "$MINUTES" -gt 30 ]; then + COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG" + elif [ "$MINUTES" -gt 10 ]; then + COLOR="$ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM" + else + COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT" + fi + else + COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL" + fi + + if [ "$HOURS" -gt 24 ]; then + echo "[$COLOR${DAYS}d${SUB_HOURS}h${SUB_MINUTES}m%{$reset_color%}]" + elif [ "$MINUTES" -gt 60 ]; then + echo "[$COLOR${HOURS}h${SUB_MINUTES}m%{$reset_color%}]" + else + echo "[$COLOR${MINUTES}m%{$reset_color%}]" + fi + else + COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL" + echo "[$COLOR~]" + fi + fi +} + +PROMPT=' +%{$fg[blue]%}%m%{$reset_color%} 寿帝文 %{$fg[cyan]%}%~ %{$reset_color%}$(git_prompt_short_sha)$(git_prompt_info) +%{$fg[red]%}%!%{$reset_color%} $(prompt_char) : ' + +RPROMPT='${return_status}$(git_time_since_commit)$(git_prompt_status)%{$reset_color%}' From 03f71d14dd1866b9da58f28f8f40f5c12bf3072f Mon Sep 17 00:00:00 2001 From: Stephen Tudor Date: Sun, 19 Jun 2011 12:22:23 -0400 Subject: [PATCH 147/184] Changed kanji to fuku (good luck) --- themes/smt.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/smt.zsh-theme b/themes/smt.zsh-theme index fcb4858de..7a287523e 100644 --- a/themes/smt.zsh-theme +++ b/themes/smt.zsh-theme @@ -85,7 +85,7 @@ function git_time_since_commit() { } PROMPT=' -%{$fg[blue]%}%m%{$reset_color%} 寿帝文 %{$fg[cyan]%}%~ %{$reset_color%}$(git_prompt_short_sha)$(git_prompt_info) +%{$fg[blue]%}%m%{$reset_color%} 福 %{$fg[cyan]%}%~ %{$reset_color%}$(git_prompt_short_sha)$(git_prompt_info) %{$fg[red]%}%!%{$reset_color%} $(prompt_char) : ' RPROMPT='${return_status}$(git_time_since_commit)$(git_prompt_status)%{$reset_color%}' From e43eec99f94c00a6a9d2b30f9c449aff5ab0dfe5 Mon Sep 17 00:00:00 2001 From: Matthew McCullough Date: Tue, 28 Jun 2011 19:42:50 -0600 Subject: [PATCH 148/184] Added cloudapp from @holman of @GitHub fame --- plugins/cloudapp/cloudapp.plugin.zsh | 2 + plugins/cloudapp/cloudapp.rb | 60 ++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 plugins/cloudapp/cloudapp.plugin.zsh create mode 100755 plugins/cloudapp/cloudapp.rb diff --git a/plugins/cloudapp/cloudapp.plugin.zsh b/plugins/cloudapp/cloudapp.plugin.zsh new file mode 100644 index 000000000..99252f690 --- /dev/null +++ b/plugins/cloudapp/cloudapp.plugin.zsh @@ -0,0 +1,2 @@ +#!/bin/zsh +alias cloudapp=$ZSH/plugins/cloudapp/cloudapp.rb diff --git a/plugins/cloudapp/cloudapp.rb b/plugins/cloudapp/cloudapp.rb new file mode 100755 index 000000000..a11cfdb32 --- /dev/null +++ b/plugins/cloudapp/cloudapp.rb @@ -0,0 +1,60 @@ +#!/usr/bin/env ruby +# +# cloudapp +# Zach Holman / @holman +# +# Uploads a file from the command line to CloudApp, drops it into your +# clipboard (on a Mac, at least). +# +# Example: +# +# cloudapp drunk-blake.png +# +# This requires Aaron Russell's cloudapp_api gem: +# +# gem install cloudapp_api +# +# Requires you set your CloudApp credentials in ~/.cloudapp as a simple file of: +# +# email +# password + +require 'rubygems' +begin + require 'cloudapp_api' +rescue LoadError + puts "You need to install cloudapp_api: gem install cloudapp_api" + exit!(1) +end + +config_file = "#{ENV['HOME']}/.cloudapp" +unless File.exist?(config_file) + puts "You need to type your email and password (one per line) into "+ + "`~/.cloudapp`" + exit!(1) +end + +email,password = File.read(config_file).split("\n") + +class HTTParty::Response + # Apparently HTTPOK.ok? IS NOT OKAY WTFFFFFFFFFFUUUUUUUUUUUUUU + # LETS MONKEY PATCH IT I FEEL OKAY ABOUT IT + def ok? ; true end +end + +if ARGV[0].nil? + puts "You need to specify a file to upload." + exit!(1) +end + +CloudApp.authenticate(email,password) +url = CloudApp::Item.create(:upload, {:file => ARGV[0]}).url + +# Say it for good measure. +puts "Uploaded to #{url}." + +# Get the embed link. +url = "#{url}/#{ARGV[0].split('/').last}" + +# Copy it to your (Mac's) clipboard. +`echo '#{url}' | tr -d "\n" | pbcopy` From b61fcb64abfd733a95f0e83e3009086959623252 Mon Sep 17 00:00:00 2001 From: Frank Louwers Date: Thu, 30 Jun 2011 15:19:50 +0200 Subject: [PATCH 149/184] knife autocompletion --- plugins/knife/_knife | 174 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 174 insertions(+) create mode 100644 plugins/knife/_knife diff --git a/plugins/knife/_knife b/plugins/knife/_knife new file mode 100644 index 000000000..7f8c95ee5 --- /dev/null +++ b/plugins/knife/_knife @@ -0,0 +1,174 @@ +#compdef knife + +# 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 ) + +# knife has a very special syntax, some example calls are: +# knife status +# knife cookbook list +# knife role show ROLENAME +# knife data bag show DATABAGNAME +# knife role show ROLENAME --attribute ATTRIBUTENAME +# knife cookbook show COOKBOOKNAME COOKBOOKVERSION recipes + +# The -Q switch in compadd allow for completions of things like "data bag" without having to go through two rounds of completion and avoids zsh inserting a \ for escaping spaces +_knife() { + local curcontext="$curcontext" state line + typeset -A opt_args + cloudproviders=(bluebox ec2 rackspace slicehost terremark) + _arguments \ + '1: :->knifecmd'\ + '2: :->knifesubcmd'\ + '3: :->knifesubcmd2' \ + '4: :->knifesubcmd3' \ + '5: :->knifesubcmd4' \ + '6: :->knifesubcmd5' + + case $state in + knifecmd) + compadd -Q "$@" bootstrap client configure cookbook "cookbook site" "data bag" exec index node recipe role search ssh status windows $cloudproviders + ;; + knifesubcmd) + case $words[2] in + (bluebox|ec2|rackspace|slicehost|terremark) + compadd "$@" server images + ;; + client) + compadd -Q "$@" "bulk delete" list create show delete edit reregister + ;; + configure) + compadd "$@" client + ;; + cookbook) + compadd -Q "$@" test list create download delete "metadata from" show "bulk delete" metadata upload + ;; + node) + compadd -Q "$@" "from file" create show edit delete list run_list "bulk delete" + ;; + recipe) + compadd "$@" list + ;; + role) + compadd -Q "$@" "bulk delete" create delete edit "from file" list show + ;; + windows) + compadd "$@" bootstrap + ;; + *) + _arguments '2:Subsubcommands:($(_knife_options1))' + esac + ;; + knifesubcmd2) + case $words[3] in + server) + compadd "$@" list create delete + ;; + images) + compadd "$@" list + ;; + site) + compadd "$@" vendor show share search download list unshare + ;; + (show|delete|edit) + _arguments '3:Subsubcommands:($(_chef_$words[2]s_remote))' + ;; + (upload|test) + _arguments '3:Subsubcommands:($(_chef_$words[2]s_local) --all)' + ;; + list) + compadd -a "$@" knife_general_flags + ;; + bag) + compadd -Q "$@" show edit list "from file" create delete + ;; + *) + _arguments '3:Subsubcommands:($(_knife_options2))' + esac + ;; + knifesubcmd3) + case $words[3] in + show) + case $words[2] in + cookbook) + versioncomp=1 + _arguments '4:Cookbookversions:($(_cookbook_versions) latest)' + ;; + (node|client|role) + compadd "$@" --attribute + esac + esac + case $words[4] in + (show|edit) + _arguments '4:Subsubsubcommands:($(_chef_$words[2]_$words[3]s_remote))' + ;; + file) + _arguments '*:file or directory:_files -g "*.(rb|json)"' + ;; + list) + compadd -a "$@" knife_general_flags + ;; + *) + _arguments '*:Subsubcommands:($(_knife_options3))' + esac + ;; + knifesubcmd4) + if (( versioncomp > 0 )); then + compadd "$@" attributes definitions files libraries providers recipes resources templates + else + _arguments '*:Subsubcommands:($(_knife_options2))' + fi + ;; + knifesubcmd5) + _arguments '*:Subsubcommands:($(_knife_options3))' + esac +} + +# Helper functions to provide the argument completion for several depths of commands +_knife_options1() { + ( for line in $( knife $words[2] --help | grep -v "^knife" ); do echo $line | grep "\-\-"; done ) +} + +_knife_options2() { + ( for line in $( knife $words[2] $words[3] --help | grep -v "^knife" ); do echo $line | grep "\-\-"; done ) +} + +_knife_options3() { + ( for line in $( knife $words[2] $words[3] $words[4] --help | grep -v "^knife" ); do echo $line | grep "\-\-"; done ) +} + +# The chef_x_remote functions use knife to get a list of objects of type x on the server +_chef_roles_remote() { + (knife role list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') +} + +_chef_clients_remote() { + (knife client list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') +} + +_chef_nodes_remote() { + (knife node list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') +} + +_chef_cookbooks_remote() { + (knife cookbook list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') +} + +_chef_sitecookbooks_remote() { + (knife cookbook site list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') +} + +_chef_data_bags_remote() { + (knife data bag list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') +} + +# 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() { + (for i in $( grep cookbook_path $HOME/.chef/knife.rb | awk 'BEGIN {FS = "[" }; {print $2}' | sed 's/\,//g' | sed "s/'//g" | sed 's/\(.*\)]/\1/' ); do ls $i; done) +} + +# This function extracts the available cookbook versions on the chef server +_cookbook_versions() { + (knife cookbook show $words[4] | grep -v $words[4] | grep -v -E '\]|\[|\{|\}' | sed 's/ //g' | sed 's/"//g') +} + +_knife "$@" From 8f62ef490de6945308c144a3bee7c3509a16d421 Mon Sep 17 00:00:00 2001 From: Dan Poggi Date: Tue, 12 Jul 2011 23:20:21 -0400 Subject: [PATCH 150/184] Added 'dpoggi' theme --- themes/dpoggi.zsh-theme | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 themes/dpoggi.zsh-theme diff --git a/themes/dpoggi.zsh-theme b/themes/dpoggi.zsh-theme new file mode 100644 index 000000000..6469a2009 --- /dev/null +++ b/themes/dpoggi.zsh-theme @@ -0,0 +1,14 @@ +if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="green"; fi +local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" + +PROMPT='%{$fg[$NCOLOR]%}%n%{$reset_color%}@%{$fg[cyan]%}%m\ +%{$reset_color%}:%{$fg[magenta]%}%~\ +$(git_prompt_info) \ +%{$fg[red]%}%(!.#.»)%{$reset_color%} ' +PROMPT2='%{$fg[red]%}\ %{$reset_color%}' +RPS1='${return_code}' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}(" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%}○%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}⚡%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$fg[yellow]%})%{$reset_color%}" From 9e8194355c1a4f69dc52fbe2699fbce1be5c6493 Mon Sep 17 00:00:00 2001 From: Bodo Tasche Date: Sun, 12 Jun 2011 13:13:39 +0200 Subject: [PATCH 151/184] Added bundler-exec plugin --- plugins/bundler-exec/bundler-exec.plugin.zsh | 37 ++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 plugins/bundler-exec/bundler-exec.plugin.zsh diff --git a/plugins/bundler-exec/bundler-exec.plugin.zsh b/plugins/bundler-exec/bundler-exec.plugin.zsh new file mode 100644 index 000000000..966725976 --- /dev/null +++ b/plugins/bundler-exec/bundler-exec.plugin.zsh @@ -0,0 +1,37 @@ +# This plugin is based on https://github.com/gma/bundler-exec +# modify the BUNDLED_COMMANDS if needed + +BUNDLED_COMMANDS=(cucumber heroku rackup rails rake rspec ruby shotgun spec spork) + +## Functions + +bundler-installed() +{ + which bundle > /dev/null 2>&1 +} + +within-bundled-project() +{ + local dir="$(pwd)" + while [ "$(dirname $dir)" != "/" ]; do + [ -f "$dir/Gemfile" ] && return + dir="$(dirname $dir)" + done + false +} + +run-with-bundler() +{ + local command="$1" + shift + if bundler-installed && within-bundled-project; then + bundle exec $command "$@" + else + $command "$@" + fi +} + +## Main program +for CMD in $BUNDLED_COMMANDS; do + alias $CMD="run-with-bundler $CMD" +done From 05883f383143fa4821a5b07a748a800c0299f1fd Mon Sep 17 00:00:00 2001 From: Bodo Tasche Date: Sun, 12 Jun 2011 15:52:58 +0200 Subject: [PATCH 152/184] use lowercase for variablenames --- plugins/bundler-exec/bundler-exec.plugin.zsh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/bundler-exec/bundler-exec.plugin.zsh b/plugins/bundler-exec/bundler-exec.plugin.zsh index 966725976..cfab16c5e 100644 --- a/plugins/bundler-exec/bundler-exec.plugin.zsh +++ b/plugins/bundler-exec/bundler-exec.plugin.zsh @@ -1,7 +1,7 @@ # This plugin is based on https://github.com/gma/bundler-exec # modify the BUNDLED_COMMANDS if needed -BUNDLED_COMMANDS=(cucumber heroku rackup rails rake rspec ruby shotgun spec spork) +bundled_commands=(cucumber heroku rackup rails rake rspec ruby shotgun spec spork) ## Functions @@ -32,6 +32,6 @@ run-with-bundler() } ## Main program -for CMD in $BUNDLED_COMMANDS; do - alias $CMD="run-with-bundler $CMD" +for cmd in $bundled_commands; do + alias $cmd="run-with-bundler $cmd" done From 3aee5c19412dea541495e10f1c4cc7a6d8e4af50 Mon Sep 17 00:00:00 2001 From: Bodo Tasche Date: Sun, 12 Jun 2011 19:16:04 +0200 Subject: [PATCH 153/184] changed names of functions and variables to fit naming conventions --- plugins/bundler-exec/bundler-exec.plugin.zsh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/plugins/bundler-exec/bundler-exec.plugin.zsh b/plugins/bundler-exec/bundler-exec.plugin.zsh index cfab16c5e..4684dcb8d 100644 --- a/plugins/bundler-exec/bundler-exec.plugin.zsh +++ b/plugins/bundler-exec/bundler-exec.plugin.zsh @@ -5,26 +5,26 @@ bundled_commands=(cucumber heroku rackup rails rake rspec ruby shotgun spec spor ## Functions -bundler-installed() +_bundler-installed() { which bundle > /dev/null 2>&1 } -within-bundled-project() +_within-bundled-project() { - local dir="$(pwd)" - while [ "$(dirname $dir)" != "/" ]; do - [ -f "$dir/Gemfile" ] && return - dir="$(dirname $dir)" + local check_dir=$PWD + while [ "$(dirname $check_dir)" != "/" ]; do + [ -f "$check_dir/Gemfile" ] && return + dir="$(dirname $check_dir)" done false } -run-with-bundler() +_run-with-bundler() { local command="$1" shift - if bundler-installed && within-bundled-project; then + if _bundler-installed && _within-bundled-project; then bundle exec $command "$@" else $command "$@" @@ -33,5 +33,5 @@ run-with-bundler() ## Main program for cmd in $bundled_commands; do - alias $cmd="run-with-bundler $cmd" + alias $cmd="_run-with-bundler $cmd" done From 86958a32f3d3e647fc61e92700a9ce393e11a3cb Mon Sep 17 00:00:00 2001 From: Bodo Tasche Date: Sun, 12 Jun 2011 20:28:27 +0200 Subject: [PATCH 154/184] forgot to rename one variable --- plugins/bundler-exec/bundler-exec.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/bundler-exec/bundler-exec.plugin.zsh b/plugins/bundler-exec/bundler-exec.plugin.zsh index 4684dcb8d..bc4d35a84 100644 --- a/plugins/bundler-exec/bundler-exec.plugin.zsh +++ b/plugins/bundler-exec/bundler-exec.plugin.zsh @@ -15,7 +15,7 @@ _within-bundled-project() local check_dir=$PWD while [ "$(dirname $check_dir)" != "/" ]; do [ -f "$check_dir/Gemfile" ] && return - dir="$(dirname $check_dir)" + check_dir="$(dirname $check_dir)" done false } @@ -27,7 +27,7 @@ _run-with-bundler() if _bundler-installed && _within-bundled-project; then bundle exec $command "$@" else - $command "$@" + $command "$@" fi } From 69d30a6302f8c7daf6ad5ecf23224074789843db Mon Sep 17 00:00:00 2001 From: Bodo Tasche Date: Sun, 12 Jun 2011 23:16:47 +0200 Subject: [PATCH 155/184] Moved opening braces --- plugins/bundler-exec/bundler-exec.plugin.zsh | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/plugins/bundler-exec/bundler-exec.plugin.zsh b/plugins/bundler-exec/bundler-exec.plugin.zsh index bc4d35a84..09f44ed5e 100644 --- a/plugins/bundler-exec/bundler-exec.plugin.zsh +++ b/plugins/bundler-exec/bundler-exec.plugin.zsh @@ -1,17 +1,15 @@ # This plugin is based on https://github.com/gma/bundler-exec -# modify the BUNDLED_COMMANDS if needed +# modify the bundled_commands if needed bundled_commands=(cucumber heroku rackup rails rake rspec ruby shotgun spec spork) ## Functions -_bundler-installed() -{ +_bundler-installed() { which bundle > /dev/null 2>&1 } -_within-bundled-project() -{ +_within-bundled-project() { local check_dir=$PWD while [ "$(dirname $check_dir)" != "/" ]; do [ -f "$check_dir/Gemfile" ] && return @@ -20,8 +18,7 @@ _within-bundled-project() false } -_run-with-bundler() -{ +_run-with-bundler() { local command="$1" shift if _bundler-installed && _within-bundled-project; then From 37fcd4af049ad9b755d7b1d32cf63b537da0342c Mon Sep 17 00:00:00 2001 From: Hakan Ensari Date: Wed, 13 Jul 2011 22:39:23 +0100 Subject: [PATCH 156/184] update bundled commands --- plugins/bundler-exec/bundler-exec.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/bundler-exec/bundler-exec.plugin.zsh b/plugins/bundler-exec/bundler-exec.plugin.zsh index 09f44ed5e..61829eb2c 100644 --- a/plugins/bundler-exec/bundler-exec.plugin.zsh +++ b/plugins/bundler-exec/bundler-exec.plugin.zsh @@ -1,7 +1,7 @@ # This plugin is based on https://github.com/gma/bundler-exec # modify the bundled_commands if needed -bundled_commands=(cucumber heroku rackup rails rake rspec ruby shotgun spec spork) +bundled_commands=(cap capify cucumber heroku rackup rails rake rspec ruby shotgun spec spork thin unicorn unicorn_rails) ## Functions From a77e6fb003cc80fbbff5d453a5ca3d38638d99ed Mon Sep 17 00:00:00 2001 From: Hakan Ensari Date: Wed, 13 Jul 2011 22:40:23 +0100 Subject: [PATCH 157/184] fix indentation --- plugins/bundler-exec/bundler-exec.plugin.zsh | 30 ++++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/plugins/bundler-exec/bundler-exec.plugin.zsh b/plugins/bundler-exec/bundler-exec.plugin.zsh index 61829eb2c..3417ea81c 100644 --- a/plugins/bundler-exec/bundler-exec.plugin.zsh +++ b/plugins/bundler-exec/bundler-exec.plugin.zsh @@ -6,29 +6,29 @@ bundled_commands=(cap capify cucumber heroku rackup rails rake rspec ruby shotgu ## Functions _bundler-installed() { - which bundle > /dev/null 2>&1 + which bundle > /dev/null 2>&1 } _within-bundled-project() { - local check_dir=$PWD - while [ "$(dirname $check_dir)" != "/" ]; do - [ -f "$check_dir/Gemfile" ] && return - check_dir="$(dirname $check_dir)" - done - false + local check_dir=$PWD + while [ "$(dirname $check_dir)" != "/" ]; do + [ -f "$check_dir/Gemfile" ] && return + check_dir="$(dirname $check_dir)" + done + false } _run-with-bundler() { - local command="$1" - shift - if _bundler-installed && _within-bundled-project; then - bundle exec $command "$@" - else - $command "$@" - fi + local command="$1" + shift + if _bundler-installed && _within-bundled-project; then + bundle exec $command "$@" + else + $command "$@" + fi } ## Main program for cmd in $bundled_commands; do - alias $cmd="_run-with-bundler $cmd" + alias $cmd="_run-with-bundler $cmd" done From 60e104acd1710c04057d079cfa5ac9316762f580 Mon Sep 17 00:00:00 2001 From: Hakan Ensari Date: Wed, 13 Jul 2011 22:41:09 +0100 Subject: [PATCH 158/184] merge bundler and bundle-exec plugins --- plugins/bundler-exec/bundler-exec.plugin.zsh | 34 -------------------- plugins/bundler/bundler.plugin.zsh | 34 ++++++++++++++++++++ 2 files changed, 34 insertions(+), 34 deletions(-) delete mode 100644 plugins/bundler-exec/bundler-exec.plugin.zsh diff --git a/plugins/bundler-exec/bundler-exec.plugin.zsh b/plugins/bundler-exec/bundler-exec.plugin.zsh deleted file mode 100644 index 3417ea81c..000000000 --- a/plugins/bundler-exec/bundler-exec.plugin.zsh +++ /dev/null @@ -1,34 +0,0 @@ -# This plugin is based on https://github.com/gma/bundler-exec -# modify the bundled_commands if needed - -bundled_commands=(cap capify cucumber heroku rackup rails rake rspec ruby shotgun spec spork thin unicorn unicorn_rails) - -## Functions - -_bundler-installed() { - which bundle > /dev/null 2>&1 -} - -_within-bundled-project() { - local check_dir=$PWD - while [ "$(dirname $check_dir)" != "/" ]; do - [ -f "$check_dir/Gemfile" ] && return - check_dir="$(dirname $check_dir)" - done - false -} - -_run-with-bundler() { - local command="$1" - shift - if _bundler-installed && _within-bundled-project; then - bundle exec $command "$@" - else - $command "$@" - fi -} - -## Main program -for cmd in $bundled_commands; do - alias $cmd="_run-with-bundler $cmd" -done diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index fb40e2cec..fcf3e85fc 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -1,3 +1,37 @@ alias be="bundle exec" alias bi="bundle install" alias bu="bundle update" + +# The following is based on https://github.com/gma/bundler-exec + +bundled_commands=(cap capify cucumber heroku rackup rails rake rspec ruby shotgun spec spork thin unicorn unicorn_rails) + +## Functions + +_bundler-installed() { + which bundle > /dev/null 2>&1 +} + +_within-bundled-project() { + local check_dir=$PWD + while [ "$(dirname $check_dir)" != "/" ]; do + [ -f "$check_dir/Gemfile" ] && return + check_dir="$(dirname $check_dir)" + done + false +} + +_run-with-bundler() { + local command="$1" + shift + if _bundler-installed && _within-bundled-project; then + bundle exec $command "$@" + else + $command "$@" + fi +} + +## Main program +for cmd in $bundled_commands; do + alias $cmd="_run-with-bundler $cmd" +done From ba5fa3abc8ccf1f05e48c9b201282792c956c337 Mon Sep 17 00:00:00 2001 From: Hakan Ensari Date: Wed, 13 Jul 2011 22:41:36 +0100 Subject: [PATCH 159/184] alias bundle list --- 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 fcf3e85fc..c91dc9ab9 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -1,5 +1,6 @@ alias be="bundle exec" alias bi="bundle install" +alias bl="bundle list" alias bu="bundle update" # The following is based on https://github.com/gma/bundler-exec From 7d19ae8fab80c826156f984aa6dd8221a9aaada0 Mon Sep 17 00:00:00 2001 From: Hakan Ensari Date: Wed, 13 Jul 2011 22:42:44 +0100 Subject: [PATCH 160/184] clean up rails plugin, removing bundler-specific logic --- plugins/rails3/rails3.plugin.zsh | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/plugins/rails3/rails3.plugin.zsh b/plugins/rails3/rails3.plugin.zsh index f669ef047..f4ee637e6 100644 --- a/plugins/rails3/rails3.plugin.zsh +++ b/plugins/rails3/rails3.plugin.zsh @@ -1,13 +1,5 @@ # Rails 3 aliases, backwards-compatible with Rails 2. -function _bundle_command { - if command -v bundle && [ -e "Gemfile" ]; then - bundle exec $@ - else - $@ - fi -} - function _rails_command () { if [ -e "script/server" ]; then ruby script/$@ @@ -25,6 +17,3 @@ alias rp='_rails_command plugin' alias rs='_rails_command server' alias rsd='_rails_command server --debugger' alias devlog='tail -f log/development.log' - -alias rspec='_bundle_command rspec' -alias cuke='_bundle_command cucumber' From 6774fb3d59365ddb8520cdb4d46444720f788be0 Mon Sep 17 00:00:00 2001 From: Brandon Konkle Date: Wed, 13 Jul 2011 23:23:01 -0700 Subject: [PATCH 161/184] Minor corrections to deletion detection in git_prompt_status --- lib/git.zsh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/git.zsh b/lib/git.zsh index ce4de5598..f04343650 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -52,7 +52,9 @@ git_prompt_status() { if $(echo "$INDEX" | grep '^R ' &> /dev/null); then STATUS="$ZSH_THEME_GIT_PROMPT_RENAMED$STATUS" fi - if $(echo "$INDEX" | grep '^D ' &> /dev/null); then + if $(echo "$INDEX" | grep '^ D ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS" + elif $(echo "$INDEX" | grep '^AD ' &> /dev/null); then STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS" fi if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then From 913cf5325264960d4c1dfe678a2adadeaecdbf6a Mon Sep 17 00:00:00 2001 From: Hakan Ensari Date: Thu, 14 Jul 2011 17:34:18 +0100 Subject: [PATCH 162/184] refactor _run-with-bundler --- plugins/bundler/bundler.plugin.zsh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index c91dc9ab9..e98bb4b46 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -23,12 +23,10 @@ _within-bundled-project() { } _run-with-bundler() { - local command="$1" - shift if _bundler-installed && _within-bundled-project; then - bundle exec $command "$@" + bundle exec $@ else - $command "$@" + $@ fi } From 9308a7d472a1dea6610887b98d6d789741f96a49 Mon Sep 17 00:00:00 2001 From: Adam Blinkinsop Date: Thu, 14 Jul 2011 11:04:46 -0700 Subject: [PATCH 163/184] Added a new theme. --- themes/blinks.zsh-theme | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 themes/blinks.zsh-theme diff --git a/themes/blinks.zsh-theme b/themes/blinks.zsh-theme new file mode 100644 index 000000000..3db7012f4 --- /dev/null +++ b/themes/blinks.zsh-theme @@ -0,0 +1,20 @@ +# https://github.com/blinks zsh theme + +function _prompt_char() { + if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then + echo "%{%F{blue}%}±%{%f%k%b%}" + else + echo ' ' + fi +} + +ZSH_THEME_GIT_PROMPT_PREFIX=" [%{%B%F{blue}%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{%f%k%b%K{black}%B%F{green}%}]" +ZSH_THEME_GIT_PROMPT_DIRTY=" %{%F{red}%}*%{%f%k%b%}" +ZSH_THEME_GIT_PROMPT_CLEAN="" + +PROMPT='%{%f%k%b%} +%{%K{black}%B%F{green}%}%n%{%B%F{blue}%}@%{%B%F{cyan}%}%m%{%B%F{green}%} %{%b%F{yellow}%K{black}%}%~%{%B%F{green}%}$(git_prompt_info)%E%{%f%k%b%} +%{%K{black}%}$(_prompt_char)%{%K{black}%} %#%{%f%k%b%} ' + +RPROMPT='!%{%B%F{cyan}%}%!%{%f%k%b%}' From caa1cc70678e15fe0da93a89e52f543c6bda7494 Mon Sep 17 00:00:00 2001 From: "Suraj N. Kurapati" Date: Thu, 14 Jul 2011 21:41:26 -0700 Subject: [PATCH 164/184] zsh-history-substring-search plugin at 15f63de https://github.com/sunaku/zsh-history-substring-search --- README | 7 + history-substring-search.plugin.zsh | 12 + history-substring-search.zsh | 642 ++++++++++++++++++++++++++++ 3 files changed, 661 insertions(+) create mode 100644 README create mode 100644 history-substring-search.plugin.zsh create mode 100644 history-substring-search.zsh diff --git a/README b/README new file mode 100644 index 000000000..be11adf76 --- /dev/null +++ b/README @@ -0,0 +1,7 @@ +To activate this script, load it into an interactive ZSH session: + + % source history-substring-search.zsh + +See the "history-substring-search.zsh" file for more information: + + % sed -n '2,/^$/s/^#//p' history-substring-search.zsh | more diff --git a/history-substring-search.plugin.zsh b/history-substring-search.plugin.zsh new file mode 100644 index 000000000..99a5922c5 --- /dev/null +++ b/history-substring-search.plugin.zsh @@ -0,0 +1,12 @@ +# This file integrates the history-substring-search script into oh-my-zsh. + +source "$ZSH/plugins/history-substring-search/history-substring-search.zsh" + +if test "$CASE_SENSITIVE" = true; then + unset HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS +fi + +if test "$DISABLE_COLOR" = true; then + unset HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND + unset HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND +fi diff --git a/history-substring-search.zsh b/history-substring-search.zsh new file mode 100644 index 000000000..53f707c79 --- /dev/null +++ b/history-substring-search.zsh @@ -0,0 +1,642 @@ +#!/usr/bin/env zsh +# +# This is a clean-room implementation of the Fish[1] shell's history search +# feature, where you can type in any part of any previously entered command +# and press the UP and DOWN arrow keys to cycle through the matching commands. +# +#----------------------------------------------------------------------------- +# Usage +#----------------------------------------------------------------------------- +# +# 1. Load this script into your interactive ZSH session: +# +# % source history-substring-search.zsh +# +# If you want to use the zsh-syntax-highlighting[6] script along with this +# script, then make sure that you load it *before* you load this script: +# +# % source zsh-syntax-highlighting.zsh +# % source history-substring-search.zsh +# +# 2. Type any part of any previous command and then: +# +# * Press the UP arrow key to select the nearest command that (1) contains +# your query and (2) is older than the current command in the command +# history. +# +# * Press the DOWN arrow key to select the nearest command that (1) +# contains your query and (2) is newer than the current command in the +# command history. +# +# * Press ^U (the Control and U keys simultaneously) to abort the search. +# +# 3. If a matching command spans more than one line of text, press the LEFT +# arrow key to move the cursor away from the end of the command, and then: +# +# * Press the UP arrow key to move the cursor to the line above. When the +# cursor reaches the first line of the command, pressing the UP arrow +# key again will cause this script to perform another search. +# +# * Press the DOWN arrow key to move the cursor to the line below. When +# the cursor reaches the last line of the command, pressing the DOWN +# arrow key again will cause this script to perform another search. +# +#----------------------------------------------------------------------------- +# Configuration +#----------------------------------------------------------------------------- +# +# This script defines the following global variables. You may override their +# default values only after having loaded this script into your ZSH session. +# +# * HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND is a global variable that defines +# how the query should be highlighted inside a matching command. Its default +# value causes this script to highlight using bold, white text on a magenta +# background. See the "Character Highlighting" section in the zshzle(1) man +# page to learn about the kinds of values you may assign to this variable. +# +# * HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND is a global variable that +# defines how the query should be highlighted when no commands in the +# history match it. Its default value causes this script to highlight using +# bold, white text on a red background. See the "Character Highlighting" +# section in the zshzle(1) man page to learn about the kinds of values you +# may assign to this variable. +# +# * HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS is a global variable that defines +# how the command history will be searched for your query. Its default value +# causes this script to perform a case-insensitive search. See the "Globbing +# Flags" section in the zshexpn(1) man page to learn about the kinds of +# values you may assign to this variable. +# +#----------------------------------------------------------------------------- +# History +#----------------------------------------------------------------------------- +# +# This script was originally written by Peter Stephenson[2], who published it +# to the ZSH users mailing list (thereby making it public domain) in September +# 2009. It was later revised by Guido van Steen and released under the BSD +# license (see below) as part of the fizsh[3] project in January 2011. +# +# It was later extracted from fizsh[3] release 1.0.1, refactored heavily, and +# repackaged as both an oh-my-zsh plugin[4] and as an independently loadable +# ZSH script[5] by Suraj N. Kurapati in 2011. +# +# It was further developed[4] by Guido van Steen, Suraj N. Kurapati, Sorin +# Ionescu, and Vincent Guerci in 2011. +# +# [1]: http://fishshell.com +# [2]: http://www.zsh.org/mla/users/2009/msg00818.html +# [3]: http://sourceforge.net/projects/fizsh/ +# [4]: https://github.com/robbyrussell/oh-my-zsh/pull/215 +# [5]: https://github.com/sunaku/zsh-history-substring-search +# [6]: https://github.com/nicoulaj/zsh-syntax-highlighting +# +############################################################################## +# +# Copyright (c) 2009 Peter Stephenson +# Copyright (c) 2011 Guido van Steen +# Copyright (c) 2011 Suraj N. Kurapati +# Copyright (c) 2011 Sorin Ionescu +# Copyright (c) 2011 Vincent Guerci +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * Neither the name of the FIZSH nor the names of its contributors +# may be used to endorse or promote products derived from this +# software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################## + +#----------------------------------------------------------------------------- +# configuration variables +#----------------------------------------------------------------------------- + +HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND='bg=magenta,fg=white,bold' +HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND='bg=red,fg=white,bold' +HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS='i' + +#----------------------------------------------------------------------------- +# the main ZLE widgets +#----------------------------------------------------------------------------- + +function history-substring-search-up() { + _history-substring-search-begin + + _history-substring-search-up-history || + _history-substring-search-up-buffer || + _history-substring-search-up-search + + _history-substring-search-end +} + +function history-substring-search-down() { + _history-substring-search-begin + + _history-substring-search-down-history || + _history-substring-search-down-buffer || + _history-substring-search-down-search + + _history-substring-search-end +} + +zle -N history-substring-search-up +zle -N history-substring-search-down + +bindkey '\e[A' history-substring-search-up +bindkey '\e[B' history-substring-search-down + +#----------------------------------------------------------------------------- +# implementation details +#----------------------------------------------------------------------------- + +setopt extendedglob +zmodload -F zsh/parameter + +# +# We have to "override" some keys and widgets if the +# zsh-syntax-highlighting plugin has not been loaded: +# +# https://github.com/nicoulaj/zsh-syntax-highlighting +# +if [[ $+functions[_zsh_highlight] -eq 0 ]]; then + # + # Dummy implementation of _zsh_highlight() + # that simply removes existing highlights + # + function _zsh_highlight() { + region_highlight=() + } + + # + # Remove existing highlights when the user + # inserts printable characters into $BUFFER + # + function ordinary-key-press() { + if [[ $KEYS == [[:print:]] ]]; then + region_highlight=() + fi + zle .self-insert + } + zle -N self-insert ordinary-key-press + + # + # Override ZLE widgets to invoke _zsh_highlight() + # + # https://github.com/nicoulaj/zsh-syntax-highlighting/blob/ + # bb7fcb79fad797a40077bebaf6f4e4a93c9d8163/zsh-syntax-highlighting.zsh#L121 + # + #--------------8<-------------------8<-------------------8<----------------- + # + # Copyright (c) 2010-2011 zsh-syntax-highlighting contributors + # All rights reserved. + # + # Redistribution and use in source and binary forms, with or without + # modification, are permitted provided that the following conditions are + # met: + # + # * Redistributions of source code must retain the above copyright + # notice, this list of conditions and the following disclaimer. + # + # * Redistributions in binary form must reproduce the above copyright + # notice, this list of conditions and the following disclaimer in the + # documentation and/or other materials provided with the distribution. + # + # * Neither the name of the zsh-syntax-highlighting contributors nor the + # names of its contributors may be used to endorse or promote products + # derived from this software without specific prior written permission. + # + # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + # IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + # Load ZSH module zsh/zleparameter, needed to override user defined widgets. + zmodload zsh/zleparameter 2>/dev/null || { + echo 'zsh-syntax-highlighting: failed loading zsh/zleparameter, exiting.' >&2 + return -1 + } + + # Override ZLE widgets to make them invoke _zsh_highlight. + for event in ${${(f)"$(zle -la)"}:#(_*|orig-*|.run-help|.which-command)}; do + if [[ "$widgets[$event]" == completion:* ]]; then + eval "zle -C orig-$event ${${${widgets[$event]}#*:}/:/ } ; $event() { builtin zle orig-$event && _zsh_highlight } ; zle -N $event" + else + case $event in + accept-and-menu-complete) + eval "$event() { builtin zle .$event && _zsh_highlight } ; zle -N $event" + ;; + + # The following widgets should NOT remove any previously + # applied highlighting. Therefore we do not remap them. + .forward-char|.backward-char|.up-line-or-history|.down-line-or-history) + ;; + + .*) + clean_event=$event[2,${#event}] # Remove the leading dot in the event name + case ${widgets[$clean_event]-} in + (completion|user):*) + ;; + *) + eval "$clean_event() { builtin zle $event && _zsh_highlight } ; zle -N $clean_event" + ;; + esac + ;; + *) + ;; + esac + fi + done + unset event clean_event + #-------------->8------------------->8------------------->8----------------- +fi + +function _history-substring-search-begin() { + _history_substring_search_move_cursor_eol=false + _history_substring_search_query_highlight= + + # + # Continue using the previous $_history_substring_search_result by default, + # unless the current query was cleared or a new/different query was entered. + # + if [[ -z $BUFFER || $BUFFER != $_history_substring_search_result ]]; then + # + # For the purpose of highlighting we will also keep + # a version without doubly-escaped meta characters. + # + _history_substring_search_query=$BUFFER + + # + # $BUFFER contains the text that is in the command-line currently. + # we put an extra "\\" before meta characters such as "\(" and "\)", + # so that they become "\\\(" and "\\\)". + # + _history_substring_search_query_escaped=${BUFFER//(#m)[\][()|\\*?#<>~^]/\\$MATCH} + + # + # Find all occurrences of the search query in the history file. + # + # (k) turns it an array of line numbers. + # + # (on) seems to remove duplicates, which are default + # options. They can be turned off by (ON). + # + _history_substring_search_matches=(${(kon)history[(R)(#$HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS)*${_history_substring_search_query_escaped}*]}) + + # + # Define the range of values that $_history_substring_search_match_index + # can take: [0, $_history_substring_search_matches_count_plus]. + # + _history_substring_search_matches_count=$#_history_substring_search_matches + _history_substring_search_matches_count_plus=$(( _history_substring_search_matches_count + 1 )) + _history_substring_search_matches_count_sans=$(( _history_substring_search_matches_count - 1 )) + + # + # If $_history_substring_search_match_index is equal to + # $_history_substring_search_matches_count_plus, this indicates that we + # are beyond the beginning of $_history_substring_search_matches. + # + # If $_history_substring_search_match_index is equal to 0, this indicates + # that we are beyond the end of $_history_substring_search_matches. + # + # If we have initially pressed "up" we have to initialize + # $_history_substring_search_match_index to + # $_history_substring_search_matches_count_plus so that it will be + # decreased to $_history_substring_search_matches_count. + # + # If we have initially pressed "down" we have to initialize + # $_history_substring_search_match_index to + # $_history_substring_search_matches_count so that it will be increased to + # $_history_substring_search_matches_count_plus. + # + if [[ $WIDGET == history-substring-search-down ]]; then + _history_substring_search_match_index=$_history_substring_search_matches_count + else + _history_substring_search_match_index=$_history_substring_search_matches_count_plus + fi + fi +} + +function _history-substring-search-end() { + _history_substring_search_result=$BUFFER + + # move the cursor to the end of the command line + if [[ $_history_substring_search_move_cursor_eol == true ]]; then + CURSOR=${#BUFFER} + fi + + # highlight command line using zsh-syntax-highlighting + _zsh_highlight + + # highlight the search query inside the command line + if [[ -n $_history_substring_search_query_highlight && -n $_history_substring_search_query ]]; then + # + # The following expression yields a variable $MBEGIN, which + # indicates the begin position + 1 of the first occurrence + # of _history_substring_search_query_escaped in $BUFFER. + # + : ${(S)BUFFER##(#m$HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS)($_history_substring_search_query##)} + local begin=$(( MBEGIN - 1 )) + local end=$(( begin + $#_history_substring_search_query )) + region_highlight+=("$begin $end $_history_substring_search_query_highlight") + fi + + # For debugging purposes: + # zle -R "mn: "$_history_substring_search_match_index" m#: "${#_history_substring_search_matches} + # read -k -t 200 && zle -U $REPLY + + # Exit successfully from the history-substring-search-* widgets. + true +} + +function _history-substring-search-up-buffer() { + # + # Check if the UP arrow was pressed to move the cursor within a multi-line + # buffer. This amounts to three tests: + # + # 1. $#buflines -gt 1. + # + # 2. $CURSOR -ne $#BUFFER. + # + # 3. Check if we are on the first line of the current multi-line buffer. + # If so, pressing UP would amount to leaving the multi-line buffer. + # + # We check this by adding an extra "x" to $LBUFFER, which makes + # sure that xlbuflines is always equal to the number of lines + # until $CURSOR (including the line with the cursor on it). + # + local buflines XLBUFFER xlbuflines + buflines=(${(f)BUFFER}) + XLBUFFER=$LBUFFER"x" + xlbuflines=(${(f)XLBUFFER}) + + if [[ $#buflines -gt 1 && $CURSOR -ne $#BUFFER && $#xlbuflines -ne 1 ]]; then + zle up-line-or-history + return true + fi + + false +} + +function _history-substring-search-down-buffer() { + # + # Check if the DOWN arrow was pressed to move the cursor within a multi-line + # buffer. This amounts to three tests: + # + # 1. $#buflines -gt 1. + # + # 2. $CURSOR -ne $#BUFFER. + # + # 3. Check if we are on the last line of the current multi-line buffer. + # If so, pressing DOWN would amount to leaving the multi-line buffer. + # + # We check this by adding an extra "x" to $RBUFFER, which makes + # sure that xrbuflines is always equal to the number of lines + # from $CURSOR (including the line with the cursor on it). + # + local buflines XRBUFFER xrbuflines + buflines=(${(f)BUFFER}) + XRBUFFER="x"$RBUFFER + xrbuflines=(${(f)XRBUFFER}) + + if [[ $#buflines -gt 1 && $CURSOR -ne $#BUFFER && $#xrbuflines -ne 1 ]]; then + zle down-line-or-history + return true + fi + + false +} + +function _history-substring-search-up-history() { + # + # Behave like up in ZSH, except clear the $BUFFER + # when beginning of history is reached like in Fish. + # + if [[ -z $_history_substring_search_query ]]; then + + # we have reached the absolute top of history + if [[ $HISTNO -eq 1 ]]; then + BUFFER= + + # going up from somewhere below the top of history + else + zle up-history + fi + + return true + fi + + false +} + +function _history-substring-search-down-history() { + # + # Behave like down-history in ZSH, except clear the + # $BUFFER when end of history is reached like in Fish. + # + if [[ -z $_history_substring_search_query ]]; then + + # going down from the absolute top of history + if [[ $HISTNO -eq 1 && -z $BUFFER ]]; then + BUFFER=${history[1]} + _history_substring_search_move_cursor_eol=true + + # going down from somewhere above the bottom of history + else + zle down-history + fi + + return true + fi + + false +} + +function _history-substring-search-up-search() { + _history_substring_search_move_cursor_eol=true + + # + # Highlight matches during history-substring-up-search: + # + # The following constants have been initialized in + # _history-substring-search-up/down-search(): + # + # $_history_substring_search_matches is the current list of matches + # $_history_substring_search_matches_count is the current number of matches + # $_history_substring_search_matches_count_plus is the current number of matches + 1 + # $_history_substring_search_matches_count_sans is the current number of matches - 1 + # $_history_substring_search_match_index is the index of the current match + # + # The range of values that $_history_substring_search_match_index can take + # is: [0, $_history_substring_search_matches_count_plus]. A value of 0 + # indicates that we are beyond the end of + # $_history_substring_search_matches. A value of + # $_history_substring_search_matches_count_plus indicates that we are beyond + # the beginning of $_history_substring_search_matches. + # + # In _history-substring-search-up-search() the initial value of + # $_history_substring_search_match_index is + # $_history_substring_search_matches_count_plus. This value is set in + # _history-substring-search-begin(). _history-substring-search-up-search() + # will initially decrease it to $_history_substring_search_matches_count. + # + if [[ $_history_substring_search_match_index -ge 2 ]]; then + # + # Highlight the next match: + # + # 1. Decrease the value of $_history_substring_search_match_index. + # + # 2. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND + # to highlight the current buffer. + # + (( _history_substring_search_match_index-- )) + BUFFER=$history[$_history_substring_search_matches[$_history_substring_search_match_index]] + _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND + + elif [[ $_history_substring_search_match_index -eq 1 ]]; then + # + # We will move beyond the end of $_history_substring_search_matches: + # + # 1. Decrease the value of $_history_substring_search_match_index. + # + # 2. Save the current buffer in $_history_substring_search_old_buffer, + # so that it can be retrieved by + # _history-substring-search-down-search() later. + # + # 3. Make $BUFFER equal to $_history_substring_search_query. + # + # 4. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND + # to highlight the current buffer. + # + (( _history_substring_search_match_index-- )) + _history_substring_search_old_buffer=$BUFFER + BUFFER=$_history_substring_search_query + _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND + + elif [[ $_history_substring_search_match_index -eq $_history_substring_search_matches_count_plus ]]; then + # + # We were beyond the beginning of $_history_substring_search_matches but + # UP makes us move back to $_history_substring_search_matches: + # + # 1. Decrease the value of $_history_substring_search_match_index. + # + # 2. Restore $BUFFER from $_history_substring_search_old_buffer. + # + # 3. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND + # to highlight the current buffer. + # + (( _history_substring_search_match_index-- )) + BUFFER=$_history_substring_search_old_buffer + _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND + fi +} + +function _history-substring-search-down-search() { + _history_substring_search_move_cursor_eol=true + + # + # Highlight matches during history-substring-up-search: + # + # The following constants have been initialized in + # _history-substring-search-up/down-search(): + # + # $_history_substring_search_matches is the current list of matches + # $_history_substring_search_matches_count is the current number of matches + # $_history_substring_search_matches_count_plus is the current number of matches + 1 + # $_history_substring_search_matches_count_sans is the current number of matches - 1 + # $_history_substring_search_match_index is the index of the current match + # + # The range of values that $_history_substring_search_match_index can take + # is: [0, $_history_substring_search_matches_count_plus]. A value of 0 + # indicates that we are beyond the end of + # $_history_substring_search_matches. A value of + # $_history_substring_search_matches_count_plus indicates that we are beyond + # the beginning of $_history_substring_search_matches. + # + # In _history-substring-search-down-search() the initial value of + # $_history_substring_search_match_index is + # $_history_substring_search_matches_count. This value is set in + # _history-substring-search-begin(). + # _history-substring-search-down-search() will initially increase it to + # $_history_substring_search_matches_count_plus. + # + if [[ $_history_substring_search_match_index -le $_history_substring_search_matches_count_sans ]]; then + # + # Highlight the next match: + # + # 1. Increase $_history_substring_search_match_index by 1. + # + # 2. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND + # to highlight the current buffer. + # + (( _history_substring_search_match_index++ )) + BUFFER=$history[$_history_substring_search_matches[$_history_substring_search_match_index]] + _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND + + elif [[ $_history_substring_search_match_index -eq $_history_substring_search_matches_count ]]; then + # + # We will move beyond the beginning of $_history_substring_search_matches: + # + # 1. Increase $_history_substring_search_match_index by 1. + # + # 2. Save the current buffer in $_history_substring_search_old_buffer, so + # that it can be retrieved by _history-substring-search-up-search() + # later. + # + # 3. Make $BUFFER equal to $_history_substring_search_query. + # + # 4. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND + # to highlight the current buffer. + # + (( _history_substring_search_match_index++ )) + _history_substring_search_old_buffer=$BUFFER + BUFFER=$_history_substring_search_query + _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND + + elif [[ $_history_substring_search_match_index -eq 0 ]]; then + # + # We were beyond the end of $_history_substring_search_matches but DOWN + # makes us move back to the $_history_substring_search_matches: + # + # 1. Increase $_history_substring_search_match_index by 1. + # + # 2. Restore $BUFFER from $_history_substring_search_old_buffer. + # + # 3. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND + # to highlight the current buffer. + # + (( _history_substring_search_match_index++ )) + BUFFER=$_history_substring_search_old_buffer + _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND + fi +} + +# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- +# vim: ft=zsh sw=2 ts=2 et From 66c6260c10422bf50c474c9654a7928ce99e7ceb Mon Sep 17 00:00:00 2001 From: Paul Serby Date: Sat, 16 Jul 2011 16:15:15 +0100 Subject: [PATCH 165/184] Completion for cake the coffee-script build tool --- plugins/cake/cake.plugin.zsh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 plugins/cake/cake.plugin.zsh diff --git a/plugins/cake/cake.plugin.zsh b/plugins/cake/cake.plugin.zsh new file mode 100644 index 000000000..75997521a --- /dev/null +++ b/plugins/cake/cake.plugin.zsh @@ -0,0 +1,32 @@ +# Set this to 1 if you want to cache the tasks +cacheTaskList=1 + +# Cache filename +cacheFile='.cake-task-cache' + +_cake_does_target_list_need_generating () { + + if [ $cacheTaskList -eq 0 ]; then + return 1; + fi + + if [ ! -f $cacheFile ]; then return 0; + else + accurate=$(stat -f%m $cacheFile) + changed=$(stat -f%m Cakefile) + return $(expr $accurate '>=' $changed) + fi +} + +_cake () { + if [ -f Cakefile ]; then + if _cake_does_target_list_need_generating; then + cake | sed -e "s/cake \([^ ]*\) .*/\1/" | grep -v '^$' > $cacheFile + compadd `cat $cacheFile` + else + compadd `cake | sed -e "s/cake \([^ ]*\) .*/\1/" | grep -v '^$'` + fi + fi +} + +compdef _cake cake From e7e9e5bbe608fd7572a810f36e7f1b3321c25136 Mon Sep 17 00:00:00 2001 From: Benjamin Boudreau Date: Sat, 16 Jul 2011 18:42:09 -0400 Subject: [PATCH 166/184] Added archlinux plugin --- plugins/archlinux/archlinux.plugin.zsh | 67 ++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 plugins/archlinux/archlinux.plugin.zsh diff --git a/plugins/archlinux/archlinux.plugin.zsh b/plugins/archlinux/archlinux.plugin.zsh new file mode 100644 index 000000000..acb8df057 --- /dev/null +++ b/plugins/archlinux/archlinux.plugin.zsh @@ -0,0 +1,67 @@ +# Archlinux zsh aliases and functions for zsh + +# Aliases ################################################################### + +# Look for yaourt, and add some useful functions if we have it. +if [[ -x `which yaourt` ]]; then + upgrade () { + yaourt -Syu -C + } + # Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips + alias yaupg='sudo yaourt -Syu' # Synchronize with repositories before upgrading packages that are out of date on the local system. + alias yain='sudo yaourt -S' # Install specific package(s) from the repositories + alias yains='sudo yaourt -U' # Install specific package not from the repositories but from a file + alias yare='sudo yaourt -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies + alias yarem='sudo yaourt -Rns' # Remove the specified package(s), its configuration(s) and unneeded dependencies + alias yarep='yaourt -Si' # Display information about a given package in the repositories + 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 + # Additional yaourt alias examples + alias yaupd='sudo yaourt -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories + alias yainsd='sudo yaourt -S --asdeps' # Install given package(s) as dependencies of another package + alias yamir='sudo yaourt -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist +else + upgrade() { + sudo pacman -Syu + } +fi + +# Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips +alias pacupg='sudo pacman -Syu' # Synchronize with repositories before upgrading packages that are out of date on the local system. +alias pacin='sudo pacman -S' # Install specific package(s) from the repositories +alias pacins='sudo pacman -U' # Install specific package not from the repositories but from a file +alias pacre='sudo pacman -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies +alias pacrem='sudo pacman -Rns' # Remove the specified package(s), its configuration(s) and unneeded dependencies +alias pacrep='pacman -Si' # Display information about a given package in the repositories +alias pacreps='pacman -Ss' # Search for package(s) in the repositories +alias pacloc='pacman -Qi' # Display information about a given package in the local database +alias paclocs='pacman -Qs' # Search for package(s) in the local database +# Additional pacman alias examples +alias pacupd='sudo pacman -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories +alias pacinsd='sudo pacman -S --asdeps' # Install given package(s) as dependencies of another package +alias pacmir='sudo pacman -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist + +# https://bbs.archlinux.org/viewtopic.php?id=93683 +paclist() { + sudo pacman -Qei $(pacman -Qu|cut -d" " -f 1)|awk ' BEGIN {FS=":"}/^Name/{printf("\033[1;36m%s\033[1;37m", $2)}/^Description/{print $2}' +} +alias paclsorhpans='sudo pacman -Qdt' +alias pacrmorphans='sudo pacman -Rs $(pacman -Qtdq)' + +pacdisowned() { + tmp=${TMPDIR-/tmp}/pacman-disowned-$UID-$$ + db=$tmp/db + fs=$tmp/fs + + mkdir "$tmp" + trap 'rm -rf "$tmp"' EXIT + + pacman -Qlq | sort -u > "$db" + + find /bin /etc /lib /sbin /usr \ + ! -name lost+found \ + \( -type d -printf '%p/\n' -o -print \) | sort > "$fs" + + comm -23 "$fs" "$db" +} From edcd4f7eea357cefee37a25a371e1dd5d1a6b598 Mon Sep 17 00:00:00 2001 From: Jake Bell Date: Sun, 17 Jul 2011 13:01:48 -0500 Subject: [PATCH 167/184] Adding quotes to deal with paths that have spaces. --- tools/upgrade.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/upgrade.sh b/tools/upgrade.sh index e30488822..2b75e5541 100644 --- a/tools/upgrade.sh +++ b/tools/upgrade.sh @@ -9,4 +9,4 @@ echo "\033[0;32m"'\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '"\033[0m echo "\033[0;32m"' /____/ '"\033[0m" echo "\033[0;34mHooray! Oh My Zsh has been updated and/or is at the current version.\033[0m" echo "\033[0;34mTo keep up on the latest, be sure to follow Oh My Zsh on twitter: \033[1mhttp://twitter.com/ohmyzsh\033[0m" -cd $current_path +cd "$current_path" From 127d2ae57b01ae13dd6017c3c104a45a0086e88e Mon Sep 17 00:00:00 2001 From: alexandru totolici Date: Sun, 17 Jul 2011 21:01:06 -0700 Subject: [PATCH 168/184] Fixed typo for one of the subcommands (linset -> linsert) --- plugins/redis-cli/_redis-cli | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/redis-cli/_redis-cli b/plugins/redis-cli/_redis-cli index 3789add18..1569f2916 100644 --- a/plugins/redis-cli/_redis-cli +++ b/plugins/redis-cli/_redis-cli @@ -51,7 +51,7 @@ _1st_arguments=( 'keys:find all keys matching the given pattern' 'lastsave:get the UNIX timestamp of the last successful save to disk' 'lindex:get an element from a list by its index' - 'linset:insert an element before or after another element in a list' + 'linsert:insert an element before or after another element in a list' 'llen:get the length of a list' 'lpop:remove and get the first element in a list' 'lpush:prepend a value to a list' From a38774c98d1c08f82b1325a40b2de1a76586e02a Mon Sep 17 00:00:00 2001 From: Christopher Sexton Date: Tue, 17 May 2011 14:13:07 -0400 Subject: [PATCH 169/184] C-x C-e to edit current command in EDITOR The command C-x C-e opens the current command line for editing in the editor defined by the $EDITOR environment variable. Thanks to Craig Bosma and his blog post about this: http://distrustsimplicity.net/articles/zsh-command-editing --- lib/edit-command-line.zsh | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 lib/edit-command-line.zsh diff --git a/lib/edit-command-line.zsh b/lib/edit-command-line.zsh new file mode 100644 index 000000000..db2000325 --- /dev/null +++ b/lib/edit-command-line.zsh @@ -0,0 +1,3 @@ +autoload -U edit-command-line +zle -N edit-command-line +bindkey '\C-x\C-e' edit-command-line From c09e2f2986aafbf2a67004f8df6b5dd10abb8d61 Mon Sep 17 00:00:00 2001 From: Paul Serby Date: Mon, 18 Jul 2011 16:05:05 +0100 Subject: [PATCH 170/184] Bringing inline with oh-my-zsh coding convensions --- plugins/cake/cake.plugin.zsh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/plugins/cake/cake.plugin.zsh b/plugins/cake/cake.plugin.zsh index 75997521a..f968c71d5 100644 --- a/plugins/cake/cake.plugin.zsh +++ b/plugins/cake/cake.plugin.zsh @@ -1,18 +1,18 @@ # Set this to 1 if you want to cache the tasks -cacheTaskList=1 +cache_task_list=1 # Cache filename -cacheFile='.cake-task-cache' +cache_file='.cake_task_cache' _cake_does_target_list_need_generating () { - if [ $cacheTaskList -eq 0 ]; then + if [ $cache_task_list -eq 0 ]; then return 1; fi - if [ ! -f $cacheFile ]; then return 0; + if [ ! -f $cache_file ]; then return 0; else - accurate=$(stat -f%m $cacheFile) + accurate=$(stat -f%m $cache_file) changed=$(stat -f%m Cakefile) return $(expr $accurate '>=' $changed) fi @@ -21,8 +21,8 @@ _cake_does_target_list_need_generating () { _cake () { if [ -f Cakefile ]; then if _cake_does_target_list_need_generating; then - cake | sed -e "s/cake \([^ ]*\) .*/\1/" | grep -v '^$' > $cacheFile - compadd `cat $cacheFile` + cake | sed -e "s/cake \([^ ]*\) .*/\1/" | grep -v '^$' > $cache_file + compadd `cat $cache_file` else compadd `cake | sed -e "s/cake \([^ ]*\) .*/\1/" | grep -v '^$'` fi From 8e77ad468dd22f25c461a0f69f9c03cbb2fb2d05 Mon Sep 17 00:00:00 2001 From: Benjamin Boudreau Date: Tue, 19 Jul 2011 19:38:29 -0700 Subject: [PATCH 171/184] Fix typo --- plugins/archlinux/archlinux.plugin.zsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/archlinux/archlinux.plugin.zsh b/plugins/archlinux/archlinux.plugin.zsh index acb8df057..8ed291fcf 100644 --- a/plugins/archlinux/archlinux.plugin.zsh +++ b/plugins/archlinux/archlinux.plugin.zsh @@ -46,7 +46,8 @@ alias pacmir='sudo pacman -Syy' # Force refresh of all package li paclist() { sudo pacman -Qei $(pacman -Qu|cut -d" " -f 1)|awk ' BEGIN {FS=":"}/^Name/{printf("\033[1;36m%s\033[1;37m", $2)}/^Description/{print $2}' } -alias paclsorhpans='sudo pacman -Qdt' + +alias paclsorphans='sudo pacman -Qdt' alias pacrmorphans='sudo pacman -Rs $(pacman -Qtdq)' pacdisowned() { From cbaa97d8c38bf7bc1a92480ae83e323e1e0cac02 Mon Sep 17 00:00:00 2001 From: Benjamin Boudreau Date: Sat, 23 Jul 2011 10:42:43 -0400 Subject: [PATCH 172/184] Add utility method to spectrum --- lib/spectrum.zsh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/spectrum.zsh b/lib/spectrum.zsh index 4006a7fe1..2fdf537ef 100644 --- a/lib/spectrum.zsh +++ b/lib/spectrum.zsh @@ -18,3 +18,11 @@ for color in {000..255}; do FG[$color]="%{[38;5;${color}m%}" BG[$color]="%{[48;5;${color}m%}" done + +# Show all 256 colors with color number +function spectrum_ls() { + for code in {000..255}; do + print -P -- "$code: %F{$code}Test%f" + done +} + From 512f3678c07accd6d121e9c0d6d50f008c99708a Mon Sep 17 00:00:00 2001 From: Benjamin Boudreau Date: Sat, 23 Jul 2011 11:22:39 -0400 Subject: [PATCH 173/184] Remove sudo when using yaourt + do not rely on abs when not in path - In archlinux plugin --- plugins/archlinux/archlinux.plugin.zsh | 42 +++++++++++++++----------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/plugins/archlinux/archlinux.plugin.zsh b/plugins/archlinux/archlinux.plugin.zsh index 8ed291fcf..b5e519036 100644 --- a/plugins/archlinux/archlinux.plugin.zsh +++ b/plugins/archlinux/archlinux.plugin.zsh @@ -1,26 +1,30 @@ -# Archlinux zsh aliases and functions for zsh - -# Aliases ################################################################### +# Archlinux zsh aliases and functions +# Usage is also described at https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins # Look for yaourt, and add some useful functions if we have it. if [[ -x `which yaourt` ]]; then upgrade () { - yaourt -Syu -C + yaourt -Syu } + alias yaconf='yaourt -C' # Fix all configuration files with vimdiff # Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips - alias yaupg='sudo yaourt -Syu' # Synchronize with repositories before upgrading packages that are out of date on the local system. - alias yain='sudo yaourt -S' # Install specific package(s) from the repositories - alias yains='sudo yaourt -U' # Install specific package not from the repositories but from a file - alias yare='sudo yaourt -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies - alias yarem='sudo yaourt -Rns' # Remove the specified package(s), its configuration(s) and unneeded dependencies - alias yarep='yaourt -Si' # Display information about a given package in the repositories - 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 yaupg='yaourt -Syu' # Synchronize with repositories before upgrading packages that are out of date on the local system. + 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 + alias yare='yaourt -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies + alias yarem='yaourt -Rns' # Remove the specified package(s), its configuration(s) and unneeded dependencies + alias yarep='yaourt -Si' # Display information about a given package in the repositories + 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 # Additional yaourt alias examples - alias yaupd='sudo yaourt -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories - alias yainsd='sudo yaourt -S --asdeps' # Install given package(s) as dependencies of another package - alias yamir='sudo yaourt -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist + if [[ -x `which abs` ]]; then + alias yaupd='yaourt -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories + else + alias yaupd='yaourt -Sy' # Update and refresh the local package and ABS databases against repositories + fi + alias yainsd='yaourt -S --asdeps' # Install given package(s) as dependencies of another package + alias yamir='yaourt -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist else upgrade() { sudo pacman -Syu @@ -38,7 +42,11 @@ alias pacreps='pacman -Ss' # Search for package(s) in the repositori alias pacloc='pacman -Qi' # Display information about a given package in the local database alias paclocs='pacman -Qs' # Search for package(s) in the local database # Additional pacman alias examples -alias pacupd='sudo pacman -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories +if [[ -x `which abs` ]]; then + alias pacupd='sudo pacman -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories +else + alias pacupd='sudo pacman -Sy' # Update and refresh the local package and ABS databases against repositories +fi alias pacinsd='sudo pacman -S --asdeps' # Install given package(s) as dependencies of another package alias pacmir='sudo pacman -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist From 34f00f385ce1b322ee7de48f30d175746bba94fc Mon Sep 17 00:00:00 2001 From: hobbestigrou Date: Mon, 11 Oct 2010 21:19:23 +0200 Subject: [PATCH 174/184] More generic. --- lib/misc.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/misc.zsh b/lib/misc.zsh index 4c1743657..88732e664 100644 --- a/lib/misc.zsh +++ b/lib/misc.zsh @@ -10,4 +10,4 @@ setopt long_list_jobs ## pager export PAGER=less -export LC_CTYPE=en_US.UTF-8 +export LC_CTYPE=$LANG From eb63ddf6bb119e3d0e62f012b2f9b5fe95e0d647 Mon Sep 17 00:00:00 2001 From: Sven Lito Date: Tue, 12 Oct 2010 20:02:04 +0100 Subject: [PATCH 175/184] added mac keybinding for backward-delete-char --- lib/key-bindings.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/key-bindings.zsh b/lib/key-bindings.zsh index 9f28d5761..9c2dda35a 100644 --- a/lib/key-bindings.zsh +++ b/lib/key-bindings.zsh @@ -21,6 +21,7 @@ bindkey ' ' magic-space # also do history expansion on space bindkey '^[[Z' reverse-menu-complete # Make the delete key (or Fn + Delete on the Mac) work instead of outputting a ~ +bindkey '^?' backward-delete-char bindkey "^[[3~" delete-char bindkey "^[3;5~" delete-char bindkey "\e[3~" delete-char From 6bb0c1c9269025867e886b76bcbf737e5a54400d Mon Sep 17 00:00:00 2001 From: Sven Lito Date: Mon, 11 Oct 2010 02:43:51 +0100 Subject: [PATCH 176/184] added git log with graph --- 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 bc340e86b..0c94cc99e 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -27,6 +27,8 @@ alias gcp='git cherry-pick' compdef _git gcp=git-cherry-pick 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 # Git and svn mix alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk' From 96b0af68242ec6235e4162f5e7e1f4d470cb2b22 Mon Sep 17 00:00:00 2001 From: Sven Lito Date: Sat, 9 Oct 2010 23:09:42 +0100 Subject: [PATCH 177/184] adding git svn aliases --- plugins/git/git.plugin.zsh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 0c94cc99e..3721d3343 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -34,6 +34,8 @@ compdef _git glgg=git-log alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk' compdef git-svn-dcommit-push=git +alias gsr='git svn rebase' +alias gsd='git svn dcommit' # # Will return the current branch name # Usage example: git pull origin $(current_branch) @@ -47,6 +49,10 @@ function current_branch() { alias ggpull='git pull origin $(current_branch)' compdef ggpull=git alias ggpush='git push origin $(current_branch)' +<<<<<<< HEAD compdef ggpush=git alias ggpnp='git pull origin $(current_branch) && git push origin $(current_branch)' compdef ggpnp=git +======= +alias ggpnp='git pull origin $(current_branch) && git push origin $(current_branch)' +>>>>>>> e5e032f... adding git svn aliases From 9e783c0a8e276e89d9d81951a4c32ea61dadccf1 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Sat, 23 Jul 2011 09:14:44 -0700 Subject: [PATCH 178/184] fixing issue with last commit merge. missed a conflict --- plugins/git/git.plugin.zsh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 3721d3343..5132b639a 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -49,10 +49,6 @@ function current_branch() { alias ggpull='git pull origin $(current_branch)' compdef ggpull=git alias ggpush='git push origin $(current_branch)' -<<<<<<< HEAD compdef ggpush=git alias ggpnp='git pull origin $(current_branch) && git push origin $(current_branch)' compdef ggpnp=git -======= -alias ggpnp='git pull origin $(current_branch) && git push origin $(current_branch)' ->>>>>>> e5e032f... adding git svn aliases From 3cb33fc254290a848a602af634cfa26179d630e5 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Mon, 25 Jul 2011 09:46:17 +1000 Subject: [PATCH 179/184] Replace a duplicated test to see if we're in an SVN folder with a call to the 'in_svn' function. --- plugins/svn/svn.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/svn/svn.plugin.zsh b/plugins/svn/svn.plugin.zsh index 86050227d..77de27481 100644 --- a/plugins/svn/svn.plugin.zsh +++ b/plugins/svn/svn.plugin.zsh @@ -1,5 +1,5 @@ function svn_prompt_info { - if [[ -d .svn ]]; then + if [ in_svn ]; then echo "$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_PREFIX\ $ZSH_THEME_REPO_NAME_COLOR$(svn_get_repo_name)$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_SUFFIX$ZSH_PROMPT_BASE_COLOR$(svn_dirty)$ZSH_PROMPT_BASE_COLOR" fi From 7b25a3fca90e31f2c272fd8d2ef1dfa3e61dc9e4 Mon Sep 17 00:00:00 2001 From: Andrew Smith Date: Mon, 25 Jul 2011 09:50:54 +1000 Subject: [PATCH 180/184] The original SVN pluging would mark a folder as dirty if there was an svn:external set and the output of 'svn status' returned the check for the external. E.g. $ svn st X Application Performing status on external item at 'Application' Shouldn't be marked as being dirty. By grepping for only the valid output for what should be class as dirty, it won't return false positives. --- plugins/svn/svn.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/svn/svn.plugin.zsh b/plugins/svn/svn.plugin.zsh index 77de27481..53a8a513a 100644 --- a/plugins/svn/svn.plugin.zsh +++ b/plugins/svn/svn.plugin.zsh @@ -28,7 +28,7 @@ function svn_get_rev_nr { function svn_dirty_choose { if [ in_svn ]; then - s=$(svn status 2>/dev/null) + s=$(svn status|grep -E '^\s*[ACDIM!?L]' 2>/dev/null) if [ $s ]; then echo $1 else From 6bf468f92c9302f84d3b21358202c3a956cad02b Mon Sep 17 00:00:00 2001 From: Shane Emmons Date: Mon, 25 Jul 2011 08:02:25 -0700 Subject: [PATCH 181/184] add alias for `bundle package` to the bundler plugin --- 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 e98bb4b46..f005700ff 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -2,6 +2,7 @@ alias be="bundle exec" alias bi="bundle install" alias bl="bundle list" alias bu="bundle update" +alias bp="bundle package" # The following is based on https://github.com/gma/bundler-exec From fd732eb3ff4984ddc9109e950cf7ceb472cb9824 Mon Sep 17 00:00:00 2001 From: "Suraj N. Kurapati" Date: Wed, 27 Jul 2011 10:28:55 -0700 Subject: [PATCH 182/184] move history-substring-search* files into plugins/ --- README => plugins/history-substring-search/README | 0 .../history-substring-search/history-substring-search.plugin.zsh | 0 .../history-substring-search/history-substring-search.zsh | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename README => plugins/history-substring-search/README (100%) rename history-substring-search.plugin.zsh => plugins/history-substring-search/history-substring-search.plugin.zsh (100%) rename history-substring-search.zsh => plugins/history-substring-search/history-substring-search.zsh (100%) diff --git a/README b/plugins/history-substring-search/README similarity index 100% rename from README rename to plugins/history-substring-search/README diff --git a/history-substring-search.plugin.zsh b/plugins/history-substring-search/history-substring-search.plugin.zsh similarity index 100% rename from history-substring-search.plugin.zsh rename to plugins/history-substring-search/history-substring-search.plugin.zsh diff --git a/history-substring-search.zsh b/plugins/history-substring-search/history-substring-search.zsh similarity index 100% rename from history-substring-search.zsh rename to plugins/history-substring-search/history-substring-search.zsh From d866662c4af4c6e6e661c59d2da8f60eabbfba1d Mon Sep 17 00:00:00 2001 From: Fredrik Wallgren Date: Sat, 30 Jul 2011 04:38:57 +0200 Subject: [PATCH 183/184] Add autocomplete for gas. Based on the rvm plugin. --- plugins/gas/_gas | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 plugins/gas/_gas diff --git a/plugins/gas/_gas b/plugins/gas/_gas new file mode 100644 index 000000000..069713fc6 --- /dev/null +++ b/plugins/gas/_gas @@ -0,0 +1,34 @@ +#compdef gas + +local curcontext="$curcontext" state line cmds ret=1 + +_arguments -C \ + '(- 1 *)'{-v,--version}'[display version information]' \ + '(-h|--help)'{-h,--help}'[show help information]' \ + '1: :->cmds' \ + '*: :->args' && ret=0 + +case $state in + cmds) + cmds=( + "version:Prints Gas's version" + "use:Uses author" + "show:Shows your current user" + "list:Lists your authors" + "import:Imports current user to gasconfig" + "help:Describe available tasks or one specific task" + "delete:Deletes author" + "add:Adds author to gasconfig" + ) + _describe -t commands 'gas command' cmds && ret=0 + ;; + args) + case $line[1] in + (use|delete) + _values -S , 'rubies' $(cat ~/.gas | sed -n -e 's/^\[\(.*\)\]/\1/p') && ret=0 + ;; + esac + ;; +esac + +return ret From c3412ca57d313a0a1419d26b5529f28de49285d0 Mon Sep 17 00:00:00 2001 From: Fredrik Wallgren Date: Sat, 30 Jul 2011 04:57:25 +0200 Subject: [PATCH 184/184] Replace forgotten rubies with authors --- plugins/gas/_gas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/gas/_gas b/plugins/gas/_gas index 069713fc6..befdc9459 100644 --- a/plugins/gas/_gas +++ b/plugins/gas/_gas @@ -25,7 +25,7 @@ case $state in args) case $line[1] in (use|delete) - _values -S , 'rubies' $(cat ~/.gas | sed -n -e 's/^\[\(.*\)\]/\1/p') && ret=0 + _values -S , 'authors' $(cat ~/.gas | sed -n -e 's/^\[\(.*\)\]/\1/p') && ret=0 ;; esac ;;