From 2d5412e99be6d9fab50169ad0cf290e022fc6e9b Mon Sep 17 00:00:00 2001 From: James Smith Date: Sat, 19 Mar 2011 17:50:24 -0700 Subject: [PATCH 01/33] Added new function git_remote_status to check if we are ahead, behind or diverged from the remote branch --- lib/git.zsh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/git.zsh b/lib/git.zsh index 8512de8a4..75367f877 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -4,6 +4,7 @@ function git_prompt_info() { echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX" } +# get dirty status of the current working tree parse_git_dirty () { if [[ -n $(git status -s 2> /dev/null) ]]; then echo "$ZSH_THEME_GIT_PROMPT_DIRTY" @@ -12,6 +13,26 @@ parse_git_dirty () { fi } +# get the difference between the local and remote branches +git_remote_status() { + remote=${$(git rev-parse --verify ${hook_com[branch]}@{upstream} --symbolic-full-name 2>/dev/null)/refs\/remotes\/} + if [[ -n ${remote} ]] ; then + ahead=$(git rev-list ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null | wc -l) + behind=$(git rev-list HEAD..${hook_com[branch]}@{upstream} 2>/dev/null | wc -l) + + if [ $ahead -eq 0 ] && [ $behind -gt 0 ] + then + echo "$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE" + elif [ $ahead -gt 0 ] && [ $behind -eq 0 ] + then + echo "$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE" + elif [ $ahead -gt 0 ] && [ $behind -gt 0 ] + then + echo "$ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE" + fi + fi +} + # get the status of the working tree git_prompt_status() { INDEX=$(git status --porcelain 2> /dev/null) From a15a8c4a98bc1aff024c3ef44dec48309ff4f90b Mon Sep 17 00:00:00 2001 From: James Smith Date: Sat, 19 Mar 2011 17:51:22 -0700 Subject: [PATCH 02/33] New theme 'intheloop' which demonstrates the git_remote_status function --- themes/intheloop.zsh-theme | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 themes/intheloop.zsh-theme diff --git a/themes/intheloop.zsh-theme b/themes/intheloop.zsh-theme new file mode 100644 index 000000000..c4736422d --- /dev/null +++ b/themes/intheloop.zsh-theme @@ -0,0 +1,18 @@ +# ZSH theme by James Smith (http://loopj.com) +# A multiline prompt with username, hostname, full path, return status, git branch, git dirty status, git remote status + +local return_status="%{$fg[red]%}%(?..⏎)%{$reset_color%}" + +PROMPT=' +%{$fg_bold[grey]%}[%{$reset_color%}%{$fg_bold[green]%}%n@%m%{$reset_color%}%{$fg_bold[grey]%}]%{$reset_color%} %{$fg_bold[blue]%}%10c%{$reset_color%} $(git_prompt_info) $(git_remote_status) +%{$fg_bold[cyan]%}❯%{$reset_color%} ' + +RPROMPT='${return_status}%{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[grey]%}(%{$fg[red]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[grey]%}) %{$fg[yellow]%}⚡%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[grey]%})" +ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE="%{$fg_bold[magenta]%}↓%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE="%{$fg_bold[magenta]%}↑%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE="%{$fg_bold[magenta]%}↕%{$reset_color%}" \ No newline at end of file From e8a7a31ef66093f1b1ab034e84e01a147fa8b28a Mon Sep 17 00:00:00 2001 From: Lorrin Nelson Date: Mon, 7 Feb 2011 23:21:46 -0800 Subject: [PATCH 03/33] Make command-not-found no-op when support not available (e.g. not on Ubuntu) --- plugins/command-not-found/command-not-found.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/command-not-found/command-not-found.plugin.zsh b/plugins/command-not-found/command-not-found.plugin.zsh index 5ab03d5a9..567da1b45 100644 --- a/plugins/command-not-found/command-not-found.plugin.zsh +++ b/plugins/command-not-found/command-not-found.plugin.zsh @@ -2,4 +2,4 @@ # as seen in http://www.porcheron.info/command-not-found-for-zsh/ # this is installed in Ubuntu -source /etc/zsh_command_not_found +[[ -e /etc/zsh_command_not_found ]] && source /etc/zsh_command_not_found From b727e337adb0264b3d03ffdd0a4af3ba9802572a Mon Sep 17 00:00:00 2001 From: Sagie Maoz Date: Mon, 27 Jun 2011 01:37:27 -0700 Subject: [PATCH 04/33] Updated the frisk theme to display Bazaar branch information as well (based on zedtux.zsh-theme http://j.mp/ikTZJj) --- themes/frisk.zsh-theme | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/themes/frisk.zsh-theme b/themes/frisk.zsh-theme index f181aec90..2c999a6a6 100644 --- a/themes/frisk.zsh-theme +++ b/themes/frisk.zsh-theme @@ -1,10 +1,22 @@ PROMPT=$' -%{$fg[blue]%}%/%{$reset_color%} $(git_prompt_info)%{$fg[white]%}[%n@%m]%{$reset_color%} %{$fg[white]%}[%T]%{$reset_color%} +%{$fg[blue]%}%/%{$reset_color%} $(git_prompt_info)$(bzr_prompt_info)%{$fg[white]%}[%n@%m]%{$reset_color%} %{$fg[white]%}[%T]%{$reset_color%} %{$fg_bold[black]%}>%{$reset_color%} ' PROMPT2="%{$fg_blod[black]%}%_> %{$reset_color%}" -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}[" +GIT_CB="git::" +ZSH_THEME_SCM_PROMPT_PREFIX="%{$fg[green]%}[" +ZSH_THEME_GIT_PROMPT_PREFIX=$ZSH_THEME_SCM_PROMPT_PREFIX$GIT_CB ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%} " ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}*%{$fg[green]%}" ZSH_THEME_GIT_PROMPT_CLEAN="" + +## Bazaar integration +bzr_prompt_info() { + BZR_CB=`bzr nick 2> /dev/null | grep -v "ERROR" | cut -d ":" -f2 | awk -F / '{print "bzr::"$1}'` + if [ -n "$BZR_CB" ]; then + BZR_DIRTY="" + [[ -n `bzr status` ]] && BZR_DIRTY="%{$fg[red]%} *%{$reset_color%}" + echo "$ZSH_THEME_SCM_PROMPT_PREFIX$BZR_CB$BZR_DIRTY$ZSH_THEME_GIT_PROMPT_SUFFIX" + fi +} From 3bc32eef6dbad942fd137a7c7d04050d9b87fed4 Mon Sep 17 00:00:00 2001 From: Adolfo Benedetti Date: Tue, 2 Aug 2011 09:42:23 +0200 Subject: [PATCH 05/33] add theme with command-line tips support --- themes/adben.zsh-theme | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 themes/adben.zsh-theme diff --git a/themes/adben.zsh-theme b/themes/adben.zsh-theme new file mode 100644 index 000000000..9f777e847 --- /dev/null +++ b/themes/adben.zsh-theme @@ -0,0 +1,26 @@ +#!/usr/bin/env zsh +local USER_HOST='%{$terminfo[bold]$fg[yellow]%}%n@%m%{$reset_color%}' +local RETURN_CODE="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" +local GIT_BRANCH='%{$terminfo[bold]$fg[red]%}$(git_prompt_info)%{$reset_color%}' +local CURRENT_DIR='%{$terminfo[bold]$fg[green]%} %~%{$reset_color%}' +local RUBY_RVM='%{$fg[gray]%}‹$(rvm-prompt i v g)›%{$reset_color%}' +local COMMAND_TIP='%{$terminfo[bold]$fg[blue]%}$(wget -qO - http://www.commandlinefu.com/commands/random/plaintext | sed 1d | sed '/^$/d' | sed 's/^/║/g')%{$reset_color%}' +######### PROMPT ######### +PROMPT="%{$terminfo[bold]$fg[blue]%}╔═ %{$reset_color%}${USER_HOST} ${CURRENT_DIR} ${RUBY_RVM} ${GIT_BRANCH} +${COMMAND_TIP} +%{$terminfo[bold]$fg[blue]%}╚═ %{$reset_color%}%B%{$terminfo[bold]$fg[white]%}$%b%{$reset_color%} " +RPS1='${RETURN_CODE}' +RPROMPT='%{$fg[green]%}[%*]%{$reset_color%}' +######### PROMPT ######### +########## GIT ########### +ZSH_THEME_GIT_PROMPT_PREFIX="‹" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$GIT_PROMPT_INFO%}›" +ZSH_THEME_GIT_PROMPT_DIRTY=" %{$GIT_DIRTY_COLOR%}✘" +ZSH_THEME_GIT_PROMPT_CLEAN=" %{$GIT_CLEAN_COLOR%}✔" +ZSH_THEME_GIT_PROMPT_ADDED="%{$FG[082]%}✚%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_MODIFIED="%{$FG[166]%}✹%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DELETED="%{$FG[160]%}✖%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_RENAMED="%{$FG[220]%}➜%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_UNMERGED="%{$FG[082]%}═%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$FG[190]%}✭%{$reset_color%}" +########## GIT ########### From 878d569c6845198005dacc4e9a56b6610e46ffd9 Mon Sep 17 00:00:00 2001 From: Aslam Najeebdeen Date: Mon, 4 Jul 2011 15:37:11 +0530 Subject: [PATCH 06/33] FrontCube theme with git status --- themes/frontcube.zsh-theme | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 themes/frontcube.zsh-theme diff --git a/themes/frontcube.zsh-theme b/themes/frontcube.zsh-theme new file mode 100644 index 000000000..081fa2f29 --- /dev/null +++ b/themes/frontcube.zsh-theme @@ -0,0 +1,10 @@ +PROMPT=' +%{$fg_bold[gray]%}%~%{$fg_bold[blue]%}%{$fg_bold[blue]%} % %{$reset_color%} +%{$fg[green]%}➞ %{$reset_color%' + +RPROMPT='$(git_prompt_info)' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}[git:" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}] %{$fg[red]%}✖ %{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%}] %{$fg[green]%}✔%{$reset_color%}" From ebbead82abe59663cedd9f0ade4627e01548b4c1 Mon Sep 17 00:00:00 2001 From: Aslam Najeebdeen Date: Sat, 16 Jul 2011 17:31:57 +0530 Subject: [PATCH 07/33] RVM info --- themes/frontcube.zsh-theme | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/themes/frontcube.zsh-theme b/themes/frontcube.zsh-theme index 081fa2f29..d9f5b6d9c 100644 --- a/themes/frontcube.zsh-theme +++ b/themes/frontcube.zsh-theme @@ -1,8 +1,10 @@ +local rvm="%{$fg[green]%}[$(rvm-prompt i v g)]%{$reset_color%}" + PROMPT=' %{$fg_bold[gray]%}%~%{$fg_bold[blue]%}%{$fg_bold[blue]%} % %{$reset_color%} %{$fg[green]%}➞ %{$reset_color%' -RPROMPT='$(git_prompt_info)' +RPROMPT='$(git_prompt_info) $(rvm)' ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}[git:" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" From 00bff0a9963d4b36e6afc968449781c727bfef3b Mon Sep 17 00:00:00 2001 From: James Smith Date: Thu, 20 Sep 2012 19:35:09 -0700 Subject: [PATCH 08/33] Red prompt for remote hosts --- themes/intheloop.zsh-theme | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/themes/intheloop.zsh-theme b/themes/intheloop.zsh-theme index c4736422d..85b4a4d95 100644 --- a/themes/intheloop.zsh-theme +++ b/themes/intheloop.zsh-theme @@ -3,10 +3,16 @@ local return_status="%{$fg[red]%}%(?..⏎)%{$reset_color%}" +local host_color="green" +if [ -n "$SSH_CLIENT" ]; then + local host_color="red" +fi + PROMPT=' -%{$fg_bold[grey]%}[%{$reset_color%}%{$fg_bold[green]%}%n@%m%{$reset_color%}%{$fg_bold[grey]%}]%{$reset_color%} %{$fg_bold[blue]%}%10c%{$reset_color%} $(git_prompt_info) $(git_remote_status) +%{$fg_bold[grey]%}[%{$reset_color%}%{$fg_bold[${host_color}]%}%n@%m%{$reset_color%}%{$fg_bold[grey]%}]%{$reset_color%} %{$fg_bold[blue]%}%10c%{$reset_color%} $(git_prompt_info) $(git_remote_status) %{$fg_bold[cyan]%}❯%{$reset_color%} ' + RPROMPT='${return_status}%{$reset_color%}' ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[grey]%}(%{$fg[red]%}" From af21abb134c023699b2d39db4463180ebdf81a83 Mon Sep 17 00:00:00 2001 From: Paul Redmond Date: Tue, 9 Oct 2012 09:02:45 -0700 Subject: [PATCH 09/33] Wrong URL :zap: --- plugins/jira/jira.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/jira/jira.plugin.zsh b/plugins/jira/jira.plugin.zsh index 636e4619e..de8d10529 100644 --- a/plugins/jira/jira.plugin.zsh +++ b/plugins/jira/jira.plugin.zsh @@ -14,7 +14,7 @@ open_jira_issue () { `open $jira_url/secure/CreateIssue!default.jspa`; else echo "Opening issue #$1"; - `open $jira_url/issues/$1`; + `open $jira_url/browse/$1`; fi fi } From c2cbd31b3ceaabcab09686c1c6ecf10c51715868 Mon Sep 17 00:00:00 2001 From: Paulo Luis Franchini Casaretto Date: Wed, 17 Oct 2012 14:00:18 -0300 Subject: [PATCH 10/33] Add the heroku --remote switch This remote selects the app based on your current repo remotes For example heroku logs --remote staging More info at https://devcenter.heroku.com/articles/using-the-cli --- plugins/heroku/_heroku | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/heroku/_heroku b/plugins/heroku/_heroku index dc899e2b2..a95c38647 100644 --- a/plugins/heroku/_heroku +++ b/plugins/heroku/_heroku @@ -154,5 +154,6 @@ case "$words[1]" in _arguments \ $_command_args \ '(--app)--app[the app name]' \ + '(--remote)--remote[the remote name]' \ && return 0 From 91e5619a585f3c94a3c6c536a5b40c772f64bf85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96rjan=20Persson?= Date: Tue, 16 Oct 2012 22:36:56 -0700 Subject: [PATCH 11/33] Added last working directory plugin Keeps track of the last changed directory. When a new shell is created, the last directory will be restored. Mimics how tabs works in many terminal emulators. --- .../last-working-dir.plugin.zsh | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 plugins/last-working-dir/last-working-dir.plugin.zsh diff --git a/plugins/last-working-dir/last-working-dir.plugin.zsh b/plugins/last-working-dir/last-working-dir.plugin.zsh new file mode 100644 index 000000000..5b3121d11 --- /dev/null +++ b/plugins/last-working-dir/last-working-dir.plugin.zsh @@ -0,0 +1,23 @@ +#!/usr/bin/env zsh +# Keeps track of the last used working directory and automatically jumps +# into it for new shells. + +# Flag indicating if we've previously jumped to last directory. +typeset -g ZSH_LAST_WORKING_DIRECTORY +local cache_file="$ZSH/cache/last-working-dir" + +# Updates the last directory once directory is changed. +function chpwd() { + echo "$PWD" > "$cache_file" +} + +# Changes directory to the last working directory. +function lwd() { + [[ ! -r "$cache_file" ]] || cd `cat "$cache_file"` +} + +# Automatically jump to last working directory unless this isn't the first time +# this plugin has been loaded. +if [[ -z "$ZSH_LAST_WORKING_DIRECTORY" ]]; then + lwd 2>/dev/null && ZSH_LAST_WORKING_DIRECTORY=1 || true +fi From b0cf0674ef732b4102bf793543ceed3d23897ab6 Mon Sep 17 00:00:00 2001 From: Eric Mathison Date: Sun, 21 Oct 2012 02:19:56 -0700 Subject: [PATCH 12/33] Fix color syntax --- tools/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/install.sh b/tools/install.sh index b080be3a1..6f58db939 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -13,7 +13,7 @@ hash git >/dev/null && /usr/bin/env git clone https://github.com/robbyrussell/oh echo "\033[0;34mLooking for an existing zsh config...\033[0m" if [ -f ~/.zshrc ] || [ -h ~/.zshrc ] then - echo "\033[0;33mFound ~/.zshrc.\033[0m \033[0;32]Backing up to ~/.zshrc.pre-oh-my-zsh\033[0m"; + echo "\033[0;33mFound ~/.zshrc.\033[0m \033[0;32mBacking up to ~/.zshrc.pre-oh-my-zsh\033[0m"; cp ~/.zshrc ~/.zshrc.pre-oh-my-zsh; rm ~/.zshrc; fi From 15563c1b785cee11aa09b5ce1e2c6b51cea11bdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Santiago=20Borraz=C3=A1s?= Date: Thu, 1 Nov 2012 21:41:07 -0300 Subject: [PATCH 13/33] Added pass plugin in order to provide completion. More info about pass tool: http://zx2c4.com/projects/password-store/ --- plugins/pass/_pass | 119 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 plugins/pass/_pass diff --git a/plugins/pass/_pass b/plugins/pass/_pass new file mode 100644 index 000000000..f6c1a6c4b --- /dev/null +++ b/plugins/pass/_pass @@ -0,0 +1,119 @@ +#compdef pass +#autoload + +# Copyright (C) 2012: +# Johan Venant +# Brian Mattern +# Jason A. Donenfeld . +# Santiago Borrazás +# All Rights Reserved. +# This file is licensed under the GPLv2+. Please see COPYING for more information. + + +_pass () { + local cmd + if (( CURRENT > 2)); then + cmd=${words[2]} + # Set the context for the subcommand. + curcontext="${curcontext%:*:*}:pass-$cmd" + # Narrow the range of words we are looking at to exclude `pass' + (( CURRENT-- )) + shift words + # Run the completion for the subcommand + case "${cmd}" in + init) + _arguments : \ + "-r[re-encrypt existing passwords]" \ + "--reencrypt[re-encrypt existing passwords]" + _pass_complete_keys + ;; + ls|list|edit) + _pass_complete_entries_with_subdirs + ;; + insert) + _arguments : \ + "-e[echo password to console]" \ + "--echo[echo password to console]" \ + "-m[multiline]" \ + "--multiline[multiline]" + _pass_complete_entries_with_subdirs + ;; + generate) + _arguments : \ + "-n[don't include symbols in password]" \ + "--no-symbols[don't include symbols in password]" \ + "-c[copy password to the clipboard]" \ + "--clip[copy password to the clipboard]" + _pass_complete_entries_with_subdirs + ;; + rm) + _arguments : \ + "-f[force deletion]" \ + "--force[force deletion]" \ + "-r[recursively delete]" \ + "--recursive[recursively delete]" + _pass_complete_entries_with_subdirs + ;; + git) + local -a subcommands + subcommands=( + "init:Initialize git repository" + "push:Push to remote repository" + "pull:Pull from remote repository" + "config:Show git config" + "log:Show git log" + "reflog:Show git reflog" + ) + _describe -t commands 'pass git' subcommands + ;; + show|*) + _pass_cmd_show + ;; + esac + else + local -a subcommands + subcommands=( + "init:Initialize new password storage" + "ls:List passwords" + "show:Decrypt and print a password" + "insert:Insert a new password" + "generate:Generate a new password using pwgen" + "edit:Edit a password with \$EDITOR" + "rm:Remove the password" + "git:Call git on the password store" + "version:Output version information" + "help:Output help message" + ) + _describe -t commands 'pass' subcommands + _arguments : \ + "--version[Output version information]" \ + "--help[Output help message]" + _pass_cmd_show + fi +} + +_pass_cmd_show () { + _arguments : \ + "-c[put it on the clipboard]" \ + "--clip[put it on the clipboard]" + _pass_complete_entries +} +_pass_complete_entries_helper () { + local IFS=$'\n' + local prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store}" + _values -C 'passwords' $(find "$prefix" \( -name .git -o -name .gpg-id \) -prune -o $@ -print | sed -e "s#${prefix}.##" -e 's#\.gpg##' | sort) +} + +_pass_complete_entries_with_subdirs () { + _pass_complete_entries_helper +} + +_pass_complete_entries () { + _pass_complete_entries_helper -type f +} + +_pass_complete_keys () { + local IFS=$'\n' + # Extract names and email addresses from gpg --list-keys + _values 'gpg keys' $(gpg2 --list-secret-keys --with-colons | cut -d : -f 10 | sort -u | sed '/^$/d') +} From cd0e7c5e4906c810b87f7c8f1b2c6c79e4b04889 Mon Sep 17 00:00:00 2001 From: Eugene Nikolsky Date: Mon, 5 Nov 2012 10:34:29 +0200 Subject: [PATCH 14/33] Fix sourcing brew's autojump of version 21.0.3+ Starting with autojump 21.0.3+ there is no file autojump in etc/ directory, so we source the autojump.zsh file directly. Version 20 has it as well, so there should be no problems with earlier versions. Comments on autojump's update in homebrew: https://github.com/mxcl/homebrew/commit/5da9c4d5eb38e6abb516ba648898fb374ec360cd#Library/Formula/autojump.rb --- plugins/autojump/autojump.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/autojump/autojump.plugin.zsh b/plugins/autojump/autojump.plugin.zsh index d367863b8..fdce3a246 100644 --- a/plugins/autojump/autojump.plugin.zsh +++ b/plugins/autojump/autojump.plugin.zsh @@ -5,7 +5,7 @@ if [ $commands[autojump] ]; then # check if autojump is installed . /etc/profile.d/autojump.zsh elif [ -f /opt/local/etc/profile.d/autojump.zsh ]; then # mac os x with ports . /opt/local/etc/profile.d/autojump.zsh - elif [ $commands[brew] -a -f `brew --prefix`/etc/autojump ]; then # mac os x with brew - . `brew --prefix`/etc/autojump + elif [ $commands[brew] -a -f `brew --prefix`/etc/autojump.zsh ]; then # mac os x with brew + . `brew --prefix`/etc/autojump.zsh fi fi From ec9b5500a57a39f8937e50424868493087fa40b4 Mon Sep 17 00:00:00 2001 From: Hao Hong Date: Mon, 5 Nov 2012 16:33:21 -0800 Subject: [PATCH 15/33] Update plugins/git-flow/git-flow.plugin.zsh Fixed git-flow feature publish's desc error https://github.com/agate/oh-my-zsh/commit/72aeaa9d9ee55fbfe15b371c0bf127ab3948a965#commitcomment-2104214 --- plugins/git-flow/git-flow.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/git-flow/git-flow.plugin.zsh b/plugins/git-flow/git-flow.plugin.zsh index 71b343884..ea4caa016 100644 --- a/plugins/git-flow/git-flow.plugin.zsh +++ b/plugins/git-flow/git-flow.plugin.zsh @@ -195,7 +195,7 @@ __git-flow-feature () 'start:Start a new feature branch.' 'finish:Finish a feature branch.' 'list:List all your feature branches. (Alias to `git flow feature`)' - 'publish: public' + 'publish: publish' 'track: track' 'diff: diff' 'rebase: rebase' From 99468cb4ec38f11b78ac71cae0c9ac70ac0a516e Mon Sep 17 00:00:00 2001 From: Brian Hartvigsen Date: Wed, 7 Nov 2012 23:53:44 -0700 Subject: [PATCH 16/33] Update themes/minimal.zsh-theme Cleans up minimal theme by not using a custom prompt function Removed case of 2 spaces showing if not in a version controlled folder Adds support for svn_prompt_info --- themes/minimal.zsh-theme | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/themes/minimal.zsh-theme b/themes/minimal.zsh-theme index ee3ab6b22..a2a16031f 100644 --- a/themes/minimal.zsh-theme +++ b/themes/minimal.zsh-theme @@ -1,15 +1,18 @@ ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[white]%}[" -ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}●%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_CLEAN="" +ZSH_THEME_GIT_PROMPT_SUFFIX="" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}●%{$reset_color%}]%{$reset_color%} " +ZSH_THEME_GIT_PROMPT_CLEAN="]%{$reset_color%} " +ZSH_THEME_SVN_PROMPT_PREFIX=$ZSH_THEME_GIT_PROMPT_PREFIX +ZSH_THEME_SVN_PROMPT_SUFFIX=$ZSH_THEME_GIT_PROMPT_SUFFIX +ZSH_THEME_SVN_PROMPT_DIRTY=$ZSH_THEME_GIT_PROMPT_DIRTY +ZSH_THEME_SVN_PROMPT_CLEAN=$ZSH_THEME_GIT_PROMPT_CLEAN -#Customized git status, oh-my-zsh currently does not allow render dirty status before branch -git_custom_status() { - local cb=$(current_branch) - if [ -n "$cb" ]; then - echo "- $ZSH_THEME_GIT_PROMPT_PREFIX$(current_branch)$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX" - fi +vcs_status() { + if [[ ( $(whence in_svn) != "" ) && ( $(in_svn) == 1 ) ]]; then + svn_prompt_info + else + git_prompt_info + fi } - -PROMPT='%2~ $(git_custom_status) »%b ' \ No newline at end of file +PROMPT='%2~ $(vcs_status)»%b ' \ No newline at end of file From 1b768a3b407103cd77d21d856051183960e0349e Mon Sep 17 00:00:00 2001 From: Brian Hartvigsen Date: Thu, 8 Nov 2012 13:48:43 -0700 Subject: [PATCH 17/33] Update plugins/svn/svn.plugin.zsh Behave more like lib/git.zsh. Set `SVN_SHOW_BRANCH="true"` to display branch/tag or trunk instead of just repo name. Falls back to repo name if branch information is not available. Idea and awk call from revans/bash-it/themes/base.theme.bash --- plugins/svn/svn.plugin.zsh | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/plugins/svn/svn.plugin.zsh b/plugins/svn/svn.plugin.zsh index 4d5bfb8dd..bb46a7d0d 100644 --- a/plugins/svn/svn.plugin.zsh +++ b/plugins/svn/svn.plugin.zsh @@ -1,7 +1,14 @@ function svn_prompt_info { if [ $(in_svn) ]; then + if [ "x$SVN_SHOW_BRANCH" = "xtrue" ]; then + unset SVN_SHOW_BRANCH + _DISPLAY=$(svn_get_branch_name) + else + _DISPLAY=$(svn_get_repo_name) + fi echo "$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_PREFIX\ -$ZSH_THEME_REPO_NAME_COLOR$(svn_get_repo_name)$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_SUFFIX$ZSH_PROMPT_BASE_COLOR$(svn_dirty)$ZSH_PROMPT_BASE_COLOR" +$ZSH_THEME_REPO_NAME_COLOR$_DISPLAY$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_SUFFIX$ZSH_PROMPT_BASE_COLOR$(svn_dirty)$ZSH_PROMPT_BASE_COLOR" + unset _DISPLAY fi } @@ -20,6 +27,16 @@ function svn_get_repo_name { fi } +function svn_get_branch_name { + _DISPLAY=$(svn info 2> /dev/null | awk -F/ '/^URL:/ { for (i=0; i<=NF; i++) { if ($i == "branches" || $i == "tags" ) { print $(i+1); break }; if ($i == "trunk") { print $i; break } } }') + if [ "x$_DISPLAY" = "x" ]; then + svn_get_repo_name + else + echo $_DISPLAY + fi + unset _DISPLAY +} + function svn_get_rev_nr { if [ $(in_svn) ]; then svn info 2> /dev/null | sed -n s/Revision:\ //p From 9ba799111c254f6edb537255d447b7052c8a45e6 Mon Sep 17 00:00:00 2001 From: Jim Hester Date: Fri, 16 Nov 2012 10:23:33 -0500 Subject: [PATCH 18/33] Replace reset-prompt with push-line and accept-line The in memory history is not updated until an accept line command, so you have to push enter before it is correct, this commit replaces the reset-prompt with an accept-line. It also adds a push-line, to preserve the current editing buffer --- .../per-directory-history/per-directory-history.plugin.zsh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/per-directory-history/per-directory-history.plugin.zsh b/plugins/per-directory-history/per-directory-history.plugin.zsh index 22383b8b9..61e8b5a62 100644 --- a/plugins/per-directory-history/per-directory-history.plugin.zsh +++ b/plugins/per-directory-history/per-directory-history.plugin.zsh @@ -65,12 +65,13 @@ function per-directory-history-toggle-history() { if [[ $_per_directory_history_is_global == true ]]; then _per-directory-history-set-directory-history - echo "using local history\n" + print "\nusing local history\n" else _per-directory-history-set-global-history - echo "using global history\n" + print "\nusing global history\n" fi - zle reset-prompt + zle .push-line + zle .accept-line } autoload per-directory-history-toggle-history From 7d9518d48d25c9510b765af04b3910de9a20a117 Mon Sep 17 00:00:00 2001 From: Jeong Mok Cho Date: Mon, 19 Nov 2012 17:04:10 +0900 Subject: [PATCH 19/33] Use rvm completion from ~/.rvm/scripts/zsh/Completion --- plugins/rvm/_rvm | 147 ------------------------------------- plugins/rvm/rvm.plugin.zsh | 2 + 2 files changed, 2 insertions(+), 147 deletions(-) delete mode 100644 plugins/rvm/_rvm diff --git a/plugins/rvm/_rvm b/plugins/rvm/_rvm deleted file mode 100644 index bba5304a0..000000000 --- a/plugins/rvm/_rvm +++ /dev/null @@ -1,147 +0,0 @@ -#compdef rvm - -local curcontext="$curcontext" state line cmds ret=1 - -_arguments -C \ - '(- 1 *)'{-v,--version}'[display version information]' \ - '(-l|--level)'{-l,--level}'+[patch level to use with rvm use / install]:number' \ - '(--prefix)--prefix[path for all rvm files (~/.rvm/), with trailing slash!]:path:_files' \ - '(--bin)--bin[path for binaries to be placed (~/.rvm/bin/)]:path:_files' \ - '(--source)--source[src directory to use (~/.rvm/src/)]:path:_files' \ - '(--archives)--archives[directory for downladed files (~/.rvm/archives/)]:path:_files' \ - '-S[Specify a script file to attempt to load and run (rubydo)]:file:_files' \ - '-e[Execute code from the command line]:code' \ - '(-G)-G[root gem path to use]:path:_files' \ - '(--gems)--gems[Used to set the gems_flag, use with remove to remove gems]' \ - '(--archive)--archive[Used to set the archive_flag, use with remove to remove archive]' \ - '(--patch)--patch[With MRI Rubies you may specify one or more full paths to patches]' \ - '(-C|--configure)'{-C,--configure}'=[custom configure options]' \ - '(--nice)--nice[process niceness (for slow computers, default 0)]:number' \ - '(--ree)--ree-options[Options passed directly to ree ./installer on the command line]:options' \ - '(--head)--head[with update, updates rvm to git head version]' \ - '(--rubygems)--rubygems[with update, updates rubygems for selected ruby]' \ - '(--default)--default[with ruby select, sets a default ruby for new shells]' \ - '(--debug)--debug[Toggle debug mode on for very verbose output]' \ - '(--trace)--trace[Toggle trace mode on to see EVERYTHING rvm is doing]' \ - '(--force)--force[Force install, removes old install & source before install]' \ - '(--summary)--summary[Used with rubydo to print out a summary of the commands run]' \ - '(--latest)--latest[with gemset --dump skips version strings for latest gem]' \ - '(--gems)--gems[with uninstall/remove removes gems with the interpreter]' \ - '(--docs)--docs[with install, attempt to generate ri after installation]' \ - '(--reconfigure)--reconfigure[Force ./configure on install even if Makefile already exists]' \ - '1: :->cmds' \ - '*: :->args' && ret=0 - -case $state in - cmds) - cmds=( - "version:show the rvm version installed in rvm_path" - "use:setup current shell to use a specific ruby version" - "reload:reload rvm source itself (useful after changing rvm source)" - "implode:(seppuku) removes the rvm installation completely. This means everything in $rvm_path (~/.rvm)." - "update:upgrades rvm to the latest version." - "reset:remove current and stored default & system settings." - "info :show the *current* environment information for current ruby" - "current:print the *current* ruby version and the name of any gemset being used." - "debug:show info plus additional information for common issues" - "install:install one or many ruby versions" - "uninstall:uninstall one or many ruby versions, leaves their sources" - "remove:uninstall one or many ruby versions and remove their sources" - "migrate:Lets you migrate all gemsets from one ruby to another." - "upgrade:Lets you upgrade from one version of a ruby to another, including migrating your gemsets semi-automatically." - "wrapper:generates a set of wrapper executables for a given ruby with the specified ruby and gemset combination. Used under the hood for passenger support and the like." - "cleanup:Lets you remove stale source folders / archives and other miscellaneous data associated with rvm." - "repair:Lets you repair parts of your environment e.g. wrappers, env files and and similar files (e.g. general maintenance)." - "snapshot:Lets your backup / restore an rvm installation in a lightweight manner." - "disk-usage:Tells you how much disk space rvm install is using." - "tools:Provides general information about the ruby environment, primarily useful when scripting rvm." - "docs:Tools to make installing ri and rdoc documentation easier." - "rvmrc:Tools related to managing rvmrc trust and loading." - "exec:runs an arbitrary command as a set operation." - "ruby:runs a named ruby file against specified and/or all rubies" - "gem:runs a gem command using selected ruby's 'gem'" - "rake:runs a rake task against specified and/or all rubies" - "tests:runs 'rake test' across selected ruby versions" - "specs:runs 'rake spec' across selected ruby versions" - "monitor:Monitor cwd for testing, run rake {spec,test} on changes." - "gemset:gemsets: http://rvm.beginrescueend.com/gemsets/" - "rubygems:Switches the installed version of rubygems for the current ruby." - "gemdir:display the path to the current gem directory (GEM_HOME)." - "srcdir:display the path to rvm source directory (may be yanked)" - "fetch:Performs an archive / src fetch only of the selected ruby." - "list:show currently installed rubies, interactive output." - "package:Install a dependency package {readline,iconv,zlib,openssl}" - "notes:Display notes, with operating system specifics." - "export:Temporarily set an environment variable in the current shell." - "unexport:Undo changes made to the environment by 'rvm export'." - ) - _describe -t commands 'rvm command' cmds && ret=0 - ;; - args) - case $line[1] in - (use|uninstall|remove|list) - _values -S , 'rubies' $(rvm list strings | sed -e 's/ruby-\([^) ]*\)-\([^) ]*\)/ruby-\1-\2 \1-\2 \1/g') default system && ret=0 - ;; - (install|fetch) - _values -S , 'rubies' $(rvm list known_strings) && ret=0 - ;; - gemset) - if (( CURRENT == 3 )); then - _values 'gemset_commands' \ - 'import' \ - 'export' \ - 'create' \ - 'copy' \ - 'rename' \ - 'empty' \ - 'delete' \ - 'name' \ - 'dir' \ - 'list' \ - 'list_all' \ - 'gemdir' \ - 'install' \ - 'pristine' \ - 'clear' \ - 'use' \ - 'update' \ - 'unpack' \ - 'globalcache' - else - _values -S , 'gemsets' $(rvm gemset list | grep -v gemset 2>/dev/null) - fi - ret=0 - ;; - package) - if (( CURRENT == 3 )); then - _values 'package_commands' \ - 'install' \ - 'uninstall' - else - _values 'packages' \ - 'readline' \ - 'iconv' \ - 'curl' \ - 'openssl' \ - 'zlib' \ - 'autoconf' \ - 'ncurses' \ - 'pkgconfig' \ - 'gettext' \ - 'glib' \ - 'mono' \ - 'llvm' \ - 'libxml2' \ - 'libxslt' \ - 'libyaml' - fi - ret=0 - ;; - *) - (( ret )) && _message 'no more arguments' - ;; - esac - ;; -esac - -return ret diff --git a/plugins/rvm/rvm.plugin.zsh b/plugins/rvm/rvm.plugin.zsh index 604c00713..27f29f2b3 100644 --- a/plugins/rvm/rvm.plugin.zsh +++ b/plugins/rvm/rvm.plugin.zsh @@ -1,3 +1,5 @@ +fpath=($rvm_path/scripts/zsh/Completion $fpath) + alias rubies='rvm list rubies' alias gemsets='rvm gemset list' From 4c96e530a3b4818b3d378949a5d13377ae7f45e9 Mon Sep 17 00:00:00 2001 From: Josh Davis Date: Mon, 19 Nov 2012 08:16:21 -0600 Subject: [PATCH 20/33] Added a CoffeeScript plugin. --- plugins/coffee/_coffee | 71 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 plugins/coffee/_coffee diff --git a/plugins/coffee/_coffee b/plugins/coffee/_coffee new file mode 100644 index 000000000..5c8eb9a08 --- /dev/null +++ b/plugins/coffee/_coffee @@ -0,0 +1,71 @@ +#compdef coffee +# ------------------------------------------------------------------------------ +# Copyright (c) 2011 Github zsh-users - http://github.com/zsh-users +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of the zsh-users nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# Completion script for Coffee.js v0.6.11 (http://coffeejs.org) +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * Mario Fernandez (https://github.com/sirech) +# +# ------------------------------------------------------------------------------ + +local curcontext="$curcontext" state line ret=1 +typeset -A opt_args + +_arguments -C \ + '(- *)'{-h,--help}'[display this help message]' \ + '(- *)'{-v,--version}'[display the version number]' \ + '(-b --bare)'{-b,--bare}'[compile without a top-level function wrapper]' \ + '(-e --eval)'{-e,--eval}'[pass a string from the command line as input]:Inline Script' \ + '(-i --interactive)'{-i,--interactive}'[run an interactive CoffeeScript REPL]' \ + '(-j --join)'{-j,--join}'[concatenate the source CoffeeScript before compiling]:Destination JS file:_files -g "*.js"' \ + '(-l --lint)'{-l,--lint}'[pipe the compiled JavaScript through JavaScript Lint]' \ + '(--nodejs)--nodejs[pass options directly to the "node" binary]' \ + '(-c --compile)'{-c,--compile}'[compile to JavaScript and save as .js files]' \ + '(-o --output)'{-o,--output}'[set the output directory for compiled JavaScript]:Output Directory:_files -/' \ + '(-n -t -p)'{-n,--nodes}'[print out the parse tree that the parser produces]' \ + '(-n -t -p)'{-p,--print}'[print out the compiled JavaScript]' \ + '(-n -t -p)'{-t,--tokens}'[print out the tokens that the lexer/rewriter produce]' \ + '(-r --require)'{-r,--require}'[require a library before executing your script]:library' \ + '(-s --stdio)'{-s,--stdio}'[listen for and compile scripts over stdio]' \ + '(-w --watch)'{-w,--watch}'[watch scripts for changes and rerun commands]' \ + '*:script or directory:_files' && ret=0 + +return ret + +# Local Variables: +# mode: Shell-Script +# sh-indentation: 2 +# indent-tabs-mode: nil +# sh-basic-offset: 2 +# End: +# vim: ft=zsh sw=2 ts=2 et From 003b0da9e5b2b9f230296aeaedfc946579222d81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81rni=20Hermann=20Reynisson?= Date: Tue, 20 Nov 2012 15:01:39 +0000 Subject: [PATCH 21/33] Use pull --rebase for 'gup' shortcut. Instead of git fetch && git rebase. --- plugins/git/git.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index d3d3f702a..adedea79e 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -5,7 +5,7 @@ alias gst='git status' compdef _git gst=git-status alias gl='git pull' compdef _git gl=git-pull -alias gup='git fetch && git rebase' +alias gup='git pull --rebase' compdef _git gup=git-fetch alias gp='git push' compdef _git gp=git-push From af729cc47698e4a894c074f5c5d19384cf175baa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denys=20L=C3=B3zko?= Date: Thu, 22 Nov 2012 00:46:50 +0200 Subject: [PATCH 22/33] Add support of screen-* $TERM in screen plugin --- plugins/screen/screen.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/screen/screen.plugin.zsh b/plugins/screen/screen.plugin.zsh index 98178e807..7009e7a91 100644 --- a/plugins/screen/screen.plugin.zsh +++ b/plugins/screen/screen.plugin.zsh @@ -1,6 +1,6 @@ # if using GNU screen, let the zsh tell screen what the title and hardstatus # of the tab window should be. -if [[ $TERM == "screen" ]]; then +if [[ "$TERM" == screen* ]]; then if [[ $_GET_PATH == '' ]]; then _GET_PATH='echo $PWD | sed "s/^\/Users\//~/;s/^\/home\//~/;s/^~$USER/~/"' fi From 7991562e768733be9565fb05615c3f0f83ba4eb0 Mon Sep 17 00:00:00 2001 From: Stanislav Mekhonoshin Date: Sat, 24 Nov 2012 11:23:44 +0400 Subject: [PATCH 23/33] Added gwc(git whatchanged alias) Allows to view commit history in extended way --- plugins/git/git.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index d3d3f702a..03ad2edb0 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -38,6 +38,7 @@ alias gm='git merge' compdef _git gm=git-merge alias grh='git reset HEAD' alias grhh='git reset HEAD --hard' +alias gwc='git whatchanged -p --abbrev-commit --pretty=medium' # Git and svn mix alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk' From b2b5e3a7549fc323d3801054c51143142baf4f17 Mon Sep 17 00:00:00 2001 From: Srihari Sriraman Date: Sat, 24 Nov 2012 20:42:40 +0530 Subject: [PATCH 24/33] Added alias to rake db:test:prepare Quite often, db:test:prepare is run after db:migrate. Added for convenience. --- plugins/rails/rails.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/rails/rails.plugin.zsh b/plugins/rails/rails.plugin.zsh index 4aa7a05d6..cd232a6ae 100644 --- a/plugins/rails/rails.plugin.zsh +++ b/plugins/rails/rails.plugin.zsh @@ -5,6 +5,7 @@ alias sp='ruby script/plugin' alias sr='ruby script/runner' alias ssp='ruby script/spec' alias rdbm='rake db:migrate' +alias rdbtp='rake db:test:prepare' alias sc='ruby script/console' alias sd='ruby script/server --debugger' alias devlog='tail -f log/development.log' From 7c768543df965ce5102b34e83fab78cf5e73b626 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20M=C4=83gheru=C8=99an-Stanciu?= Date: Sat, 24 Nov 2012 20:33:25 +0100 Subject: [PATCH 25/33] Added a small mod of the tjkirch theme - single-line prompt - removed the extra line after each command output --- themes/tjkirch_mod.zsh-theme | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 themes/tjkirch_mod.zsh-theme diff --git a/themes/tjkirch_mod.zsh-theme b/themes/tjkirch_mod.zsh-theme new file mode 100644 index 000000000..1b206a7e1 --- /dev/null +++ b/themes/tjkirch_mod.zsh-theme @@ -0,0 +1,13 @@ +ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[green]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}⚡" +ZSH_THEME_GIT_PROMPT_CLEAN="" + +function prompt_char { + if [ $UID -eq 0 ]; then echo "%{$fg[red]%}#%{$reset_color%}"; else echo $; fi +} + +PROMPT='%(?,,%{$fg[red]%}FAIL: $?%{$reset_color%} +)%{$fg[magenta]%}%n%{$reset_color%}@%{$fg[yellow]%}%m%{$reset_color%}: %{$fg_bold[blue]%}%~%{$reset_color%}$(git_prompt_info) %_$(prompt_char) ' + +RPROMPT='%{$fg[green]%}[%*]%{$reset_color%}' From 79e620c392393f254d9614b18963af1c9ac234e7 Mon Sep 17 00:00:00 2001 From: Drarok Ithaqua Date: Tue, 27 Nov 2012 12:03:51 +0000 Subject: [PATCH 26/33] Whitespace cleanup. --- plugins/svn/svn.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/svn/svn.plugin.zsh b/plugins/svn/svn.plugin.zsh index bd2767e3e..142ac3bd3 100644 --- a/plugins/svn/svn.plugin.zsh +++ b/plugins/svn/svn.plugin.zsh @@ -15,7 +15,7 @@ function in_svn() { function svn_get_repo_name { if [ $(in_svn) ]; then svn info | sed -n 's/Repository\ Root:\ .*\///p' | read SVN_ROOT - + svn info | sed -n "s/URL:\ .*$SVN_ROOT\///p" fi } @@ -31,7 +31,7 @@ function svn_dirty_choose { svn status 2> /dev/null | grep -Eq '^\s*[ACDIM!?L]' if [ $pipestatus[-1] -ne 0 ]; then echo $1 - else + else echo $2 fi fi From 120db35b2dd7792b981401f66323e8886668c909 Mon Sep 17 00:00:00 2001 From: Drarok Ithaqua Date: Tue, 27 Nov 2012 12:08:18 +0000 Subject: [PATCH 27/33] Fix the backwards svn status, and add comments explaining which way grep does things. --- plugins/svn/svn.plugin.zsh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/svn/svn.plugin.zsh b/plugins/svn/svn.plugin.zsh index 142ac3bd3..79c8bdcdf 100644 --- a/plugins/svn/svn.plugin.zsh +++ b/plugins/svn/svn.plugin.zsh @@ -1,3 +1,4 @@ + function svn_prompt_info { if [ $(in_svn) ]; then echo "$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_PREFIX\ @@ -29,9 +30,11 @@ function svn_get_rev_nr { function svn_dirty_choose { if [ $(in_svn) ]; then svn status 2> /dev/null | grep -Eq '^\s*[ACDIM!?L]' - if [ $pipestatus[-1] -ne 0 ]; then + if [ $pipestatus[-1] -eq 0 ]; then + # Grep exits with 0 when "One or more lines were selected", return "dirty". echo $1 else + # Otherwise, no lines were found, or an error occurred. Return clean. echo $2 fi fi From 53854754e0d052c41587c7d84b9be7868f31bfe8 Mon Sep 17 00:00:00 2001 From: Max Bane Date: Wed, 28 Nov 2012 02:02:58 -0500 Subject: [PATCH 28/33] Revert "Fix to restore bindings after switching to vi-mode" This reverts commit b609aa0e6c981f2039d777687cb01a84587f6edc -- this commit was a bad idea, because it makes vi-mode very difficult to use. The default `bindkey` keybindings are NOT MEANT to coexist with `bindkey -v` Vi mode; that's why `bindkey -v` clears them in the first place! Restoring all of the default keybindings after enabling Vi mode, the way the reverted commit did, causes many collisions between those default keybindings that begin with ESC and the command-mode-initiating ESC of Vi mode. See Issue 1438 of robbyrussell/oh-my-zsh. If people have custom keybindings, they should create them in their ~/.zshrc AFTER enabling the vi-mode plugin and sourcing oh-my-zsh.sh. # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # On branch master # Changes to be committed: # (use "git reset HEAD ..." to unstage) # # modified: plugins/vi-mode/vi-mode.plugin.zsh # --- plugins/vi-mode/vi-mode.plugin.zsh | 5 ----- 1 file changed, 5 deletions(-) diff --git a/plugins/vi-mode/vi-mode.plugin.zsh b/plugins/vi-mode/vi-mode.plugin.zsh index d29eb1dda..c47ab7211 100644 --- a/plugins/vi-mode/vi-mode.plugin.zsh +++ b/plugins/vi-mode/vi-mode.plugin.zsh @@ -5,12 +5,7 @@ function zle-line-init zle-keymap-select { zle -N zle-line-init zle -N zle-keymap-select -#changing mode clobbers the keybinds, so store the keybinds before and execute -#them after -binds=`bindkey -L` bindkey -v -for bind in ${(@f)binds}; do eval $bind; done -unset binds # if mode indicator wasn't setup by theme, define default if [[ "$MODE_INDICATOR" == "" ]]; then From 1b4393fbb67b24d90caad71067c1cb58e8706a69 Mon Sep 17 00:00:00 2001 From: Will Weaver Date: Wed, 28 Nov 2012 08:09:25 -0500 Subject: [PATCH 29/33] Add autocomplete for git "hubflow" This was copied from the git-flow plugin and necessary changes made for the additional features. http://dev.datasift.com/blog/hubflow-github-and-gitflow-model-together HubFlow is git flow with additional features to help with use of github. --- plugins/git-hubflow/git-hubflow.plugin.zsh | 348 +++++++++++++++++++++ 1 file changed, 348 insertions(+) create mode 100644 plugins/git-hubflow/git-hubflow.plugin.zsh diff --git a/plugins/git-hubflow/git-hubflow.plugin.zsh b/plugins/git-hubflow/git-hubflow.plugin.zsh new file mode 100644 index 000000000..a09f88391 --- /dev/null +++ b/plugins/git-hubflow/git-hubflow.plugin.zsh @@ -0,0 +1,348 @@ +#!zsh +# +# Installation +# ------------ +# +# To achieve git-hubflow completion nirvana: +# +# 0. Update your zsh's git-completion module to the newest verion. +# From here. http://zsh.git.sourceforge.net/git/gitweb.cgi?p=zsh/zsh;a=blob_plain;f=Completion/Unix/Command/_git;hb=HEAD +# +# 1. Install this file. Either: +# +# a. Place it in your .zshrc: +# +# b. Or, copy it somewhere (e.g. ~/.git-hubflow-completion.zsh) and put the following line in +# your .zshrc: +# +# source ~/.git-hubflow-completion.zsh +# +# c. Or, use this file as a oh-my-zsh plugin. +# + +_git-hf () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + + local -a subcommands + subcommands=( + 'init:Initialize a new git repo with support for the branching model.' + 'feature:Manage your feature branches.' + 'release:Manage your release branches.' + 'hotfix:Manage your hotfix branches.' + 'support:Manage your support branches.' + 'update:Pull upstream changes down into your master and develop branches.' + 'version:Shows version information.' + ) + _describe -t commands 'git hf' subcommands + ;; + + (options) + case $line[1] in + + (init) + _arguments \ + -f'[Force setting of gitflow branches, even if already configured]' + ;; + + (version) + ;; + + (hotfix) + __git-hf-hotfix + ;; + + (release) + __git-hf-release + ;; + + (feature) + __git-hf-feature + ;; + esac + ;; + esac +} + +__git-hf-release () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + + local -a subcommands + subcommands=( + 'start:Start a new release branch.' + 'finish:Finish a release branch.' + 'list:List all your release branches. (Alias to `git hf release`)' + 'cancel:Cancel release' + 'push:Push release to github' + 'pull:Pull release from github' + 'track:Track release' + ) + _describe -t commands 'git hf release' subcommands + _arguments \ + -v'[Verbose (more) output]' + ;; + + (options) + case $line[1] in + + (start) + _arguments \ + -F'[Fetch from origin before performing finish]'\ + ':version:__git_hf_version_list' + ;; + + (finish) + _arguments \ + -F'[Fetch from origin before performing finish]' \ + -s'[Sign the release tag cryptographically]'\ + -u'[Use the given GPG-key for the digital signature (implies -s)]'\ + -m'[Use the given tag message]'\ + -p'[Push to $ORIGIN after performing finish]'\ + -k'[Keep branch after performing finish]'\ + -n"[Don't tag this release]"\ + ':version:__git_hf_version_list' + ;; + + *) + _arguments \ + -v'[Verbose (more) output]' + ;; + esac + ;; + esac +} + +__git-hf-hotfix () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + + local -a subcommands + subcommands=( + 'start:Start a new hotfix branch.' + 'finish:Finish a hotfix branch.' + 'list:List all your hotfix branches. (Alias to `git hf hotfix`)' + 'publish:Publish the hotfix branch.' + 'track:Track the hotfix branch.' + 'pull:Pull the hotfix from github.' + 'push:Push the hotfix to github.' + 'cancel:Cancel the hotfix.' + ) + _describe -t commands 'git hf hotfix' subcommands + _arguments \ + -v'[Verbose (more) output]' + ;; + + (options) + case $line[1] in + + (start) + _arguments \ + -F'[Fetch from origin before performing finish]'\ + ':hotfix:__git_hf_version_list'\ + ':branch-name:__git_branch_names' + ;; + + (finish) + _arguments \ + -F'[Fetch from origin before performing finish]' \ + -s'[Sign the release tag cryptographically]'\ + -u'[Use the given GPG-key for the digital signature (implies -s)]'\ + -m'[Use the given tag message]'\ + -p'[Push to $ORIGIN after performing finish]'\ + -k'[Keep branch after performing finish]'\ + -n"[Don't tag this release]"\ + ':hotfix:__git_hf_hotfix_list' + ;; + + *) + _arguments \ + -v'[Verbose (more) output]' + ;; + esac + ;; + esac +} + +__git-hf-feature () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + + local -a subcommands + subcommands=( + 'list:List all your feature branches. (Alias to `git hf feature`)' + 'start:Start a new feature branch' + 'finish:Finish a feature branch' + 'submit:submit' + 'track:track' + 'diff:Diff' + 'rebase:Rebase feature branch against develop' + 'checkout:Checkout feature' + 'pull:Pull feature branch from github' + 'push:Push feature branch to github' + 'cancel:Cancel feature' + ) + _describe -t commands 'git hf feature' subcommands + _arguments \ + -v'[Verbose (more) output]' + ;; + + (options) + case $line[1] in + + (start) + _arguments \ + -F'[Fetch from origin before performing finish]'\ + ':feature:__git_hf_feature_list'\ + ':branch-name:__git_branch_names' + ;; + + (finish) + _arguments \ + -F'[Fetch from origin before performing finish]' \ + -r'[Rebase instead of merge]'\ + ':feature:__git_hf_feature_list' + ;; + + (publish) + _arguments \ + ':feature:__git_hf_feature_list'\ + ;; + + (track) + _arguments \ + ':feature:__git_hf_feature_list'\ + ;; + + (diff) + _arguments \ + ':branch:__git_branch_names'\ + ;; + + (rebase) + _arguments \ + -i'[Do an interactive rebase]' \ + ':branch:__git_branch_names' + ;; + + (checkout) + _arguments \ + ':branch:__git_hf_feature_list'\ + ;; + + (pull) + _arguments \ + ':remote:__git_remotes'\ + ':branch:__git_branch_names' + ;; + + *) + _arguments \ + -v'[Verbose (more) output]' + ;; + esac + ;; + esac +} + +__git_hf_version_list () +{ + local expl + declare -a versions + + versions=(${${(f)"$(_call_program versions git hf release list 2> /dev/null | tr -d ' |*')"}}) + __git_command_successful || return + + _wanted versions expl 'version' compadd $versions +} + +__git_hf_feature_list () +{ + local expl + declare -a features + + features=(${${(f)"$(_call_program features git hf feature list 2> /dev/null | tr -d ' |*')"}}) + __git_command_successful || return + + _wanted features expl 'feature' compadd $features +} + +__git_remotes () { + local expl gitdir remotes + + gitdir=$(_call_program gitdir git rev-parse --git-dir 2>/dev/null) + __git_command_successful || return + + remotes=(${${(f)"$(_call_program remotes git config --get-regexp '"^remote\..*\.url$"')"}//#(#b)remote.(*).url */$match[1]}) + __git_command_successful || return + + # TODO: Should combine the two instead of either or. + if (( $#remotes > 0 )); then + _wanted remotes expl remote compadd $* - $remotes + else + _wanted remotes expl remote _files $* - -W "($gitdir/remotes)" -g "$gitdir/remotes/*" + fi +} + +__git_hf_hotfix_list () +{ + local expl + declare -a hotfixes + + hotfixes=(${${(f)"$(_call_program hotfixes git hf hotfix list 2> /dev/null | tr -d ' |*')"}}) + __git_command_successful || return + + _wanted hotfixes expl 'hotfix' compadd $hotfixes +} + +__git_branch_names () { + local expl + declare -a branch_names + + branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/}) + __git_command_successful || return + + _wanted branch-names expl branch-name compadd $* - $branch_names +} + +__git_command_successful () { + if (( ${#pipestatus:#0} > 0 )); then + _message 'not a git repository' + return 1 + fi + return 0 +} + +zstyle ':completion:*:*:git:*' user-commands flow:'description for foo' From 3b6fae14fb6f700bb623d48b2915736de552b387 Mon Sep 17 00:00:00 2001 From: Gustavo Date: Wed, 28 Nov 2012 20:33:45 -0300 Subject: [PATCH 30/33] Node.js version of urltools es more fast (53% aprox), you can try this with strace -o trace -c -Ttt --- plugins/urltools/urltools.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/urltools/urltools.plugin.zsh b/plugins/urltools/urltools.plugin.zsh index 0d29314d6..3de74ae3d 100644 --- a/plugins/urltools/urltools.plugin.zsh +++ b/plugins/urltools/urltools.plugin.zsh @@ -4,6 +4,6 @@ # Taken from: # http://ruslanspivak.com/2010/06/02/urlencode-and-urldecode-from-a-command-line/ -alias urlencode='python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1])"' +alias urlencode='node -e "console.log(encodeURIComponent(process.argv[1]))"' -alias urldecode='python -c "import sys, urllib as ul; print ul.unquote_plus(sys.argv[1])"' \ No newline at end of file +alias urldecode='node -e "console.log(decodeURIComponent(process.argv[1]))"' From 5b201468d109f87b0ec3dd0b190fa71813af542e Mon Sep 17 00:00:00 2001 From: Ryan Castillo Date: Sat, 1 Dec 2012 21:03:07 -0500 Subject: [PATCH 31/33] Improve formatting of step 2 for clarity --- README.textile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.textile b/README.textile index a38e2d7cf..e114da6d2 100644 --- a/README.textile +++ b/README.textile @@ -28,10 +28,10 @@ h3. The manual way 2. Create a new zsh config by copying the zsh template we've provided. - *NOTE*: If you already have a ~/.zshrc file, you should back it up. @cp ~/.zshrc ~/.zshrc.orig@ in case you want to go back to your original settings. - @cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc@ + *NOTE*: If you already have a ~/.zshrc file, you should back it up. @cp ~/.zshrc ~/.zshrc.orig@ in case you want to go back to your original settings. + 3. Set zsh as your default shell: @chsh -s /bin/zsh@ From 60c38134725e4a41c9849bb9ffc1a5cea86c00e3 Mon Sep 17 00:00:00 2001 From: Ryan Castillo Date: Sat, 1 Dec 2012 21:10:23 -0500 Subject: [PATCH 32/33] Make the NOTE an optional for improved instructions --- README.textile | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/README.textile b/README.textile index e114da6d2..0a4545bac 100644 --- a/README.textile +++ b/README.textile @@ -26,17 +26,20 @@ h3. The manual way @git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh@ -2. Create a new zsh config by copying the zsh template we've provided. +2. *OPTIONAL* Backup your existing ~/.zshrc file + + @cp ~/.zshrc ~/.zshrc.orig@ + +3. Create a new zsh config by copying the zsh template we've provided. @cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc@ - *NOTE*: If you already have a ~/.zshrc file, you should back it up. @cp ~/.zshrc ~/.zshrc.orig@ in case you want to go back to your original settings. -3. Set zsh as your default shell: +4. Set zsh as your default shell: @chsh -s /bin/zsh@ -4. Start / restart zsh (open a new terminal is easy enough...) +5. Start / restart zsh (open a new terminal is easy enough...) h3. Problems? From f29daef2973018e60900553b0ea69074a5d9a5de Mon Sep 17 00:00:00 2001 From: Michael Nikitochkin Date: Sun, 2 Dec 2012 14:16:58 +0200 Subject: [PATCH 33/33] Fix repo for github. --- plugins/github/github.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/github/github.plugin.zsh b/plugins/github/github.plugin.zsh index 197e86a48..598b059c1 100644 --- a/plugins/github/github.plugin.zsh +++ b/plugins/github/github.plugin.zsh @@ -61,6 +61,7 @@ exist_gh() { # [DIRECTORY] cd "$1" name=$( git config user.name ) ghuser=$( git config github.user ) + repo=$1 git remote add origin git@github.com:${ghuser}/${repo}.git git push -u origin master