From f294eeb57175f5ef86f903d41c84ecacd96fe00c Mon Sep 17 00:00:00 2001 From: Roman Kamyk Date: Sat, 2 Oct 2010 19:49:16 +0200 Subject: [PATCH 01/68] added rkj theme - xion-chiamiov-plus + hg from thomasjbradley --- themes/rkj.zsh-theme | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 themes/rkj.zsh-theme diff --git a/themes/rkj.zsh-theme b/themes/rkj.zsh-theme new file mode 100644 index 000000000..fa950b255 --- /dev/null +++ b/themes/rkj.zsh-theme @@ -0,0 +1,15 @@ +# user, host, full path, and time/date +# on two lines for easier vgrepping +# entry in a nice long thread on the Arch Linux forums: http://bbs.archlinux.org/viewtopic.php?pid=521888#p521888 + +function hg_prompt_info { + hg prompt --angle-brackets "\ +%{$reset_color%}>\ +%{$reset_color%}>\ +%{$fg[green]%}%{$reset_color%}< +patches: >" 2>/dev/null +} + +PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%Y-%m-%d %I:%M:%S"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} +%{\e[0;34m%}%B└─%B[%{\e[1;35m%}$%{\e[0;34m%}%B] <$(git_prompt_info)$(hg_prompt_info)>%{\e[0m%}%b ' +PS2=$' \e[0;34m%}%B>%{\e[0m%}%b ' From 57e0b57434eb7f3b7d0fe0ca4849478477404e43 Mon Sep 17 00:00:00 2001 From: Roman Kamyk Date: Fri, 19 Nov 2010 20:25:19 +0100 Subject: [PATCH 02/68] changes --- themes/rkj.zsh-theme | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/themes/rkj.zsh-theme b/themes/rkj.zsh-theme index fa950b255..af178b2b9 100644 --- a/themes/rkj.zsh-theme +++ b/themes/rkj.zsh-theme @@ -6,10 +6,24 @@ function hg_prompt_info { hg prompt --angle-brackets "\ %{$reset_color%}>\ %{$reset_color%}>\ -%{$fg[green]%}%{$reset_color%}< +%{$fg[red]%}%{$reset_color%}< patches: >" 2>/dev/null } +ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[cyan]%}+" +ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[yellow]%}✱" +ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%}✗" +ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%}➦" +ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[magenta]%}✂" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[grey]%}✈" + +function mygit() { + ref=$(git symbolic-ref HEAD 2> /dev/null) || return + echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$( git_prompt_status )%{$reset_color%}$ZSH_THEME_GIT_PROMPT_SUFFIX" +} + PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%Y-%m-%d %I:%M:%S"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} -%{\e[0;34m%}%B└─%B[%{\e[1;35m%}$%{\e[0;34m%}%B] <$(git_prompt_info)$(hg_prompt_info)>%{\e[0m%}%b ' +%{\e[0;34m%}%B└─%B[%{\e[1;35m%}$%{\e[0;34m%}%B] <$(mygit)$(hg_prompt_info)>%{\e[0m%}%b ' PS2=$' \e[0;34m%}%B>%{\e[0m%}%b ' +RPROMPT='$(mygit)' + From 48ab2ad6e261fc30caa7fe17bd4d3435100c7f3d Mon Sep 17 00:00:00 2001 From: Roman Kamyk Date: Tue, 22 Feb 2011 09:53:02 +0100 Subject: [PATCH 03/68] no hg & git status (sloooow) --- themes/rkj.zsh-theme | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/themes/rkj.zsh-theme b/themes/rkj.zsh-theme index af178b2b9..4b49a2a09 100644 --- a/themes/rkj.zsh-theme +++ b/themes/rkj.zsh-theme @@ -23,7 +23,9 @@ function mygit() { } PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%Y-%m-%d %I:%M:%S"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} -%{\e[0;34m%}%B└─%B[%{\e[1;35m%}$%{\e[0;34m%}%B] <$(mygit)$(hg_prompt_info)>%{\e[0m%}%b ' +%{\e[0;34m%}%B└─%B[%{\e[1;35m%}$%{\e[0;34m%}%B]%{\e[0m%}%b ' +#PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%Y-%m-%d %I:%M:%S"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} +#%{\e[0;34m%}%B└─%B[%{\e[1;35m%}$%{\e[0;34m%}%B] <$(mygit)$(hg_prompt_info)>%{\e[0m%}%b ' PS2=$' \e[0;34m%}%B>%{\e[0m%}%b ' -RPROMPT='$(mygit)' +#RPROMPT='$(mygit)' From 4144f4beea4e56231adeb3574d3516b35c3331cf Mon Sep 17 00:00:00 2001 From: Christopher Chow Date: Wed, 23 Feb 2011 03:05:25 +1100 Subject: [PATCH 04/68] Add tab completion to bundler plugin. --- plugins/bundler/_bundler | 82 ++++++++++++++++++++++++++++++ plugins/bundler/bundler.plugin.zsh | 4 ++ 2 files changed, 86 insertions(+) create mode 100644 plugins/bundler/_bundler diff --git a/plugins/bundler/_bundler b/plugins/bundler/_bundler new file mode 100644 index 000000000..5d22cac9a --- /dev/null +++ b/plugins/bundler/_bundler @@ -0,0 +1,82 @@ +#compdef bundle + +local curcontext="$curcontext" state line _gems _opts ret=1 + +_arguments -C -A "-v" -A "--version" \ + '(- 1 *)'{-v,--version}'[display version information]' \ + '1: :->cmds' \ + '*:: :->args' && ret=0 + +case $state in + cmds) + _values "bundle command" \ + "install[Install the gems specified by the Gemfile or Gemfile.lock]" \ + "update[Update dependencies to their latest versions]" \ + "package[Package the .gem files required by your application]" \ + "exec[Execute a script in the context of the current bundle]" \ + "config[Specify and read configuration options for bundler]" \ + "check[Determine whether the requirements for your application are installed]" \ + "list[Show all of the gems in the current bundle]" \ + "show[Show the source location of a particular gem in the bundle]" \ + "console[Start an IRB session in the context of the current bundle]" \ + "open[Open an installed gem in the editor]" \ + "viz[Generate a visual representation of your dependencies]" \ + "init[Generate a simple Gemfile, placed in the current directory]" \ + "gem[Create a simple gem, suitable for development with bundler]" \ + "help[Describe available tasks or one specific task]" + ret=0 + ;; + args) + case $line[1] in + help) + _values 'commands' \ + 'install' \ + 'update' \ + 'package' \ + 'exec' \ + 'config' \ + 'check' \ + 'list' \ + 'show' \ + 'console' \ + 'open' \ + 'viz' \ + 'init' \ + 'gem' \ + 'help' && ret=0 + ;; + install) + _arguments \ + '(--no-color)--no-color[disable colorization in output]' \ + '(--local)--local[do not attempt to connect to rubygems.org]' \ + '(--quiet)--quiet[only output warnings and errors]' \ + '(--gemfile)--gemfile=-[use the specified gemfile instead of Gemfile]:gemfile' \ + '(--system)--system[install to the system location]' \ + '(--deployment)--deployment[install using defaults tuned for deployment environments]' \ + '(--frozen)--frozen[do not allow the Gemfile.lock to be updated after this install]' \ + '(--path)--path=-[specify a different path than the system default]:path:_files' \ + '(--binstubs)--binstubs=-[generate bin stubs for bundled gems to ./bin]:directory:_files' \ + '(--without)--without=-[exclude gems that are part of the specified named group]:groups' + ret=0 + ;; + exec) + _normal && ret=0 + ;; + (open|show) + _gems=( $(bundle show 2> /dev/null | sed -e '/^ \*/!d; s/^ \* \([^ ]*\) .*/\1/') ) + if [[ $_gems != "" ]]; then + _values 'gems' $_gems && ret=0 + fi + ;; + *) + _opts=( $(bundle help $line[1] | sed -e '/^ \[-/!d; s/^ \[\(-[^=]*\)=.*/\1/') ) + _opts+=( $(bundle help $line[1] | sed -e '/^ -/!d; s/^ \(-.\), \[\(-[^=]*\)=.*/\1 \2/') ) + if [[ $_opts != "" ]]; then + _values 'options' $_opts && ret=0 + fi + ;; + esac + ;; +esac + +return ret diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index fb40e2cec..caa2f6771 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -1,3 +1,7 @@ +fpath=($ZSH/plugins/bundler $fpath) +autoload -U compinit +compinit -i + alias be="bundle exec" alias bi="bundle install" alias bu="bundle update" From fadd5f74ce205ddb14735354170150745ae42ca6 Mon Sep 17 00:00:00 2001 From: Stephen Eley Date: Tue, 22 Feb 2011 14:03:48 -0500 Subject: [PATCH 05/68] Crunch theme (by Stephen Eley) --- themes/crunch.zsh-theme | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 themes/crunch.zsh-theme diff --git a/themes/crunch.zsh-theme b/themes/crunch.zsh-theme new file mode 100644 index 000000000..7dd5816ee --- /dev/null +++ b/themes/crunch.zsh-theme @@ -0,0 +1,37 @@ +# CRUNCH - created from Steve Eley's cat waxing. +# Initially hacked from the Dallas theme. Thanks, Dallas Reedy. +# +# This theme assumes you do most of your oh-my-zsh'ed "colorful" work at a single machine, +# and eschews the standard space-consuming user and hostname info. Instead, only the +# things that vary in my own workflow are shown: +# +# * The time (not the date) +# * The RVM version (omitting the interpreter name if it's just 'ruby') +# * The current directory +# * The Git branch and its 'dirty' state +# +# Colors are at the top so you can mess with those separately if you like. +# For the most part I stuck with Dallas's. + +CRUNCH_BRACKET_COLOR="%{$fg[white]%}" +CRUNCH_TIME_COLOR="%{$fg[yellow]%}" +CRUNCH_RVM_COLOR="%{$fg[magenta]%}" +CRUNCH_DIR_COLOR="%{$fg[cyan]%}" +CRUNCH_GIT_BRANCH_COLOR="%{$fg[green]%}" +CRUNCH_GIT_CLEAN_COLOR="%{$fg[green]%}" +CRUNCH_GIT_DIRTY_COLOR="%{$fg[red]%}" + +# These Git variables are used by the oh-my-zsh git_prompt_info helper: +ZSH_THEME_GIT_PROMPT_PREFIX="$CRUNCH_BRACKET_COLOR:$CRUNCH_GIT_BRANCH_COLOR" +ZSH_THEME_GIT_PROMPT_SUFFIX="" +ZSH_THEME_GIT_PROMPT_CLEAN=" $CRUNCH_GIT_CLEAN_COLOR✓" +ZSH_THEME_GIT_PROMPT_DIRTY=" $CRUNCH_GIT_DIRTY_COLOR✗" + +# Our elements: +CRUNCH_TIME_="$CRUNCH_BRACKET_COLOR{$CRUNCH_TIME_COLOR%T$CRUNCH_BRACKET_COLOR}%{$reset_color%}" +CRUNCH_RVM_="$CRUNCH_BRACKET_COLOR"["$CRUNCH_RVM_COLOR\$(~/.rvm/bin/rvm-prompt v g)$CRUNCH_BRACKET_COLOR"]"%{$reset_color%}" +CRUNCH_DIR_="$CRUNCH_DIR_COLOR%~\$(git_prompt_info) " +CRUNCH_PROMPT="$CRUNCH_BRACKET_COLOR➭ " + +# Put it all together! +PROMPT="$CRUNCH_TIME_$CRUNCH_RVM_$CRUNCH_DIR_$CRUNCH_PROMPT%{$reset_color%}" From d926a55872b5a12ab8b987e9d86c02358d0c825e Mon Sep 17 00:00:00 2001 From: Stephen Eley Date: Tue, 22 Feb 2011 14:38:37 -0500 Subject: [PATCH 06/68] Refined RVM prompt in Crunch theme --- themes/crunch.zsh-theme | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/crunch.zsh-theme b/themes/crunch.zsh-theme index 7dd5816ee..2473cd230 100644 --- a/themes/crunch.zsh-theme +++ b/themes/crunch.zsh-theme @@ -6,7 +6,7 @@ # things that vary in my own workflow are shown: # # * The time (not the date) -# * The RVM version (omitting the interpreter name if it's just 'ruby') +# * The RVM version and gemset (omitting the 'ruby' name if it's MRI) # * The current directory # * The Git branch and its 'dirty' state # @@ -29,7 +29,7 @@ ZSH_THEME_GIT_PROMPT_DIRTY=" $CRUNCH_GIT_DIRTY_COLOR✗" # Our elements: CRUNCH_TIME_="$CRUNCH_BRACKET_COLOR{$CRUNCH_TIME_COLOR%T$CRUNCH_BRACKET_COLOR}%{$reset_color%}" -CRUNCH_RVM_="$CRUNCH_BRACKET_COLOR"["$CRUNCH_RVM_COLOR\$(~/.rvm/bin/rvm-prompt v g)$CRUNCH_BRACKET_COLOR"]"%{$reset_color%}" +CRUNCH_RVM_="$CRUNCH_BRACKET_COLOR"["$CRUNCH_RVM_COLOR\${\$(~/.rvm/bin/rvm-prompt i v g)#ruby-}$CRUNCH_BRACKET_COLOR"]"%{$reset_color%}" CRUNCH_DIR_="$CRUNCH_DIR_COLOR%~\$(git_prompt_info) " CRUNCH_PROMPT="$CRUNCH_BRACKET_COLOR➭ " From 911837c48fc6387daa341b3cc5be21b1b1cade57 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Wed, 13 Apr 2011 00:30:45 +0200 Subject: [PATCH 07/68] github plugin: check for `ruby`. I've run into the issue where a stripped down container had no Ruby installed, which caused `hub` to fail. Therefore I've added an extra check to verify that `ruby` is in the commands list before setting up this alias/function. --- plugins/github/github.plugin.zsh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/plugins/github/github.plugin.zsh b/plugins/github/github.plugin.zsh index 8d4580654..18fff1755 100644 --- a/plugins/github/github.plugin.zsh +++ b/plugins/github/github.plugin.zsh @@ -1,6 +1,5 @@ -# hub alias from defunkt -# https://github.com/defunkt/hub -if [ "$commands[(I)hub]" ]; then +# Setup hub function for git, if it is available; http://github.com/defunkt/hub +if [ "$commands[(I)hub]" ] && [ "$commands[(I)ruby]" ]; then # eval `hub alias -s zsh` function git(){hub "$@"} fi From 14a1877311bd0a9cf9c4db0e44e55da0fba77c5c Mon Sep 17 00:00:00 2001 From: Tristan Carel Date: Wed, 13 Apr 2011 16:48:47 +0200 Subject: [PATCH 08/68] New plugin git-svn installing git project git-svn-clone-externals --- plugins/git-svn/.gitignore | 1 + plugins/git-svn/git-svn.plugin.zsh | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 plugins/git-svn/.gitignore create mode 100644 plugins/git-svn/git-svn.plugin.zsh diff --git a/plugins/git-svn/.gitignore b/plugins/git-svn/.gitignore new file mode 100644 index 000000000..bf5e1a14f --- /dev/null +++ b/plugins/git-svn/.gitignore @@ -0,0 +1 @@ +git-svn-clone-externals diff --git a/plugins/git-svn/git-svn.plugin.zsh b/plugins/git-svn/git-svn.plugin.zsh new file mode 100644 index 000000000..062d63e05 --- /dev/null +++ b/plugins/git-svn/git-svn.plugin.zsh @@ -0,0 +1,10 @@ + +if ! [ -d "$ZSH/plugins/git-svn/git-svn-clone-externals" ] ;then + git clone https://github.com/andrep/git-svn-clone-externals.git +fi +export PATH="$ZSH/plugins/git-svn/git-svn-clone-externals:$PATH" + +function git_svn_update { + (cd "$ZSH/plugins/git-svn/git-svn-clone-externals" && \ + git pull origin master) +} From d6c150decca10ba2a3566fe1dc1144f7e37f1c5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Di=C3=B3genes?= Date: Wed, 13 Apr 2011 11:55:24 -0300 Subject: [PATCH 09/68] adding python plugin with some aliases --- plugins/python/python.plugin.zsh | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 plugins/python/python.plugin.zsh diff --git a/plugins/python/python.plugin.zsh b/plugins/python/python.plugin.zsh new file mode 100644 index 000000000..fde54fa88 --- /dev/null +++ b/plugins/python/python.plugin.zsh @@ -0,0 +1,5 @@ +# Find python file +alias pyfind='find . -name "*.py"' + +# Remove python compiled byte-code +alias pycrm='rm `find . | grep -E "*.(pyc|pyo)$"`' From ca4dabb45e14d8cd38e07c4ffadf9473ceb2193b Mon Sep 17 00:00:00 2001 From: Tristan Carel Date: Wed, 13 Apr 2011 17:23:25 +0200 Subject: [PATCH 10/68] New tool require_tool.sh --- tools/require_tool.sh | 161 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 161 insertions(+) create mode 100755 tools/require_tool.sh diff --git a/tools/require_tool.sh b/tools/require_tool.sh new file mode 100755 index 000000000..42da2ccf9 --- /dev/null +++ b/tools/require_tool.sh @@ -0,0 +1,161 @@ +__require_tool_version_compare () +{ + ( + # Locally ignore failures, otherwise we'll exit whenever $1 and $2 + # are not equal! + set +e + +awk_strverscmp=' + # Use only awk features that work with 7th edition Unix awk (1978). + # My, what an old awk you have, Mr. Solaris! + END { + while (length(v1) || length(v2)) { + # Set d1 to be the next thing to compare from v1, and likewise for d2. + # Normally this is a single character, but if v1 and v2 contain digits, + # compare them as integers and fractions as strverscmp does. + if (v1 ~ /^[0-9]/ && v2 ~ /^[0-9]/) { + # Split v1 and v2 into their leading digit string components d1 and d2, + # and advance v1 and v2 past the leading digit strings. + for (len1 = 1; substr(v1, len1 + 1) ~ /^[0-9]/; len1++) continue + for (len2 = 1; substr(v2, len2 + 1) ~ /^[0-9]/; len2++) continue + d1 = substr(v1, 1, len1); v1 = substr(v1, len1 + 1) + d2 = substr(v2, 1, len2); v2 = substr(v2, len2 + 1) + if (d1 ~ /^0/) { + if (d2 ~ /^0/) { + # Compare two fractions. + while (d1 ~ /^0/ && d2 ~ /^0/) { + d1 = substr(d1, 2); len1-- + d2 = substr(d2, 2); len2-- + } + if (len1 != len2 && ! (len1 && len2 && substr(d1, 1, 1) == substr(d2, 1, 1))) { + # The two components differ in length, and the common prefix + # contains only leading zeros. Consider the longer to be less. + d1 = -len1 + d2 = -len2 + } else { + # Otherwise, compare as strings. + d1 = "x" d1 + d2 = "x" d2 + } + } else { + # A fraction is less than an integer. + exit 1 + } + } else { + if (d2 ~ /^0/) { + # An integer is greater than a fraction. + exit 2 + } else { + # Compare two integers. + d1 += 0 + d2 += 0 + } + } + } else { + # The normal case, without worrying about digits. + if (v1 == "") d1 = v1; else { d1 = substr(v1, 1, 1); v1 = substr(v1,2) } + if (v2 == "") d2 = v2; else { d2 = substr(v2, 1, 1); v2 = substr(v2,2) } + } + if (d1 < d2) exit 1 + if (d1 > d2) exit 2 + } + } +' + awk "$awk_strverscmp" v1="$1" v2="$2" /dev/null + case $? in + 1) echo '<';; + 0) echo '=';; + 2) echo '>';; + esac + ) +} + + +__require_tool_fatal () +{ + echo $@ >/dev/stderr + return 1 +} + +# Usage: require_tool program version +# Returns: 0 if $1 version if greater equals than $2, 1 otherwise. +# In case of error, message is written on error output. +# +# Example: require_tool gcc 4.6 +# Use GCC environment variable if defined instead of lookup for the tool +# in the environment. +require_tool () +{ + envvar_name=$(echo $1 | tr '[:lower:]' '[:upper:]') + tool=$(printenv $envvar_name || echo $1) + local version=$($tool --version 2>/dev/null| \ + sed -n 's/.*[^0-9.]\([0-9][0-9.]*\).*/\1/p;q') + if test x"$version" = x ; then + echo "$tool is required" >/dev/stderr + return 1 + fi + case $(__require_tool_version_compare "$2" "$version") in + '>') + echo "$1 $2 or better is required: this is $tool $version" >/dev/stderr + return 1 + ;; + esac +} + +usage() { + cat < Date: Wed, 13 Apr 2011 17:24:44 +0200 Subject: [PATCH 11/68] Fix version parsing. Now working with command $ zsh --version --- tools/require_tool.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/require_tool.sh b/tools/require_tool.sh index 42da2ccf9..1fa77f77a 100755 --- a/tools/require_tool.sh +++ b/tools/require_tool.sh @@ -89,7 +89,7 @@ require_tool () envvar_name=$(echo $1 | tr '[:lower:]' '[:upper:]') tool=$(printenv $envvar_name || echo $1) local version=$($tool --version 2>/dev/null| \ - sed -n 's/.*[^0-9.]\([0-9][0-9.]*\).*/\1/p;q') + sed -n 's/.*[^0-9.]\([0-9]*\.[0-9.]*\).*/\1/p;q') if test x"$version" = x ; then echo "$tool is required" >/dev/stderr return 1 From 2fba4486bfa63cf2a4a11a34c94ce123127ef4c9 Mon Sep 17 00:00:00 2001 From: Tristan Carel Date: Wed, 13 Apr 2011 17:34:51 +0200 Subject: [PATCH 12/68] Add new plugin emacs, to take benefit of daemon capabilities of emacs >=23 --- plugins/emacs/emacs.plugin.zsh | 11 +++++++++++ plugins/emacs/emacsclient.sh | 10 ++++++++++ 2 files changed, 21 insertions(+) create mode 100644 plugins/emacs/emacs.plugin.zsh create mode 100755 plugins/emacs/emacsclient.sh diff --git a/plugins/emacs/emacs.plugin.zsh b/plugins/emacs/emacs.plugin.zsh new file mode 100644 index 000000000..bca79e70e --- /dev/null +++ b/plugins/emacs/emacs.plugin.zsh @@ -0,0 +1,11 @@ +# Use daemon capabilities of emacs 23 +if "$ZSH/tools/require_tool.sh" emacs 23 2>/dev/null ; then + export EDITOR="$ZSH/plugins/emacs/emacsclient.sh" + alias emacs="$EDITOR --no-wait" + alias e=emacs + + alias emasc=emacs + alias emcas=emacs + # create a new X frame + alias emacs_frame='emacsclient --alternate-editor "" --create-frame' +fi diff --git a/plugins/emacs/emacsclient.sh b/plugins/emacs/emacsclient.sh new file mode 100755 index 000000000..3475926a6 --- /dev/null +++ b/plugins/emacs/emacsclient.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +# Starts emacs daemon if not already started. + +x=`emacsclient --alternate-editor '' --eval '(x-display-list)' 2>/dev/null` +if [ -z "$x" ] ;then + emacsclient --alternate-editor "" --create-frame $@ +else + emacsclient --alternate-editor "" $@ +fi From df0b37f9db3f8a1d445bebf30d04039eb247ab71 Mon Sep 17 00:00:00 2001 From: Tristan Carel Date: Wed, 13 Apr 2011 17:45:04 +0200 Subject: [PATCH 13/68] Merge branch 'master'; commit 'ca4dabb45e14d8cd38e07c4ffadf9473ceb2193b' into require_tool From 0c032aaf81afcb134668a462a9ea028e6fc64eeb Mon Sep 17 00:00:00 2001 From: Tristan Carel Date: Wed, 13 Apr 2011 17:46:36 +0200 Subject: [PATCH 14/68] Removing master stuff --- plugins/emacs/emacs.plugin.zsh | 11 ----------- plugins/emacs/emacsclient.sh | 10 ---------- plugins/git-svn/.gitignore | 1 - plugins/git-svn/git-svn.plugin.zsh | 10 ---------- 4 files changed, 32 deletions(-) delete mode 100644 plugins/emacs/emacs.plugin.zsh delete mode 100755 plugins/emacs/emacsclient.sh delete mode 100644 plugins/git-svn/.gitignore delete mode 100644 plugins/git-svn/git-svn.plugin.zsh diff --git a/plugins/emacs/emacs.plugin.zsh b/plugins/emacs/emacs.plugin.zsh deleted file mode 100644 index bca79e70e..000000000 --- a/plugins/emacs/emacs.plugin.zsh +++ /dev/null @@ -1,11 +0,0 @@ -# Use daemon capabilities of emacs 23 -if "$ZSH/tools/require_tool.sh" emacs 23 2>/dev/null ; then - export EDITOR="$ZSH/plugins/emacs/emacsclient.sh" - alias emacs="$EDITOR --no-wait" - alias e=emacs - - alias emasc=emacs - alias emcas=emacs - # create a new X frame - alias emacs_frame='emacsclient --alternate-editor "" --create-frame' -fi diff --git a/plugins/emacs/emacsclient.sh b/plugins/emacs/emacsclient.sh deleted file mode 100755 index 3475926a6..000000000 --- a/plugins/emacs/emacsclient.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -# Starts emacs daemon if not already started. - -x=`emacsclient --alternate-editor '' --eval '(x-display-list)' 2>/dev/null` -if [ -z "$x" ] ;then - emacsclient --alternate-editor "" --create-frame $@ -else - emacsclient --alternate-editor "" $@ -fi diff --git a/plugins/git-svn/.gitignore b/plugins/git-svn/.gitignore deleted file mode 100644 index bf5e1a14f..000000000 --- a/plugins/git-svn/.gitignore +++ /dev/null @@ -1 +0,0 @@ -git-svn-clone-externals diff --git a/plugins/git-svn/git-svn.plugin.zsh b/plugins/git-svn/git-svn.plugin.zsh deleted file mode 100644 index 062d63e05..000000000 --- a/plugins/git-svn/git-svn.plugin.zsh +++ /dev/null @@ -1,10 +0,0 @@ - -if ! [ -d "$ZSH/plugins/git-svn/git-svn-clone-externals" ] ;then - git clone https://github.com/andrep/git-svn-clone-externals.git -fi -export PATH="$ZSH/plugins/git-svn/git-svn-clone-externals:$PATH" - -function git_svn_update { - (cd "$ZSH/plugins/git-svn/git-svn-clone-externals" && \ - git pull origin master) -} From b2d5b4365019a466fb8481598de87159704ded7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Di=C3=B3genes?= Date: Thu, 14 Apr 2011 12:15:26 -0300 Subject: [PATCH 15/68] refactored pycrm command --- plugins/python/python.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/python/python.plugin.zsh b/plugins/python/python.plugin.zsh index fde54fa88..3ea34d718 100644 --- a/plugins/python/python.plugin.zsh +++ b/plugins/python/python.plugin.zsh @@ -2,4 +2,4 @@ alias pyfind='find . -name "*.py"' # Remove python compiled byte-code -alias pycrm='rm `find . | grep -E "*.(pyc|pyo)$"`' +alias pyclean='find . -type f -name "*.py[co]" -exec rm -f \{\} \;' From e199e1dae8f43e3de3bfd59696226497a7c3c3d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jurri=C3=ABn=20Stutterheim?= Date: Sun, 15 May 2011 15:02:46 +0200 Subject: [PATCH 16/68] Add norm theme --- themes/norm.zsh-theme | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 themes/norm.zsh-theme diff --git a/themes/norm.zsh-theme b/themes/norm.zsh-theme new file mode 100644 index 000000000..933fad2ad --- /dev/null +++ b/themes/norm.zsh-theme @@ -0,0 +1,4 @@ +PROMPT='%{$fg[yellow]%}λ %{$fg[green]%}${PWD/#$HOME/~} %{$fg[yellow]%}→ $(git_prompt_info)%{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX="λ %{$fg[blue]%}git %{$fg[red]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$fg[yellow]%} → %{$reset_color%}" From 8454542ddc33c4907bb864054b9adb0cf61d9002 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jurri=C3=ABn=20Stutterheim?= Date: Fri, 20 May 2011 13:21:04 +0200 Subject: [PATCH 17/68] Update, no more full path --- themes/norm.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/norm.zsh-theme b/themes/norm.zsh-theme index 933fad2ad..5f0ad03ee 100644 --- a/themes/norm.zsh-theme +++ b/themes/norm.zsh-theme @@ -1,4 +1,4 @@ -PROMPT='%{$fg[yellow]%}λ %{$fg[green]%}${PWD/#$HOME/~} %{$fg[yellow]%}→ $(git_prompt_info)%{$reset_color%}' +PROMPT='%{$fg[yellow]%}λ %{$fg[green]%}%c %{$fg[yellow]%}→ $(git_prompt_info)%{$reset_color%}' ZSH_THEME_GIT_PROMPT_PREFIX="λ %{$fg[blue]%}git %{$fg[red]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$fg[yellow]%} → %{$reset_color%}" From 5aa6b0fae5f1fa82c90003c2020849b4bb87c9e8 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sun, 1 May 2011 11:46:11 -0400 Subject: [PATCH 18/68] Replaced npm 0.x completion with 1.0 completion. --- plugins/npm/_npm | 19 ------------------- plugins/npm/npm.plugin.zsh | 1 + 2 files changed, 1 insertion(+), 19 deletions(-) delete mode 100644 plugins/npm/_npm create mode 100644 plugins/npm/npm.plugin.zsh diff --git a/plugins/npm/_npm b/plugins/npm/_npm deleted file mode 100644 index 24b536188..000000000 --- a/plugins/npm/_npm +++ /dev/null @@ -1,19 +0,0 @@ -#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..c3eb91d31 --- /dev/null +++ b/plugins/npm/npm.plugin.zsh @@ -0,0 +1 @@ +eval "$(npm completion 2>/dev/null)" From bf86502b6940d938c488254befdf9461cb50591b Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 3 Feb 2011 17:25:45 -0500 Subject: [PATCH 19/68] Added gnu-utils plugin. --- plugins/gnu-utils/gnu-utils.plugin.zsh | 80 ++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 plugins/gnu-utils/gnu-utils.plugin.zsh diff --git a/plugins/gnu-utils/gnu-utils.plugin.zsh b/plugins/gnu-utils/gnu-utils.plugin.zsh new file mode 100644 index 000000000..e59265d66 --- /dev/null +++ b/plugins/gnu-utils/gnu-utils.plugin.zsh @@ -0,0 +1,80 @@ +# ------------------------------------------------------------------------------ +# FILE: gnu-utils.plugin.zsh +# DESCRIPTION: oh-my-zsh plugin file. +# AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com) +# VERSION: 1.0.0 +# ------------------------------------------------------------------------------ + + +if [[ -x "${commands[gwhoami]}" ]]; then + __gnu_utils() { + emulate -L zsh + local gcmds + local gcmd + local cmd + local prefix + + # coreutils + gcmds=('g[' 'gbase64' 'gbasename' 'gcat' 'gchcon' 'gchgrp' 'gchmod' + 'gchown' 'gchroot' 'gcksum' 'gcomm' 'gcp' 'gcsplit' 'gcut' 'gdate' + 'gdd' 'gdf' 'gdir' 'gdircolors' 'gdirname' 'gdu' 'gecho' 'genv' 'gexpand' + 'gexpr' 'gfactor' 'gfalse' 'gfmt' 'gfold' 'ggroups' 'ghead' 'ghostid' + 'gid' 'ginstall' 'gjoin' 'gkill' 'glink' 'gln' 'glogname' 'gls' 'gmd5sum' + 'gmkdir' 'gmkfifo' 'gmknod' 'gmktemp' 'gmv' 'gnice' 'gnl' 'gnohup' 'gnproc' + 'god' 'gpaste' 'gpathchk' 'gpinky' 'gpr' 'gprintenv' 'gprintf' 'gptx' 'gpwd' + 'greadlink' 'grm' 'grmdir' 'gruncon' 'gseq' 'gsha1sum' 'gsha224sum' + 'gsha256sum' 'gsha384sum' 'gsha512sum' 'gshred' 'gshuf' 'gsleep' 'gsort' + 'gsplit' 'gstat' 'gstty' 'gsum' 'gsync' 'gtac' 'gtail' 'gtee' 'gtest' + 'gtimeout' 'gtouch' 'gtr' 'gtrue' 'gtruncate' 'gtsort' 'gtty' 'guname' + 'gunexpand' 'guniq' 'gunlink' 'guptime' 'gusers' 'gvdir' 'gwc' 'gwho' + 'gwhoami' 'gyes') + + # Not part of coreutils, installed separately. + gcmds+=('gsed' 'gtar' 'gtime') + + for gcmd in "${gcmds[@]}"; do + # + # This method allows for builtin commands to be primary but it's + # lost if hash -r or rehash -f is executed. Thus, those two + # functions have to be wrapped. + # + (( ${+commands[$gcmd]} )) && hash ${gcmd[2,-1]}=${commands[$gcmd]} + + # + # This method generates wrapper functions. + # It will override shell builtins. + # + # (( ${+commands[$gcmd]} )) && \ + # eval "function $gcmd[2,-1]() { \"${prefix}/${gcmd//"["/"\\["}\" \"\$@\"; }" + + # + # This method is inflexible since the aliases are at risk of being + # overriden resulting in the BSD coreutils being called. + # + # (( ${+commands[$gcmd]} )) && \ + # alias "$gcmd[2,-1]"="${prefix}/${gcmd//"["/"\\["}" + done + + return 0 + } + __gnu_utils; + + function hash() { + if [[ "$*" =~ "-(r|f)" ]]; then + builtin hash "$@" + __gnu_utils + else + builtin hash "$@" + fi + } + + function rehash() { + if [[ "$*" =~ "-f" ]]; then + builtin rehash "$@" + __gnu_utils + else + builtin rehash "$@" + fi + } +fi + From 5444d2088c97dc776dcbd17acf55dd54b9d7060a Mon Sep 17 00:00:00 2001 From: thunfischbrot Date: Sun, 5 Jun 2011 15:19:46 -0700 Subject: [PATCH 20/68] Included some essential aliases, inspired by http://lolcode.com/ --- plugins/lol/lol.plugin.zsh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/plugins/lol/lol.plugin.zsh b/plugins/lol/lol.plugin.zsh index a7153bb57..e455527e7 100644 --- a/plugins/lol/lol.plugin.zsh +++ b/plugins/lol/lol.plugin.zsh @@ -8,19 +8,30 @@ alias rtfm='man' alias visible='echo' alias invisible='cat' alias moar='more' +alias tldr='less' +alias alwayz='tail -f' alias icanhas='mkdir' +alias gimmeh='touch' alias donotwant='rm' alias dowant='cp' alias gtfo='mv' +alias nowai='chmod' alias hai='cd' +alias iz='ls' alias plz='pwd' +alias ihasbucket='df -h' alias inur='locate' +alias iminurbase='finger' + +alias btw='nice' +alias obtw='nohup' alias nomz='ps -aux' alias nomnom='killall' +alias byes='exit' alias cya='reboot' alias kthxbai='halt' From 55eda0c48b42e3ccd1b12579cd46d20332b828c1 Mon Sep 17 00:00:00 2001 From: ptrv Date: Fri, 10 Jun 2011 15:38:59 +0200 Subject: [PATCH 21/68] Added mercurial plugin with aliases. --- plugins/mercurial/mercurial.plugin.zsh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 plugins/mercurial/mercurial.plugin.zsh diff --git a/plugins/mercurial/mercurial.plugin.zsh b/plugins/mercurial/mercurial.plugin.zsh new file mode 100644 index 000000000..2988f0a46 --- /dev/null +++ b/plugins/mercurial/mercurial.plugin.zsh @@ -0,0 +1,14 @@ + +# Mercurial +alias hgc='hg commit -v' +alias hgb='hg branch -v' +alias hgba='hg branches' +alias hgco='hg checkout' +alias hgd='hg diff' +alias hged='hg diffmerge' +# pull and update +alias hgl='hg pull -u -v' +alias hgp='hg push -v' +alias hgs='hg status -v' +# this is the 'git commit --amend' equivalent +alias hgca='hg qimport -r tip ; hg qrefresh -e ; hg qfinish tip' From 929c64e4c6f53e926757b7d9d89ab7da4f9a0d0d Mon Sep 17 00:00:00 2001 From: Max Gonzih Date: Tue, 21 Jun 2011 12:09:57 +0300 Subject: [PATCH 22/68] Create gnzh theme --- themes/gnzh.zsh-theme | 47 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 themes/gnzh.zsh-theme diff --git a/themes/gnzh.zsh-theme b/themes/gnzh.zsh-theme new file mode 100644 index 000000000..a984d25fa --- /dev/null +++ b/themes/gnzh.zsh-theme @@ -0,0 +1,47 @@ +# ZSH Theme - Preview: http://dl.dropbox.com/u/4109351/pics/gnzh-zsh-theme.png +# Based on bira theme + +# load some modules +autoload -U colors zsh/terminfo # Used in the colour alias below +colors +setopt prompt_subst + +# make some aliases for the colours: (coud use normal escap.seq's too) +for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do + eval PR_$color='%{$fg[${(L)color}]%}' +done +eval PR_NO_COLOR="%{$terminfo[sgr0]%}" +eval PR_BOLD="%{$terminfo[bold]%}" + +# Check the UID +if [[ $UID -ge 1000 ]]; then # normal user + eval PR_USER='${PR_GREEN}%n${PR_NO_COLOR}' + eval PR_USER_OP='${PR_GREEN}%#${PR_NO_COLOR}' + local PR_PROMPT='$PR_NO_COLOR➤ $PR_NO_COLOR' +elif [[ $UID -eq 0 ]]; then # root + eval PR_USER='${PR_RED}%n${PR_NO_COLOR}' + eval PR_USER_OP='${PR_RED}%#${PR_NO_COLOR}' + local PR_PROMPT='$PR_RED➤ $PR_NO_COLOR' +fi + +# Check if we are on SSH or not +if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then + eval PR_HOST='${PR_YELLOW}%M${PR_NO_COLOR}' #SSH +else + eval PR_HOST='${PR_GREEN}%M${PR_NO_COLOR}' # no SSH +fi + +local return_code="%(?..%{$PR_RED%}%? ↵%{$PR_NO_COLOR%})" + +local user_host='${PR_USER}${PR_CYAN}@${PR_HOST}' +local current_dir='%{$PR_BOLD$PR_BLUE%}%~%{$PR_NO_COLOR%}' +local rvm_ruby='%{$PR_RED%}‹$(rvm-prompt i v g s)›%{$PR_NO_COLOR%}' +local git_branch='$(git_prompt_info)%{$PR_NO_COLOR%}' + +#PROMPT="${user_host} ${current_dir} ${rvm_ruby} ${git_branch}$PR_PROMPT " +PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch} +╰─$PR_PROMPT " +RPS1="${return_code}" + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$PR_YELLOW%}‹" +ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$PR_NO_COLOR%}" From a335e9df9f13a5caa2b83cad9ebcfaa25b748202 Mon Sep 17 00:00:00 2001 From: Max Gonzih Date: Tue, 21 Jun 2011 13:50:39 +0300 Subject: [PATCH 23/68] plugin for vundle (vim plugins managment system) that provide vundle, vundle-update and vundle-init aliases --- plugins/vundle/vundle.plugin.zsh | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 plugins/vundle/vundle.plugin.zsh diff --git a/plugins/vundle/vundle.plugin.zsh b/plugins/vundle/vundle.plugin.zsh new file mode 100644 index 000000000..7caed4715 --- /dev/null +++ b/plugins/vundle/vundle.plugin.zsh @@ -0,0 +1,3 @@ +alias vundle-init='git clone http://github.com/gmarik/vundle.git ~/.vim/bundle/vundle' +alias vundle='vim -c "execute \"BundleInstall\" | q"' +alias vundle-update='vim -c "execute \"BundleInstall!\" | q"' From 7ef7ffc5ebd21bff4ab8e42989c63ba8204c0e5b Mon Sep 17 00:00:00 2001 From: Max Gonzih Date: Tue, 21 Jun 2011 14:53:11 +0300 Subject: [PATCH 24/68] removing useless line --- themes/gnzh.zsh-theme | 1 - 1 file changed, 1 deletion(-) diff --git a/themes/gnzh.zsh-theme b/themes/gnzh.zsh-theme index a984d25fa..357798cf6 100644 --- a/themes/gnzh.zsh-theme +++ b/themes/gnzh.zsh-theme @@ -38,7 +38,6 @@ local current_dir='%{$PR_BOLD$PR_BLUE%}%~%{$PR_NO_COLOR%}' local rvm_ruby='%{$PR_RED%}‹$(rvm-prompt i v g s)›%{$PR_NO_COLOR%}' local git_branch='$(git_prompt_info)%{$PR_NO_COLOR%}' -#PROMPT="${user_host} ${current_dir} ${rvm_ruby} ${git_branch}$PR_PROMPT " PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch} ╰─$PR_PROMPT " RPS1="${return_code}" From 499819ced108aa4b0d90dd0ac922a174c965d814 Mon Sep 17 00:00:00 2001 From: Max Gonzih Date: Wed, 29 Jun 2011 10:26:42 +0300 Subject: [PATCH 25/68] vundle plugin refactored first it checks existens of vundle plugin, if plugin dont exist run git clone --- plugins/vundle/vundle.plugin.zsh | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/plugins/vundle/vundle.plugin.zsh b/plugins/vundle/vundle.plugin.zsh index 7caed4715..39c36ac59 100644 --- a/plugins/vundle/vundle.plugin.zsh +++ b/plugins/vundle/vundle.plugin.zsh @@ -1,3 +1,22 @@ -alias vundle-init='git clone http://github.com/gmarik/vundle.git ~/.vim/bundle/vundle' -alias vundle='vim -c "execute \"BundleInstall\" | q"' -alias vundle-update='vim -c "execute \"BundleInstall!\" | q"' +function vundle-init () { + if [ ! -d ~/.vim/bundle/vundle/ ] + then + mkdir -p ~/.vim/bundle/vundle/ + fi + + if [ ! -d ~/.vim/bundle/vundle/.git/ ] + then + git clone http://github.com/gmarik/vundle.git ~/.vim/bundle/vundle + fi +} + +function vundle () { + vundle-init + vim -c "execute \"BundleInstall\" | q" +} + + +function vundle-update () { + vundle-init + vim -c "execute \"BundleInstall!\" | q" +} From 053cb24d3160d69cb6c9579a3f154f45a72f065c Mon Sep 17 00:00:00 2001 From: Max Gonzih Date: Thu, 30 Jun 2011 11:45:24 +0300 Subject: [PATCH 26/68] added tip about vundle configutarion after git clone --- plugins/vundle/vundle.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/vundle/vundle.plugin.zsh b/plugins/vundle/vundle.plugin.zsh index 39c36ac59..1e2e1f088 100644 --- a/plugins/vundle/vundle.plugin.zsh +++ b/plugins/vundle/vundle.plugin.zsh @@ -7,6 +7,7 @@ function vundle-init () { if [ ! -d ~/.vim/bundle/vundle/.git/ ] then git clone http://github.com/gmarik/vundle.git ~/.vim/bundle/vundle + echo "\n\tRead about vim configuration for vundle at https://github.com/gmarik/vundle\n" fi } From fea4e54b1053764df10f507c233286281133fe90 Mon Sep 17 00:00:00 2001 From: fox Date: Tue, 19 Jul 2011 21:47:26 +0200 Subject: [PATCH 27/68] added theme chooser --- tools/theme_chooser.sh | 47 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100755 tools/theme_chooser.sh diff --git a/tools/theme_chooser.sh b/tools/theme_chooser.sh new file mode 100755 index 000000000..2413bfee8 --- /dev/null +++ b/tools/theme_chooser.sh @@ -0,0 +1,47 @@ +#!/bin/sh + +# Zsh Theme Chooser by fox (fox91 at anche dot no) +# This program is free software. It comes without any warranty, to +# the extent permitted by applicable law. You can redistribute it +# and/or modify it under the terms of the Do What The Fuck You Want +# To Public License, Version 2, as published by Sam Hocevar. See +# http://sam.zoy.org/wtfpl/COPYING for more details. + +THEMES_DIR="$ZSH/themes" +FAVLIST="~/.zsh_favlist" + +function noyes() { + read -p "$1 [y/N]" a + if [[ $a == "N" || $a == "n" || $a = "" ]]; then + return 0 + fi + return 1 +} + +function theme_preview() { + THEME=$1 + export ZDOTDIR="$(mktemp -d)" + +cat <<-EOF >"$ZDOTDIR/.zshrc" + source ~/.zshrc + source "$THEMES_DIR/$THEME" +EOF + zsh + rm -rf "$ZDOTDIR" + + echo + noyes "Do you want to add it to your favourite list?" && \ + echo $THEME >> $FAVLIST + echo +} + +echo +echo "╺━┓┏━┓╻ ╻ ╺┳╸╻ ╻┏━╸┏┳┓┏━╸ ┏━╸╻ ╻┏━┓┏━┓┏━┓┏━╸┏━┓" +echo "┏━┛┗━┓┣━┫ ┃ ┣━┫┣╸ ┃┃┃┣╸ ┃ ┣━┫┃ ┃┃ ┃┗━┓┣╸ ┣┳┛" +echo "┗━╸┗━┛╹ ╹ ╹ ╹ ╹┗━╸╹ ╹┗━╸ ┗━╸╹ ╹┗━┛┗━┛┗━┛┗━╸╹┗╸" +echo + +for i in $(ls $THEMES_DIR); do + echo "Now showing theme $i" + theme_preview $i +done From 5d5d2f94be7a13c3a5069bed6bfc2070fa7f014c Mon Sep 17 00:00:00 2001 From: fox Date: Tue, 19 Jul 2011 22:02:34 +0200 Subject: [PATCH 28/68] fox's theme + theme chooser fixes --- themes/fox.zsh-theme | 8 ++++++++ tools/theme_chooser.sh | 6 +++--- 2 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 themes/fox.zsh-theme diff --git a/themes/fox.zsh-theme b/themes/fox.zsh-theme new file mode 100644 index 000000000..1959853cf --- /dev/null +++ b/themes/fox.zsh-theme @@ -0,0 +1,8 @@ +#fox theme +PROMPT='%{$fg[cyan]%}┌[%{$fg_bold[white]%}%n%{$reset_color%}%{$fg[cyan]%}☮%{$fg_bold[white]%}%M%{$reset_color%}%{$fg[cyan]%}]%{$fg[white]%}-%{$fg[cyan]%}(%{$fg_bold[white]%}%~%{$reset_color%}%{$fg[cyan]%})$(git_prompt_info) +└> % %{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX="-[%{$reset_color%}%{$fg[white]%}git://%{$fg_bold[white]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}%{$fg[cyan]%}]-" +ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}✗%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN=" %{$fg[green]%}✔%{$reset_color%}" diff --git a/tools/theme_chooser.sh b/tools/theme_chooser.sh index 2413bfee8..50f80f092 100755 --- a/tools/theme_chooser.sh +++ b/tools/theme_chooser.sh @@ -8,10 +8,10 @@ # http://sam.zoy.org/wtfpl/COPYING for more details. THEMES_DIR="$ZSH/themes" -FAVLIST="~/.zsh_favlist" +FAVLIST="${HOME}/.zsh_favlist" function noyes() { - read -p "$1 [y/N]" a + read -p "$1 [y/N] " a if [[ $a == "N" || $a == "n" || $a = "" ]]; then return 0 fi @@ -30,7 +30,7 @@ EOF rm -rf "$ZDOTDIR" echo - noyes "Do you want to add it to your favourite list?" && \ + noyes "Do you want to add it to your favourite list ($FAVLIST)?" || \ echo $THEME >> $FAVLIST echo } From 428f18cf428fd86bd6e99c4363e5f25d0e392506 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Yhuel?= Date: Sat, 23 Jul 2011 23:09:03 +0200 Subject: [PATCH 29/68] Add key bindings for gnome-terminal on Fedora --- lib/key-bindings.zsh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/key-bindings.zsh b/lib/key-bindings.zsh index 9c2dda35a..5c1b90bfa 100644 --- a/lib/key-bindings.zsh +++ b/lib/key-bindings.zsh @@ -14,10 +14,15 @@ bindkey '^[[B' down-line-or-search bindkey "^[[H" beginning-of-line bindkey "^[[1~" beginning-of-line +bindkey "^[OH" beginning-of-line bindkey "^[[F" end-of-line bindkey "^[[4~" end-of-line +bindkey "^[OF" end-of-line bindkey ' ' magic-space # also do history expansion on space +bindkey "^[[1;5C" forward-word +bindkey "^[[1;5D" backward-word + bindkey '^[[Z' reverse-menu-complete # Make the delete key (or Fn + Delete on the Mac) work instead of outputting a ~ From 76dd2d8b05cb1b8d34653732e8b3939f68e8a67a Mon Sep 17 00:00:00 2001 From: fox Date: Sun, 24 Jul 2011 11:58:41 +0200 Subject: [PATCH 30/68] mac os fix --- tools/theme_chooser.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/theme_chooser.sh b/tools/theme_chooser.sh index 50f80f092..af861a15b 100755 --- a/tools/theme_chooser.sh +++ b/tools/theme_chooser.sh @@ -20,7 +20,7 @@ function noyes() { function theme_preview() { THEME=$1 - export ZDOTDIR="$(mktemp -d)" + export ZDOTDIR="$(mktemp -d tmp.zshXXXX)" cat <<-EOF >"$ZDOTDIR/.zshrc" source ~/.zshrc From d15d3a5b01a527d8642cc0b173a2f8d1b92332c0 Mon Sep 17 00:00:00 2001 From: fox Date: Sun, 24 Jul 2011 20:51:27 +0200 Subject: [PATCH 31/68] global zsh config --- tools/theme_chooser.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/theme_chooser.sh b/tools/theme_chooser.sh index af861a15b..ea5191afe 100755 --- a/tools/theme_chooser.sh +++ b/tools/theme_chooser.sh @@ -20,18 +20,19 @@ function noyes() { function theme_preview() { THEME=$1 + THEME_NAME=`echo $THEME | sed s/\.zsh-theme//` export ZDOTDIR="$(mktemp -d tmp.zshXXXX)" cat <<-EOF >"$ZDOTDIR/.zshrc" - source ~/.zshrc - source "$THEMES_DIR/$THEME" + ZSH_THEME="$THEME_NAME" + source $ZSH/oh-my-zsh.sh EOF zsh rm -rf "$ZDOTDIR" echo noyes "Do you want to add it to your favourite list ($FAVLIST)?" || \ - echo $THEME >> $FAVLIST + echo $THEME_NAME >> $FAVLIST echo } From f35bfd9c4b2a3924975b936d2ca946dbca48c51f Mon Sep 17 00:00:00 2001 From: Max Masnick Date: Fri, 29 Jul 2011 15:17:22 -0400 Subject: [PATCH 32/68] Add fino.zsh-theme Add my brand new oh-my-zsh theme called Fino. It borrows from some other themes (see comments at the beginning). I only have/can tested on OS X 10.7, so there might be some compatibility problems with other platforms. --- themes/fino.zsh-theme | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 themes/fino.zsh-theme diff --git a/themes/fino.zsh-theme b/themes/fino.zsh-theme new file mode 100644 index 000000000..17cf59708 --- /dev/null +++ b/themes/fino.zsh-theme @@ -0,0 +1,39 @@ +# Fino theme by Max Masnick (http://max.masnick.me) + +# Use with a dark background and 256-color terminal! +# Meant for people with RVM and git. Tested only on OS X 10.7. + +# You can set your computer name in the ~/.box-name file if you want. + +# Borrowing shamelessly from these oh-my-zsh themes: +# bira +# robbyrussell +# +# Also borrowing from http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/ + +function virtualenv_info { + [ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') ' +} + +function prompt_char { + git branch >/dev/null 2>/dev/null && echo '±' && return + echo '○' +} + +function box_name { + [ -f ~/.box-name ] && cat ~/.box-name || hostname -s +} + + +local rvm_ruby='‹$(rvm-prompt i v g)›%{$reset_color%}' +local current_dir='${PWD/#$HOME/~}' +local git_info='$(git_prompt_info)' + + +PROMPT="╭─%{$FG[040]%}%n%{$reset_color%} %{$FG[239]%}at%{$reset_color%} %{$FG[033]%}$(box_name)%{$reset_color%} %{$FG[239]%}in%{$reset_color%} %{$terminfo[bold]$FG[226]%}${current_dir}%{$reset_color%}${git_info} %{$FG[239]%}using%{$FG[243]%} ${rvm_ruby} +╰─$(virtualenv_info)$(prompt_char) " + +ZSH_THEME_GIT_PROMPT_PREFIX=" %{$FG[239]%}on%{$reset_color%} %{$fg[255]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$FG[202]%}✘✘✘" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$FG[040]%}✔" \ No newline at end of file From cbf662744ffcf998829cabbd7b2550861c13d1d8 Mon Sep 17 00:00:00 2001 From: fox Date: Wed, 3 Aug 2011 09:42:16 +0200 Subject: [PATCH 33/68] fixed theme chooser + options + list available themes + show all themes --- tools/theme_chooser.sh | 90 ++++++++++++++++++++++++++++++++---------- 1 file changed, 69 insertions(+), 21 deletions(-) diff --git a/tools/theme_chooser.sh b/tools/theme_chooser.sh index ea5191afe..4d7047444 100755 --- a/tools/theme_chooser.sh +++ b/tools/theme_chooser.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/zsh # Zsh Theme Chooser by fox (fox91 at anche dot no) # This program is free software. It comes without any warranty, to @@ -9,9 +9,10 @@ THEMES_DIR="$ZSH/themes" FAVLIST="${HOME}/.zsh_favlist" +source $ZSH/oh-my-zsh.sh function noyes() { - read -p "$1 [y/N] " a + read "a?$1 [y/N] " if [[ $a == "N" || $a == "n" || $a = "" ]]; then return 0 fi @@ -20,29 +21,76 @@ function noyes() { function theme_preview() { THEME=$1 - THEME_NAME=`echo $THEME | sed s/\.zsh-theme//` - export ZDOTDIR="$(mktemp -d tmp.zshXXXX)" - -cat <<-EOF >"$ZDOTDIR/.zshrc" - ZSH_THEME="$THEME_NAME" - source $ZSH/oh-my-zsh.sh -EOF - zsh - rm -rf "$ZDOTDIR" + THEME_NAME=`echo $THEME | sed s/\.zsh-theme$//` + print "$fg[blue]${(l.((${COLUMNS}-${#THEME_NAME}-5))..─.)}$reset_color $THEME_NAME $fg[blue]───$reset_color" + source "$THEMES_DIR/$THEME" + print -P $PROMPT +} +function banner() { echo - noyes "Do you want to add it to your favourite list ($FAVLIST)?" || \ - echo $THEME_NAME >> $FAVLIST + echo "╺━┓┏━┓╻ ╻ ╺┳╸╻ ╻┏━╸┏┳┓┏━╸ ┏━╸╻ ╻┏━┓┏━┓┏━┓┏━╸┏━┓" + echo "┏━┛┗━┓┣━┫ ┃ ┣━┫┣╸ ┃┃┃┣╸ ┃ ┣━┫┃ ┃┃ ┃┗━┓┣╸ ┣┳┛" + echo "┗━╸┗━┛╹ ╹ ╹ ╹ ╹┗━╸╹ ╹┗━╸ ┗━╸╹ ╹┗━┛┗━┛┗━┛┗━╸╹┗╸" echo } -echo -echo "╺━┓┏━┓╻ ╻ ╺┳╸╻ ╻┏━╸┏┳┓┏━╸ ┏━╸╻ ╻┏━┓┏━┓┏━┓┏━╸┏━┓" -echo "┏━┛┗━┓┣━┫ ┃ ┣━┫┣╸ ┃┃┃┣╸ ┃ ┣━┫┃ ┃┃ ┃┗━┓┣╸ ┣┳┛" -echo "┗━╸┗━┛╹ ╹ ╹ ╹ ╹┗━╸╹ ╹┗━╸ ┗━╸╹ ╹┗━┛┗━┛┗━┛┗━╸╹┗╸" -echo +function usage() { + echo "Usage: $0 [options] [theme]" + echo + echo "Options" + echo " -l List available themes" + echo " -s Show all themes" + echo " -h Get this help message" + exit 1 +} -for i in $(ls $THEMES_DIR); do - echo "Now showing theme $i" - theme_preview $i +function list_themes() { + for THEME in $(ls $THEMES_DIR); do + THEME_NAME=`echo $THEME | sed s/\.zsh-theme$//` + echo $THEME_NAME + done +} + +function insert_favlist() { + if grep -q "$THEME_NAME" $FAVLIST 2> /dev/null ; then + echo "Already in favlist" + else + echo $THEME_NAME >> $FAVLIST + echo "Saved to favlist" + fi + +} + +function theme_chooser() { + for THEME in $(ls $THEMES_DIR); do + echo + theme_preview $THEME + echo + if [[ -z $1 ]]; then + noyes "Do you want to add it to your favourite list ($FAVLIST)?" || \ + insert_favlist $THEME_NAME + echo + fi + done +} + +while getopts ":lhs" Option +do + case $Option in + l ) list_themes ;; + s ) theme_chooser 0 ;; + h ) usage ;; + * ) usage ;; # Default. + esac done + +if [[ -z $Option ]]; then + if [[ -z $1 ]]; then + banner + echo + theme_chooser + else + theme_preview $1".zsh-theme" + fi +fi From 3780247f633d99b6870e39ea77c540ebb5125095 Mon Sep 17 00:00:00 2001 From: Sune Kibsgaard Pedersen Date: Thu, 4 Aug 2011 12:37:33 +0200 Subject: [PATCH 34/68] added option of setting another path to custom plugins and files just set ZSH_CUSTOM in your .zshrc, if not set oh-my-zsh.sh will use the default custom dir in the repository --- oh-my-zsh.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index c4522491b..3865abe17 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -21,17 +21,24 @@ for plugin ($plugins) fpath=($ZSH/plugins/$plugin $fpath) autoload -U compinit compinit -i +# Set ZSH_CUSTOM to the path where your custom config files +# and plugins exists, or else we will use the default custom/ +if [ "$ZSH_CUSTOM" = "" ] +then + ZSH_CUSTOM="$ZSH/custom" +fi + # Load all of the plugins that were defined in ~/.zshrc for plugin ($plugins); do - if [ -f $ZSH/custom/plugins/$plugin/$plugin.plugin.zsh ]; then - source $ZSH/custom/plugins/$plugin/$plugin.plugin.zsh + 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 # Load all of your custom configurations from custom/ -for config_file ($ZSH/custom/*.zsh) source $config_file +for config_file ($ZSH_CUSTOM/*.zsh) source $config_file # Load the theme if [ "$ZSH_THEME" = "random" ] From 749feb2720948a4ac9a981286654962e699d8d94 Mon Sep 17 00:00:00 2001 From: Daniel Bolton Date: Sat, 6 Aug 2011 15:22:55 -0400 Subject: [PATCH 35/68] Merge "deb" and "debian" plugins. --- plugins/deb/deb.plugin.zsh | 13 ------------- plugins/debian/debian.plugin.zsh | 30 +++++++++++++++++++++++++++--- 2 files changed, 27 insertions(+), 16 deletions(-) delete mode 100644 plugins/deb/deb.plugin.zsh diff --git a/plugins/deb/deb.plugin.zsh b/plugins/deb/deb.plugin.zsh deleted file mode 100644 index 1b35a0646..000000000 --- a/plugins/deb/deb.plugin.zsh +++ /dev/null @@ -1,13 +0,0 @@ -# Aliases -alias as="aptitude -F \"* %p -> %d \n(%v/%V)\" \ - --no-gui --disable-columns search" # search package -alias ad="sudo apt-get update" # update packages lists -alias au="sudo apt-get update && \ - sudo apt-get dselect-upgrade" # upgrade packages -alias ai="sudo apt-get install" # install package -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 diff --git a/plugins/debian/debian.plugin.zsh b/plugins/debian/debian.plugin.zsh index f8865a412..6feb6973d 100644 --- a/plugins/debian/debian.plugin.zsh +++ b/plugins/debian/debian.plugin.zsh @@ -1,4 +1,4 @@ -# https://github.com/dbbolton/ +# https://github.com/dbb/ # # Debian-related zsh aliases and functions for zsh @@ -6,14 +6,29 @@ # Aliases ################################################################### # Some self-explanatory aliases +alias acs="apt-cache search" alias afs='apt-file search --regexp' alias aps='aptitude search' +alias as="aptitude -F \"* %p -> %d \n(%v/%V)\" \ + --no-gui --disable-columns search" # search package alias apsrc='apt-get source' alias apv='apt-cache policy' +# aliases that use su -c ############## alias apdg='su -c "aptitude update && aptitude safe-upgrade"' alias apud='su -c "aptitude update"' alias apug='su -c "aptitude safe-upgrade"' +# end aliases that use su -c ########## + +# aliases that use sudo ############### +alias ad="sudo apt-get update" # update packages lists +alias au="sudo apt-get update && \ + sudo apt-get dselect-upgrade" # upgrade packages +alias ai="sudo apt-get install" # install package +alias ar="sudo apt-get remove --purge && \ + sudo apt-get autoremove --purge" # remove package +alias ac="sudo apt-get clean && sudo apt-get autoclean" # clean apt cache +# end aliases that use sudo ########### # print all installed packages alias allpkgs='aptitude search -F "%p" --disable-columns ~i' @@ -33,6 +48,13 @@ alias kclean='su -c '\''aptitude remove -P ?and(~i~nlinux-(ima|hea) ?not(~n`unam # Functions ################################################################# +# install packages without sudo +apin() { + cmd="su -lc 'aptitude -P install $@' root" + print "$cmd" + eval "$cmd" +} + # create a simple script that can be used to 'duplicate' a system apt-copy() { print '#!/bin/sh'"\n" > apt-copy.sh @@ -46,8 +68,10 @@ apt-copy() { # Kernel-package building shortcut -dbb-build () { - MAKEFLAGS='' # temporarily unset MAKEFLAGS ( '-j3' will fail ) +kerndeb () { + # temporarily unset MAKEFLAGS ( '-j3' will fail ) + MAKEFLAGS=$( print - $MAKEFLAGS | perl -pe 's/-j\s*[\d]+//g' ) + print '$MAKEFLAGS set to '"'$MAKEFLAGS'" appendage='-custom' # this shows up in $ (uname -r ) revision=$(date +"%Y%m%d") # this shows up in the .deb file name From fd55d53eb22856883953bb6efc89bb2d643ef296 Mon Sep 17 00:00:00 2001 From: Daniel Bolton Date: Sat, 6 Aug 2011 15:41:52 -0400 Subject: [PATCH 36/68] Fix su commands --- plugins/debian/debian.plugin.zsh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/plugins/debian/debian.plugin.zsh b/plugins/debian/debian.plugin.zsh index 6feb6973d..0c487cf70 100644 --- a/plugins/debian/debian.plugin.zsh +++ b/plugins/debian/debian.plugin.zsh @@ -15,9 +15,9 @@ alias apsrc='apt-get source' alias apv='apt-cache policy' # aliases that use su -c ############## -alias apdg='su -c "aptitude update && aptitude safe-upgrade"' -alias apud='su -c "aptitude update"' -alias apug='su -c "aptitude safe-upgrade"' +alias apdg='su -lc "aptitude update && aptitude safe-upgrade" root' +alias apud='su -lc "aptitude update" root' +alias apug='su -lc "aptitude safe-upgrade" root' # end aliases that use su -c ########## # aliases that use sudo ############### @@ -36,13 +36,13 @@ alias allpkgs='aptitude search -F "%p" --disable-columns ~i' # Install all .deb files in the current directory. # Warning: you will need to put the glob in single quotes if you use: # glob_subst -alias di='su -c "dpkg -i ./*.deb"' +alias di='su -lc "dpkg -i ./*.deb" root' # Create a basic .deb package alias mydeb='time dpkg-buildpackage -rfakeroot -us -uc' # Remove ALL kernel images and headers EXCEPT the one in use -alias kclean='su -c '\''aptitude remove -P ?and(~i~nlinux-(ima|hea) ?not(~n`uname -r`))'\'' root' +alias kclean='su -lc '\''aptitude remove -P ?and(~i~nlinux-(ima|hea) ?not(~n`uname -r`))'\'' root' @@ -81,4 +81,3 @@ kerndeb () { "$revision" kernel_image kernel_headers } - From 8ed6dd5fc4c5e9b28d0f8a87f72c0bbe5f628580 Mon Sep 17 00:00:00 2001 From: Daniel Bolton Date: Sat, 6 Aug 2011 15:58:40 -0400 Subject: [PATCH 37/68] Add functions for new GH repos. --- plugins/github/github.plugin.zsh | 41 ++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/plugins/github/github.plugin.zsh b/plugins/github/github.plugin.zsh index 1eb338113..e5f59097d 100644 --- a/plugins/github/github.plugin.zsh +++ b/plugins/github/github.plugin.zsh @@ -4,3 +4,44 @@ if [ "$commands[(I)hub]" ]; then # eval `hub alias -s zsh` function git(){hub "$@"} fi + +# Functions ################################################################# + +# https://github.com/dbb + +# These are taken directly from the instructions you see after you create a new +# repo. As the names imply, new_gh() assumes you're starting from scratch in a +# directory named after the repo (this name is the only argument it takes), and +# exist_gh() assumes that you've already initialized git in the given directory +# (again, the only argument). +# set up a new repo + +new_gh() { # [NAME_OF_REPO] + repo = $1 + + name=$( igit config user.name ) + email=$( git config user.email ) + user=$( git config github.user ) + + mkdir "$repo" + cd "$repo" + git init + touch README + git add README + git commit -m 'Initial commit.' + git remote add origin git@github.com:${user}/${name}.git + git push -u origin master +} + +exist_gh() { # [DIRECTORY] + cd "$1" + name=$( git config user.name ) + email=$( git config user.email ) + user=$( git config github.user ) + + git remote add origin git@github.com:${user}/${name}.git + git push -u origin master +} + +# End Functions ############################################################# + From 8c48f10a04ce8e6c789cead457e062602cc89931 Mon Sep 17 00:00:00 2001 From: Daniel Bolton Date: Sat, 6 Aug 2011 16:15:09 -0400 Subject: [PATCH 38/68] Add functions for new GH repos. --- plugins/github/github.plugin.zsh | 44 +++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/plugins/github/github.plugin.zsh b/plugins/github/github.plugin.zsh index e5f59097d..fc51b173c 100644 --- a/plugins/github/github.plugin.zsh +++ b/plugins/github/github.plugin.zsh @@ -9,19 +9,13 @@ fi # https://github.com/dbb -# These are taken directly from the instructions you see after you create a new -# repo. As the names imply, new_gh() assumes you're starting from scratch in a -# directory named after the repo (this name is the only argument it takes), and -# exist_gh() assumes that you've already initialized git in the given directory -# (again, the only argument). -# set up a new repo -new_gh() { # [NAME_OF_REPO] +# empty_gh [NAME_OF_REPO] +# +# Use this when creating a new repo from scratch. +empty_gh() { # [NAME_OF_REPO] repo = $1 - - name=$( igit config user.name ) - email=$( git config user.email ) - user=$( git config github.user ) + ghuser=$( git config github.user ) mkdir "$repo" cd "$repo" @@ -29,17 +23,37 @@ new_gh() { # [NAME_OF_REPO] touch README git add README git commit -m 'Initial commit.' - git remote add origin git@github.com:${user}/${name}.git + git remote add origin git@github.com:${ghuser}/${repo}.git git push -u origin master } +# new_gh [DIRECTORY] +# +# Use this when you have a directory that is not yet set up for git. +# This function will add all non-hidden files to git. +new_gh() { # [DIRECTORY] + cd "$1" + ghuser=$( git config github.user ) + + git init + # add all non-dot files + print '.*'"\n"'*~' >> .gitignore + git add ^.* + git commit -m 'Initial commit.' + git remote add origin git@github.com:${ghuser}/${repo}.git + git push -u origin master +} + +# exist_gh [DIRECTORY] +# +# Use this when you have a git repo that's ready to go and you want to add it +# to your GitHub. exist_gh() { # [DIRECTORY] cd "$1" name=$( git config user.name ) - email=$( git config user.email ) - user=$( git config github.user ) + ghuser=$( git config github.user ) - git remote add origin git@github.com:${user}/${name}.git + git remote add origin git@github.com:${ghuser}/${repo}.git git push -u origin master } From fac74012f81fc99eb2ba7a85e94a2cd74c352271 Mon Sep 17 00:00:00 2001 From: Daniel Bolton Date: Sun, 7 Aug 2011 15:30:55 -0400 Subject: [PATCH 39/68] Add options for su(do) and apt(itude|-get) --- plugins/debian/debian.plugin.zsh | 76 ++++++++++++++++++++++---------- 1 file changed, 52 insertions(+), 24 deletions(-) diff --git a/plugins/debian/debian.plugin.zsh b/plugins/debian/debian.plugin.zsh index 0c487cf70..1df91dc4a 100644 --- a/plugins/debian/debian.plugin.zsh +++ b/plugins/debian/debian.plugin.zsh @@ -1,48 +1,76 @@ -# https://github.com/dbb/ +# Authors: +# https://github.com/AlexBio +# https://github.com/dbb # # Debian-related zsh aliases and functions for zsh +# Set to 'apt-get' or 'aptitude' +apt_pref='aptitude' + +# Use sudo by default if it's installed +if [[ -e $( which sudo ) ]]; then + use_sudo=1 +fi # Aliases ################################################################### # Some self-explanatory aliases alias acs="apt-cache search" -alias afs='apt-file search --regexp' alias aps='aptitude search' alias as="aptitude -F \"* %p -> %d \n(%v/%V)\" \ --no-gui --disable-columns search" # search package -alias apsrc='apt-get source' -alias apv='apt-cache policy' -# aliases that use su -c ############## -alias apdg='su -lc "aptitude update && aptitude safe-upgrade" root' -alias apud='su -lc "aptitude update" root' -alias apug='su -lc "aptitude safe-upgrade" root' -# end aliases that use su -c ########## +# apt-file +alias afs='apt-file search --regexp' + + +# These are apt-get only +alias asrc='apt-get source' +alias ap='apt-cache policy' + +# superuser operations ################ +if [[ $use_sudo -eq 1 ]]; then + alias ai="sudo $apt_pref install" + alias ad="sudo $apt_pref update" + alias afu='sudo apt-file update' + alias ag="sudo $apt_pref upgrade" + alias adg="sudo $apt_pref update && sudo $apt_pref upgrade" + alias ap="sudo $apt_pref purge" + alias ar="sudo $apt_pref remove" + + if [[ $apt_pref -eq 'apt-get' ]]; then + alias ads="sudo $apt_pref dselect-upgrade" + fi + + # Install all .deb files in the current directory. + # Warning: you will need to put the glob in single quotes if you use: + # glob_subst + alias di='sudo dpkg -i ./*.deb' + + # Remove ALL kernel images and headers EXCEPT the one in use + alias kclean='sudo aptitude remove -P ?and(~i~nlinux-(ima|hea) ?not(~n`uname -r`))' +else + alias ai='apin' + alias ad='su -lc "'"$apt_pref"' update" root' + alias afu='su -lc "apt-file update"' + alias ag='su -lc "'"$apt_pref"' safe-upgrade" root' + alias adg='su -lc "'"$apt_pref"' update && aptitude safe-upgrade" root' + alias di='su -lc "dpkg -i ./*.deb" root' + # Remove ALL kernel images and headers EXCEPT the one in use + alias kclean='su -lc '\''aptitude remove -P ?and(~i~nlinux-(ima|hea) ?not(~n`uname -r`))'\'' root' +fi +# end superuser operations ########## -# aliases that use sudo ############### -alias ad="sudo apt-get update" # update packages lists -alias au="sudo apt-get update && \ - sudo apt-get dselect-upgrade" # upgrade packages -alias ai="sudo apt-get install" # install package -alias ar="sudo apt-get remove --purge && \ - sudo apt-get autoremove --purge" # remove package -alias ac="sudo apt-get clean && sudo apt-get autoclean" # clean apt cache -# end aliases that use sudo ########### # print all installed packages alias allpkgs='aptitude search -F "%p" --disable-columns ~i' -# Install all .deb files in the current directory. -# Warning: you will need to put the glob in single quotes if you use: -# glob_subst -alias di='su -lc "dpkg -i ./*.deb" root' + # Create a basic .deb package alias mydeb='time dpkg-buildpackage -rfakeroot -us -uc' -# Remove ALL kernel images and headers EXCEPT the one in use -alias kclean='su -lc '\''aptitude remove -P ?and(~i~nlinux-(ima|hea) ?not(~n`uname -r`))'\'' root' + From 65393b4bb10de841edbe2026dba29b73625b33d7 Mon Sep 17 00:00:00 2001 From: Daniel Bolton Date: Sun, 7 Aug 2011 16:51:14 -0400 Subject: [PATCH 40/68] Extend root ops, switch apt-copy to plain zsh --- plugins/debian/debian.plugin.zsh | 92 ++++++++++++++++++++++---------- 1 file changed, 65 insertions(+), 27 deletions(-) diff --git a/plugins/debian/debian.plugin.zsh b/plugins/debian/debian.plugin.zsh index 1df91dc4a..23cb98f93 100644 --- a/plugins/debian/debian.plugin.zsh +++ b/plugins/debian/debian.plugin.zsh @@ -4,8 +4,13 @@ # # Debian-related zsh aliases and functions for zsh -# Set to 'apt-get' or 'aptitude' -apt_pref='aptitude' +# Use aptitude if installed, or apt-get if not. +# You can just set apt_pref='apt-get' to override it. +if [[ -e $( which aptitude ) ]]; then + apt_pref='aptitude' +else + apt_pref='apt-get' +fi # Use sudo by default if it's installed if [[ -e $( which sudo ) ]]; then @@ -13,6 +18,10 @@ if [[ -e $( which sudo ) ]]; then fi # Aliases ################################################################### +# These are for more obscure uses of apt-get and aptitude that aren't covered +# below. +alias ag='apt-get' +alias at='aptitude' # Some self-explanatory aliases alias acs="apt-cache search" @@ -28,19 +37,23 @@ alias afs='apt-file search --regexp' alias asrc='apt-get source' alias ap='apt-cache policy' -# superuser operations ################ +# superuser operations ###################################################### if [[ $use_sudo -eq 1 ]]; then - alias ai="sudo $apt_pref install" +# commands using sudo ####### + alias aac="sudo $apt_pref autoclean" + alias abd="sudo $apt_pref build-dep" + alias ac="sudo $apt_pref clean" alias ad="sudo $apt_pref update" + alias adg="sudo $apt_pref update && sudo $apt_pref upgrade" + alias adu="sudo $apt_pref update && sudo $apt_pref dist-upgrade" alias afu='sudo apt-file update' alias ag="sudo $apt_pref upgrade" - alias adg="sudo $apt_pref update && sudo $apt_pref upgrade" + alias ai="sudo $apt_pref install" alias ap="sudo $apt_pref purge" alias ar="sudo $apt_pref remove" - if [[ $apt_pref -eq 'apt-get' ]]; then - alias ads="sudo $apt_pref dselect-upgrade" - fi + # apt-get only + alias ads="sudo $apt_pref dselect-upgrade" # Install all .deb files in the current directory. # Warning: you will need to put the glob in single quotes if you use: @@ -48,25 +61,54 @@ if [[ $use_sudo -eq 1 ]]; then alias di='sudo dpkg -i ./*.deb' # Remove ALL kernel images and headers EXCEPT the one in use - alias kclean='sudo aptitude remove -P ?and(~i~nlinux-(ima|hea) ?not(~n`uname -r`))' + alias kclean='sudo aptitude remove -P ?and(~i~nlinux-(ima|hea) \ + ?not(~n`uname -r`))' + + +# commands using su ######### else - alias ai='apin' + alias aac='su -ls "'"$apt_pref"' autoclean" root' + abd() { + cmd="su -lc '$apt_pref build-dep $@' root" + print "$cmd" + eval "$cmd" + } + alias ac='su -ls "'"$apt_pref"' clean" root' alias ad='su -lc "'"$apt_pref"' update" root' + alias adg='su -lc "'"$apt_pref"' update && aptitude safe-upgrade" root' + alias adu='su -lc "'"$apt_pref"' update && aptitude dist-upgrade" root' alias afu='su -lc "apt-file update"' alias ag='su -lc "'"$apt_pref"' safe-upgrade" root' - alias adg='su -lc "'"$apt_pref"' update && aptitude safe-upgrade" root' + ai() { + cmd="su -lc 'aptitude -P install $@' root" + print "$cmd" + eval "$cmd" + } + ap() { + cmd="su -lc '$apt_pref -P purge $@' root" + print "$cmd" + eval "$cmd" + } + ar() { + cmd="su -lc '$apt_pref -P remove $@' root" + print "$cmd" + eval "$cmd" + } + + # Install all .deb files in the current directory + # Assumes glob_subst is off alias di='su -lc "dpkg -i ./*.deb" root' + # Remove ALL kernel images and headers EXCEPT the one in use - alias kclean='su -lc '\''aptitude remove -P ?and(~i~nlinux-(ima|hea) ?not(~n`uname -r`))'\'' root' + alias kclean='su -lc '\''aptitude remove -P ?and(~i~nlinux-(ima|hea) \ + ?not(~n`uname -r`))'\'' root' fi -# end superuser operations ########## +# Misc. ##################################################################### # print all installed packages alias allpkgs='aptitude search -F "%p" --disable-columns ~i' - - # Create a basic .deb package alias mydeb='time dpkg-buildpackage -rfakeroot -us -uc' @@ -75,23 +117,19 @@ alias mydeb='time dpkg-buildpackage -rfakeroot -us -uc' # Functions ################################################################# - -# install packages without sudo -apin() { - cmd="su -lc 'aptitude -P install $@' root" - print "$cmd" - eval "$cmd" -} - # create a simple script that can be used to 'duplicate' a system apt-copy() { - print '#!/bin/sh'"\n" > apt-copy.sh + print '#!/bin/sh'"\n" > apt-copy.sh - list=$(perl -m'AptPkg::Cache' -e '$c=AptPkg::Cache->new; for (keys %$c){ push @a, $_ if $c->{$_}->{'CurrentState'} eq 'Installed';} print "$_ " for sort @a;') + cmd="$apt_pref install -s " - print 'aptitude install '"$list\n" >> apt-copy.sh + for p in ${(f)"$(aptitude search -F "%p" --disable-columns \~i)"}; { + cmd="${cmd} ${p}" + } - chmod +x apt-copy.sh + print $cmd "\n" >> apt-copy.sh + + chmod +x apt-copy.sh } From c2a95b796b79b4ce4e36b8cb879cb9b0162bc438 Mon Sep 17 00:00:00 2001 From: Matthew Git McCullough Date: Tue, 14 Jun 2011 15:01:28 -0600 Subject: [PATCH 41/68] Added a gradle build tool plugin * Enhanced gradle plugin to parse tasks from a quick execution of the tool * Added a duplicated function for gradlew completion that uses gradlew internally. Builds like Gradle itself (built with Gradle) are sensitive to being run with a matching gradlew version. * Fixed broken caching of gradle task names. Added - and -- argument completions. --- plugins/gradle/gradle.plugin.zsh | 119 +++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 plugins/gradle/gradle.plugin.zsh diff --git a/plugins/gradle/gradle.plugin.zsh b/plugins/gradle/gradle.plugin.zsh new file mode 100644 index 000000000..fc4c78c50 --- /dev/null +++ b/plugins/gradle/gradle.plugin.zsh @@ -0,0 +1,119 @@ +#!zsh +############################################################################## +# A descriptive listing of core Gradle commands +############################################################################ +function _gradle_core_commands() { + local ret=1 state + _arguments ':subcommand:->subcommand' && ret=0 + + case $state in + subcommand) + subcommands=( + "properties:Display all project properties" + "tasks:Calculate and display all tasks" + "dependencies:Calculate and display all dependencies" + "projects:Discover and display all sub-projects" + "build:Build the project" + "help:Display help" + ) + _describe -t subcommands 'gradle subcommands' subcommands && ret=0 + esac + + return ret +} + +function _gradle_arguments() { + _arguments -C \ + '-a[Do not rebuild project dependencies]' \ + '-h[Help]' \ + '-D[System property]' \ + '-d[Log at the debug level]' \ + '--gui[Launches the Gradle GUI app]' \ + '--stop[Stop the Gradle daemon]' \ + '--daemon[Use the Gradle daemon]' \ + '--no-daemon[Do not use the Gradle daemon]' \ + '--no-opt[Do not perform any task optimization]' \ + '-i[Log at the info level]' \ + '-m[Dry run]' \ + '-P[Set a project property]' \ + '--profile[Profile the build time]' \ + '-q[Log at the quiet level (only show errors)]' \ + '-v[Print the Gradle version info]' \ + '-x[Specify a task to be excluded]' \ + '*::command:->command' \ + && return 0 +} + + +############################################################################## +# Are we in a directory containing a build.gradle file? +############################################################################ +function in_gradle() { + if [[ -f build.gradle ]]; then + echo 1 + fi +} + +############################################################################ +# Define the stat_cmd command based on platform behavior +########################################################################## +stat -f%m . > /dev/null 2>&1 +if [ "$?" = 0 ]; then + stat_cmd=(stat -f%m) +else + stat_cmd=(stat -L --format=%Y) +fi + +############################################################################## Examine the build.gradle file to see if its +# timestamp has changed, and if so, regen +# the .gradle_tasks cache file +############################################################################ +_gradle_does_task_list_need_generating () { + if [ ! -f .gradletasknamecache ]; then return 0; + else + accurate=$($stat_cmd .gradletasknamecache) + changed=$($stat_cmd build.gradle) + return $(expr $accurate '>=' $changed) + fi +} + + +############################################################################## +# Discover the gradle tasks by running "gradle tasks --all" +############################################################################ +_gradle_tasks () { + if [ in_gradle ]; then + _gradle_arguments + if _gradle_does_task_list_need_generating; then + gradle tasks --all | grep "^[ ]*[a-zA-Z0-9]*\ -\ " | sed "s/ - .*$//" | sed "s/[\ ]*//" > .gradletasknamecache + fi + compadd -X "==== Gradle Tasks ====" `cat .gradletasknamecache` + fi +} + +_gradlew_tasks () { + if [ in_gradle ]; then + _gradle_arguments + if _gradle_does_task_list_need_generating; then + gradlew tasks --all | grep "^[ ]*[a-zA-Z0-9]*\ -\ " | sed "s/ - .*$//" | sed "s/[\ ]*//" > .gradletasknamecache + fi + compadd -X "==== Gradlew Tasks ====" `cat .gradletasknamecache` + fi +} + + +############################################################################## +# Register the completions against the gradle and gradlew commands +############################################################################ +compdef _gradle_tasks gradle +compdef _gradlew_tasks gradlew + + +############################################################################## +# Open questions for future improvements: +# 1) Should 'gradle tasks' use --all or just the regular set? +# 2) Should gradlew use the same approach as gradle? +# 3) Should only the " - " be replaced with a colon so it can work +# with the richer descriptive method of _arguments? +# gradle tasks | grep "^[a-zA-Z0-9]*\ -\ " | sed "s/ - /\:/" +############################################################################# From 4dc11fee35f21b295deb1a61503031c8e17f83a1 Mon Sep 17 00:00:00 2001 From: Max Gonzih Date: Sat, 13 Aug 2011 13:29:13 +0300 Subject: [PATCH 42/68] detect rvm or rbenv and show ruby version --- themes/gnzh.zsh-theme | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/themes/gnzh.zsh-theme b/themes/gnzh.zsh-theme index 357798cf6..7765efbf2 100644 --- a/themes/gnzh.zsh-theme +++ b/themes/gnzh.zsh-theme @@ -1,4 +1,4 @@ -# ZSH Theme - Preview: http://dl.dropbox.com/u/4109351/pics/gnzh-zsh-theme.png +# ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png # Based on bira theme # load some modules @@ -35,9 +35,17 @@ local return_code="%(?..%{$PR_RED%}%? ↵%{$PR_NO_COLOR%})" local user_host='${PR_USER}${PR_CYAN}@${PR_HOST}' local current_dir='%{$PR_BOLD$PR_BLUE%}%~%{$PR_NO_COLOR%}' -local rvm_ruby='%{$PR_RED%}‹$(rvm-prompt i v g s)›%{$PR_NO_COLOR%}' +local rvm_ruby='' +if which rvm-prompt &> /dev/null; then + rvm_ruby='%{$PR_RED%}‹$(rvm-prompt i v g s)›%{$PR_NO_COLOR%}' +else + if which rbenv &> /dev/null; then + rvm_ruby='%{$PR_RED%}‹$(rbenv version | sed -e "s/ (set.*$//")›%{$PR_NO_COLOR%}' + fi +fi local git_branch='$(git_prompt_info)%{$PR_NO_COLOR%}' +#PROMPT="${user_host} ${current_dir} ${rvm_ruby} ${git_branch}$PR_PROMPT " PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch} ╰─$PR_PROMPT " RPS1="${return_code}" From 7a89786139bcfd83e0e9caa9974f66a423c6ed48 Mon Sep 17 00:00:00 2001 From: Max Gonzih Date: Sat, 13 Aug 2011 13:32:37 +0300 Subject: [PATCH 43/68] oops, restore broken theme preview --- themes/gnzh.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/gnzh.zsh-theme b/themes/gnzh.zsh-theme index 7765efbf2..3c6b8a409 100644 --- a/themes/gnzh.zsh-theme +++ b/themes/gnzh.zsh-theme @@ -1,4 +1,4 @@ -# ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png +# ZSH Theme - Preview: http://dl.dropbox.com/u/4109351/pics/gnzh-zsh-theme.png # Based on bira theme # load some modules From d3116d4f0b499bb76e371f7d60eed48b81068932 Mon Sep 17 00:00:00 2001 From: Daniel Bolton Date: Sat, 13 Aug 2011 10:53:24 -0400 Subject: [PATCH 44/68] Remove -s switch from apt-copy --- plugins/debian/debian.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/debian/debian.plugin.zsh b/plugins/debian/debian.plugin.zsh index 23cb98f93..09771881d 100644 --- a/plugins/debian/debian.plugin.zsh +++ b/plugins/debian/debian.plugin.zsh @@ -121,7 +121,7 @@ alias mydeb='time dpkg-buildpackage -rfakeroot -us -uc' apt-copy() { print '#!/bin/sh'"\n" > apt-copy.sh - cmd="$apt_pref install -s " + cmd="$apt_pref install " for p in ${(f)"$(aptitude search -F "%p" --disable-columns \~i)"}; { cmd="${cmd} ${p}" From 85f388fabf657360960c3fcf55b52f2fb3c4e142 Mon Sep 17 00:00:00 2001 From: David Aaron Fendley Date: Tue, 16 Aug 2011 11:18:23 -0500 Subject: [PATCH 45/68] Added nifty purple Apple theme. --- themes/apple.zsh-theme | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 themes/apple.zsh-theme diff --git a/themes/apple.zsh-theme b/themes/apple.zsh-theme new file mode 100644 index 000000000..350548e36 --- /dev/null +++ b/themes/apple.zsh-theme @@ -0,0 +1,5 @@ +function toon { + echo -n "" +} + +PROMPT='%{$fg[magenta]%}$(toon)%{$reset_color%} %~/ %{$reset_color%}' From c113e88c454cf759078f06c95f4b35db90acb9d7 Mon Sep 17 00:00:00 2001 From: Tim Taylor Date: Wed, 17 Aug 2011 00:17:21 -0400 Subject: [PATCH 46/68] Fix auto upgrade failure from non-exported ZSH env var Fixes #549. Specify ZSH=$ZSH explicitly when invoking the auto update scripts. --- oh-my-zsh.sh | 2 +- tools/check_for_upgrade.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index c4522491b..f77762815 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -1,7 +1,7 @@ # Check for updates on initial load... if [ "$DISABLE_AUTO_UPDATE" != "true" ] then - /usr/bin/env zsh $ZSH/tools/check_for_upgrade.sh + /usr/bin/env ZSH=$ZSH zsh $ZSH/tools/check_for_upgrade.sh fi # Initializes Oh My Zsh diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh index e1e4eb99f..aeaa0e415 100644 --- a/tools/check_for_upgrade.sh +++ b/tools/check_for_upgrade.sh @@ -24,7 +24,7 @@ then read line if [ "$line" = Y ] || [ "$line" = y ] then - /bin/sh $ZSH/tools/upgrade.sh + /usr/bin/env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh # update the zsh file _update_zsh_update fi From 1fb141cfb51f753fe997d17c12ac810ad321f36f Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Sat, 27 Aug 2011 16:16:51 -0500 Subject: [PATCH 47/68] Add gss alias for git status -s --- 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 5132b639a..37bfd383a 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -29,6 +29,8 @@ alias glg='git log --stat --max-count=5' compdef _git glg=git-log alias glgg='git log --graph --max-count=5' compdef _git glgg=git-log +alias gss='git status -s' +compdef _git gss=git-status # Git and svn mix alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk' From bd6aba9c68db06758593e9ef707839c2f0271235 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Sat, 27 Aug 2011 16:23:49 -0500 Subject: [PATCH 48/68] Add an alias for ga --> git add, too --- 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 37bfd383a..4fcf9425d 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -31,6 +31,8 @@ alias glgg='git log --graph --max-count=5' compdef _git glgg=git-log alias gss='git status -s' compdef _git gss=git-status +alias ga='git add' +compdef _git ga=git-add # Git and svn mix alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk' From 9d67d75b0ad62242e60db1bd6d22ae7ea252c7bc Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Tue, 30 Aug 2011 20:56:13 -0700 Subject: [PATCH 49/68] Revert "Enable red dots during completion by default". After a few weeks of using this, I'd prefer this to not be enabled by default. My bad for suggesting that in the first place. This reverts commit fc49b4a4ded376cd82b813dcb6d72fdc050b7bed. --- lib/completion.zsh | 2 +- templates/zshrc.zsh-template | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/completion.zsh b/lib/completion.zsh index 2a457402a..b3cc91822 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -59,7 +59,7 @@ zstyle ':completion:*:*:*:users' ignored-patterns \ # ... unless we really want to. zstyle '*' single-ignored show -if [ "$DISABLE_COMPLETION_WAITING_DOTS" != "true" ]; then +if [ "x$COMPLETION_WAITING_DOTS" = "xtrue" ]; then expand-or-complete-with-dots() { echo -n "\e[31m......\e[0m" zle expand-or-complete diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template index 4de1fa4e9..1ab40aba6 100644 --- a/templates/zshrc.zsh-template +++ b/templates/zshrc.zsh-template @@ -19,8 +19,8 @@ ZSH_THEME="robbyrussell" # Uncomment following line if you want to disable autosetting terminal title. # DISABLE_AUTO_TITLE="true" -# Uncomment following line if you want disable red dots displayed while waiting for completion -# DISABLE_COMPLETION_WAITING_DOTS="true" +# Uncomment following line if you want red dots to be displayed while waiting for completion +# COMPLETION_WAITING_DOTS="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 9c5c70dc0a2531b621ba825c2599189717694d56 Mon Sep 17 00:00:00 2001 From: Hakan Ensari Date: Wed, 31 Aug 2011 12:51:10 +0100 Subject: [PATCH 50/68] order aliases alphabetically --- plugins/bundler/bundler.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index a6c116407..17e17efd9 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -1,8 +1,8 @@ alias be="bundle exec" alias bi="bundle install" alias bl="bundle list" -alias bu="bundle update" alias bp="bundle package" +alias bu="bundle update" # The following is based on https://github.com/gma/bundler-exec From ee507c90461beb06590af1c5e30bd78a62d8c4be Mon Sep 17 00:00:00 2001 From: Hakan Ensari Date: Wed, 31 Aug 2011 12:53:02 +0100 Subject: [PATCH 51/68] add foreman, nanoc, and rainbows to list of bundled commands --- plugins/bundler/bundler.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index 17e17efd9..bd26ca312 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -6,7 +6,7 @@ alias bu="bundle update" # The following is based on https://github.com/gma/bundler-exec -bundled_commands=(cap capify cucumber guard heroku rackup rails rake rspec ruby shotgun spec spork thin unicorn unicorn_rails) +bundled_commands=(cap capify cucumber foreman guard heroku nanoc rackup rails rainbows rake rspec ruby shotgun spec spork thin unicorn unicorn_rails) ## Functions From fe175661fddd04691cc03012f84490e729cf2bae Mon Sep 17 00:00:00 2001 From: Max Gonzih Date: Fri, 2 Sep 2011 16:06:32 +0300 Subject: [PATCH 52/68] vundle call fixed for new vundle version --- plugins/vundle/vundle.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/vundle/vundle.plugin.zsh b/plugins/vundle/vundle.plugin.zsh index 39c36ac59..d7ab4858d 100644 --- a/plugins/vundle/vundle.plugin.zsh +++ b/plugins/vundle/vundle.plugin.zsh @@ -12,11 +12,11 @@ function vundle-init () { function vundle () { vundle-init - vim -c "execute \"BundleInstall\" | q" + vim -c "execute \"BundleInstall\" | q | q" } function vundle-update () { vundle-init - vim -c "execute \"BundleInstall!\" | q" + vim -c "execute \"BundleInstall!\" | q | q" } From 965e1cfefa41bd0419126d9321eecec4fcbbb0e3 Mon Sep 17 00:00:00 2001 From: Mario Fernandez Date: Sat, 10 Sep 2011 11:35:08 +0200 Subject: [PATCH 53/68] fix completion for commands wrapped with bundler --- plugins/bundler/bundler.plugin.zsh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index a6c116407..bd77b0781 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -33,5 +33,10 @@ _run-with-bundler() { ## Main program for cmd in $bundled_commands; do - alias $cmd="_run-with-bundler $cmd" + eval "function bundled_$cmd () { _run-with-bundler $cmd \$@}" + alias $cmd=bundled_$cmd + + if which _$cmd > /dev/null 2>&1; then + compdef _$cmd bundled_$cmd + fi done From c6e8c856cb59e24362fe50fd93de097f30205420 Mon Sep 17 00:00:00 2001 From: Zach Riggle Date: Sat, 10 Sep 2011 06:48:40 -0400 Subject: [PATCH 54/68] [plugins/grails] Added grails plugin --- plugins/grails/grails.plugin.zsh | 62 ++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100755 plugins/grails/grails.plugin.zsh diff --git a/plugins/grails/grails.plugin.zsh b/plugins/grails/grails.plugin.zsh new file mode 100755 index 000000000..95b1324e7 --- /dev/null +++ b/plugins/grails/grails.plugin.zsh @@ -0,0 +1,62 @@ + +if [[ ! -d $GRAILS_HOME/scripts ]]; +then + echo "$0:" + echo "Please set \$GRAILS_HOME to use the 'grails' plugin, and ensure that \$GRAILS_HOME/scripts exists" +fi + +_enumerateGrailsScripts() { + # Default directoryies + directories=($GRAILS_HOME/scripts ~/.grails/scripts ./scripts) + + # Check all of the plugins directories, if they exist + if [ -d plugins ] + then + directories+=(plugins/*/scripts) + fi + + # Enumerate all of the Groovy files + files=() + for dir in $directories; + do + if [ -d $dir ] + then + files+=($dir/*.groovy) + fi + done + + # Don't try to basename () + if [ ${#files} -eq 0 ]; + then + return + fi + + # - Strip the path + # - Remove all scripts with a leading '_' + # - PackagePlugin_.groovy -> PackagePlugin + # - PackagePlugin -> Package-Plugin + # - Package-Plugin -> package-plugin + basename $files \ + | grep -vE -e '^_' \ + | sed -E -e 's/^_?([^_]+)_?.groovy/\1/'\ + -e 's/([a-z])([A-Z])/\1-\2/g' \ + | tr "[:upper:]" "[:lower:]" \ + | sort \ + | uniq +} + +_grails() { + if (( CURRENT == 2 )); then + scripts=( $(_enumerateGrailsScripts) ) + + if [ ${#scripts} -ne 0 ]; + then + _multi_parts / scripts + return + fi + fi + + _files +} + +compdef _grails grails From 51736343595eb83f9d2364b50cf0b62227a4fab4 Mon Sep 17 00:00:00 2001 From: Zach Riggle Date: Sat, 10 Sep 2011 07:00:31 -0400 Subject: [PATCH 55/68] [plugins/grails] Use globbing instead of grep --- plugins/grails/grails.plugin.zsh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/grails/grails.plugin.zsh b/plugins/grails/grails.plugin.zsh index 95b1324e7..88e8b9008 100755 --- a/plugins/grails/grails.plugin.zsh +++ b/plugins/grails/grails.plugin.zsh @@ -21,7 +21,7 @@ _enumerateGrailsScripts() { do if [ -d $dir ] then - files+=($dir/*.groovy) + files+=($dir/[^_]*.groovy) fi done @@ -37,7 +37,6 @@ _enumerateGrailsScripts() { # - PackagePlugin -> Package-Plugin # - Package-Plugin -> package-plugin basename $files \ - | grep -vE -e '^_' \ | sed -E -e 's/^_?([^_]+)_?.groovy/\1/'\ -e 's/([a-z])([A-Z])/\1-\2/g' \ | tr "[:upper:]" "[:lower:]" \ From f9c143b69c30396f79e2cb75d11e70e4b983c1bd Mon Sep 17 00:00:00 2001 From: Zach Riggle Date: Sat, 10 Sep 2011 07:06:26 -0400 Subject: [PATCH 56/68] [plugins/grails] Remove warning message; it's always displayed --- plugins/grails/grails.plugin.zsh | 7 ------- 1 file changed, 7 deletions(-) diff --git a/plugins/grails/grails.plugin.zsh b/plugins/grails/grails.plugin.zsh index 88e8b9008..cc6f9c53b 100755 --- a/plugins/grails/grails.plugin.zsh +++ b/plugins/grails/grails.plugin.zsh @@ -1,10 +1,3 @@ - -if [[ ! -d $GRAILS_HOME/scripts ]]; -then - echo "$0:" - echo "Please set \$GRAILS_HOME to use the 'grails' plugin, and ensure that \$GRAILS_HOME/scripts exists" -fi - _enumerateGrailsScripts() { # Default directoryies directories=($GRAILS_HOME/scripts ~/.grails/scripts ./scripts) From ecfac1cd74cada9594531d6c0217e511914a14f6 Mon Sep 17 00:00:00 2001 From: David Aaron Fendley Date: Sun, 11 Sep 2011 15:19:49 -0500 Subject: [PATCH 57/68] Added VCS prompt to Apple theme. --- themes/apple.zsh-theme | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/themes/apple.zsh-theme b/themes/apple.zsh-theme index 350548e36..92f1df941 100644 --- a/themes/apple.zsh-theme +++ b/themes/apple.zsh-theme @@ -2,4 +2,25 @@ function toon { echo -n "" } -PROMPT='%{$fg[magenta]%}$(toon)%{$reset_color%} %~/ %{$reset_color%}' +get_git_dirty() { + git diff --quiet || echo '*' +} + +autoload -Uz vcs_info +autoload -U colors && colors +zstyle ':vcs_info:*' check-for-changes true +zstyle ':vcs_info:*' unstagedstr '%F{red}*' # display this when there are unstaged changes +zstyle ':vcs_info:*' stagedstr '%F{yellow}+' # display this when there are staged changes +zstyle ':vcs_info:*' actionformats \ + '%F{5}%F{5}[%F{2}%b%F{3}|%F{1}%a%c%u%F{5}]%f ' +zstyle ':vcs_info:*' formats \ + '%F{5}%F{5}[%F{2}%b%c%u%F{5}]%f ' +zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r' +zstyle ':vcs_info:*' enable git cvs svn + +precmd () { + vcs_info +} + +setopt prompt_subst +PROMPT='%{$fg[magenta]%}$(toon)%{$reset_color%} %~/ %{$reset_color%}${vcs_info_msg_0_}%{$reset_color%}' From 701f775c18f1f8a1acdd3282cc3f68f1075904ad Mon Sep 17 00:00:00 2001 From: Gil Vandendriesssche Date: Wed, 14 Sep 2011 10:13:01 +0300 Subject: [PATCH 58/68] Textmate plugin update to take Gemfile and cucumber features in account --- plugins/textmate/textmate.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/textmate/textmate.plugin.zsh b/plugins/textmate/textmate.plugin.zsh index aa2f75f4f..a11a097f5 100644 --- a/plugins/textmate/textmate.plugin.zsh +++ b/plugins/textmate/textmate.plugin.zsh @@ -1,5 +1,5 @@ alias et='mate .' -alias ett='mate app config lib db public spec test Rakefile Capfile Todo' +alias ett='mate Gemfile app config features 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' From 1ad8fde027ea3e66c0ed8f1498dfcfb07e0aefe6 Mon Sep 17 00:00:00 2001 From: Philipp Bosch Date: Thu, 15 Sep 2011 15:00:47 +0200 Subject: [PATCH 59/68] Add basic autocompletion for terminitor (https://github.com/achiu/terminitor). --- plugins/terminitor/_terminitor | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 plugins/terminitor/_terminitor diff --git a/plugins/terminitor/_terminitor b/plugins/terminitor/_terminitor new file mode 100644 index 000000000..7d267643b --- /dev/null +++ b/plugins/terminitor/_terminitor @@ -0,0 +1,26 @@ +#compdef terminitor +#autoload + +# terminitor zsh completion + +local -a _1st_arguments +_1st_arguments=( + 'create:create a Termfile in directory' + 'delete:delete terminitor script' + 'edit:open termitor script' + 'fetch:clone the designated repo and run setup' + 'help:Describe available tasks or one specific task' + 'init:create initial root terminitor folder' + 'list:lists all terminitor scripts' + 'setup:execute setup in the terminitor script' + 'start:runs the terminitor script' + 'update:update Terminitor to new global path(.config/.terminitor)' +) + +_arguments \ + '*:: :->subcmds' && return 0 + +if (( CURRENT == 1 )); then + _describe -t commands "terminitor task" _1st_arguments + return +fi From 47d0735b5fb5e9e82d8fb5d71f4f4c814e977b68 Mon Sep 17 00:00:00 2001 From: Philipp Bosch Date: Thu, 15 Sep 2011 15:18:15 +0200 Subject: [PATCH 60/68] terminitor plugin: add autocompletion for start subcommand. --- plugins/terminitor/_terminitor | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/plugins/terminitor/_terminitor b/plugins/terminitor/_terminitor index 7d267643b..0326506eb 100644 --- a/plugins/terminitor/_terminitor +++ b/plugins/terminitor/_terminitor @@ -3,6 +3,10 @@ # terminitor zsh completion +_terminitor_available_scripts() { + scripts=(`for SCRIPT in ~/.config/terminitor/*.term ; do basename $SCRIPT .term ; done`) +} + local -a _1st_arguments _1st_arguments=( 'create:create a Termfile in directory' @@ -17,6 +21,8 @@ _1st_arguments=( 'update:update Terminitor to new global path(.config/.terminitor)' ) +local expl + _arguments \ '*:: :->subcmds' && return 0 @@ -24,3 +30,9 @@ if (( CURRENT == 1 )); then _describe -t commands "terminitor task" _1st_arguments return fi + +case "$words[1]" in + start) + _terminitor_available_scripts + _wanted scripts expl 'installed scripts' compadd -a scripts ;; +esac From 0d285e3a0f12b8bf9f0ac63d5ef7930ab9455bff Mon Sep 17 00:00:00 2001 From: Philipp Bosch Date: Thu, 15 Sep 2011 15:22:05 +0200 Subject: [PATCH 61/68] terminitor plugin: add autocompletion also for edit, delete and setup subcommands. --- plugins/terminitor/_terminitor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/terminitor/_terminitor b/plugins/terminitor/_terminitor index 0326506eb..1ce87c3ad 100644 --- a/plugins/terminitor/_terminitor +++ b/plugins/terminitor/_terminitor @@ -32,7 +32,7 @@ if (( CURRENT == 1 )); then fi case "$words[1]" in - start) + start|edit|delete|setup) _terminitor_available_scripts _wanted scripts expl 'installed scripts' compadd -a scripts ;; esac From d22b253ce2bd69d908f0c2fce75c5d9ab09edda3 Mon Sep 17 00:00:00 2001 From: Roman Kamyk Date: Tue, 20 Sep 2011 10:16:51 +0200 Subject: [PATCH 62/68] split rkj into two themes. --- themes/rkj-repos.zsh-theme | 29 +++++++++++++++++++++++++++++ themes/rkj.zsh-theme | 25 +------------------------ 2 files changed, 30 insertions(+), 24 deletions(-) create mode 100644 themes/rkj-repos.zsh-theme diff --git a/themes/rkj-repos.zsh-theme b/themes/rkj-repos.zsh-theme new file mode 100644 index 000000000..318c315bb --- /dev/null +++ b/themes/rkj-repos.zsh-theme @@ -0,0 +1,29 @@ +# user, host, full path, and time/date +# on two lines for easier vgrepping +# entry in a nice long thread on the Arch Linux forums: http://bbs.archlinux.org/viewtopic.php?pid=521888#p521888 + +function hg_prompt_info { + hg prompt --angle-brackets "\ +%{$reset_color%}>\ +%{$reset_color%}>\ +%{$fg[red]%}%{$reset_color%}< +patches: >" 2>/dev/null +} + +ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[cyan]%}+" +ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[yellow]%}✱" +ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%}✗" +ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%}➦" +ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[magenta]%}✂" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[grey]%}✈" + +function mygit() { + ref=$(git symbolic-ref HEAD 2> /dev/null) || return + echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$( git_prompt_status )%{$reset_color%}$ZSH_THEME_GIT_PROMPT_SUFFIX" +} + +# alternate prompt with git & hg +PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%Y-%m-%d %I:%M:%S"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} +%{\e[0;34m%}%B└─%B[%{\e[1;35m%}$%{\e[0;34m%}%B] <$(mygit)$(hg_prompt_info)>%{\e[0m%}%b ' +PS2=$' \e[0;34m%}%B>%{\e[0m%}%b ' + diff --git a/themes/rkj.zsh-theme b/themes/rkj.zsh-theme index 4b49a2a09..81b701e07 100644 --- a/themes/rkj.zsh-theme +++ b/themes/rkj.zsh-theme @@ -2,30 +2,7 @@ # on two lines for easier vgrepping # entry in a nice long thread on the Arch Linux forums: http://bbs.archlinux.org/viewtopic.php?pid=521888#p521888 -function hg_prompt_info { - hg prompt --angle-brackets "\ -%{$reset_color%}>\ -%{$reset_color%}>\ -%{$fg[red]%}%{$reset_color%}< -patches: >" 2>/dev/null -} - -ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[cyan]%}+" -ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[yellow]%}✱" -ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%}✗" -ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%}➦" -ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[magenta]%}✂" -ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[grey]%}✈" - -function mygit() { - ref=$(git symbolic-ref HEAD 2> /dev/null) || return - echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$( git_prompt_status )%{$reset_color%}$ZSH_THEME_GIT_PROMPT_SUFFIX" -} - PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%Y-%m-%d %I:%M:%S"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} %{\e[0;34m%}%B└─%B[%{\e[1;35m%}$%{\e[0;34m%}%B]%{\e[0m%}%b ' -#PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%Y-%m-%d %I:%M:%S"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} -#%{\e[0;34m%}%B└─%B[%{\e[1;35m%}$%{\e[0;34m%}%B] <$(mygit)$(hg_prompt_info)>%{\e[0m%}%b ' -PS2=$' \e[0;34m%}%B>%{\e[0m%}%b ' -#RPROMPT='$(mygit)' + From c2d0cdd5330ae072468ca801d0b5750bf4fae7c3 Mon Sep 17 00:00:00 2001 From: James Moore Date: Fri, 23 Sep 2011 10:18:09 -0700 Subject: [PATCH 63/68] This needs to explicitly check the return value --- 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 53a8a513a..b1f873be5 100644 --- a/plugins/svn/svn.plugin.zsh +++ b/plugins/svn/svn.plugin.zsh @@ -1,5 +1,5 @@ function svn_prompt_info { - if [ in_svn ]; then + if [[ in_svn == 1 ]]; 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 b2703a3c8a6c860eeea8a36bc693a1508372d8c1 Mon Sep 17 00:00:00 2001 From: James Moore Date: Fri, 23 Sep 2011 10:51:20 -0700 Subject: [PATCH 64/68] This is the correct way to check the return value --- 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 b1f873be5..e2cf96ca3 100644 --- a/plugins/svn/svn.plugin.zsh +++ b/plugins/svn/svn.plugin.zsh @@ -1,5 +1,5 @@ function svn_prompt_info { - if [[ in_svn == 1 ]]; 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 @@ -13,7 +13,7 @@ function in_svn() { } function svn_get_repo_name { - if [ in_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 [ in_svn ]; then + if [ $(in_svn) ]; then svn info 2> /dev/null | sed -n s/Revision:\ //p fi } function svn_dirty_choose { - if [ in_svn ]; then + if [ $(in_svn) ]; then s=$(svn status|grep -E '^\s*[ACDIM!?L]' 2>/dev/null) if [ $s ]; then echo $1 From 8287cc177e993aebc8ee0a9f5ee5a1cee6893253 Mon Sep 17 00:00:00 2001 From: Nick Stenning Date: Sat, 24 Sep 2011 17:09:57 +0100 Subject: [PATCH 65/68] Better cake completion: don't barf on options, and don't clobber user's namespace --- plugins/cake/cake.plugin.zsh | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/plugins/cake/cake.plugin.zsh b/plugins/cake/cake.plugin.zsh index f968c71d5..1d0d196ee 100644 --- a/plugins/cake/cake.plugin.zsh +++ b/plugins/cake/cake.plugin.zsh @@ -1,18 +1,22 @@ # Set this to 1 if you want to cache the tasks -cache_task_list=1 +_cake_cache_task_list=1 # Cache filename -cache_file='.cake_task_cache' +_cake_task_cache_file='.cake_task_cache' + +_cake_get_target_list () { + cake | grep '^cake ' | sed -e "s/cake \([^ ]*\) .*/\1/" | grep -v '^$' +} _cake_does_target_list_need_generating () { - if [ $cache_task_list -eq 0 ]; then + if [ ${_cake_cache_task_list} -eq 0 ]; then return 1; fi - if [ ! -f $cache_file ]; then return 0; + if [ ! -f ${_cake_task_cache_file} ]; then return 0; else - accurate=$(stat -f%m $cache_file) + accurate=$(stat -f%m $_cake_task_cache_file) changed=$(stat -f%m Cakefile) return $(expr $accurate '>=' $changed) fi @@ -21,12 +25,12 @@ _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 '^$' > $cache_file - compadd `cat $cache_file` + _cake_get_target_list > ${_cake_task_cache_file} + compadd `cat ${_cake_task_cache_file}` else - compadd `cake | sed -e "s/cake \([^ ]*\) .*/\1/" | grep -v '^$'` + compadd `_cake_get_target_list` fi fi } -compdef _cake cake +compdef _cake cake \ No newline at end of file From c1c7b0e4af8a33c25118679f075f63a3b67b14f4 Mon Sep 17 00:00:00 2001 From: Dan Shearmur Date: Mon, 26 Sep 2011 14:44:42 +0100 Subject: [PATCH 66/68] added git merge as gm --- 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 4fcf9425d..183c56c1c 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -33,6 +33,8 @@ alias gss='git status -s' compdef _git gss=git-status alias ga='git add' compdef _git ga=git-add +alias gm='git merge' +compdef _git gm=git-merge # Git and svn mix alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk' From 40cc4dabfb7cd91e09e70a3dd11f73b20d303303 Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Tue, 4 Oct 2011 21:27:36 -0500 Subject: [PATCH 67/68] Add new theme: wuffers --- themes/wuffers.zsh-theme | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 themes/wuffers.zsh-theme diff --git a/themes/wuffers.zsh-theme b/themes/wuffers.zsh-theme new file mode 100644 index 000000000..004b5ebc4 --- /dev/null +++ b/themes/wuffers.zsh-theme @@ -0,0 +1,5 @@ +ZSH_THEME_GIT_PROMPT_PREFIX="$fg_bold[blue][" +ZSH_THEME_GIT_PROMPT_SUFFIX="]$reset_color " +ZSH_THEME_GIT_PROMPT_DIRTY="$fg_bold[red] x$fg_bold[blue]" + +PROMPT='$(git_prompt_info)$fg_bold[green]{$(rvm current)}$reset_color $fg[cyan]%c$reset_color ' From c373c7153be77a91d30a9c6d5ea96b18e911823c Mon Sep 17 00:00:00 2001 From: Mark Szymanski Date: Tue, 4 Oct 2011 21:30:32 -0500 Subject: [PATCH 68/68] Fix up some wonkiness --- themes/wuffers.zsh-theme | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/themes/wuffers.zsh-theme b/themes/wuffers.zsh-theme index 004b5ebc4..182d8a34f 100644 --- a/themes/wuffers.zsh-theme +++ b/themes/wuffers.zsh-theme @@ -1,5 +1,5 @@ -ZSH_THEME_GIT_PROMPT_PREFIX="$fg_bold[blue][" -ZSH_THEME_GIT_PROMPT_SUFFIX="]$reset_color " -ZSH_THEME_GIT_PROMPT_DIRTY="$fg_bold[red] x$fg_bold[blue]" +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}[" +ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%} " +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%} x%{$fg_bold[blue]%}" -PROMPT='$(git_prompt_info)$fg_bold[green]{$(rvm current)}$reset_color $fg[cyan]%c$reset_color ' +PROMPT='%{$(git_prompt_info)%}%{$fg_bold[green]%}{%{$(rvm current)%}}%{$reset_color%} %{$fg[cyan]%}%c%{$reset_color%} '