From 6a3a23dfe1e6e839de825577e0a8850dc9738b82 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Sun, 30 Aug 2009 18:49:53 -0700 Subject: [PATCH 001/614] Attempting to load zsh properly after auto-install --- tools/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/install.sh b/tools/install.sh index 7b1ead62e..8873260cf 100644 --- a/tools/install.sh +++ b/tools/install.sh @@ -22,4 +22,4 @@ echo "Time to change your default shell to zsh!" chsh -s /bin/zsh echo "Hooray! Oh My Zsh has been installed." -/bin/zsh \ No newline at end of file +source ~/.zshrc && /bin/zsh From 76d21ba816f3e4a4c4a296af96a84d426b2dde90 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Sun, 30 Aug 2009 18:51:41 -0700 Subject: [PATCH 002/614] Changing order of loading zsh at end of install --- tools/install.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/install.sh b/tools/install.sh index 8873260cf..78a39cd96 100644 --- a/tools/install.sh +++ b/tools/install.sh @@ -22,4 +22,6 @@ echo "Time to change your default shell to zsh!" chsh -s /bin/zsh echo "Hooray! Oh My Zsh has been installed." -source ~/.zshrc && /bin/zsh +/bin/zsh +source ~/.zshrc + From 65ff4019a774b4db2f8d292e52e900284eeacb69 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Sun, 30 Aug 2009 18:54:39 -0700 Subject: [PATCH 003/614] Updating README to match new path for installation. --- README.textile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.textile b/README.textile index 4a52a1d18..fdfb6afae 100644 --- a/README.textile +++ b/README.textile @@ -13,13 +13,13 @@ h3. The manual way 1. Clone the repository - @git clone git://github.com/robbyrussell/oh-my-zsh.git@ + @git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh@ 2. Symlink the zsh config with: *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. - @ln -s ~/oh-my-zsh/zshrc ~/.zshrc@ + @ln -s ~/.oh-my-zsh/zshrc ~/.zshrc@ 3. Set zsh as your default shell: From 93cfed0e111897ae5e26df4fa3187dd21e576daf Mon Sep 17 00:00:00 2001 From: Geoff Garside Date: Mon, 31 Aug 2009 13:58:53 +0100 Subject: [PATCH 004/614] Add in my normal s{s,d} aliases --- aliases.zsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/aliases.zsh b/aliases.zsh index 5cf253dc5..4c079c1e5 100644 --- a/aliases.zsh +++ b/aliases.zsh @@ -2,7 +2,8 @@ alias pu='pushd' alias po='popd' alias sc='ruby script/console' -alias ss='ruby script/server' +alias sd='ruby script/server --debugger' +alias ss='thin --stats "/thin/stats" start' alias mr='mate CHANGELOG app config db lib public script spec test' alias .='pwd' From 0196e5ed6d75a3c740902642fb64ac30621885d4 Mon Sep 17 00:00:00 2001 From: Geoff Garside Date: Mon, 31 Aug 2009 13:59:16 +0100 Subject: [PATCH 005/614] Add textmate aliases --- aliases.zsh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/aliases.zsh b/aliases.zsh index 4c079c1e5..cabeca60e 100644 --- a/aliases.zsh +++ b/aliases.zsh @@ -27,4 +27,9 @@ alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk' bindkey '\ew' kill-region bindkey -s '\el' "ls\n" -bindkey -s '\e.' "..\n" \ No newline at end of file +bindkey -s '\e.' "..\n" + +alias et='mate . &' +alias ett='mate app config lib db public spec test Rakefile Capfile Todo &' +alias etp='mate app config lib db public spec test vendor/plugins vendor/gems Rakefile Capfile Todo &' +alias etts='mate app config lib db public script spec test vendor/plugins vendor/gems Rakefile Capfile Todo &' From 1f82cfc85a3a68435846f8ec13094be267d8bff8 Mon Sep 17 00:00:00 2001 From: Geoff Garside Date: Mon, 31 Aug 2009 13:59:34 +0100 Subject: [PATCH 006/614] Swap out g alias to git --- aliases.zsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/aliases.zsh b/aliases.zsh index cabeca60e..9bbeb0682 100644 --- a/aliases.zsh +++ b/aliases.zsh @@ -11,7 +11,8 @@ alias ...='cd ../..' alias _='sudo' -alias g='grep -in' +#alias g='grep -in' +alias g='git' alias history='fc -l 1' From be966214c9be7fbcc3083f7be3094b87bf2acf70 Mon Sep 17 00:00:00 2001 From: Geoff Garside Date: Mon, 31 Aug 2009 14:01:39 +0100 Subject: [PATCH 007/614] Strip colours from git.zsh --- git.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git.zsh b/git.zsh index b9a86173f..7f5714f74 100644 --- a/git.zsh +++ b/git.zsh @@ -4,7 +4,7 @@ function git_prompt_info() { branch=${ref#refs/heads/} if [[ -d .git ]]; then - CURRENT_BRANCH="%{$fg[red]%}git:(%{$fg[green]${branch}%{$fg[red])" + CURRENT_BRANCH="(${branch})" else CURRENT_BRANCH='' fi From 4e3f4d5e9fc3c7ea04fa507729c7d83acc1e372e Mon Sep 17 00:00:00 2001 From: Geoff Garside Date: Mon, 31 Aug 2009 14:02:19 +0100 Subject: [PATCH 008/614] Use my normal PATH instead of included --- zshrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zshrc b/zshrc index 46f0b1b51..d5c00d6df 100644 --- a/zshrc +++ b/zshrc @@ -6,6 +6,6 @@ export ZSH=$HOME/.oh-my-zsh for i in $ZSH/*zsh; do source $i; done; # Customize to your needs... -export PATH=~/bin:/opt/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/local/sbin:/opt/local/lib/postgresql83/bin - +#export PATH=~/bin:/opt/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/local/sbin:/opt/local/lib/postgresql83/bin +export PATH=$PATH:$HOME/bin From b2f26ab8545197e929538539acbedba999e11ff7 Mon Sep 17 00:00:00 2001 From: Geoff Garside Date: Mon, 31 Aug 2009 14:03:33 +0100 Subject: [PATCH 009/614] Customise prompt value --- prompt.zsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/prompt.zsh b/prompt.zsh index 09481ded9..d191af7f5 100644 --- a/prompt.zsh +++ b/prompt.zsh @@ -29,4 +29,5 @@ setopt prompt_subst export LSCOLORS="Gxfxcxdxbxegedabagacad" -PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' +# PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' +PROMPT='%m:%1/$(git_prompt_info) %n\$ ' From 0678055f66faaeebfabcfe58aeb67059410df790 Mon Sep 17 00:00:00 2001 From: Geoff Garside Date: Mon, 31 Aug 2009 14:03:56 +0100 Subject: [PATCH 010/614] Add tab, take and tm functions --- functions.zsh | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/functions.zsh b/functions.zsh index dcabed957..0dcfbd39a 100644 --- a/functions.zsh +++ b/functions.zsh @@ -22,4 +22,26 @@ function preexec { function remote_console() { /usr/bin/env ssh $1 "( cd $2 && ruby script/console production )" -} \ No newline at end of file +} + +function tab() { + osascript 2>/dev/null < Date: Mon, 31 Aug 2009 07:45:31 -0700 Subject: [PATCH 011/614] Adding theme support so that people can share their zsh prompts with others. Users can set which theme to load in zshrc now. --- prompt.zsh | 2 +- themes/example.zsh-theme | 5 +++++ themes/funky.zsh-theme | 14 ++++++++++++++ themes/robbyrussell.zsh-theme | 1 + zshrc | 4 ++++ 5 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 themes/example.zsh-theme create mode 100644 themes/funky.zsh-theme create mode 100644 themes/robbyrussell.zsh-theme diff --git a/prompt.zsh b/prompt.zsh index 09481ded9..d6c35a652 100644 --- a/prompt.zsh +++ b/prompt.zsh @@ -29,4 +29,4 @@ setopt prompt_subst export LSCOLORS="Gxfxcxdxbxegedabagacad" -PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' +source "$ZSH/themes/$ZSH_THEME.zsh-theme" \ No newline at end of file diff --git a/themes/example.zsh-theme b/themes/example.zsh-theme new file mode 100644 index 000000000..dbd9dc9c9 --- /dev/null +++ b/themes/example.zsh-theme @@ -0,0 +1,5 @@ +# Found on the ZshWiki +# http://zshwiki.org/home/config/prompt +# + +PROMPT="%{$fg[red]%}%n%{$reset_color%}@%{$fg[blue]%}%m %{$fg[yellow]%}%~ %{$reset_color%}%% " \ No newline at end of file diff --git a/themes/funky.zsh-theme b/themes/funky.zsh-theme new file mode 100644 index 000000000..2451296d9 --- /dev/null +++ b/themes/funky.zsh-theme @@ -0,0 +1,14 @@ +# Taken from Tassilo's Blog +# http://tsdh.wordpress.com/2007/12/06/my-funky-zsh-prompt/ + +local blue_op="%{$fg[blue]%}[%{$reset_color%}" +local blue_cp="%{$fg[blue]%}]%{$reset_color%}" +local path_p="${blue_op}%~${blue_cp}" +local user_host="${blue_op}%n@%m${blue_cp}" +local ret_status="${blue_op}%?${blue_cp}" +local hist_no="${blue_op}%h${blue_cp}" +local smiley="%(?,%{$fg[green]%}:%)%{$reset_color%},%{$fg[red]%}:(%{$reset_color%})" +PROMPT="╭─${path_p}─${user_host}─${ret_status}─${hist_no} +╰─${blue_op}${smiley}${blue_cp} %# " +local cur_cmd="${blue_op}%_${blue_cp}" +PROMPT2="${cur_cmd}> " \ No newline at end of file diff --git a/themes/robbyrussell.zsh-theme b/themes/robbyrussell.zsh-theme new file mode 100644 index 000000000..d45796f7c --- /dev/null +++ b/themes/robbyrussell.zsh-theme @@ -0,0 +1 @@ +PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' diff --git a/zshrc b/zshrc index 46f0b1b51..e2f5fbad6 100644 --- a/zshrc +++ b/zshrc @@ -1,6 +1,10 @@ # Path to your oh-my-zsh configuration. export ZSH=$HOME/.oh-my-zsh +# Set to the name theme to load. +# Look in ~/.oh-my-zsh/themes/ +export ZSH_THEME="robbyrussell" + # Load all of the config files in ~/oh-my-zsh that end in .zsh # TIP: Add files you don't want in git to .gitignore for i in $ZSH/*zsh; do source $i; done; From 209638773a070e3f5bb2f5e9eb0b9aee23adbb97 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Mon, 31 Aug 2009 08:12:45 -0700 Subject: [PATCH 012/614] Updating README with info about themes --- README.textile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.textile b/README.textile index fdfb6afae..f09feec0e 100644 --- a/README.textile +++ b/README.textile @@ -38,6 +38,7 @@ TODO: Update this.. * Rake autocomplete: @rake (tab)@. Will generate a cache of all your rake tasks and then let you auto-complete and/or select the task to run. * ssh autocomplete: @ssh (tab)@ or @scp (tab)@ * Git branch, it'll tell you which branch you're in when you're in a git repository directory. +* Theme support: Change the @ZSH_THEME@ environment variable in @~/.zshrc@. * much much more.. h2. Thanks @@ -49,4 +50,7 @@ h2. Help out! I'm far from being a zsh-expert and suspect there are many ways to improve. If you have ideas on how to make the configuration easier to maintain (and faster), don't hesitate to fork and send pull requests! +h3. Send us your theme! + +I'm hoping to collect a bunch of themes for our command prompts. You can see existing ones in the @themes/@ directory. From eb36ee5ec193909147b1ce30a2bc9bc8ddaad4db Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Mon, 31 Aug 2009 09:27:35 -0700 Subject: [PATCH 013/614] Adding Evan's skinny, topless prompt. --- themes/evan.zsh-theme | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 themes/evan.zsh-theme diff --git a/themes/evan.zsh-theme b/themes/evan.zsh-theme new file mode 100644 index 000000000..5ef1f40dd --- /dev/null +++ b/themes/evan.zsh-theme @@ -0,0 +1,2 @@ +# Evan describes this sexy prompt as: "a skinny, topless prompt" +PROMPT='%m :: %2~ %B»%b ' \ No newline at end of file From 51ee785c53c2c34237516887433c6fb45d35cf4c Mon Sep 17 00:00:00 2001 From: Geoff Garside Date: Mon, 31 Aug 2009 18:46:48 +0100 Subject: [PATCH 014/614] Add geoffgarside theme --- themes/geoffgarside.zsh-theme | 1 + zshrc | 1 + 2 files changed, 2 insertions(+) create mode 100644 themes/geoffgarside.zsh-theme diff --git a/themes/geoffgarside.zsh-theme b/themes/geoffgarside.zsh-theme new file mode 100644 index 000000000..861ef9196 --- /dev/null +++ b/themes/geoffgarside.zsh-theme @@ -0,0 +1 @@ +PROMPT='%m:%1/$(git_prompt_info) %n\$ ' diff --git a/zshrc b/zshrc index 2e2a33d9b..c92becf92 100644 --- a/zshrc +++ b/zshrc @@ -4,6 +4,7 @@ export ZSH=$HOME/.oh-my-zsh # Set to the name theme to load. # Look in ~/.oh-my-zsh/themes/ export ZSH_THEME="robbyrussell" +export ZSH_THEME="geoffgarside" # Load all of the config files in ~/oh-my-zsh that end in .zsh # TIP: Add files you don't want in git to .gitignore From 3d3dbaf5dbd42e60a04293d80d89c320fec8ba14 Mon Sep 17 00:00:00 2001 From: Geoff Garside Date: Mon, 31 Aug 2009 18:49:48 +0100 Subject: [PATCH 015/614] Remove PATH definition as we define this in .profile --- zshrc | 1 - 1 file changed, 1 deletion(-) diff --git a/zshrc b/zshrc index c92becf92..fb023885f 100644 --- a/zshrc +++ b/zshrc @@ -12,5 +12,4 @@ for i in $ZSH/*zsh; do source $i; done; # Customize to your needs... #export PATH=~/bin:/opt/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/local/sbin:/opt/local/lib/postgresql83/bin -export PATH=$PATH:$HOME/bin From fb21e5ddb753075efbaa35693915fe62f80aa3bb Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Mon, 31 Aug 2009 11:17:05 -0700 Subject: [PATCH 016/614] Adding a file into log/ so that we have a log file to record history to --- log/.easter-egg | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 log/.easter-egg diff --git a/log/.easter-egg b/log/.easter-egg new file mode 100644 index 000000000..2533149e2 --- /dev/null +++ b/log/.easter-egg @@ -0,0 +1,4 @@ +This file is only here so that Git will keep a log directory as .gitignore is ignoring all the log files within it. + +feel free to add love notes for people here. + From 7b844f8aa3540e2b75d2e7114475331415d59f67 Mon Sep 17 00:00:00 2001 From: Geoff Garside Date: Mon, 31 Aug 2009 21:12:58 +0100 Subject: [PATCH 017/614] Remove colour from ls command --- aliases.zsh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/aliases.zsh b/aliases.zsh index 9bbeb0682..e27cd0366 100644 --- a/aliases.zsh +++ b/aliases.zsh @@ -16,7 +16,7 @@ alias g='git' alias history='fc -l 1' -alias ls='ls -GF' +alias ls='ls -F' alias ll='ls -al' alias sgem='sudo gem' @@ -34,3 +34,6 @@ alias et='mate . &' alias ett='mate app config lib db public spec test Rakefile Capfile Todo &' alias etp='mate app config lib db public spec test vendor/plugins vendor/gems Rakefile Capfile Todo &' alias etts='mate app config lib db public script spec test vendor/plugins vendor/gems Rakefile Capfile Todo &' + +bindkey "^[[A" history-beginning-search-backward +bindkey "^[[B" history-beginning-search-forward From 5f039558a326030b637b59c0b59bd35a8d0bded2 Mon Sep 17 00:00:00 2001 From: Geoff Garside Date: Mon, 31 Aug 2009 21:23:35 +0100 Subject: [PATCH 018/614] Change dirty git string to a yello X --- git.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git.zsh b/git.zsh index 7f5714f74..85279265e 100644 --- a/git.zsh +++ b/git.zsh @@ -13,5 +13,5 @@ function git_prompt_info() { } parse_git_dirty () { - [[ $(git status | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "%{$fg[white] ♻ " + [[ $(git status | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "%{$fg[yellow]%}✗%{$reset_color%}" } From fee63f0db8823e90df66d3e1f363a2182d017727 Mon Sep 17 00:00:00 2001 From: Geoff Garside Date: Mon, 31 Aug 2009 21:23:59 +0100 Subject: [PATCH 019/614] Colour branch name and add dirty string --- git.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git.zsh b/git.zsh index 85279265e..805969b71 100644 --- a/git.zsh +++ b/git.zsh @@ -4,7 +4,7 @@ function git_prompt_info() { branch=${ref#refs/heads/} if [[ -d .git ]]; then - CURRENT_BRANCH="(${branch})" + CURRENT_BRANCH="(%{$fg[red]%}${branch}%{$reset_color%}) $(parse_git_dirty) " else CURRENT_BRANCH='' fi From f1e17335b83bfd7f296ff453c735170f757b6188 Mon Sep 17 00:00:00 2001 From: Geoff Garside Date: Mon, 31 Aug 2009 21:25:12 +0100 Subject: [PATCH 020/614] Add my own theme --- themes/geoffgarside.zsh-theme | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/themes/geoffgarside.zsh-theme b/themes/geoffgarside.zsh-theme index 861ef9196..022e44abe 100644 --- a/themes/geoffgarside.zsh-theme +++ b/themes/geoffgarside.zsh-theme @@ -1 +1,2 @@ -PROMPT='%m:%1/$(git_prompt_info) %n\$ ' +# PROMPT="[%*] %n:%c $(git_prompt_info)%(!.#.$) " +PROMPT="[%*] %{$fg[cyan]%}%n%{$reset_color%}:%{$fg[green]%}%c%{$reset_color%} $(git_prompt_info)%(!.#.$) " From 5e975f6286fcc1c15129efd45f1c501f414fa270 Mon Sep 17 00:00:00 2001 From: Geoff Garside Date: Mon, 31 Aug 2009 21:49:24 +0100 Subject: [PATCH 021/614] Switch double quotes for singles, fixes prompt issues --- themes/geoffgarside.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/geoffgarside.zsh-theme b/themes/geoffgarside.zsh-theme index 022e44abe..5c37ffc3e 100644 --- a/themes/geoffgarside.zsh-theme +++ b/themes/geoffgarside.zsh-theme @@ -1,2 +1,2 @@ # PROMPT="[%*] %n:%c $(git_prompt_info)%(!.#.$) " -PROMPT="[%*] %{$fg[cyan]%}%n%{$reset_color%}:%{$fg[green]%}%c%{$reset_color%} $(git_prompt_info)%(!.#.$) " +PROMPT='[%*] %{$fg[cyan]%}%n%{$reset_color%}:%{$fg[green]%}%c%{$reset_color%} $(git_prompt_info)%(!.#.$) ' From 5d51e6e1ef5fbdbece667c252edb2328a880fa55 Mon Sep 17 00:00:00 2001 From: Geoff Garside Date: Mon, 31 Aug 2009 21:51:11 +0100 Subject: [PATCH 022/614] Restructure spaces in git pieces --- git.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/git.zsh b/git.zsh index 805969b71..a8e2e36aa 100644 --- a/git.zsh +++ b/git.zsh @@ -4,7 +4,7 @@ function git_prompt_info() { branch=${ref#refs/heads/} if [[ -d .git ]]; then - CURRENT_BRANCH="(%{$fg[red]%}${branch}%{$reset_color%}) $(parse_git_dirty) " + CURRENT_BRANCH="(%{$fg[red]%}${branch}%{$reset_color%})$(parse_git_dirty) " else CURRENT_BRANCH='' fi @@ -13,5 +13,5 @@ function git_prompt_info() { } parse_git_dirty () { - [[ $(git status | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "%{$fg[yellow]%}✗%{$reset_color%}" + [[ $(git status | tail -n1) != "nothing to commit (working directory clean)" ]] && echo " %{$fg[yellow]%}✗%{$reset_color%}" } From 71bc81b14af956e7bcd958c12d5aaf56d474f9a4 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Mon, 31 Aug 2009 13:54:50 -0700 Subject: [PATCH 023/614] Only calling git symbolic-ref HEAD when we are in a .git directory --- git.zsh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/git.zsh b/git.zsh index b9a86173f..567c2faa2 100644 --- a/git.zsh +++ b/git.zsh @@ -1,9 +1,8 @@ # get the name of the branch we are on function git_prompt_info() { - ref=$(git symbolic-ref HEAD 2> /dev/null) || return - branch=${ref#refs/heads/} - if [[ -d .git ]]; then + ref=$(git symbolic-ref HEAD 2> /dev/null) || return + branch=${ref#refs/heads/} CURRENT_BRANCH="%{$fg[red]%}git:(%{$fg[green]${branch}%{$fg[red])" else CURRENT_BRANCH='' From a165a6a078cbf9b045d9fd1c81265034adce8a69 Mon Sep 17 00:00:00 2001 From: Geoff Garside Date: Mon, 31 Aug 2009 22:24:03 +0100 Subject: [PATCH 024/614] Move the spaces around again :P --- git.zsh | 2 +- themes/geoffgarside.zsh-theme | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/git.zsh b/git.zsh index a8e2e36aa..1b458762d 100644 --- a/git.zsh +++ b/git.zsh @@ -4,7 +4,7 @@ function git_prompt_info() { branch=${ref#refs/heads/} if [[ -d .git ]]; then - CURRENT_BRANCH="(%{$fg[red]%}${branch}%{$reset_color%})$(parse_git_dirty) " + CURRENT_BRANCH="(%{$fg[red]%}${branch}%{$reset_color%})$(parse_git_dirty)" else CURRENT_BRANCH='' fi diff --git a/themes/geoffgarside.zsh-theme b/themes/geoffgarside.zsh-theme index 5c37ffc3e..38733d95c 100644 --- a/themes/geoffgarside.zsh-theme +++ b/themes/geoffgarside.zsh-theme @@ -1,2 +1,2 @@ # PROMPT="[%*] %n:%c $(git_prompt_info)%(!.#.$) " -PROMPT='[%*] %{$fg[cyan]%}%n%{$reset_color%}:%{$fg[green]%}%c%{$reset_color%} $(git_prompt_info)%(!.#.$) ' +PROMPT='[%*] %{$fg[cyan]%}%n%{$reset_color%}:%{$fg[green]%}%c%{$reset_color%}$(git_prompt_info) %(!.#.$) ' From a4471665bac5618266c24effdad71d8f685dc7e0 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Mon, 31 Aug 2009 15:00:15 -0700 Subject: [PATCH 025/614] Adding zsh_stats function to show you which commands you run the most. --- functions.zsh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/functions.zsh b/functions.zsh index dcabed957..1f2a2023c 100644 --- a/functions.zsh +++ b/functions.zsh @@ -22,4 +22,8 @@ function preexec { function remote_console() { /usr/bin/env ssh $1 "( cd $2 && ruby script/console production )" +} + +function zsh_stats() { + history | awk '{print $2}' | sort | uniq -c | sort -rn | head } \ No newline at end of file From ccd3a191dc256a1f81a288ec6b302cf4c2111a48 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Mon, 31 Aug 2009 15:00:38 -0700 Subject: [PATCH 026/614] Adding an uninstaller tool --- README.textile | 4 ++++ functions.zsh | 4 ++++ tools/uninstall.sh | 20 ++++++++++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 tools/uninstall.sh diff --git a/README.textile b/README.textile index f09feec0e..d7169c394 100644 --- a/README.textile +++ b/README.textile @@ -41,6 +41,10 @@ TODO: Update this.. * Theme support: Change the @ZSH_THEME@ environment variable in @~/.zshrc@. * much much more.. +h3. Uninstalling + +If you want to uninstall it, just run @uninstall_oh_my_zsh@ from the command line and it'll remove itself and revert you to bash (or your previous zsh config). + h2. Thanks * Rick Olsen (technoweenie) might remember some of the configuration, which I took from a pastie a few years ago. diff --git a/functions.zsh b/functions.zsh index 1f2a2023c..2ce91c964 100644 --- a/functions.zsh +++ b/functions.zsh @@ -26,4 +26,8 @@ function remote_console() { function zsh_stats() { history | awk '{print $2}' | sort | uniq -c | sort -rn | head +} + +function uninstall_oh_my_zsh() { + /bin/sh $ZSH/tools/uninstall.sh } \ No newline at end of file diff --git a/tools/uninstall.sh b/tools/uninstall.sh new file mode 100644 index 000000000..8ff583322 --- /dev/null +++ b/tools/uninstall.sh @@ -0,0 +1,20 @@ +echo "Removing ~/.oh-my-zsh" +if [[ -d ~/.oh-my-zsh ]] +then + rm -rf ~/.oh-my-zsh +fi + +echo "Looking for an existing zsh config..." +if [ -f ~/.zshrc.pre-oh-my-zsh ] || [ -h ~/.zshrc.pre-oh-my-zsh ] +then + echo "Found ~/.zshrc. Backing up to ~/.zshrc.pre-oh-my-zsh"; + rm ~/.zshrc; + cp ~/.zshrc.pre-oh-my-zsh ~/.zshrc; + source ~/.zshrc; +else + echo "Switching back to bash" + chsh -s /bin/bash + source /etc/profile +fi + +echo "Thanks for trying out Oh My Zsh. It's been uninstalled." \ No newline at end of file From dff23da1be91c151938da07ba6d3ab20475a1db9 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Mon, 31 Aug 2009 15:10:46 -0700 Subject: [PATCH 027/614] Removing left over theme reference to geoffs theme --- zshrc | 1 - 1 file changed, 1 deletion(-) diff --git a/zshrc b/zshrc index 39e2406f7..c66b9609c 100644 --- a/zshrc +++ b/zshrc @@ -4,7 +4,6 @@ export ZSH=$HOME/.oh-my-zsh # Set to the name theme to load. # Look in ~/.oh-my-zsh/themes/ export ZSH_THEME="robbyrussell" -# export ZSH_THEME="geoffgarside" # Load all of the config files in ~/oh-my-zsh that end in .zsh # TIP: Add files you don't want in git to .gitignore From cde57ba9a75bd057e14d72cbb74522d95d869b0f Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Mon, 31 Aug 2009 15:48:09 -0700 Subject: [PATCH 028/614] Adding an upgrade_oh_my_zsh function to... well, upgrade Oh My Zsh --- functions.zsh | 4 ++++ tools/upgrade.sh | 5 +++++ 2 files changed, 9 insertions(+) create mode 100644 tools/upgrade.sh diff --git a/functions.zsh b/functions.zsh index d0c24e9e9..e3891f6fc 100644 --- a/functions.zsh +++ b/functions.zsh @@ -32,6 +32,10 @@ function uninstall_oh_my_zsh() { /bin/sh $ZSH/tools/uninstall.sh } +function upgrade_oh_my_zsh() { + /bin/sh $ZSH/tools/upgrade.sh +} + function tab() { osascript 2>/dev/null < Date: Tue, 1 Sep 2009 11:01:26 +0200 Subject: [PATCH 029/614] Added extra theme with full pathnames and hostname --- themes/maran.zsh-theme | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 themes/maran.zsh-theme diff --git a/themes/maran.zsh-theme b/themes/maran.zsh-theme new file mode 100644 index 000000000..7523696f4 --- /dev/null +++ b/themes/maran.zsh-theme @@ -0,0 +1,3 @@ +# Theme with full path names and hostname +# Handy if you work on different servers all the time; +PROMPT='%{$fg[cyan]%}%n%{$reset_color%}@$fg[yellow]%}%M:%{$fg[green]%}%/%{$reset_color%} $(git_prompt_info) %(!.#.$) ' \ No newline at end of file From 2846766c3cd7a088eef721175d2e2ac0ee72c2c3 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Tue, 1 Sep 2009 05:41:49 -0700 Subject: [PATCH 030/614] Including a link to the Themes wiki page from the README --- README.textile | 1 + 1 file changed, 1 insertion(+) diff --git a/README.textile b/README.textile index d7169c394..305df4fce 100644 --- a/README.textile +++ b/README.textile @@ -39,6 +39,7 @@ TODO: Update this.. * ssh autocomplete: @ssh (tab)@ or @scp (tab)@ * Git branch, it'll tell you which branch you're in when you're in a git repository directory. * Theme support: Change the @ZSH_THEME@ environment variable in @~/.zshrc@. +** Take a look at the "current themes":http://wiki.github.com/robbyrussell/oh-my-zsh/themes that come bundled with Oh My Zsh. * much much more.. h3. Uninstalling From cbaffd4a1cbf8120638f2969b9915df6c0388fb7 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Tue, 1 Sep 2009 07:41:18 -0700 Subject: [PATCH 031/614] Moving the loading of all .zsh files into a different file so that we can remove zshrc from the repository --- oh-my-zsh.sh | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 oh-my-zsh.sh diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh new file mode 100644 index 000000000..d6382c973 --- /dev/null +++ b/oh-my-zsh.sh @@ -0,0 +1,5 @@ +# Initializes Oh My Zsh + +# Load all of the config files in ~/oh-my-zsh that end in .zsh +# TIP: Add files you don't want in git to .gitignore +for i in $ZSH/*.zsh; do source $i; done; From bdd1b01a1351ce60150a254aaeb7a7f79148bc1f Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Tue, 1 Sep 2009 07:43:46 -0700 Subject: [PATCH 032/614] Moving and renaming the zshrc file to a template file --- zshrc => templates/zshrc-template | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename zshrc => templates/zshrc-template (100%) diff --git a/zshrc b/templates/zshrc-template similarity index 100% rename from zshrc rename to templates/zshrc-template From 010e76f154876745c695bf01fb333c183588b78b Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Tue, 1 Sep 2009 07:45:49 -0700 Subject: [PATCH 033/614] Renaming template file one last time (for now) --- templates/{zshrc-template => zshrc.zsh-template} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename templates/{zshrc-template => zshrc.zsh-template} (100%) diff --git a/templates/zshrc-template b/templates/zshrc.zsh-template similarity index 100% rename from templates/zshrc-template rename to templates/zshrc.zsh-template From a3ade732316796052b506feaf61d079d075fbdc4 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Tue, 1 Sep 2009 07:46:15 -0700 Subject: [PATCH 034/614] Updating the template file to use the oh-my-zsh.sh loader --- templates/zshrc.zsh-template | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template index c66b9609c..6aae14013 100644 --- a/templates/zshrc.zsh-template +++ b/templates/zshrc.zsh-template @@ -5,10 +5,7 @@ export ZSH=$HOME/.oh-my-zsh # Look in ~/.oh-my-zsh/themes/ export ZSH_THEME="robbyrussell" -# Load all of the config files in ~/oh-my-zsh that end in .zsh -# TIP: Add files you don't want in git to .gitignore -for i in $ZSH/*zsh; do source $i; done; - # Customize to your needs... #export PATH=~/bin:/opt/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/local/sbin:/opt/local/lib/postgresql83/bin +source $ZSH/oh-my-zsh.sh From a0d9976215c02f4c8c79afdca7cac8b6f1128b54 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Tue, 1 Sep 2009 07:50:45 -0700 Subject: [PATCH 035/614] Updating installer to use the new template file. ~/.zshrc will now be outside of the repository --- tools/install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/install.sh b/tools/install.sh index 78a39cd96..05b3a52cd 100644 --- a/tools/install.sh +++ b/tools/install.sh @@ -15,8 +15,8 @@ then rm ~/.zshrc; fi -echo "Symlinking .zshrc to ~/.oh-my-zsh/" -ln -s ~/.oh-my-zsh/zshrc ~/.zshrc +echo "Using the Oh My Zsh template file and adding it to ~/.zshrc" +cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc echo "Time to change your default shell to zsh!" chsh -s /bin/zsh From 18309b9a5b70a113b37c7f51cea6c79d0858f1ef Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Tue, 1 Sep 2009 07:52:43 -0700 Subject: [PATCH 036/614] Updating README to instruct people to copy the .zshrc template file versus symlinking it. --- README.textile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.textile b/README.textile index 305df4fce..bf4086916 100644 --- a/README.textile +++ b/README.textile @@ -15,11 +15,11 @@ h3. The manual way @git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh@ -2. Symlink the zsh config with: +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. - @ln -s ~/.oh-my-zsh/zshrc ~/.zshrc@ + @cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc@ 3. Set zsh as your default shell: From 0cce4fe21e15b898c72cbefc0e12fb1d530ad952 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Tue, 1 Sep 2009 20:34:58 -0700 Subject: [PATCH 037/614] Trying out some zsh-fu. Using the for x (*.zsh) source approach --- oh-my-zsh.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index d6382c973..b931f558a 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -2,4 +2,4 @@ # Load all of the config files in ~/oh-my-zsh that end in .zsh # TIP: Add files you don't want in git to .gitignore -for i in $ZSH/*.zsh; do source $i; done; +for config_file ($ZSH/*.zsh) source $config_file From 169e4ed6818d57c0c6005f093be423cac04e29cc Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Tue, 1 Sep 2009 20:46:48 -0700 Subject: [PATCH 038/614] Moving bindings into their own file. Updating aliases after moving out bindings --- aliases.zsh | 9 ++------- key-bindings.zsh | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 7 deletions(-) create mode 100644 key-bindings.zsh diff --git a/aliases.zsh b/aliases.zsh index e27cd0366..eef321de5 100644 --- a/aliases.zsh +++ b/aliases.zsh @@ -25,15 +25,10 @@ alias rfind='find . -name *.rb | xargs grep -n' alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk' -bindkey '\ew' kill-region - -bindkey -s '\el' "ls\n" -bindkey -s '\e.' "..\n" - alias et='mate . &' alias ett='mate app config lib db public spec test Rakefile Capfile Todo &' alias etp='mate app config lib db public spec test vendor/plugins vendor/gems Rakefile Capfile Todo &' alias etts='mate app config lib db public script spec test vendor/plugins vendor/gems Rakefile Capfile Todo &' -bindkey "^[[A" history-beginning-search-backward -bindkey "^[[B" history-beginning-search-forward + + diff --git a/key-bindings.zsh b/key-bindings.zsh new file mode 100644 index 000000000..20caad11f --- /dev/null +++ b/key-bindings.zsh @@ -0,0 +1,14 @@ +# TODO: Explain what some of this does.. +autoload -U compinit +compinit +bindkey '\ew' kill-region +bindkey -s '\el' "ls\n" +bindkey -s '\e.' "..\n" +bindkey '^r' history-incremental-search-backward +bindkey "^[[5~" up-line-or-history +bindkey "^[[6~" down-line-or-history +bindkey "^[[H" beginning-of-line +bindkey "^[[1~" beginning-of-line +bindkey "^[[F" end-of-line +bindkey "^[[4~" end-of-line +bindkey ' ' magic-space # also do history expansion on space \ No newline at end of file From a799ad5a37a687e59234d95fb20377b8717f6df9 Mon Sep 17 00:00:00 2001 From: mwilliams Date: Thu, 3 Sep 2009 14:45:23 -0400 Subject: [PATCH 039/614] Adding more useful aliases for Git. --- aliases.zsh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/aliases.zsh b/aliases.zsh index eef321de5..253c2ac64 100644 --- a/aliases.zsh +++ b/aliases.zsh @@ -12,7 +12,16 @@ alias ...='cd ../..' alias _='sudo' #alias g='grep -in' + alias g='git' +alias gst='git status' +alias gl='git pull' +alias gp='git push' +alias gd='git diff | mate' +alias gc='git commit -v' +alias gca='git commit -v -a' +alias gb='git branch' +alias gba='git branch -a' alias history='fc -l 1' From b0bdeede6116056d35681a5b70801e8aabcbfbb1 Mon Sep 17 00:00:00 2001 From: Jamie van Dyke Date: Sun, 6 Sep 2009 13:19:33 +0100 Subject: [PATCH 040/614] added case-insensitive auto completion --- completion.zsh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/completion.zsh b/completion.zsh index e0edc763f..dff71cfd3 100644 --- a/completion.zsh +++ b/completion.zsh @@ -11,6 +11,9 @@ compinit zmodload -i zsh/complist +## case-insensitive (all),partial-word and then substring completion +zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' + zstyle ':completion:*' list-colors '' zstyle ':completion:*' hosts $( sed 's/[, ].*$//' $HOME/.ssh/known_hosts ) From 160a02fc60274a971ba2da8fbfeee88982d7c8b2 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Mon, 7 Sep 2009 09:11:34 -0700 Subject: [PATCH 041/614] Updating install process to copy your current environments PATH and adding it to the bottom of ~/.zshrc. --- templates/zshrc.zsh-template | 5 ++--- tools/install.sh | 3 +++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template index 6aae14013..b8da51428 100644 --- a/templates/zshrc.zsh-template +++ b/templates/zshrc.zsh-template @@ -5,7 +5,6 @@ export ZSH=$HOME/.oh-my-zsh # Look in ~/.oh-my-zsh/themes/ export ZSH_THEME="robbyrussell" -# Customize to your needs... -#export PATH=~/bin:/opt/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/local/sbin:/opt/local/lib/postgresql83/bin - source $ZSH/oh-my-zsh.sh + +# Customize to your needs... diff --git a/tools/install.sh b/tools/install.sh index 05b3a52cd..5c9f5592a 100644 --- a/tools/install.sh +++ b/tools/install.sh @@ -18,6 +18,9 @@ fi echo "Using the Oh My Zsh template file and adding it to ~/.zshrc" cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc +echo "Copying your current PATH and adding it to the end of ~/.zshrc for you." +echo "export PATH=$PATH" >> ~/.zshrc + echo "Time to change your default shell to zsh!" chsh -s /bin/zsh From 30b43dc9a1b6b7d41e4ded7933353d28e4fef425 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Mon, 7 Sep 2009 09:18:40 -0700 Subject: [PATCH 042/614] Updating the name of the rake and capistrano task cache file to append a ~ to the end of the filename so it's easier to ignore in rails git projects. [#1] --- rake_completion.zsh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/rake_completion.zsh b/rake_completion.zsh index a94b48896..239fe15a3 100644 --- a/rake_completion.zsh +++ b/rake_completion.zsh @@ -1,7 +1,7 @@ _rake_does_task_list_need_generating () { - if [ ! -f .rake_tasks ]; then return 0; + if [ ! -f .rake_tasks~ ]; then return 0; else - accurate=$(stat -f%m .rake_tasks) + accurate=$(stat -f%m .rake_tasks~) changed=$(stat -f%m Rakefile) return $(expr $accurate '>=' $changed) fi @@ -10,19 +10,19 @@ _rake_does_task_list_need_generating () { _rake () { if [ -f Rakefile ]; then if _rake_does_task_list_need_generating; then - echo "\nGenerating .rake_tasks..." > /dev/stderr - rake --silent --tasks | cut -d " " -f 2 > .rake_tasks + echo "\nGenerating .rake_tasks~..." > /dev/stderr + rake --silent --tasks | cut -d " " -f 2 > .rake_tasks~ fi - compadd `cat .rake_tasks` + compadd `cat .rake_tasks~` fi } compdef _rake rake function _cap_does_task_list_need_generating () { - if [ ! -f .cap_tasks ]; then return 0; + if [ ! -f .cap_tasks~ ]; then return 0; else - accurate=$(stat -f%m .cap_tasks) + accurate=$(stat -f%m .cap_tasks~) changed=$(stat -f%m config/deploy.rb) return $(expr $accurate '>=' $changed) fi @@ -31,11 +31,11 @@ function _cap_does_task_list_need_generating () { function _cap () { if [ -f config/deploy.rb ]; then if _cap_does_task_list_need_generating; then - echo "\nGenerating .cap_tasks..." > /dev/stderr + echo "\nGenerating .cap_tasks~..." > /dev/stderr cap show_tasks -q | cut -d " " -f 1 | sed -e '/^ *$/D' -e '1,2D' -> .cap_tasks +> .cap_tasks~ fi - compadd `cat .cap_tasks` + compadd `cat .cap_tasks~` fi } From 6f001b9b1235a88921b2a338757947ad72efe7c7 Mon Sep 17 00:00:00 2001 From: Christopher Sexton Date: Mon, 14 Sep 2009 12:42:53 -0400 Subject: [PATCH 043/614] Added risto theme and made git.zsh themable * git.zsh is now themable: * git_prompt_info() now will look in the following variables for formatting strings: * ZSH_THEME_GIT_PROMPT_PREFIX - Prefix for the prompt (before the branch name) * ZSH_THEME_GIT_PROMPT_SUFFIX - The very end of the prompt * ZSH_THEME_GIT_PROMPT_DIRTY - Displayed when the branch is dirty * ZSH_THEME_GIT_PROMPT_CLEAN - Displayed when the branch is clean * Updated geoffgarside, robbyrussell, and maran to work with new git theme * Added the Risto theme, which is very similar to a number of bash prompts, and allows me to use zsh in with out my co-workers knowing I have the advantage. Think of it as a ninja theme. --- git.zsh | 16 +++++++++++++--- themes/geoffgarside.zsh-theme | 3 +++ themes/maran.zsh-theme | 5 ++++- themes/risto.zsh-theme | 6 ++++++ themes/robbyrussell.zsh-theme | 5 +++++ 5 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 themes/risto.zsh-theme diff --git a/git.zsh b/git.zsh index b8fd1f08e..591b77895 100644 --- a/git.zsh +++ b/git.zsh @@ -1,16 +1,26 @@ +# +ZSH_THEME_GIT_PROMPT_PREFIX="git:(" +ZSH_THEME_GIT_PROMPT_SUFFIX=")" +ZSH_THEME_GIT_PROMPT_DIRTY="*" +ZSH_THEME_GIT_PROMPT_CLEAN="" + # get the name of the branch we are on function git_prompt_info() { if [[ -d .git ]]; then ref=$(git symbolic-ref HEAD 2> /dev/null) || return branch=${ref#refs/heads/} - CURRENT_BRANCH="git:(%{$fg[red]%}${branch}%{$fg[blue]%})%{$reset_color%}$(parse_git_dirty)" + CURRENT_BRANCH="$ZSH_THEME_GIT_PROMPT_PREFIX${branch}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX" else CURRENT_BRANCH='' fi echo $CURRENT_BRANCH } - parse_git_dirty () { - [[ $(git status | tail -n1) != "nothing to commit (working directory clean)" ]] && echo " %{$fg[yellow]%}✗%{$reset_color%}" + if [[ $(git status | tail -n1) != "nothing to commit (working directory clean)" ]]; then + echo "$ZSH_THEME_GIT_PROMPT_DIRTY" + else + echo "$ZSH_THEME_GIT_PROMPT_CLEAN" + fi } + diff --git a/themes/geoffgarside.zsh-theme b/themes/geoffgarside.zsh-theme index 38733d95c..675ec7206 100644 --- a/themes/geoffgarside.zsh-theme +++ b/themes/geoffgarside.zsh-theme @@ -1,2 +1,5 @@ # PROMPT="[%*] %n:%c $(git_prompt_info)%(!.#.$) " PROMPT='[%*] %{$fg[cyan]%}%n%{$reset_color%}:%{$fg[green]%}%c%{$reset_color%}$(git_prompt_info) %(!.#.$) ' + +ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[yellow]%}git:(" +ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}" diff --git a/themes/maran.zsh-theme b/themes/maran.zsh-theme index 7523696f4..0f6e3b6bd 100644 --- a/themes/maran.zsh-theme +++ b/themes/maran.zsh-theme @@ -1,3 +1,6 @@ # Theme with full path names and hostname # Handy if you work on different servers all the time; -PROMPT='%{$fg[cyan]%}%n%{$reset_color%}@$fg[yellow]%}%M:%{$fg[green]%}%/%{$reset_color%} $(git_prompt_info) %(!.#.$) ' \ No newline at end of file +PROMPT='%{$fg[cyan]%}%n%{$reset_color%}@$fg[yellow]%}%M:%{$fg[green]%}%/%{$reset_color%} $(git_prompt_info) %(!.#.$) ' + +ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[cyan]%}git:(" +ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}" diff --git a/themes/risto.zsh-theme b/themes/risto.zsh-theme new file mode 100644 index 000000000..cb773a64e --- /dev/null +++ b/themes/risto.zsh-theme @@ -0,0 +1,6 @@ +# -*- sh -*- vim:set ft=sh ai et sw=4 sts=4: +# It might be bash like, but I can't have my co-workers knowing I use zsh +PROMPT='%{$fg[green]%}%n@%m:%{$fg_bold[blue]%}%2~ $(git_prompt_info)%{$reset_color%}%(!.#.$) ' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[red]%}‹" +ZSH_THEME_GIT_PROMPT_SUFFIX="›%{$reset_color%}" diff --git a/themes/robbyrussell.zsh-theme b/themes/robbyrussell.zsh-theme index d45796f7c..7b524e82d 100644 --- a/themes/robbyrussell.zsh-theme +++ b/themes/robbyrussell.zsh-theme @@ -1 +1,6 @@ PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" From dfe962246e9df552c25cb33448c706c5a9a83855 Mon Sep 17 00:00:00 2001 From: Christopher Sexton Date: Mon, 14 Sep 2009 13:06:47 -0400 Subject: [PATCH 044/614] Adding a little documentation for the git themes --- git.zsh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/git.zsh b/git.zsh index 591b77895..faf543fd0 100644 --- a/git.zsh +++ b/git.zsh @@ -1,4 +1,9 @@ -# +# Varables for themeing the git info prompt: +# ZSH_THEME_GIT_PROMPT_PREFIX - Prefix at the very beginning of the prompt, before the branch name +# ZSH_THEME_GIT_PROMPT_SUFFIX - At the very end of the prompt +# ZSH_THEME_GIT_PROMPT_DIRTY - Text to display if the branch is dirty +# ZSH_THEME_GIT_PROMPT_CLEAN - Text to display if the branch is clean + ZSH_THEME_GIT_PROMPT_PREFIX="git:(" ZSH_THEME_GIT_PROMPT_SUFFIX=")" ZSH_THEME_GIT_PROMPT_DIRTY="*" From 814157761eb407cdab9714fdf9c1f1588901df06 Mon Sep 17 00:00:00 2001 From: James Cox Date: Tue, 22 Sep 2009 16:39:53 +0100 Subject: [PATCH 045/614] some helpers to make directory traversal go easier.... --- aliases.zsh | 6 +++++- directories.zsh | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 directories.zsh diff --git a/aliases.zsh b/aliases.zsh index 253c2ac64..cd17781a6 100644 --- a/aliases.zsh +++ b/aliases.zsh @@ -10,6 +10,7 @@ alias .='pwd' alias ...='cd ../..' alias _='sudo' +alias ss='sudo su -' #alias g='grep -in' @@ -26,7 +27,10 @@ alias gba='git branch -a' alias history='fc -l 1' alias ls='ls -F' -alias ll='ls -al' +alias ll='ls -alr' +alias l='ls' +alias ll='ls -l' +alias sl=ls # often screw this up alias sgem='sudo gem' diff --git a/directories.zsh b/directories.zsh new file mode 100644 index 000000000..32b801470 --- /dev/null +++ b/directories.zsh @@ -0,0 +1,38 @@ +# Changing/making/removing directory + + +alias ..='cd ..' +alias cd..='cd ..' +alias cd...='cd ../..' +alias cd....='cd ../../..' +alias cd.....='cd ../../../..' +alias cd/='cd /' + +alias 1='cd -' +alias 2='cd +2' +alias 3='cd +3' +alias 4='cd +4' +alias 5='cd +5' +alias 6='cd +6' +alias 7='cd +7' +alias 8='cd +8' +alias 9='cd +9' + +cd () { + if [[ "x$*" == "x..." ]]; then + cd ../.. + elif [[ "x$*" == "x...." ]]; then + cd ../../.. + elif [[ "x$*" == "x....." ]]; then + cd ../../.. + elif [[ "x$*" == "x......" ]]; then + cd ../../../.. + else + builtin cd "$@" + fi +} + +alias md='mkdir -p' +alias rd=rmdir + +alias d='dirs -v' \ No newline at end of file From 039e17d84175b091137bfaff59ccfaa67a2300d6 Mon Sep 17 00:00:00 2001 From: James Cox Date: Tue, 22 Sep 2009 16:41:22 +0100 Subject: [PATCH 046/614] make correction work; this is a nicer way of handling typos in commands --- correction.zsh | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 correction.zsh diff --git a/correction.zsh b/correction.zsh new file mode 100644 index 000000000..c9fecb0fe --- /dev/null +++ b/correction.zsh @@ -0,0 +1,6 @@ +setopt correct_all + +alias man='nocorrect man' +alias mv='nocorrect mv' +alias mysql='nocorrect mysql' +alias mv='nocorrect mv' From dd18924536d8cbd8bdb165e4ec25d17a97e6f046 Mon Sep 17 00:00:00 2001 From: Christopher Sexton Date: Tue, 22 Sep 2009 14:38:24 -0400 Subject: [PATCH 047/614] Improved git prompt handling * Improved speed, the first time cd'ing into a git repo the prompt returns much faster (for me at least). * Prompt is now decorated in nested folders within a git repo. No longer check for the '.git' folder. --- git.zsh | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/git.zsh b/git.zsh index faf543fd0..bcf3ed77b 100644 --- a/git.zsh +++ b/git.zsh @@ -11,16 +11,10 @@ ZSH_THEME_GIT_PROMPT_CLEAN="" # get the name of the branch we are on function git_prompt_info() { - if [[ -d .git ]]; then - ref=$(git symbolic-ref HEAD 2> /dev/null) || return - branch=${ref#refs/heads/} - CURRENT_BRANCH="$ZSH_THEME_GIT_PROMPT_PREFIX${branch}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX" - else - CURRENT_BRANCH='' - fi - - echo $CURRENT_BRANCH + ref=$(git-symbolic-ref HEAD 2> /dev/null) || return + echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX" } + parse_git_dirty () { if [[ $(git status | tail -n1) != "nothing to commit (working directory clean)" ]]; then echo "$ZSH_THEME_GIT_PROMPT_DIRTY" From ff076cae5f12949c612c68ccbd65a8830989fba4 Mon Sep 17 00:00:00 2001 From: Christopher Sexton Date: Tue, 22 Sep 2009 14:48:55 -0400 Subject: [PATCH 048/614] Git 1.6 support `git-symbolic-ref` needs to be `git symbolic-ref` --- git.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git.zsh b/git.zsh index bcf3ed77b..9409c92db 100644 --- a/git.zsh +++ b/git.zsh @@ -11,7 +11,7 @@ ZSH_THEME_GIT_PROMPT_CLEAN="" # get the name of the branch we are on function git_prompt_info() { - ref=$(git-symbolic-ref HEAD 2> /dev/null) || return + ref=$(git symbolic-ref HEAD 2> /dev/null) || return echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX" } From 404fee6cb1982cebaa0d9ff925127820c642fc82 Mon Sep 17 00:00:00 2001 From: James Cox Date: Tue, 22 Sep 2009 23:01:55 +0100 Subject: [PATCH 049/614] add in xterms / title hacks --- xterms.zsh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 xterms.zsh diff --git a/xterms.zsh b/xterms.zsh new file mode 100644 index 000000000..17c6a104b --- /dev/null +++ b/xterms.zsh @@ -0,0 +1,16 @@ +# Specific to xterms, such as OS X terminal + +if [[ "${TERM}" == xterm* ]]; then + unset TMOUT + + precmd () { + print -Pn "\033]0;%n@%m %~\007" + #print -Pn "\033]0;%n@%m%# %~ %l %w :: %T\a" ## or use this + } + + preexec () { + print -Pn "\033]0;%n@%m <$1> %~\007" + #print -Pn "\033]0;%n@%m%# <$1> %~ %l %w :: %T\a" ## or use this + } + +fi \ No newline at end of file From 65bbe3fa6a066314e181e58cb3be7169771840d2 Mon Sep 17 00:00:00 2001 From: James Cox Date: Tue, 22 Sep 2009 23:02:18 +0100 Subject: [PATCH 050/614] minimalist --- themes/imajes.zsh-theme | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 themes/imajes.zsh-theme diff --git a/themes/imajes.zsh-theme b/themes/imajes.zsh-theme new file mode 100644 index 000000000..88c35b6d9 --- /dev/null +++ b/themes/imajes.zsh-theme @@ -0,0 +1,5 @@ +# Found on the ZshWiki +# http://zshwiki.org/home/config/prompt +# + +PROMPT="%{$fg[red]%}%%%{$reset_color%} " \ No newline at end of file From 82e2883a4138bc08912442da198d4e1c162d384f Mon Sep 17 00:00:00 2001 From: James Cox Date: Tue, 22 Sep 2009 23:27:28 +0100 Subject: [PATCH 051/614] some todo notes, take @chris2's titlebar improvements and poke at completions --- README.textile | 4 ++++ completion.zsh | 11 +++++++---- key-bindings.zsh | 22 +++++++++++++++++++++- xterms.zsh | 37 +++++++++++++++++++++---------------- 4 files changed, 53 insertions(+), 21 deletions(-) diff --git a/README.textile b/README.textile index bf4086916..851a5aba8 100644 --- a/README.textile +++ b/README.textile @@ -59,3 +59,7 @@ h3. Send us your theme! I'm hoping to collect a bunch of themes for our command prompts. You can see existing ones in the @themes/@ directory. +h3. Todo from imajes: + +* need to make the title bar support git folder +* \ No newline at end of file diff --git a/completion.zsh b/completion.zsh index dff71cfd3..c993620ce 100644 --- a/completion.zsh +++ b/completion.zsh @@ -1,6 +1,8 @@ +## fixme - the load process here seems a bit bizarre + setopt noautomenu -setopt COMPLETE_IN_WORD -setopt ALWAYS_TO_END +setopt complete_in_word +setopt always_to_end unsetopt flowcontrol @@ -17,9 +19,10 @@ zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l: zstyle ':completion:*' list-colors '' zstyle ':completion:*' hosts $( sed 's/[, ].*$//' $HOME/.ssh/known_hosts ) -unsetopt MENU_COMPLETE -setopt AUTO_MENU +#unsetopt MENU_COMPLETE +#setopt AUTO_MENU +# should this be in keybindings? bindkey -M menuselect '^o' accept-and-infer-next-history zstyle ':completion:*:*:*:*:*' menu yes select diff --git a/key-bindings.zsh b/key-bindings.zsh index 20caad11f..43082ae1f 100644 --- a/key-bindings.zsh +++ b/key-bindings.zsh @@ -11,4 +11,24 @@ bindkey "^[[H" beginning-of-line bindkey "^[[1~" beginning-of-line bindkey "^[[F" end-of-line bindkey "^[[4~" end-of-line -bindkey ' ' magic-space # also do history expansion on space \ No newline at end of file +bindkey ' ' magic-space # also do history expansion on space + + +# consider emacs keybindings: + +#bindkey -e ## emacs key bindings +# +#bindkey '^[[A' up-line-or-search +#bindkey '^[[B' down-line-or-search +#bindkey '^[^[[C' emacs-forward-word +#bindkey '^[^[[D' emacs-backward-word +# +#bindkey -s '^X^Z' '%-^M' +#bindkey '^[e' expand-cmd-path +#bindkey '^[^I' reverse-menu-complete +#bindkey '^X^N' accept-and-infer-next-history +#bindkey '^W' kill-region +#bindkey '^I' complete-word +## Fix weird sequence that rxvt produces +#bindkey -s '^[[Z' '\t' +# \ No newline at end of file diff --git a/xterms.zsh b/xterms.zsh index 17c6a104b..fef978748 100644 --- a/xterms.zsh +++ b/xterms.zsh @@ -1,16 +1,21 @@ -# Specific to xterms, such as OS X terminal - -if [[ "${TERM}" == xterm* ]]; then - unset TMOUT - - precmd () { - print -Pn "\033]0;%n@%m %~\007" - #print -Pn "\033]0;%n@%m%# %~ %l %w :: %T\a" ## or use this - } - - preexec () { - print -Pn "\033]0;%n@%m <$1> %~\007" - #print -Pn "\033]0;%n@%m%# <$1> %~ %l %w :: %T\a" ## or use this - } - -fi \ No newline at end of file +case "$TERM" in + xterm*|rxvt*) + preexec () { + print -Pn "\e]0;%n@%m: $1\a" # xterm + } + precmd () { + print -Pn "\e]0;%n@%m: %~\a" # xterm + } + ;; + screen*) + preexec () { + local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]} + echo -ne "\ek$CMD\e\\" + print -Pn "\e]0;%n@%m: $1\a" # xterm + } + precmd () { + echo -ne "\ekzsh\e\\" + print -Pn "\e]0;%n@%m: %~\a" # xterm + } + ;; +esac \ No newline at end of file From 2b8d218167297ea50ca2e0a9a6fda307b6f3da6a Mon Sep 17 00:00:00 2001 From: James Cox Date: Tue, 22 Sep 2009 23:36:25 +0100 Subject: [PATCH 052/614] would rather store history in $HOME and double size --- history.zsh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/history.zsh b/history.zsh index a093aa27c..b2c8c0361 100644 --- a/history.zsh +++ b/history.zsh @@ -7,9 +7,8 @@ setopt HIST_IGNORE_DUPS ## Command history configuration # -HISTFILE=$ZSH/log/.zsh_history -HISTSIZE=2500 -SAVEHIST=2500 +HISTFILE=$HOME/.zsh_history +HISTSIZE=5000 +SAVEHIST=5000 setopt hist_ignore_dups # ignore duplication command history list setopt share_history # share command history data - From dc6299b82e3b846534811824932bb3a8718041f5 Mon Sep 17 00:00:00 2001 From: Gary Blessington Date: Tue, 22 Sep 2009 16:09:20 -0700 Subject: [PATCH 053/614] Added a new theme --- themes/garyblessington.zsh-theme | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 themes/garyblessington.zsh-theme diff --git a/themes/garyblessington.zsh-theme b/themes/garyblessington.zsh-theme new file mode 100644 index 000000000..9431be6d8 --- /dev/null +++ b/themes/garyblessington.zsh-theme @@ -0,0 +1,6 @@ +PROMPT='%{%{$fg[cyan]%}%c%{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%}% %{$reset_color%}: ' + +ZSH_THEME_GIT_PROMPT_PREFIX="(%{$fg[blue]%}" +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]%})" From ee31f463f2a9d9a9f75baca0e18aad88a54da9ec Mon Sep 17 00:00:00 2001 From: James Cox Date: Wed, 23 Sep 2009 00:44:57 +0100 Subject: [PATCH 054/614] tidy up history --- history.zsh | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/history.zsh b/history.zsh index b2c8c0361..356b6498b 100644 --- a/history.zsh +++ b/history.zsh @@ -1,10 +1,3 @@ -# History stuff. -setopt HIST_VERIFY -setopt INC_APPEND_HISTORY -setopt SHARE_HISTORY -setopt EXTENDED_HISTORY -setopt HIST_IGNORE_DUPS - ## Command history configuration # HISTFILE=$HOME/.zsh_history @@ -12,3 +5,8 @@ HISTSIZE=5000 SAVEHIST=5000 setopt hist_ignore_dups # ignore duplication command history list setopt share_history # share command history data + +setopt hist_verify +setopt inc_append_history +setopt extended_history +setopt hist_expire_dups_first From ed3b5693db45c2404ed53d799ef3d63bf08eb921 Mon Sep 17 00:00:00 2001 From: James Cox Date: Wed, 23 Sep 2009 00:45:15 +0100 Subject: [PATCH 055/614] misc useful --- misc.zsh | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 misc.zsh diff --git a/misc.zsh b/misc.zsh new file mode 100644 index 000000000..c368cff95 --- /dev/null +++ b/misc.zsh @@ -0,0 +1,6 @@ +## smart urls +autoload -U url-quote-magic +zle -N self-insert url-quote-magic + +## file rename magick +bindkey "^[m" copy-prev-shell-word \ No newline at end of file From c5d82052842d2312f55e809b6eb3e1e5122c1742 Mon Sep 17 00:00:00 2001 From: James Cox Date: Wed, 23 Sep 2009 00:49:00 +0100 Subject: [PATCH 056/614] further refactorings --- .gitignore | 2 +- completion.zsh | 9 ++++++++- directories.zsh | 2 +- key-bindings.zsh | 2 ++ prompt.zsh | 17 +++++------------ 5 files changed, 17 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index 56d0a2122..e80740950 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ +locals.zsh log/.zsh_history - projects.zsh diff --git a/completion.zsh b/completion.zsh index c993620ce..795903d0d 100644 --- a/completion.zsh +++ b/completion.zsh @@ -19,7 +19,7 @@ zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l: zstyle ':completion:*' list-colors '' zstyle ':completion:*' hosts $( sed 's/[, ].*$//' $HOME/.ssh/known_hosts ) -#unsetopt MENU_COMPLETE +unsetopt MENU_COMPLETE #setopt AUTO_MENU # should this be in keybindings? @@ -31,3 +31,10 @@ zstyle ':completion:*:*:*:*:*' menu yes select zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01' zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm -w -w" zstyle ':completion:*:*:(ssh|scp):*:*' hosts `sed 's/^\([^ ,]*\).*$/\1/' ~/.ssh/known_hosts` + + +#complete on history +# zstyle ':completion:*:history-words' stop yes +# zstyle ':completion:*:history-words' remove-all-dups yes +# zstyle ':completion:*:history-words' list false +# zstyle ':completion:*:history-words' menu yes \ No newline at end of file diff --git a/directories.zsh b/directories.zsh index 32b801470..31d5336bf 100644 --- a/directories.zsh +++ b/directories.zsh @@ -1,5 +1,5 @@ # Changing/making/removing directory - +setopt auto_name_dirs alias ..='cd ..' alias cd..='cd ..' diff --git a/key-bindings.zsh b/key-bindings.zsh index 43082ae1f..2fae6d05d 100644 --- a/key-bindings.zsh +++ b/key-bindings.zsh @@ -1,6 +1,8 @@ # TODO: Explain what some of this does.. autoload -U compinit compinit + +bindkey -e bindkey '\ew' kill-region bindkey -s '\el' "ls\n" bindkey -s '\e.' "..\n" diff --git a/prompt.zsh b/prompt.zsh index 31c33feb5..39689684f 100644 --- a/prompt.zsh +++ b/prompt.zsh @@ -1,19 +1,12 @@ export PAGER=less export LC_CTYPE=en_US.UTF-8 -bindkey -e +# speed stuff. -# Directory stuff. -setopt AUTO_NAME_DIRS - -# Speed stuff. - -#setopt NO_BEEP -setopt AUTO_CD -setopt MULTIOS -setopt CDABLEVARS - -bindkey -e +#setopt no_beep +setopt auto_cd +setopt multios +setopt cdablevarS if [[ x$WINDOW != x ]] then From 1f7d917ca40ca61bf437f2b0d1e1515873e3f6f4 Mon Sep 17 00:00:00 2001 From: James Cox Date: Wed, 23 Sep 2009 01:18:15 +0100 Subject: [PATCH 057/614] more fixes, more or less have this as i want --- directories.zsh | 2 ++ functions.zsh | 1 + key-bindings.zsh | 5 +++++ misc.zsh | 5 ++++- 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/directories.zsh b/directories.zsh index 31d5336bf..56d7a2316 100644 --- a/directories.zsh +++ b/directories.zsh @@ -1,5 +1,7 @@ # Changing/making/removing directory setopt auto_name_dirs +setopt auto_pushd +setopt pushd_ignore_dups alias ..='cd ..' alias cd..='cd ..' diff --git a/functions.zsh b/functions.zsh index e3891f6fc..2fb096dd6 100644 --- a/functions.zsh +++ b/functions.zsh @@ -1,3 +1,4 @@ +## fixme, i duplicated this in xterms - oops function title { if [[ $TERM == "screen" ]]; then # Use these two for GNU Screen: diff --git a/key-bindings.zsh b/key-bindings.zsh index 2fae6d05d..87e47bab6 100644 --- a/key-bindings.zsh +++ b/key-bindings.zsh @@ -9,6 +9,11 @@ bindkey -s '\e.' "..\n" bindkey '^r' history-incremental-search-backward bindkey "^[[5~" up-line-or-history bindkey "^[[6~" down-line-or-history + +# make search up and down work, so partially type and hit up/down to find relevant stuff +bindkey '^[[A' up-line-or-search +bindkey '^[[B' down-line-or-search + bindkey "^[[H" beginning-of-line bindkey "^[[1~" beginning-of-line bindkey "^[[F" end-of-line diff --git a/misc.zsh b/misc.zsh index c368cff95..fab4be931 100644 --- a/misc.zsh +++ b/misc.zsh @@ -3,4 +3,7 @@ autoload -U url-quote-magic zle -N self-insert url-quote-magic ## file rename magick -bindkey "^[m" copy-prev-shell-word \ No newline at end of file +bindkey "^[m" copy-prev-shell-word + +## jobs +setopt long_list_jobs \ No newline at end of file From fc796262ab43e1e16ca10cf614f66dcd1ec97cbb Mon Sep 17 00:00:00 2001 From: James Cox Date: Wed, 23 Sep 2009 01:20:08 +0100 Subject: [PATCH 058/614] add in refcard note --- README.textile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.textile b/README.textile index 851a5aba8..1735e150f 100644 --- a/README.textile +++ b/README.textile @@ -42,6 +42,9 @@ TODO: Update this.. ** Take a look at the "current themes":http://wiki.github.com/robbyrussell/oh-my-zsh/themes that come bundled with Oh My Zsh. * much much more.. +h2. Useful +the "refcard":http://www.bash2zsh.com/zsh_refcard/refcard.pdf is pretty tasty for tips. + h3. Uninstalling If you want to uninstall it, just run @uninstall_oh_my_zsh@ from the command line and it'll remove itself and revert you to bash (or your previous zsh config). From b3defd37672de23a4bf5f869578d1620eca4cbc2 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Tue, 22 Sep 2009 20:36:28 -0700 Subject: [PATCH 059/614] Using compctl instead of compdef to resolve Issue #1 --- rake_completion.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rake_completion.zsh b/rake_completion.zsh index 239fe15a3..c425a625e 100644 --- a/rake_completion.zsh +++ b/rake_completion.zsh @@ -17,7 +17,7 @@ _rake () { fi } -compdef _rake rake +compctl -K _rake rake function _cap_does_task_list_need_generating () { if [ ! -f .cap_tasks~ ]; then return 0; @@ -39,4 +39,4 @@ function _cap () { fi } -compdef _cap cap +compctl -K _cap cap From 8dd06e3c7334b09a4d15562af734dbc18a1c5b89 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Wed, 23 Sep 2009 07:43:36 -0700 Subject: [PATCH 060/614] Moving all zsh config options into a lib/ subdirectory to make way for some upcoming changes to directory structure and configuration options --- aliases.zsh => lib/aliases.zsh | 0 colors.zsh => lib/colors.zsh | 0 completion.zsh => lib/completion.zsh | 0 functions.zsh => lib/functions.zsh | 0 git.zsh => lib/git.zsh | 0 grep.zsh => lib/grep.zsh | 0 history.zsh => lib/history.zsh | 0 key-bindings.zsh => lib/key-bindings.zsh | 0 prompt.zsh => lib/prompt.zsh | 0 rake_completion.zsh => lib/rake_completion.zsh | 0 oh-my-zsh.sh | 2 +- 11 files changed, 1 insertion(+), 1 deletion(-) rename aliases.zsh => lib/aliases.zsh (100%) rename colors.zsh => lib/colors.zsh (100%) rename completion.zsh => lib/completion.zsh (100%) rename functions.zsh => lib/functions.zsh (100%) rename git.zsh => lib/git.zsh (100%) rename grep.zsh => lib/grep.zsh (100%) rename history.zsh => lib/history.zsh (100%) rename key-bindings.zsh => lib/key-bindings.zsh (100%) rename prompt.zsh => lib/prompt.zsh (100%) rename rake_completion.zsh => lib/rake_completion.zsh (100%) diff --git a/aliases.zsh b/lib/aliases.zsh similarity index 100% rename from aliases.zsh rename to lib/aliases.zsh diff --git a/colors.zsh b/lib/colors.zsh similarity index 100% rename from colors.zsh rename to lib/colors.zsh diff --git a/completion.zsh b/lib/completion.zsh similarity index 100% rename from completion.zsh rename to lib/completion.zsh diff --git a/functions.zsh b/lib/functions.zsh similarity index 100% rename from functions.zsh rename to lib/functions.zsh diff --git a/git.zsh b/lib/git.zsh similarity index 100% rename from git.zsh rename to lib/git.zsh diff --git a/grep.zsh b/lib/grep.zsh similarity index 100% rename from grep.zsh rename to lib/grep.zsh diff --git a/history.zsh b/lib/history.zsh similarity index 100% rename from history.zsh rename to lib/history.zsh diff --git a/key-bindings.zsh b/lib/key-bindings.zsh similarity index 100% rename from key-bindings.zsh rename to lib/key-bindings.zsh diff --git a/prompt.zsh b/lib/prompt.zsh similarity index 100% rename from prompt.zsh rename to lib/prompt.zsh diff --git a/rake_completion.zsh b/lib/rake_completion.zsh similarity index 100% rename from rake_completion.zsh rename to lib/rake_completion.zsh diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index b931f558a..40c73cb49 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -2,4 +2,4 @@ # Load all of the config files in ~/oh-my-zsh that end in .zsh # TIP: Add files you don't want in git to .gitignore -for config_file ($ZSH/*.zsh) source $config_file +for config_file ($ZSH/lib/*.zsh) source $config_file From 8d2244ed5903ff4d24d6bc27b204c974d6e738de Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Wed, 23 Sep 2009 08:02:58 -0700 Subject: [PATCH 061/614] Moving some example files into custom/ --- projects.zsh-example => custom/example.zsh | 0 oh-my-zsh.sh | 3 +++ 2 files changed, 3 insertions(+) rename projects.zsh-example => custom/example.zsh (100%) diff --git a/projects.zsh-example b/custom/example.zsh similarity index 100% rename from projects.zsh-example rename to custom/example.zsh diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 40c73cb49..6e73519b5 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -3,3 +3,6 @@ # Load all of the config files in ~/oh-my-zsh that end in .zsh # TIP: Add files you don't want in git to .gitignore for config_file ($ZSH/lib/*.zsh) source $config_file + +# Load all of your custom configurations from custom/ +for config_file ($ZSH/custom/*.zsh) source $config_file From 1fb89c35556cb982e4e2952c8f0b4b204780bda1 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Wed, 23 Sep 2009 08:03:38 -0700 Subject: [PATCH 062/614] Updating .gitignore to ignore everything but the example.zsh file in custom/ --- .gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 56d0a2122..e79e3ee0b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ log/.zsh_history -projects.zsh +custom/*.zsh +# !custom/example.zsh + From 33b9f73e3190b679f131efb2ab5ffc6e00d74bab Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Wed, 23 Sep 2009 08:05:05 -0700 Subject: [PATCH 063/614] not ignoring example.zsh --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index e79e3ee0b..551ba0bdf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ log/.zsh_history custom/*.zsh -# !custom/example.zsh +!custom/example.zsh From 9560d0b8c0d8bde9b1df396751c1334af6ded562 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Wed, 23 Sep 2009 08:06:32 -0700 Subject: [PATCH 064/614] Updating README to mention custom/ directory --- README.textile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.textile b/README.textile index bf4086916..787a9050e 100644 --- a/README.textile +++ b/README.textile @@ -42,6 +42,10 @@ TODO: Update this.. ** Take a look at the "current themes":http://wiki.github.com/robbyrussell/oh-my-zsh/themes that come bundled with Oh My Zsh. * much much more.. +h3. Customization + +If you want to override any of the default behavior, just add a new file (ending in @.zsh@) into the @custom/@ directory. + h3. Uninstalling If you want to uninstall it, just run @uninstall_oh_my_zsh@ from the command line and it'll remove itself and revert you to bash (or your previous zsh config). From 644e54e839a163afe3b95a604909744dab64f35e Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Wed, 23 Sep 2009 08:07:02 -0700 Subject: [PATCH 065/614] Bumping up history to 10k commands --- lib/history.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/history.zsh b/lib/history.zsh index a093aa27c..f7b63b7cd 100644 --- a/lib/history.zsh +++ b/lib/history.zsh @@ -8,8 +8,8 @@ setopt HIST_IGNORE_DUPS ## Command history configuration # HISTFILE=$ZSH/log/.zsh_history -HISTSIZE=2500 -SAVEHIST=2500 +HISTSIZE=10000 +SAVEHIST=10000 setopt hist_ignore_dups # ignore duplication command history list setopt share_history # share command history data From 7a2bfbe5261826ccad1e401117dcc71f5afef28a Mon Sep 17 00:00:00 2001 From: James Cox Date: Wed, 23 Sep 2009 16:14:43 +0100 Subject: [PATCH 066/614] put everything in lib --- correction.zsh => lib/correction.zsh | 0 directories.zsh => lib/directories.zsh | 0 misc.zsh => lib/misc.zsh | 0 xterms.zsh => lib/termsupport.zsh | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename correction.zsh => lib/correction.zsh (100%) rename directories.zsh => lib/directories.zsh (100%) rename misc.zsh => lib/misc.zsh (100%) rename xterms.zsh => lib/termsupport.zsh (100%) diff --git a/correction.zsh b/lib/correction.zsh similarity index 100% rename from correction.zsh rename to lib/correction.zsh diff --git a/directories.zsh b/lib/directories.zsh similarity index 100% rename from directories.zsh rename to lib/directories.zsh diff --git a/misc.zsh b/lib/misc.zsh similarity index 100% rename from misc.zsh rename to lib/misc.zsh diff --git a/xterms.zsh b/lib/termsupport.zsh similarity index 100% rename from xterms.zsh rename to lib/termsupport.zsh From f9ba4113e6839edad1d6f195774b0cdc613f1e31 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Wed, 23 Sep 2009 17:11:45 -0700 Subject: [PATCH 067/614] Adding a script to check for upgrades --- tools/check_for_upgrade.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 tools/check_for_upgrade.sh diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh new file mode 100644 index 000000000..feb999aff --- /dev/null +++ b/tools/check_for_upgrade.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +current_epoch=$(($(date +%s) / 60 / 60 / 24)) + +if [ -f ~/.zsh-update ] +then + source ~/.zsh-update + epoch_diff=$(($current_epoch - $LAST_EPOCH)) + if [ $epoch_diff -gt 6 ] + then + echo "[Oh My Zsh] Would you like to check for updates?" + echo "Type Y to update oh-my-zsh: \c" + read line + if [ "$line" = Y ] || [ "$line" = y ] + then + /bin/sh $ZSH/tools/upgrade.sh + fi + + # Set the last epoch to the current so that we don't ask for another week + echo "LAST_EPOCH=${current_epoch}" > ~/.zsh-update + fi +else + # TODO: refactor this so remove duplicates + # Create the ~/.zsh-update file with the current epoch info + echo "LAST_EPOCH=${current_epoch}" > ~/.zsh-update +fi + + From ed457cbee7a9f1b962848272fb7eda6b4af010c3 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Wed, 23 Sep 2009 17:12:19 -0700 Subject: [PATCH 068/614] Oh My Zsh gets a weekly auto-updater... the future is now! --- lib/misc.zsh | 10 +++++++++- templates/zshrc.zsh-template | 3 +++ tools/upgrade.sh | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/misc.zsh b/lib/misc.zsh index fab4be931..8d6727251 100644 --- a/lib/misc.zsh +++ b/lib/misc.zsh @@ -6,4 +6,12 @@ zle -N self-insert url-quote-magic bindkey "^[m" copy-prev-shell-word ## jobs -setopt long_list_jobs \ No newline at end of file +setopt long_list_jobs + +# Check for updates on initial load... +if [ "$DISABLE_AUTO_UPDATE" = "true" ] +then + return +else + /bin/sh $ZSH/tools/check_for_upgrade.sh +fi diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template index b8da51428..787dc3d09 100644 --- a/templates/zshrc.zsh-template +++ b/templates/zshrc.zsh-template @@ -5,6 +5,9 @@ export ZSH=$HOME/.oh-my-zsh # Look in ~/.oh-my-zsh/themes/ export ZSH_THEME="robbyrussell" +# Comment this out to disable weekly auto-update checks +# export DISABLE_AUTO_UPDATE="false" + source $ZSH/oh-my-zsh.sh # Customize to your needs... diff --git a/tools/upgrade.sh b/tools/upgrade.sh index fa07daaea..f749404e9 100644 --- a/tools/upgrade.sh +++ b/tools/upgrade.sh @@ -1,5 +1,5 @@ current_path=`pwd` echo "Upgrading Oh My Zsh" ( cd $ZSH && git pull origin master ) -echo "Done." +echo "Hooray! Oh My Zsh has been updated and/or is at the current version. \nAny new updates will be reflected when you start your next terminal session." cd $current_path \ No newline at end of file From 5e2ad9a8ed883d75afc18b9a8b17ff563e2bfee5 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Thu, 1 Oct 2009 08:55:07 +0100 Subject: [PATCH 069/614] run update check *after* running custom configuration scripts. This means we are running it after $PATH has potentially been set up, which means it's more likely that commands like "git" will be found --- lib/misc.zsh | 8 -------- oh-my-zsh.sh | 8 ++++++++ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/misc.zsh b/lib/misc.zsh index 8d6727251..a01627d9e 100644 --- a/lib/misc.zsh +++ b/lib/misc.zsh @@ -7,11 +7,3 @@ bindkey "^[m" copy-prev-shell-word ## jobs setopt long_list_jobs - -# Check for updates on initial load... -if [ "$DISABLE_AUTO_UPDATE" = "true" ] -then - return -else - /bin/sh $ZSH/tools/check_for_upgrade.sh -fi diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 6e73519b5..4b5959625 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -6,3 +6,11 @@ for config_file ($ZSH/lib/*.zsh) source $config_file # Load all of your custom configurations from custom/ for config_file ($ZSH/custom/*.zsh) source $config_file + +# Check for updates on initial load... +if [ "$DISABLE_AUTO_UPDATE" = "true" ] +then + return +else + /bin/sh $ZSH/tools/check_for_upgrade.sh +fi From 77f632bca6c51338dc6bef84f45e53c8a0615070 Mon Sep 17 00:00:00 2001 From: Markus Prinz Date: Sat, 3 Oct 2009 19:34:49 +0200 Subject: [PATCH 070/614] Add my (cypher's) zsh prompt Based on Evan's prompt, it uses colors, shows the exit status of the last command if it was non-zero, and displays "#" when running with elevated privileges --- themes/cypher.zsh-theme | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 themes/cypher.zsh-theme diff --git a/themes/cypher.zsh-theme b/themes/cypher.zsh-theme new file mode 100644 index 000000000..36633da26 --- /dev/null +++ b/themes/cypher.zsh-theme @@ -0,0 +1,4 @@ +# Based on evan's prompt +# Shows the exit status of the last command if non-zero +# Uses "#" instead of "»" when running with elevated privileges +PROMPT="%m %B%F{red}::%b %B%F{green}%3~%(0?. . %F{red}%? )%F{red}%(0!.#.»)%b%F{white} " From 62901a68db2efcfdc7a397e756b8d58b070611e9 Mon Sep 17 00:00:00 2001 From: Markus Prinz Date: Sat, 3 Oct 2009 19:48:29 +0200 Subject: [PATCH 071/614] Make "-" an alias for "cd -" (cd back to previous directory) --- lib/aliases.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/aliases.zsh b/lib/aliases.zsh index cd17781a6..6f6c614f7 100644 --- a/lib/aliases.zsh +++ b/lib/aliases.zsh @@ -8,6 +8,7 @@ alias ss='thin --stats "/thin/stats" start' alias mr='mate CHANGELOG app config db lib public script spec test' alias .='pwd' alias ...='cd ../..' +alias -- -='cd -' alias _='sudo' alias ss='sudo su -' From 577536ced6b5188afc96033b8d85b843b2bb1795 Mon Sep 17 00:00:00 2001 From: xiongchiamiov Date: Mon, 5 Oct 2009 19:23:12 -0700 Subject: [PATCH 072/614] add xiong-chiamiov theme --- themes/xiong-chiamiov.zsh-theme | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 themes/xiong-chiamiov.zsh-theme diff --git a/themes/xiong-chiamiov.zsh-theme b/themes/xiong-chiamiov.zsh-theme new file mode 100644 index 000000000..7c4c2e4f8 --- /dev/null +++ b/themes/xiong-chiamiov.zsh-theme @@ -0,0 +1,6 @@ +# 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 +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{"%a %b %d, %I:%M"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} +%{\e[0;34m%}%B└─%B[%{\e[1;35m%}$%{\e[0;34m%}%B]>%{\e[0m%}%b ' +PS2=$' \e[0;34m%}%B>%{\e[0m%}%b ' From 061846b0f22a90f23f29b7c6cc6524b7b1b131dc Mon Sep 17 00:00:00 2001 From: Markus Prinz Date: Tue, 6 Oct 2009 23:19:43 +0200 Subject: [PATCH 073/614] Fix cypher's theme for older zsh versions --- themes/cypher.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/cypher.zsh-theme b/themes/cypher.zsh-theme index 36633da26..45df53d22 100644 --- a/themes/cypher.zsh-theme +++ b/themes/cypher.zsh-theme @@ -1,4 +1,4 @@ # Based on evan's prompt # Shows the exit status of the last command if non-zero # Uses "#" instead of "»" when running with elevated privileges -PROMPT="%m %B%F{red}::%b %B%F{green}%3~%(0?. . %F{red}%? )%F{red}%(0!.#.»)%b%F{white} " +PROMPT="%m %{${fg_bold[red]}%}:: %{${fg[green]}%}%3~%(0?. . ${fg[red]}%? )%{${fg[blue]}%}»%{${reset_color}%} " From 92f2cf94adfd811157fcd981a42274dcdf392d04 Mon Sep 17 00:00:00 2001 From: Matthew Donoughe Date: Wed, 7 Oct 2009 20:01:52 +0000 Subject: [PATCH 074/614] allow case sensitivity to be toggled --- lib/completion.zsh | 7 ++++++- templates/zshrc.zsh-template | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/completion.zsh b/lib/completion.zsh index 795903d0d..11f67249f 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -14,7 +14,12 @@ compinit zmodload -i zsh/complist ## case-insensitive (all),partial-word and then substring completion -zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' +if [ "$CASE_SENSITIVE" ]; then + zstyle ':completion:*' matcher-list 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' + unset CASE_SENSITIVE +else + zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' +fi zstyle ':completion:*' list-colors '' zstyle ':completion:*' hosts $( sed 's/[, ].*$//' $HOME/.ssh/known_hosts ) diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template index 787dc3d09..7c43303bd 100644 --- a/templates/zshrc.zsh-template +++ b/templates/zshrc.zsh-template @@ -5,6 +5,9 @@ export ZSH=$HOME/.oh-my-zsh # Look in ~/.oh-my-zsh/themes/ export ZSH_THEME="robbyrussell" +# Set to this to use case-sensitive completion +# export CASE_SENSITIVE="true" + # Comment this out to disable weekly auto-update checks # export DISABLE_AUTO_UPDATE="false" From a44b5660bf4b76c9b1d56a3805f22417e6370ced Mon Sep 17 00:00:00 2001 From: Matthew Donoughe Date: Wed, 7 Oct 2009 20:08:54 +0000 Subject: [PATCH 075/614] should probably use the value of CASE_INSENSITIVE --- lib/completion.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/completion.zsh b/lib/completion.zsh index 11f67249f..68ca3b4c1 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -14,7 +14,7 @@ compinit zmodload -i zsh/complist ## case-insensitive (all),partial-word and then substring completion -if [ "$CASE_SENSITIVE" ]; then +if [ "x$CASE_SENSITIVE" = "xtrue" ]; then zstyle ':completion:*' matcher-list 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' unset CASE_SENSITIVE else @@ -42,4 +42,4 @@ zstyle ':completion:*:*:(ssh|scp):*:*' hosts `sed 's/^\([^ ,]*\).*$/\1/' ~/.ssh/ # zstyle ':completion:*:history-words' stop yes # zstyle ':completion:*:history-words' remove-all-dups yes # zstyle ':completion:*:history-words' list false -# zstyle ':completion:*:history-words' menu yes \ No newline at end of file +# zstyle ':completion:*:history-words' menu yes From 5ddd5914f2a90e35147806f5a15338fa0fb60b33 Mon Sep 17 00:00:00 2001 From: Wesley Moore Date: Thu, 8 Oct 2009 09:50:32 +1100 Subject: [PATCH 076/614] Add my own theme --- themes/wezm.zsh-theme | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 themes/wezm.zsh-theme diff --git a/themes/wezm.zsh-theme b/themes/wezm.zsh-theme new file mode 100644 index 000000000..1881343b0 --- /dev/null +++ b/themes/wezm.zsh-theme @@ -0,0 +1,7 @@ +PROMPT='$(git_prompt_info)%(?,,%{${fg_bold[white]}%}[%?]%{$reset_color%} )%{$fg[yellow]%}%#%{$reset_color%} ' +RPROMPT='%{$fg[green]%}%~%{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[blue]%}(" +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]%})" From 14c7bfcef7c14d7029adad36c2e2a7ba5e38c187 Mon Sep 17 00:00:00 2001 From: Gerhard Lazu Date: Sun, 11 Oct 2009 09:50:08 +0100 Subject: [PATCH 077/614] Replaced source with . --- tools/check_for_upgrade.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh index feb999aff..5c212b6fa 100644 --- a/tools/check_for_upgrade.sh +++ b/tools/check_for_upgrade.sh @@ -4,7 +4,7 @@ current_epoch=$(($(date +%s) / 60 / 60 / 24)) if [ -f ~/.zsh-update ] then - source ~/.zsh-update + . ~/.zsh-update epoch_diff=$(($current_epoch - $LAST_EPOCH)) if [ $epoch_diff -gt 6 ] then From d4d5795473c13f734d9f1f3b904ff9344861ace5 Mon Sep 17 00:00:00 2001 From: Gerhard Lazu Date: Sun, 11 Oct 2009 09:56:22 +0100 Subject: [PATCH 078/614] Added git diff for vim (gdv) --- lib/aliases.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/aliases.zsh b/lib/aliases.zsh index 6f6c614f7..c4388febb 100644 --- a/lib/aliases.zsh +++ b/lib/aliases.zsh @@ -20,6 +20,7 @@ alias gst='git status' alias gl='git pull' alias gp='git push' alias gd='git diff | mate' +alias gdv='git diff -w "$@" | vim -R -' alias gc='git commit -v' alias gca='git commit -v -a' alias gb='git branch' From bd63d88c80ac30a84ded4a9134d313b681c1064a Mon Sep 17 00:00:00 2001 From: Gerhard Lazu Date: Sun, 11 Oct 2009 14:49:24 +0100 Subject: [PATCH 079/614] Added ack-grep searching --- lib/aliases.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/aliases.zsh b/lib/aliases.zsh index c4388febb..5f3582bd8 100644 --- a/lib/aliases.zsh +++ b/lib/aliases.zsh @@ -37,6 +37,7 @@ alias sl=ls # often screw this up alias sgem='sudo gem' alias rfind='find . -name *.rb | xargs grep -n' +alias afind='ack-grep -il' alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk' From 6e4f33d2251364ef2aab22d965ad31c92f8ed522 Mon Sep 17 00:00:00 2001 From: Gerhard Lazu Date: Sun, 11 Oct 2009 15:09:10 +0100 Subject: [PATCH 080/614] Added more aliases for Rails & git --- lib/aliases.zsh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/aliases.zsh b/lib/aliases.zsh index 5f3582bd8..273bcc679 100644 --- a/lib/aliases.zsh +++ b/lib/aliases.zsh @@ -2,8 +2,14 @@ alias pu='pushd' alias po='popd' alias sc='ruby script/console' +alias sdb='ruby script/dbconsole' alias sd='ruby script/server --debugger' alias ss='thin --stats "/thin/stats" start' +alias sg='ruby script/generate' +alias sd='ruby script/destroy' +alias sp='ruby script/plugin' +alias ssp='ruby script/spec' +alias rdbm='rake db:migrate' alias mr='mate CHANGELOG app config db lib public script spec test' alias .='pwd' @@ -18,6 +24,7 @@ alias ss='sudo su -' alias g='git' alias gst='git status' alias gl='git pull' +alias gup='git fetch && git rebase' alias gp='git push' alias gd='git diff | mate' alias gdv='git diff -w "$@" | vim -R -' @@ -25,6 +32,8 @@ alias gc='git commit -v' alias gca='git commit -v -a' alias gb='git branch' alias gba='git branch -a' +alias gdb='git branch -d' +alias gcount='git shortlog -sn' alias history='fc -l 1' From 0b724396e3443d67de44aa9ef4ac2f160d027315 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Mon, 26 Oct 2009 09:09:00 -0700 Subject: [PATCH 081/614] Merging conflict. 788c9af05684f4b9e39e7f15de2c06c4c8291cbd --- lib/aliases.zsh | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/aliases.zsh b/lib/aliases.zsh index 304bafd27..69f2eee15 100644 --- a/lib/aliases.zsh +++ b/lib/aliases.zsh @@ -55,6 +55,3 @@ alias et='mate . &' alias ett='mate app config lib db public spec test Rakefile Capfile Todo &' alias etp='mate app config lib db public spec test vendor/plugins vendor/gems Rakefile Capfile Todo &' alias etts='mate app config lib db public script spec test vendor/plugins vendor/gems Rakefile Capfile Todo &' - - - From f706f53c7c63ab1d77c9bbf7c88f447ba2f3a5bf Mon Sep 17 00:00:00 2001 From: Gerhard Lazu Date: Mon, 12 Oct 2009 07:56:55 +0100 Subject: [PATCH 082/614] ll doesn't show hidden files, lsa does --- lib/aliases.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/aliases.zsh b/lib/aliases.zsh index 69f2eee15..d340c08ae 100644 --- a/lib/aliases.zsh +++ b/lib/aliases.zsh @@ -39,6 +39,7 @@ alias gcp='git cherry-pick' alias history='fc -l 1' alias ls='ls -F' +alias lsa='ls -lah' alias ll='ls -alr' alias l='ls' alias ll='ls -l' From 1617d8116dfea9194ce33ecd6818cce5bf4e7c64 Mon Sep 17 00:00:00 2001 From: To1ne Date: Mon, 12 Oct 2009 21:17:36 +0200 Subject: [PATCH 083/614] Added some comment --- lib/aliases.zsh | 28 ++++++++++++++++++++++------ lib/completion.zsh | 5 ++--- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/lib/aliases.zsh b/lib/aliases.zsh index cd17781a6..da6168506 100644 --- a/lib/aliases.zsh +++ b/lib/aliases.zsh @@ -1,19 +1,23 @@ +#!/bin/zsh + +# Push and pop directories on directory stack alias pu='pushd' alias po='popd' -alias sc='ruby script/console' -alias sd='ruby script/server --debugger' +# Ruby related alias ss='thin --stats "/thin/stats" start' -alias mr='mate CHANGELOG app config db lib public script spec test' +# Basic directory operations alias .='pwd' alias ...='cd ../..' +# Super user alias _='sudo' alias ss='sudo su -' #alias g='grep -in' +# Git related alias g='git' alias gst='git status' alias gl='git pull' @@ -24,24 +28,36 @@ alias gca='git commit -v -a' alias gb='git branch' alias gba='git branch -a' +# Show history alias history='fc -l 1' -alias ls='ls -F' +# List direcory contents +#alias ls='ls -F' # This messes up colors on my linux system +alias l='ls -la' alias ll='ls -alr' -alias l='ls' -alias ll='ls -l' alias sl=ls # often screw this up alias sgem='sudo gem' +# Find ruby file alias rfind='find . -name *.rb | xargs grep -n' +# Git and svn mix alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk' +# TextMate alias et='mate . &' alias ett='mate app config lib db public spec test Rakefile Capfile Todo &' alias etp='mate app config lib db public spec test vendor/plugins vendor/gems Rakefile Capfile Todo &' alias etts='mate app config lib db public script spec test vendor/plugins vendor/gems Rakefile Capfile Todo &' +## Ruby related +# Ruby scripts +alias sc='ruby script/console' +alias sd='ruby script/server --debugger' + +# Editor Ruby file in TextMate +alias mr='mate CHANGELOG app config db lib public script spec test' + diff --git a/lib/completion.zsh b/lib/completion.zsh index 795903d0d..7a564d640 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -14,7 +14,7 @@ compinit zmodload -i zsh/complist ## case-insensitive (all),partial-word and then substring completion -zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' +#zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' zstyle ':completion:*' list-colors '' zstyle ':completion:*' hosts $( sed 's/[, ].*$//' $HOME/.ssh/known_hosts ) @@ -32,8 +32,7 @@ zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z- zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm -w -w" zstyle ':completion:*:*:(ssh|scp):*:*' hosts `sed 's/^\([^ ,]*\).*$/\1/' ~/.ssh/known_hosts` - -#complete on history +# Complete on history # zstyle ':completion:*:history-words' stop yes # zstyle ':completion:*:history-words' remove-all-dups yes # zstyle ':completion:*:history-words' list false From 3efe8e50c5e002edd2321f0cf521b546c1c8eb7c Mon Sep 17 00:00:00 2001 From: James Salter Date: Tue, 13 Oct 2009 12:34:53 +1100 Subject: [PATCH 084/614] added gcp alias (git cherry-pick) --- lib/aliases.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/aliases.zsh b/lib/aliases.zsh index 273bcc679..f7d622149 100644 --- a/lib/aliases.zsh +++ b/lib/aliases.zsh @@ -34,6 +34,7 @@ alias gb='git branch' alias gba='git branch -a' alias gdb='git branch -d' alias gcount='git shortlog -sn' +alias gcp='git cherry-pick' alias history='fc -l 1' From e1332bd5006b212593688b08a3967efdbebf6c60 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Mon, 12 Oct 2009 19:13:52 -0700 Subject: [PATCH 085/614] Renaming script/server --debug alias to ssd to avoid conflict. Closes #1 --- lib/aliases.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/aliases.zsh b/lib/aliases.zsh index f7d622149..304bafd27 100644 --- a/lib/aliases.zsh +++ b/lib/aliases.zsh @@ -3,7 +3,7 @@ alias po='popd' alias sc='ruby script/console' alias sdb='ruby script/dbconsole' -alias sd='ruby script/server --debugger' +alias ssd='ruby script/server --debugger' alias ss='thin --stats "/thin/stats" start' alias sg='ruby script/generate' alias sd='ruby script/destroy' From 136df77b17e81760c6b20cb9d5ef5ccba075545c Mon Sep 17 00:00:00 2001 From: Gerhard Lazu Date: Wed, 14 Oct 2009 14:12:17 +0100 Subject: [PATCH 086/614] lsa now uses coloring --- lib/aliases.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/aliases.zsh b/lib/aliases.zsh index d340c08ae..855dfeb18 100644 --- a/lib/aliases.zsh +++ b/lib/aliases.zsh @@ -39,7 +39,7 @@ alias gcp='git cherry-pick' alias history='fc -l 1' alias ls='ls -F' -alias lsa='ls -lah' +alias lsa='ls -lahG' alias ll='ls -alr' alias l='ls' alias ll='ls -l' From cf10659564baa91b5707407b8d4a9470db50d595 Mon Sep 17 00:00:00 2001 From: James Adam Date: Tue, 20 Oct 2009 06:24:21 +0800 Subject: [PATCH 087/614] Added my prompt theme, with a tweak to the core oh-my-zsh to support it. My git_prompt_info function not only reports the branch and dirty status, but also whether or not the branch is ahead or behind of the remote, or both. It also switches the prompt colour from green to red if the previous command exited with a non-zero value (i.e. failed). --- lib/termsupport.zsh | 2 ++ themes/lazyatom.zsh-theme | 40 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 themes/lazyatom.zsh-theme diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index fef978748..ec828c287 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -4,6 +4,7 @@ case "$TERM" in print -Pn "\e]0;%n@%m: $1\a" # xterm } precmd () { + oh_my_zsh_theme_precmd print -Pn "\e]0;%n@%m: %~\a" # xterm } ;; @@ -14,6 +15,7 @@ case "$TERM" in print -Pn "\e]0;%n@%m: $1\a" # xterm } precmd () { + oh_my_zsh_theme_precmd echo -ne "\ekzsh\e\\" print -Pn "\e]0;%n@%m: %~\a" # xterm } diff --git a/themes/lazyatom.zsh-theme b/themes/lazyatom.zsh-theme new file mode 100644 index 000000000..6263bc2b7 --- /dev/null +++ b/themes/lazyatom.zsh-theme @@ -0,0 +1,40 @@ +git_prompt_info() { + branch=$(git symbolic-ref HEAD 2> /dev/null) || return + git_status="$(git status 2> /dev/null)" + state="" + case $git_status in + *Changed\ but\ not\ updated*) + state="%{$fg[red]%}⚡" + ;;; + *Untracked\ files*) + state="%{$fg[red]%}⚡" + ;;; + esac + + remote="" + case $git_status in + *Your\ branch\ is\ ahead*) + remote="%{$fg[yellow]%}↑" + ;;; + + *Your\ branch\ is\ behind*) + remote="%{$fg[yellow]%}↓" + ;;; + + "Your branch and") + remote="%{$fg[yellow]%}" + ;;; + esac + echo " %{$fg[yellow]%}(${branch#refs/heads/})${remote}${state}" +} + +function oh_my_zsh_theme_precmd() { + local previous_return_value=$?; + prompt="%{$fg[light_gray]%}%c%{$fg[yellow]%}$(git_prompt_info)%{$fg[white]%}" + if test $previous_return_value -eq 0 + then + export PROMPT="%{$fg[green]%}➜ %{$fg[white]%}${prompt}%{$fg[green]%} $%{$fg[white]%} " + else + export PROMPT="%{$fg[red]%}➜ %{$fg[white]%}${prompt}%{$fg[red]%} $%{$fg[white]%} " + fi +} \ No newline at end of file From e16a74b6ec54bdede14e1b942e02f7c98697871a Mon Sep 17 00:00:00 2001 From: James Adam Date: Tue, 20 Oct 2009 06:26:06 +0800 Subject: [PATCH 088/614] Whoops, forgot to include this dummy precmd implementation. --- lib/prompt.zsh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/prompt.zsh b/lib/prompt.zsh index 39689684f..19bacac9d 100644 --- a/lib/prompt.zsh +++ b/lib/prompt.zsh @@ -22,4 +22,8 @@ setopt prompt_subst export LSCOLORS="Gxfxcxdxbxegedabagacad" +function oh_my_zsh_theme_precmd() { + # Blank function; override this in your themes +} + source "$ZSH/themes/$ZSH_THEME.zsh-theme" From f5d55c993f3e3826dc81645832b579eafc84681a Mon Sep 17 00:00:00 2001 From: meh Date: Sun, 1 Nov 2009 06:16:24 +0800 Subject: [PATCH 089/614] Fixed darkblood theme as in issue #23. --- themes/darkblood.zsh-theme | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/themes/darkblood.zsh-theme b/themes/darkblood.zsh-theme index 8a00c3459..33508fbd2 100644 --- a/themes/darkblood.zsh-theme +++ b/themes/darkblood.zsh-theme @@ -1,9 +1,9 @@ # meh. Dark Blood Rewind, a new beginning. -PROMPT=$'${fg[red]}┌[${fg_bold[white]}%n${reset_color}${fg[red]}@${fg_bold[white]}%m${reset_color}${fg[red]}] [${fg_bold[white]}/dev/%y${reset_color}${fg[red]}] $(git_prompt_info)%(?,,${fg[red]}[${fg_bold[white]}%?${reset_color}${fg[red]}]) -${fg[red]}└[${fg_bold[white]}%~${reset_color}${fg[red]}]>${reset_color} ' -PS2=$' ${fg[red]}|>${reset_color} ' +PROMPT=$'%{$fg[red]%}┌[%{$fg_bold[white]%}%n%{$reset_color%}%{$fg[red]%}@%{$fg_bold[white]%}%m%{$reset_color%}%{$fg[red]%}] [%{$fg_bold[white]%}/dev/%y%{$reset_color%}%{$fg[red]%}] %{$(git_prompt_info)%}%(?,,%{$fg[red]%}[%{$fg_bold[white]%}%?%{$reset_color%}%{$fg[red]%}]) +%{$fg[red]%}└[%{$fg_bold[white]%}%~%{$reset_color%}%{$fg[red]%}]>%{$reset_color%} ' +PS2=$' %{$fg[red]%}|>%{$reset_color%} ' -ZSH_THEME_GIT_PROMPT_PREFIX="${fg[red]}[${fg_bold[white]}" -ZSH_THEME_GIT_PROMPT_SUFFIX="${reset_color}${fg[red]}] " -ZSH_THEME_GIT_PROMPT_DIRTY=" ${fg[red]}⚡${reset_color}" +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[red]%}[%{$fg_bold[white]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}%{$fg[red]%}] " +ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}⚡%{$reset_color%}" From ecdd69f32869d39963dd494e990cce08c40ad1eb Mon Sep 17 00:00:00 2001 From: meh Date: Fri, 6 Nov 2009 20:55:08 +0800 Subject: [PATCH 090/614] Fixed issue #25. --- lib/git.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/git.zsh b/lib/git.zsh index 9409c92db..7b7b3700f 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -16,7 +16,7 @@ function git_prompt_info() { } parse_git_dirty () { - if [[ $(git status | tail -n1) != "nothing to commit (working directory clean)" ]]; then + if [[ $((git status &> /dev/null) | tail -n1) != "nothing to commit (working directory clean)" ]]; then echo "$ZSH_THEME_GIT_PROMPT_DIRTY" else echo "$ZSH_THEME_GIT_PROMPT_CLEAN" From 718228f5e943c84454c24a7433e4a20de2abda0a Mon Sep 17 00:00:00 2001 From: James Rowe Date: Fri, 16 Oct 2009 12:07:02 +0800 Subject: [PATCH 091/614] Added initial jnrowe theme. --- themes/jnrowe.zsh-theme | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 themes/jnrowe.zsh-theme diff --git a/themes/jnrowe.zsh-theme b/themes/jnrowe.zsh-theme new file mode 100644 index 000000000..7c8a7082e --- /dev/null +++ b/themes/jnrowe.zsh-theme @@ -0,0 +1,31 @@ +autoload -U add-zsh-hook +autoload -Uz vcs_info + +zstyle ':vcs_info:*' actionformats \ + '%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f ' +zstyle ':vcs_info:*' formats \ + '%F{2}%s%F{7}:%F{2}(%F{1}%b%F{2})%f ' +zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r' +zstyle ':vcs_info:*' enable git + +add-zsh-hook precmd prompt_jnrowe_precmd + +prompt_jnrowe_precmd () { + vcs_info + + if [ "${vcs_info_msg_0_}" = "" ]; then + dir_status="%F{2}→%f" + elif [[ $(git diff --cached --name-status 2>/dev/null ) != "" ]]; then + dir_status="%F{1}▶%f" + elif [[ $(git diff --name-status 2>/dev/null ) != "" ]]; then + dir_status="%F{3}▶%f" + else + dir_status="%F{2}▶%f" + fi +} + +local ret_status="%(?:%{$fg_bold[green]%}Ξ:%{$fg_bold[red]%}%S↑%s%?)" + +PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg_bold[yellow]%}%2~ ${vcs_info_msg_0_}${dir_status}%{$reset_color%} ' + +# vim: set ft=zsh ts=4 sw=4 et: From 5816fdbf3c5732f557f94001e5eeeaa8c8994c97 Mon Sep 17 00:00:00 2001 From: Toon Claes Date: Fri, 16 Oct 2009 22:12:31 +0200 Subject: [PATCH 092/614] extended path variable, temporary --- oh-my-zsh.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 6e73519b5..dd6ffec06 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -6,3 +6,6 @@ for config_file ($ZSH/lib/*.zsh) source $config_file # Load all of your custom configurations from custom/ for config_file ($ZSH/custom/*.zsh) source $config_file + + +export PATH=~/bin:/opt/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/local/sbin:/opt/local/lib/postgresql83/bin From 1de3f62255d811778a15213ef0a2a4620b2b3bcd Mon Sep 17 00:00:00 2001 From: Toon Claes Date: Fri, 16 Oct 2009 23:03:50 +0200 Subject: [PATCH 093/614] Removed useless else --- tools/install.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) mode change 100644 => 100755 tools/install.sh diff --git a/tools/install.sh b/tools/install.sh old mode 100644 new mode 100755 index 5c9f5592a..5a7c00950 --- a/tools/install.sh +++ b/tools/install.sh @@ -2,11 +2,11 @@ if [ -d ~/.oh-my-zsh ] then echo "You already have Oh My Zsh installed. You'll need to remove ~/.oh-my-zsh if you want to install" exit -else - echo "Cloning Oh My Zsh..." - /usr/bin/env git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh fi +echo "Cloning Oh My Zsh..." +/usr/bin/env git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh + echo "Looking for an existing zsh config..." if [ -f ~/.zshrc ] || [ -h ~/.zshrc ] then @@ -27,4 +27,3 @@ chsh -s /bin/zsh echo "Hooray! Oh My Zsh has been installed." /bin/zsh source ~/.zshrc - From fa344e35795538bef471d15a99e4fe96d921c2d5 Mon Sep 17 00:00:00 2001 From: Sean McCleary Date: Fri, 23 Oct 2009 11:59:24 -0700 Subject: [PATCH 094/614] Fixed issue #19 'Rake not auto completing'. The stat command syntax that was being used was not correct. Or at least on my machine. See man page for the stat command --- lib/rake_completion.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/rake_completion.zsh b/lib/rake_completion.zsh index c425a625e..9ee8213ae 100644 --- a/lib/rake_completion.zsh +++ b/lib/rake_completion.zsh @@ -1,8 +1,8 @@ _rake_does_task_list_need_generating () { if [ ! -f .rake_tasks~ ]; then return 0; else - accurate=$(stat -f%m .rake_tasks~) - changed=$(stat -f%m Rakefile) + accurate=$(stat -c "%n" .rake_tasks~) + changed=$(stat -c "%n" Rakefile) return $(expr $accurate '>=' $changed) fi } From aa4b6fb64b1c422ae8894ff8f685a72beb42ec2f Mon Sep 17 00:00:00 2001 From: Erik Kastner Date: Mon, 26 Oct 2009 00:47:23 -0400 Subject: [PATCH 095/614] adding homebrew completions - and a function dir --- functions/_brew | 61 +++++++++++++++++++++++++++++++++++++++++++++++++ oh-my-zsh.sh | 3 +++ 2 files changed, 64 insertions(+) create mode 100644 functions/_brew diff --git a/functions/_brew b/functions/_brew new file mode 100644 index 000000000..91397bf3a --- /dev/null +++ b/functions/_brew @@ -0,0 +1,61 @@ +#compdef brew + +# copied from _fink + +_brew_all_formulae() { + formulae=(`brew search`) +} + +_brew_installed_formulae() { + installed_formulae=(`brew list`) +} + +local -a _1st_arguments +_1st_arguments=( + 'install:install a formula' + 'remove:remove a formula' + 'search:search for a formula (/regex/ or string)' + 'list:list files in a formula or not-installed formulae' + 'link:link a formula' + 'unlink:unlink a formula' + 'home:visit the homepage of a formula or the brew project' + 'info:information about a formula' + 'prune:remove dead links' + 'update:freshen up links' + 'log:git commit log for a formula' + 'create:create a new formula' + 'edit:edit a formula' +) + +local expl +local -a formula installed_formulae + +_arguments \ + '(-v --verbose)'{-v,--verbose}'[verbose]' \ + '(--version)--version[version information]' \ + '(--prefix)--prefix[where brew lives on this system]' \ + '(--cache)--cache[brew cache]' \ + '*:: :->subcmds' && return 0 + +if (( CURRENT == 1 )); then + _describe -t commands "brew subcommand" _1st_arguments + return +fi + +case "$words[1]" in + list) + _arguments \ + '(--unbrewed)--unbrewed[files in brew --prefix not controlled by brew]' \ + '1: :->forms' && return 0 + + if [[ "$state" == forms ]]; then + _brew_installed_formulae + _requested installed_formulae expl 'installed formulae' compadd -a installed_formulae + fi ;; + install|home|log|info) + _brew_all_formulae + _wanted formulae expl 'all formulae' compadd -a formulae ;; + remove|edit|xo) + _brew_installed_formulae + _wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae ;; +esac diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 4b5959625..eadf02d00 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -1,5 +1,8 @@ # Initializes Oh My Zsh +# add a function path +fpath=($ZSH/functions $fpath) + # Load all of the config files in ~/oh-my-zsh that end in .zsh # TIP: Add files you don't want in git to .gitignore for config_file ($ZSH/lib/*.zsh) source $config_file From 1b2725ada47fbc751c2f15b2e7c7229fd5ff1104 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Mon, 26 Oct 2009 09:24:37 -0700 Subject: [PATCH 096/614] Fixing some conflict residue that I missed in a commit/merge: --- lib/aliases.zsh | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/lib/aliases.zsh b/lib/aliases.zsh index c4428d405..928677347 100644 --- a/lib/aliases.zsh +++ b/lib/aliases.zsh @@ -10,6 +10,8 @@ alias sd='ruby script/destroy' alias sp='ruby script/plugin' alias ssp='ruby script/spec' alias rdbm='rake db:migrate' +alias sc='ruby script/console' +alias sd='ruby script/server --debugger' # Basic directory operations alias .='pwd' @@ -62,15 +64,6 @@ alias et='mate . &' alias ett='mate app config lib db public spec test Rakefile Capfile Todo &' alias etp='mate app config lib db public spec test vendor/plugins vendor/gems Rakefile Capfile Todo &' alias etts='mate app config lib db public script spec test vendor/plugins vendor/gems Rakefile Capfile Todo &' -<<<<<<< HEAD:lib/aliases.zsh -======= - -## Ruby related -# Ruby scripts -alias sc='ruby script/console' -alias sd='ruby script/server --debugger' # Editor Ruby file in TextMate -alias mr='mate CHANGELOG app config db lib public script spec test' - ->>>>>>> 886d97f41e72b8662232a2c6b196fb60508e4f67:lib/aliases.zsh +alias mr='mate CHANGELOG app config db lib public script spec test' \ No newline at end of file From bee664c03d00101f7292366cbb464016db813834 Mon Sep 17 00:00:00 2001 From: meh Date: Mon, 26 Oct 2009 18:35:51 +0100 Subject: [PATCH 097/614] Added darkblod theme. --- themes/darkblood.zsh-theme | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 themes/darkblood.zsh-theme diff --git a/themes/darkblood.zsh-theme b/themes/darkblood.zsh-theme new file mode 100644 index 000000000..8a00c3459 --- /dev/null +++ b/themes/darkblood.zsh-theme @@ -0,0 +1,9 @@ +# meh. Dark Blood Rewind, a new beginning. + +PROMPT=$'${fg[red]}┌[${fg_bold[white]}%n${reset_color}${fg[red]}@${fg_bold[white]}%m${reset_color}${fg[red]}] [${fg_bold[white]}/dev/%y${reset_color}${fg[red]}] $(git_prompt_info)%(?,,${fg[red]}[${fg_bold[white]}%?${reset_color}${fg[red]}]) +${fg[red]}└[${fg_bold[white]}%~${reset_color}${fg[red]}]>${reset_color} ' +PS2=$' ${fg[red]}|>${reset_color} ' + +ZSH_THEME_GIT_PROMPT_PREFIX="${fg[red]}[${fg_bold[white]}" +ZSH_THEME_GIT_PROMPT_SUFFIX="${reset_color}${fg[red]}] " +ZSH_THEME_GIT_PROMPT_DIRTY=" ${fg[red]}⚡${reset_color}" From ce82e6ff7a9de163d0719e600ae2ffd52fc563f0 Mon Sep 17 00:00:00 2001 From: Toon Claes Date: Thu, 29 Oct 2009 23:18:19 +0100 Subject: [PATCH 098/614] Added my theme --- themes/tonotdo.zsh-theme | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 themes/tonotdo.zsh-theme diff --git a/themes/tonotdo.zsh-theme b/themes/tonotdo.zsh-theme new file mode 100644 index 000000000..6e864f5ac --- /dev/null +++ b/themes/tonotdo.zsh-theme @@ -0,0 +1,7 @@ +# Inspired by many other themes +PROMPT='[%*] %{$fg[cyan]%}%n%{$fg[magenta]%}➜%{$fg[green]%}%3~$(git_prompt_info)%{$reset_color%} » ' + +ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg_bold[blue]%}git(%{$fg[red]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}✗%{$fg[blue]%})" From ea57faa28a124c6306e030c57dc9f1963a5753a3 Mon Sep 17 00:00:00 2001 From: Toon Claes Date: Fri, 30 Oct 2009 18:15:45 +0100 Subject: [PATCH 099/614] Small fix, probably the smallest possible --- themes/tonotdo.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/tonotdo.zsh-theme b/themes/tonotdo.zsh-theme index 6e864f5ac..1562b72bc 100644 --- a/themes/tonotdo.zsh-theme +++ b/themes/tonotdo.zsh-theme @@ -1,5 +1,5 @@ # Inspired by many other themes -PROMPT='[%*] %{$fg[cyan]%}%n%{$fg[magenta]%}➜%{$fg[green]%}%3~$(git_prompt_info)%{$reset_color%} » ' +PROMPT='[%*] %{$fg[cyan]%}%n%{$fg[magenta]%}➜%{$fg[green]%}%3~$(git_prompt_info)%{$reset_color%}» ' ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg_bold[blue]%}git(%{$fg[red]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="" From cef9b42a3a94c1a12d6587850eaa798edffe32ba Mon Sep 17 00:00:00 2001 From: Toon Claes Date: Fri, 30 Oct 2009 20:41:38 +0100 Subject: [PATCH 100/614] Skip the git word in this theme --- themes/tonotdo.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/tonotdo.zsh-theme b/themes/tonotdo.zsh-theme index 1562b72bc..dca651674 100644 --- a/themes/tonotdo.zsh-theme +++ b/themes/tonotdo.zsh-theme @@ -1,7 +1,7 @@ # Inspired by many other themes PROMPT='[%*] %{$fg[cyan]%}%n%{$fg[magenta]%}➜%{$fg[green]%}%3~$(git_prompt_info)%{$reset_color%}» ' -ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg_bold[blue]%}git(%{$fg[red]%}" +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}(%{$fg[red]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="" ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}✗%{$fg[blue]%})" From b7e3b362e3a00e3d81fb00c2ef6aacaa9687cb59 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Sun, 1 Nov 2009 14:23:03 -0800 Subject: [PATCH 101/614] Adding devlog alias for tailing development.log for Rails --- lib/aliases.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/aliases.zsh b/lib/aliases.zsh index 928677347..6667a6724 100644 --- a/lib/aliases.zsh +++ b/lib/aliases.zsh @@ -12,6 +12,7 @@ alias ssp='ruby script/spec' alias rdbm='rake db:migrate' alias sc='ruby script/console' alias sd='ruby script/server --debugger' +alias devlog='tail -f log/development.log' # Basic directory operations alias .='pwd' From 2ed5139bd6cc1cec900bdaa33671519e0e9e4a10 Mon Sep 17 00:00:00 2001 From: Toon Claes Date: Wed, 4 Nov 2009 20:37:18 +0100 Subject: [PATCH 102/614] Joined the appearance so the theme can apply LSCOLORS too --- lib/aliases.zsh | 2 +- lib/appearance.zsh | 34 ++++++++++++++++++++++++++++++++++ lib/colors.zsh | 4 ---- lib/git.zsh | 11 ----------- lib/misc.zsh | 4 ++++ lib/prompt.zsh | 25 ------------------------- 6 files changed, 39 insertions(+), 41 deletions(-) create mode 100644 lib/appearance.zsh delete mode 100644 lib/colors.zsh delete mode 100644 lib/prompt.zsh diff --git a/lib/aliases.zsh b/lib/aliases.zsh index 6667a6724..c3a6cf073 100644 --- a/lib/aliases.zsh +++ b/lib/aliases.zsh @@ -45,7 +45,7 @@ alias gcp='git cherry-pick' alias history='fc -l 1' # List direcory contents -alias ls='ls -F' +alias ls='ls -F -G' alias lsa='ls -lahG' alias l='ls -la' alias ll='ls -alr' diff --git a/lib/appearance.zsh b/lib/appearance.zsh new file mode 100644 index 000000000..b1f5a8a38 --- /dev/null +++ b/lib/appearance.zsh @@ -0,0 +1,34 @@ +# Colors +autoload colors; colors; +export LSCOLORS="Gxfxcxdxbxegedabagacad" + +#setopt no_beep +setopt auto_cd +setopt multios +setopt cdablevarS + +if [[ x$WINDOW != x ]] +then + SCREEN_NO="%B$WINDOW%b " +else + SCREEN_NO="" +fi + +# Apply theming defaults +PS1="%n@%m:%~%# " + +# git theming default: Variables for theming the git info prompt +# ZSH_THEME_GIT_PROMPT_PREFIX - Prefix at the very beginning of the prompt, before the branch name +ZSH_THEME_GIT_PROMPT_PREFIX="git:(" +# ZSH_THEME_GIT_PROMPT_SUFFIX - At the very end of the prompt +ZSH_THEME_GIT_PROMPT_SUFFIX=")" +# ZSH_THEME_GIT_PROMPT_DIRTY - Text to display if the branch is dirty +ZSH_THEME_GIT_PROMPT_DIRTY="*" +# ZSH_THEME_GIT_PROMPT_CLEAN - Text to display if the branch is clean +ZSH_THEME_GIT_PROMPT_CLEAN="" + +# Setup the prompt with pretty colors +setopt prompt_subst + +# Load the theme +source "$ZSH/themes/$ZSH_THEME.zsh-theme" \ No newline at end of file diff --git a/lib/colors.zsh b/lib/colors.zsh deleted file mode 100644 index b2b08f929..000000000 --- a/lib/colors.zsh +++ /dev/null @@ -1,4 +0,0 @@ -autoload colors; colors; - -unset LSCOLORS -export LS_COLORS='di=34:ln=35:so=32:pi=33:ex=31:bd=46;34:cd=43;34:su=41;30:sg=46;30:tw=42;30:ow=43;30' diff --git a/lib/git.zsh b/lib/git.zsh index 9409c92db..84a3af0b9 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -1,14 +1,3 @@ -# Varables for themeing the git info prompt: -# ZSH_THEME_GIT_PROMPT_PREFIX - Prefix at the very beginning of the prompt, before the branch name -# ZSH_THEME_GIT_PROMPT_SUFFIX - At the very end of the prompt -# ZSH_THEME_GIT_PROMPT_DIRTY - Text to display if the branch is dirty -# ZSH_THEME_GIT_PROMPT_CLEAN - Text to display if the branch is clean - -ZSH_THEME_GIT_PROMPT_PREFIX="git:(" -ZSH_THEME_GIT_PROMPT_SUFFIX=")" -ZSH_THEME_GIT_PROMPT_DIRTY="*" -ZSH_THEME_GIT_PROMPT_CLEAN="" - # get the name of the branch we are on function git_prompt_info() { ref=$(git symbolic-ref HEAD 2> /dev/null) || return diff --git a/lib/misc.zsh b/lib/misc.zsh index a01627d9e..4c1743657 100644 --- a/lib/misc.zsh +++ b/lib/misc.zsh @@ -7,3 +7,7 @@ bindkey "^[m" copy-prev-shell-word ## jobs setopt long_list_jobs + +## pager +export PAGER=less +export LC_CTYPE=en_US.UTF-8 diff --git a/lib/prompt.zsh b/lib/prompt.zsh deleted file mode 100644 index 39689684f..000000000 --- a/lib/prompt.zsh +++ /dev/null @@ -1,25 +0,0 @@ -export PAGER=less -export LC_CTYPE=en_US.UTF-8 - -# speed stuff. - -#setopt no_beep -setopt auto_cd -setopt multios -setopt cdablevarS - -if [[ x$WINDOW != x ]] -then - SCREEN_NO="%B$WINDOW%b " -else - SCREEN_NO="" -fi - -PS1="%n@%m:%~%# " - -# Setup the prompt with pretty colors -setopt prompt_subst - -export LSCOLORS="Gxfxcxdxbxegedabagacad" - -source "$ZSH/themes/$ZSH_THEME.zsh-theme" From a65ec360cf00a2872e5a3f23e3c7523abd71c1dc Mon Sep 17 00:00:00 2001 From: Toon Claes Date: Thu, 5 Nov 2009 20:30:53 +0100 Subject: [PATCH 103/614] added LSCOLORS --- themes/tonotdo.zsh-theme | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/themes/tonotdo.zsh-theme b/themes/tonotdo.zsh-theme index dca651674..f1e9a286a 100644 --- a/themes/tonotdo.zsh-theme +++ b/themes/tonotdo.zsh-theme @@ -1,7 +1,12 @@ # Inspired by many other themes -PROMPT='[%*] %{$fg[cyan]%}%n%{$fg[magenta]%}➜%{$fg[green]%}%3~$(git_prompt_info)%{$reset_color%}» ' +PROMPT='[%*] %{$fg[cyan]%}%n%{$fg[magenta]%}➜%{$fg[green]%}%3~%{$(git_prompt_info)%}%{$reset_color%}» ' +# git theming ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}(%{$fg[red]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="" ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}✗%{$fg[blue]%})" + +# LS colors, made with http://geoff.greer.fm/lscolors/ +export LSCOLORS="Gxfxcxdxbxegedabagacad" +export LS_COLORS="di=1;;40:ln=35;40:so=32;40:pi=33;40:ex=31;40:bd=34;46:cd=34;43:su=0;41:sg=0;46:tw=0;42:ow=0;43:" From 600efef0c3428f05c7339e67496b75280146adba Mon Sep 17 00:00:00 2001 From: Toon Claes Date: Thu, 5 Nov 2009 20:44:28 +0100 Subject: [PATCH 104/614] Enabled colors in ls and made it possible to theme them --- lib/aliases.zsh | 3 +-- lib/appearance.zsh | 21 ++++++++++++--------- templates/zshrc.zsh-template | 5 ++++- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/lib/aliases.zsh b/lib/aliases.zsh index c3a6cf073..88d68e142 100644 --- a/lib/aliases.zsh +++ b/lib/aliases.zsh @@ -45,8 +45,7 @@ alias gcp='git cherry-pick' alias history='fc -l 1' # List direcory contents -alias ls='ls -F -G' -alias lsa='ls -lahG' +alias lsa='ls -lah' alias l='ls -la' alias ll='ls -alr' alias sl=ls # often screw this up diff --git a/lib/appearance.zsh b/lib/appearance.zsh index b1f5a8a38..c9bd25d81 100644 --- a/lib/appearance.zsh +++ b/lib/appearance.zsh @@ -1,6 +1,13 @@ -# Colors +# ls colors autoload colors; colors; export LSCOLORS="Gxfxcxdxbxegedabagacad" +#export LS_COLORS + +# Enable ls colors +if [ "$DISABLE_LS_COLORS" != "true" ] then + # Find the option for using colors in ls, depending on the version: Linux or BSD + ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty' || alias ls='ls -G' +fi #setopt no_beep setopt auto_cd @@ -18,14 +25,10 @@ fi PS1="%n@%m:%~%# " # git theming default: Variables for theming the git info prompt -# ZSH_THEME_GIT_PROMPT_PREFIX - Prefix at the very beginning of the prompt, before the branch name -ZSH_THEME_GIT_PROMPT_PREFIX="git:(" -# ZSH_THEME_GIT_PROMPT_SUFFIX - At the very end of the prompt -ZSH_THEME_GIT_PROMPT_SUFFIX=")" -# ZSH_THEME_GIT_PROMPT_DIRTY - Text to display if the branch is dirty -ZSH_THEME_GIT_PROMPT_DIRTY="*" -# ZSH_THEME_GIT_PROMPT_CLEAN - Text to display if the branch is clean -ZSH_THEME_GIT_PROMPT_CLEAN="" +ZSH_THEME_GIT_PROMPT_PREFIX="git:(" # Prefix at the very beginning of the prompt, before the branch name +ZSH_THEME_GIT_PROMPT_SUFFIX=")" # At the very end of the prompt +ZSH_THEME_GIT_PROMPT_DIRTY="*" # Text to display if the branch is dirty +ZSH_THEME_GIT_PROMPT_CLEAN="" # Text to display if the branch is clean # Setup the prompt with pretty colors setopt prompt_subst diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template index 7c43303bd..d905be04b 100644 --- a/templates/zshrc.zsh-template +++ b/templates/zshrc.zsh-template @@ -9,7 +9,10 @@ export ZSH_THEME="robbyrussell" # export CASE_SENSITIVE="true" # Comment this out to disable weekly auto-update checks -# export DISABLE_AUTO_UPDATE="false" +# export DISABLE_AUTO_UPDATE="true" + +# Uncomment following line if you want to disable colors in ls +# export DISABLE_LS_COLORS="true" source $ZSH/oh-my-zsh.sh From 9c0dcdaefc87f9af941e4239a8806b957414e6c6 Mon Sep 17 00:00:00 2001 From: Toon Claes Date: Thu, 5 Nov 2009 20:48:08 +0100 Subject: [PATCH 105/614] parse error fix --- lib/appearance.zsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/appearance.zsh b/lib/appearance.zsh index c9bd25d81..ffee52b5e 100644 --- a/lib/appearance.zsh +++ b/lib/appearance.zsh @@ -4,7 +4,8 @@ export LSCOLORS="Gxfxcxdxbxegedabagacad" #export LS_COLORS # Enable ls colors -if [ "$DISABLE_LS_COLORS" != "true" ] then +if [ "$DISABLE_LS_COLORS" != "true" ] +then # Find the option for using colors in ls, depending on the version: Linux or BSD ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty' || alias ls='ls -G' fi From c36f73d4d4f077ac8bc0807e796ded2ba339b3f6 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Sun, 8 Nov 2009 15:24:20 -0800 Subject: [PATCH 106/614] Revert "Fixed issue #19 'Rake not auto completing'. The stat command syntax that was being used was not correct. Or at least on my machine. See man page for the stat command" This reverts commit 83907294d640d910968cf9152d11c6a5ab3205f5. --- lib/rake_completion.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/rake_completion.zsh b/lib/rake_completion.zsh index 9ee8213ae..c425a625e 100644 --- a/lib/rake_completion.zsh +++ b/lib/rake_completion.zsh @@ -1,8 +1,8 @@ _rake_does_task_list_need_generating () { if [ ! -f .rake_tasks~ ]; then return 0; else - accurate=$(stat -c "%n" .rake_tasks~) - changed=$(stat -c "%n" Rakefile) + accurate=$(stat -f%m .rake_tasks~) + changed=$(stat -f%m Rakefile) return $(expr $accurate '>=' $changed) fi } From eb6ed520f313b5f2119c86690bbeb3e5e40e836b Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Sun, 8 Nov 2009 15:27:17 -0800 Subject: [PATCH 107/614] Removing gdb alias as it conflicts with an actual command for gdb. Closes #17 --- lib/aliases.zsh | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/aliases.zsh b/lib/aliases.zsh index 6667a6724..ff43e6405 100644 --- a/lib/aliases.zsh +++ b/lib/aliases.zsh @@ -37,7 +37,6 @@ alias gc='git commit -v' alias gca='git commit -v -a' alias gb='git branch' alias gba='git branch -a' -alias gdb='git branch -d' alias gcount='git shortlog -sn' alias gcp='git cherry-pick' From 6326573fa21f5baab385b9000c3a47f70165d5c5 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Sun, 8 Nov 2009 15:34:02 -0800 Subject: [PATCH 108/614] Only using the contents of .ssh/known_hosts when the file exists for ssh/scp auto-completion. Closes issue #20 --- lib/completion.zsh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/completion.zsh b/lib/completion.zsh index deeb52824..c231ee21e 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -22,7 +22,7 @@ else fi zstyle ':completion:*' list-colors '' -zstyle ':completion:*' hosts $( sed 's/[, ].*$//' $HOME/.ssh/known_hosts ) + unsetopt MENU_COMPLETE #setopt AUTO_MENU @@ -35,7 +35,12 @@ zstyle ':completion:*:*:*:*:*' menu yes select zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01' zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm -w -w" -zstyle ':completion:*:*:(ssh|scp):*:*' hosts `sed 's/^\([^ ,]*\).*$/\1/' ~/.ssh/known_hosts` + +# Load known hosts file for auto-completion with ssh and scp commands +if [ -f ~/.ssh/known_hosts ]; then + zstyle ':completion:*' hosts $( sed 's/[, ].*$//' $HOME/.ssh/known_hosts ) + zstyle ':completion:*:*:(ssh|scp):*:*' hosts `sed 's/^\([^ ,]*\).*$/\1/' ~/.ssh/known_hosts` +fi # Complete on history # zstyle ':completion:*:history-words' stop yes From 8b4d9d376c04ba8ebb89ca78f0890680f4932289 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Mon, 9 Nov 2009 07:33:38 -0800 Subject: [PATCH 109/614] Revert "Whoops, forgot to include this dummy precmd implementation." This reverts commit a21525ba0ccbdf35a0524f6cf7f2025fef578c78. --- lib/prompt.zsh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/prompt.zsh b/lib/prompt.zsh index 19bacac9d..39689684f 100644 --- a/lib/prompt.zsh +++ b/lib/prompt.zsh @@ -22,8 +22,4 @@ setopt prompt_subst export LSCOLORS="Gxfxcxdxbxegedabagacad" -function oh_my_zsh_theme_precmd() { - # Blank function; override this in your themes -} - source "$ZSH/themes/$ZSH_THEME.zsh-theme" From 29b6bf6aaa6c0c5775e31490511bd142662503bf Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Mon, 9 Nov 2009 07:33:51 -0800 Subject: [PATCH 110/614] Revert "Added my prompt theme, with a tweak to the core oh-my-zsh to support it. My git_prompt_info function not only reports the branch and dirty status, but also whether or not the branch is ahead or behind of the remote, or both. It also switches the prompt colour from green to red if the previous command exited with a non-zero value (i.e. failed)." This reverts commit 14a1ce80bbf7362ab2856cdd050714f02649fe3f. --- lib/termsupport.zsh | 2 -- themes/lazyatom.zsh-theme | 40 --------------------------------------- 2 files changed, 42 deletions(-) delete mode 100644 themes/lazyatom.zsh-theme diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index ec828c287..fef978748 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -4,7 +4,6 @@ case "$TERM" in print -Pn "\e]0;%n@%m: $1\a" # xterm } precmd () { - oh_my_zsh_theme_precmd print -Pn "\e]0;%n@%m: %~\a" # xterm } ;; @@ -15,7 +14,6 @@ case "$TERM" in print -Pn "\e]0;%n@%m: $1\a" # xterm } precmd () { - oh_my_zsh_theme_precmd echo -ne "\ekzsh\e\\" print -Pn "\e]0;%n@%m: %~\a" # xterm } diff --git a/themes/lazyatom.zsh-theme b/themes/lazyatom.zsh-theme deleted file mode 100644 index 6263bc2b7..000000000 --- a/themes/lazyatom.zsh-theme +++ /dev/null @@ -1,40 +0,0 @@ -git_prompt_info() { - branch=$(git symbolic-ref HEAD 2> /dev/null) || return - git_status="$(git status 2> /dev/null)" - state="" - case $git_status in - *Changed\ but\ not\ updated*) - state="%{$fg[red]%}⚡" - ;;; - *Untracked\ files*) - state="%{$fg[red]%}⚡" - ;;; - esac - - remote="" - case $git_status in - *Your\ branch\ is\ ahead*) - remote="%{$fg[yellow]%}↑" - ;;; - - *Your\ branch\ is\ behind*) - remote="%{$fg[yellow]%}↓" - ;;; - - "Your branch and") - remote="%{$fg[yellow]%}" - ;;; - esac - echo " %{$fg[yellow]%}(${branch#refs/heads/})${remote}${state}" -} - -function oh_my_zsh_theme_precmd() { - local previous_return_value=$?; - prompt="%{$fg[light_gray]%}%c%{$fg[yellow]%}$(git_prompt_info)%{$fg[white]%}" - if test $previous_return_value -eq 0 - then - export PROMPT="%{$fg[green]%}➜ %{$fg[white]%}${prompt}%{$fg[green]%} $%{$fg[white]%} " - else - export PROMPT="%{$fg[red]%}➜ %{$fg[white]%}${prompt}%{$fg[red]%} $%{$fg[white]%} " - fi -} \ No newline at end of file From 57e0d28d3398f1444d93b2e32df04969dcecd8b9 Mon Sep 17 00:00:00 2001 From: Toon Claes Date: Mon, 9 Nov 2009 21:38:40 +0100 Subject: [PATCH 111/614] Modifying changes for issue 25, to fix issue 27 --- lib/git.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/git.zsh b/lib/git.zsh index 6ef950f12..58d826d0c 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -5,7 +5,7 @@ function git_prompt_info() { } parse_git_dirty () { - if [[ $((git status &> /dev/null) | tail -n1) != "nothing to commit (working directory clean)" ]]; then + if [[ $((git status 2> /dev/null) | tail -n1) != "nothing to commit (working directory clean)" ]]; then echo "$ZSH_THEME_GIT_PROMPT_DIRTY" else echo "$ZSH_THEME_GIT_PROMPT_CLEAN" From 70fd6b07333122e21a30af7e24216d5114566780 Mon Sep 17 00:00:00 2001 From: Toon Claes Date: Mon, 9 Nov 2009 22:05:00 +0100 Subject: [PATCH 112/614] Fixed all themes so tab-completion doesn't move the cursor to a weird position --- themes/garyblessington.zsh-theme | 2 +- themes/maran.zsh-theme | 2 +- themes/tonotdo.zsh-theme | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/themes/garyblessington.zsh-theme b/themes/garyblessington.zsh-theme index 9431be6d8..b4f84a71c 100644 --- a/themes/garyblessington.zsh-theme +++ b/themes/garyblessington.zsh-theme @@ -1,4 +1,4 @@ -PROMPT='%{%{$fg[cyan]%}%c%{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%}% %{$reset_color%}: ' +PROMPT='%{$fg[cyan]%}%c%{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%}% %{$reset_color%}: ' ZSH_THEME_GIT_PROMPT_PREFIX="(%{$fg[blue]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" diff --git a/themes/maran.zsh-theme b/themes/maran.zsh-theme index 0f6e3b6bd..6fba04688 100644 --- a/themes/maran.zsh-theme +++ b/themes/maran.zsh-theme @@ -1,6 +1,6 @@ # Theme with full path names and hostname # Handy if you work on different servers all the time; -PROMPT='%{$fg[cyan]%}%n%{$reset_color%}@$fg[yellow]%}%M:%{$fg[green]%}%/%{$reset_color%} $(git_prompt_info) %(!.#.$) ' +PROMPT='%{$fg[cyan]%}%n%{$reset_color%}@%{$fg[yellow]%}%M:%{$fg[green]%}%/%{$reset_color%} $(git_prompt_info) %(!.#.$) ' ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[cyan]%}git:(" ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}" diff --git a/themes/tonotdo.zsh-theme b/themes/tonotdo.zsh-theme index f1e9a286a..07f149ba9 100644 --- a/themes/tonotdo.zsh-theme +++ b/themes/tonotdo.zsh-theme @@ -1,5 +1,5 @@ # Inspired by many other themes -PROMPT='[%*] %{$fg[cyan]%}%n%{$fg[magenta]%}➜%{$fg[green]%}%3~%{$(git_prompt_info)%}%{$reset_color%}» ' +PROMPT='[%*] %{$fg[cyan]%}%n%{$fg[magenta]%}➜%{$fg[green]%}%3~$(git_prompt_info)%{$reset_color%}» ' # git theming ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}(%{$fg[red]%}" From e9c48b729f43bdf3da662a0470c054b66b7f342a Mon Sep 17 00:00:00 2001 From: Toon Claes Date: Mon, 9 Nov 2009 22:28:17 +0100 Subject: [PATCH 113/614] Improved the LS_COLORS in my tonotdo theme --- themes/tonotdo.zsh-theme | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/themes/tonotdo.zsh-theme b/themes/tonotdo.zsh-theme index 07f149ba9..2462971e0 100644 --- a/themes/tonotdo.zsh-theme +++ b/themes/tonotdo.zsh-theme @@ -9,4 +9,13 @@ ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}✗%{$fg[blue]%})" # LS colors, made with http://geoff.greer.fm/lscolors/ export LSCOLORS="Gxfxcxdxbxegedabagacad" -export LS_COLORS="di=1;;40:ln=35;40:so=32;40:pi=33;40:ex=31;40:bd=34;46:cd=34;43:su=0;41:sg=0;46:tw=0;42:ow=0;43:" +export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:\ + cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:\ + *.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:\ + *.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:\ + *.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:\ + *.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:\ + *.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:\ + *.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:\ + *.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:\ + *.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:' \ No newline at end of file From 2111e6fc0a9862e91ff0592052753775e9b47e83 Mon Sep 17 00:00:00 2001 From: Toon Claes Date: Wed, 11 Nov 2009 17:26:23 +0100 Subject: [PATCH 114/614] LS_COLORS fix for tonotdo theme --- themes/tonotdo.zsh-theme | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/themes/tonotdo.zsh-theme b/themes/tonotdo.zsh-theme index 2462971e0..de3206910 100644 --- a/themes/tonotdo.zsh-theme +++ b/themes/tonotdo.zsh-theme @@ -9,13 +9,4 @@ ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}✗%{$fg[blue]%})" # LS colors, made with http://geoff.greer.fm/lscolors/ export LSCOLORS="Gxfxcxdxbxegedabagacad" -export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:\ - cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:\ - *.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:\ - *.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:\ - *.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:\ - *.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:\ - *.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:\ - *.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:\ - *.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:\ - *.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:' \ No newline at end of file +export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:' \ No newline at end of file From 67f3223e720af1201ef0966fa44a36f9485f0021 Mon Sep 17 00:00:00 2001 From: Toon Claes Date: Wed, 11 Nov 2009 18:14:25 +0100 Subject: [PATCH 115/614] Spiced up the tonotdo theme --- themes/tonotdo.zsh-theme | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/themes/tonotdo.zsh-theme b/themes/tonotdo.zsh-theme index de3206910..f46d165da 100644 --- a/themes/tonotdo.zsh-theme +++ b/themes/tonotdo.zsh-theme @@ -1,11 +1,11 @@ -# Inspired by many other themes -PROMPT='[%*] %{$fg[cyan]%}%n%{$fg[magenta]%}➜%{$fg[green]%}%3~$(git_prompt_info)%{$reset_color%}» ' +PROMPT='%{$fg_no_bold[cyan]%}%n%{$fg_no_bold[yellow]%}•%{$fg_no_bold[green]%}%3~$(git_prompt_info)%{$reset_color%}» ' +RPROMPT='[%*]' # git theming -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}(%{$fg[red]%}" +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}(%{$fg_no_bold[magenta]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="" -ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}✗%{$fg[blue]%})" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[blue]%})" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%}⚡%{$fg_bold[blue]%})" # LS colors, made with http://geoff.greer.fm/lscolors/ export LSCOLORS="Gxfxcxdxbxegedabagacad" From 3b35eb308b2b59bd65a8d83766469af1e09f29a3 Mon Sep 17 00:00:00 2001 From: Toon Claes Date: Wed, 11 Nov 2009 18:15:33 +0100 Subject: [PATCH 116/614] Spiced up the tonotdo theme, some more --- themes/tonotdo.zsh-theme | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/tonotdo.zsh-theme b/themes/tonotdo.zsh-theme index f46d165da..478f01de7 100644 --- a/themes/tonotdo.zsh-theme +++ b/themes/tonotdo.zsh-theme @@ -1,8 +1,8 @@ -PROMPT='%{$fg_no_bold[cyan]%}%n%{$fg_no_bold[yellow]%}•%{$fg_no_bold[green]%}%3~$(git_prompt_info)%{$reset_color%}» ' +PROMPT='%{$fg_no_bold[cyan]%}%n%{$fg_no_bold[yellow]%}•%{$fg_no_bold[magenta]%}%3~$(git_prompt_info)%{$reset_color%}» ' RPROMPT='[%*]' # git theming -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}(%{$fg_no_bold[magenta]%}" +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}(%{$fg_no_bold[green]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="" ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[blue]%})" ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%}⚡%{$fg_bold[blue]%})" From 4a4262343f76823a6c038b2219de61d26149cc27 Mon Sep 17 00:00:00 2001 From: James Rowe Date: Sun, 9 May 2010 21:17:20 +0800 Subject: [PATCH 117/614] Don't auto-correct ebuild commands. It breaks "ebuild manifest", as there are Manifest files in the directory. --- lib/correction.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/correction.zsh b/lib/correction.zsh index a96f7ffd8..043320a6d 100644 --- a/lib/correction.zsh +++ b/lib/correction.zsh @@ -6,3 +6,4 @@ alias mysql='nocorrect mysql' alias mkdir='nocorrect mkdir' alias gist='nocorrect gist' alias heroku='nocorrect heroku' +alias ebuild='nocorrect ebuild' From f87db739c05766a959421781eab79a93d13a8a5b Mon Sep 17 00:00:00 2001 From: James Rowe Date: Sun, 9 May 2010 21:16:33 +0800 Subject: [PATCH 118/614] Ignore commands that start with a space. This is useful when you want to use a dangerous command, as it won't be available with history searching. --- lib/history.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/history.zsh b/lib/history.zsh index 509be8f09..ca6f57079 100644 --- a/lib/history.zsh +++ b/lib/history.zsh @@ -10,6 +10,7 @@ setopt hist_verify setopt inc_append_history setopt extended_history setopt hist_expire_dups_first +setopt hist_ignore_space setopt SHARE_HISTORY setopt APPEND_HISTORY From e10d8beba837b1fc2db0cb8897d8e2cd10b8f198 Mon Sep 17 00:00:00 2001 From: James Rowe Date: Sun, 9 May 2010 22:23:11 +0800 Subject: [PATCH 119/614] Don't display dotfiles or reverse sort with ll alias. The ll alias is a very common default for bash in Linux distributions, so use that definition. --- lib/aliases.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/aliases.zsh b/lib/aliases.zsh index 89c904a7e..80760a1f5 100644 --- a/lib/aliases.zsh +++ b/lib/aliases.zsh @@ -18,7 +18,7 @@ alias history='fc -l 1' # List direcory contents alias lsa='ls -lah' alias l='ls -la' -alias ll='ls -alr' +alias ll='ls -l' alias sl=ls # often screw this up alias afind='ack-grep -il' From 83e8aa50869367c64cfcd727b98155d7692faa8b Mon Sep 17 00:00:00 2001 From: James Rowe Date: Thu, 12 Nov 2009 14:52:53 +0800 Subject: [PATCH 120/614] Added a minimum zsh version note. --- README.textile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.textile b/README.textile index 950f8861b..23d8b5390 100644 --- a/README.textile +++ b/README.textile @@ -4,6 +4,8 @@ bq. "OH MY ZSHELL!" h2. Setup +@oh-my-zsh@ should work with any recent release of "zsh":http://www.zsh.org/, the minimum recommended version is 4.3.9. + h3. The automatic installer... (do you trust me?) @wget http://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh@ From 59e05dc445af9c921ce84cf06eddb232493a5b67 Mon Sep 17 00:00:00 2001 From: technoweenie Date: Thu, 12 Nov 2009 11:14:09 -0700 Subject: [PATCH 121/614] gave credit to Nick for the rake autocompletion code. --- README.textile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.textile b/README.textile index 9972cf246..950f8861b 100644 --- a/README.textile +++ b/README.textile @@ -56,8 +56,9 @@ If you want to uninstall it, just run @uninstall_oh_my_zsh@ from the command lin h2. Thanks -* Rick Olsen (technoweenie) might remember some of the configuration, which I took from a pastie a few years ago. -* Whoever created the rake autocomplete stuff, which was posted all over the internet a few years ago. +* Rick Olson (technoweenie) might remember some of the configuration, which I took from a pastie a few years ago. +* Marcel (noradio) provided Rick the original zsh configuration. +* Nicholas (ulysses) for the "rake autocompletion code":http://weblog.rubyonrails.org/2006/3/9/fast-rake-task-completion-for-zsh. h2. Help out! @@ -69,5 +70,4 @@ I'm hoping to collect a bunch of themes for our command prompts. You can see exi h3. Todo from imajes: -* need to make the title bar support git folder -* \ No newline at end of file +* need to make the title bar support git folder \ No newline at end of file From 15d6fa10b0f9fc5156a44f7f2ac10dad155faff0 Mon Sep 17 00:00:00 2001 From: Jordan Bracco Date: Fri, 13 Nov 2009 05:10:21 +0100 Subject: [PATCH 122/614] Gallifrey theme --- themes/gallifrey.zsh-theme | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 themes/gallifrey.zsh-theme diff --git a/themes/gallifrey.zsh-theme b/themes/gallifrey.zsh-theme new file mode 100644 index 000000000..fce7cb923 --- /dev/null +++ b/themes/gallifrey.zsh-theme @@ -0,0 +1,8 @@ +# ZSH Theme - Preview: http://img.skitch.com/20091113-qqtd3j8xinysujg5ugrsbr7x1y.jpg +local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" + +PROMPT='%{$fg[green]%}%m%{$reset_color%} %2~ $(git_prompt_info)%{$reset_color%}%B»%b ' +RPS1="${return_code}" + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹" +ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}" From efd94328a1258ab2ee9e15de9e7ea21fb9fbf721 Mon Sep 17 00:00:00 2001 From: Toon Claes Date: Fri, 13 Nov 2009 22:02:42 +0100 Subject: [PATCH 123/614] Theme tonotdo upgrade --- themes/tonotdo.zsh-theme | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/tonotdo.zsh-theme b/themes/tonotdo.zsh-theme index 478f01de7..f46d165da 100644 --- a/themes/tonotdo.zsh-theme +++ b/themes/tonotdo.zsh-theme @@ -1,8 +1,8 @@ -PROMPT='%{$fg_no_bold[cyan]%}%n%{$fg_no_bold[yellow]%}•%{$fg_no_bold[magenta]%}%3~$(git_prompt_info)%{$reset_color%}» ' +PROMPT='%{$fg_no_bold[cyan]%}%n%{$fg_no_bold[yellow]%}•%{$fg_no_bold[green]%}%3~$(git_prompt_info)%{$reset_color%}» ' RPROMPT='[%*]' # git theming -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}(%{$fg_no_bold[green]%}" +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}(%{$fg_no_bold[magenta]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="" ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[blue]%})" ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%}⚡%{$fg_bold[blue]%})" From 772d02270e059d8461484762668470e68a06627c Mon Sep 17 00:00:00 2001 From: Toon Claes Date: Fri, 13 Nov 2009 23:39:07 +0100 Subject: [PATCH 124/614] tonotdo theme like I like it --- themes/tonotdo.zsh-theme | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/tonotdo.zsh-theme b/themes/tonotdo.zsh-theme index f46d165da..70f224ee0 100644 --- a/themes/tonotdo.zsh-theme +++ b/themes/tonotdo.zsh-theme @@ -1,8 +1,8 @@ -PROMPT='%{$fg_no_bold[cyan]%}%n%{$fg_no_bold[yellow]%}•%{$fg_no_bold[green]%}%3~$(git_prompt_info)%{$reset_color%}» ' +PROMPT='%{$fg_no_bold[cyan]%}%n%{$fg_no_bold[magenta]%}•%{$fg_no_bold[green]%}%3~$(git_prompt_info)%{$reset_color%}» ' RPROMPT='[%*]' # git theming -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}(%{$fg_no_bold[magenta]%}" +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}(%{$fg_no_bold[yellow]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="" ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[blue]%})" ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%}⚡%{$fg_bold[blue]%})" From c48de1e2157417422c60ce1a315654ca732a91cd Mon Sep 17 00:00:00 2001 From: Toon Claes Date: Fri, 13 Nov 2009 23:44:28 +0100 Subject: [PATCH 125/614] tonotdo theme still not like I wanted --- themes/tonotdo.zsh-theme | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/tonotdo.zsh-theme b/themes/tonotdo.zsh-theme index 70f224ee0..2a171a79c 100644 --- a/themes/tonotdo.zsh-theme +++ b/themes/tonotdo.zsh-theme @@ -2,10 +2,10 @@ PROMPT='%{$fg_no_bold[cyan]%}%n%{$fg_no_bold[magenta]%}•%{$fg_no_bold[green]%} RPROMPT='[%*]' # git theming -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}(%{$fg_no_bold[yellow]%}" +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}(%{$fg_no_bold[red]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="" ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[blue]%})" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%}⚡%{$fg_bold[blue]%})" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[yellow]%}⚡%{$fg_bold[blue]%})" # LS colors, made with http://geoff.greer.fm/lscolors/ export LSCOLORS="Gxfxcxdxbxegedabagacad" From 77d520f606bdb9d2f90997b77f20548450be27ea Mon Sep 17 00:00:00 2001 From: Toon Claes Date: Fri, 13 Nov 2009 23:55:37 +0100 Subject: [PATCH 126/614] tonotdo theme: Back to the original --- themes/tonotdo.zsh-theme | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/tonotdo.zsh-theme b/themes/tonotdo.zsh-theme index 2a171a79c..a6407034c 100644 --- a/themes/tonotdo.zsh-theme +++ b/themes/tonotdo.zsh-theme @@ -1,11 +1,11 @@ -PROMPT='%{$fg_no_bold[cyan]%}%n%{$fg_no_bold[magenta]%}•%{$fg_no_bold[green]%}%3~$(git_prompt_info)%{$reset_color%}» ' +PROMPT='%{$fg_no_bold[cyan]%}%n%{$fg_no_bold[magenta]%}➜%{$fg_no_bold[green]%}%3~$(git_prompt_info)%{$reset_color%}» ' RPROMPT='[%*]' # git theming ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}(%{$fg_no_bold[red]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="" ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[blue]%})" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[yellow]%}⚡%{$fg_bold[blue]%})" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[yellow]%}✗%{$fg_bold[blue]%})" # LS colors, made with http://geoff.greer.fm/lscolors/ export LSCOLORS="Gxfxcxdxbxegedabagacad" From 0d22789e97760f463356fbe57075d86867e9f0c1 Mon Sep 17 00:00:00 2001 From: James Rowe Date: Sun, 22 Nov 2009 01:38:55 +0800 Subject: [PATCH 127/614] Don't correct hpodder commands. --- lib/correction.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/correction.zsh b/lib/correction.zsh index 043320a6d..fc60dcdbd 100644 --- a/lib/correction.zsh +++ b/lib/correction.zsh @@ -7,3 +7,4 @@ alias mkdir='nocorrect mkdir' alias gist='nocorrect gist' alias heroku='nocorrect heroku' alias ebuild='nocorrect ebuild' +alias hpodder='nocorrect hpodder' From 33f424134ea59711e3605887fc555130b6c6486d Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Wed, 25 Nov 2009 12:45:16 -0800 Subject: [PATCH 128/614] Adding current_branch function, which can be used like: git pull origin master --- lib/git.zsh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/git.zsh b/lib/git.zsh index 58d826d0c..52c7969f3 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -12,3 +12,11 @@ parse_git_dirty () { fi } +# +# Will return the current branch name +# Usage example: git pull origin $(current_branch) +# +function current_branch() { + ref=$(git symbolic-ref HEAD 2> /dev/null) || return + echo ${ref#refs/heads/} +} From 0c3b9a6f88b669200ab64e1afe0b71ca4cefc4f1 Mon Sep 17 00:00:00 2001 From: Toon Claes Date: Mon, 30 Nov 2009 23:28:40 +0100 Subject: [PATCH 129/614] Completion from history --- lib/completion.zsh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/completion.zsh b/lib/completion.zsh index c231ee21e..9fe351b33 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -43,7 +43,7 @@ if [ -f ~/.ssh/known_hosts ]; then fi # Complete on history -# zstyle ':completion:*:history-words' stop yes -# zstyle ':completion:*:history-words' remove-all-dups yes -# zstyle ':completion:*:history-words' list false -# zstyle ':completion:*:history-words' menu yes +zstyle ':completion:*:history-words' stop yes +zstyle ':completion:*:history-words' remove-all-dups yes +zstyle ':completion:*:history-words' list false +zstyle ':completion:*:history-words' menu yes From 8e3e355ce373c14b3c83088d59b1253e657d62e0 Mon Sep 17 00:00:00 2001 From: Toon Claes Date: Tue, 1 Dec 2009 23:06:15 +0100 Subject: [PATCH 130/614] Revert --- lib/completion.zsh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/completion.zsh b/lib/completion.zsh index 9fe351b33..46b6d8f65 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -43,7 +43,7 @@ if [ -f ~/.ssh/known_hosts ]; then fi # Complete on history -zstyle ':completion:*:history-words' stop yes -zstyle ':completion:*:history-words' remove-all-dups yes -zstyle ':completion:*:history-words' list false -zstyle ':completion:*:history-words' menu yes +#zstyle ':completion:*:history-words' stop yes +#zstyle ':completion:*:history-words' remove-all-dups yes +#zstyle ':completion:*:history-words' list false +#zstyle ':completion:*:history-words' menu yes From a48f1172a696aa0022e7ab4d2be55915418c70a6 Mon Sep 17 00:00:00 2001 From: To1ne Date: Thu, 10 Dec 2009 19:04:06 +0100 Subject: [PATCH 131/614] No correction on mkdir + removed duplicate nocorrect mv --- lib/correction.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/correction.zsh b/lib/correction.zsh index c9fecb0fe..9d5036933 100644 --- a/lib/correction.zsh +++ b/lib/correction.zsh @@ -3,4 +3,4 @@ setopt correct_all alias man='nocorrect man' alias mv='nocorrect mv' alias mysql='nocorrect mysql' -alias mv='nocorrect mv' +alias mkdir='nocorrect mkdir' \ No newline at end of file From b2198fb5c8c804ba264d8c261870403b52eb5322 Mon Sep 17 00:00:00 2001 From: macovsky Date: Sat, 12 Dec 2009 12:06:46 +0300 Subject: [PATCH 132/614] new theme --- themes/macovsky.zsh-theme | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 themes/macovsky.zsh-theme diff --git a/themes/macovsky.zsh-theme b/themes/macovsky.zsh-theme new file mode 100644 index 000000000..db7f9148c --- /dev/null +++ b/themes/macovsky.zsh-theme @@ -0,0 +1,8 @@ +# ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png +local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" + +PROMPT='%{$fg[green]%}%~%{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b ' +RPS1="${return_code}" + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹" +ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}" \ No newline at end of file From c2cc4841b935681bd4945cde4d19b4564308d915 Mon Sep 17 00:00:00 2001 From: To1ne Date: Sat, 12 Dec 2009 10:12:14 +0100 Subject: [PATCH 133/614] no correction on gist --- lib/correction.zsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/correction.zsh b/lib/correction.zsh index 9d5036933..62d46da19 100644 --- a/lib/correction.zsh +++ b/lib/correction.zsh @@ -3,4 +3,5 @@ setopt correct_all alias man='nocorrect man' alias mv='nocorrect mv' alias mysql='nocorrect mysql' -alias mkdir='nocorrect mkdir' \ No newline at end of file +alias mkdir='nocorrect mkdir' +alias gist='nocorrect gist' \ No newline at end of file From cf967e07f931471f25e5555a484bd7e7f858ec4b Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Sat, 12 Dec 2009 13:45:30 -0800 Subject: [PATCH 134/614] Updating check_for_upgrade script to fix issue when the LAST_EPOCH file/value got corrupted. Closes #32 --- tools/check_for_upgrade.sh | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh index 5c212b6fa..c59ebaed4 100644 --- a/tools/check_for_upgrade.sh +++ b/tools/check_for_upgrade.sh @@ -1,11 +1,22 @@ #!/bin/sh -current_epoch=$(($(date +%s) / 60 / 60 / 24)) +function _current_epoch() { + echo $(($(date +%s) / 60 / 60 / 24)) +} + +function _update_zsh_update() { + echo "LAST_EPOCH=$(_current_epoch)" > ~/.zsh-update +} if [ -f ~/.zsh-update ] then . ~/.zsh-update - epoch_diff=$(($current_epoch - $LAST_EPOCH)) + + if [[ -z "$LAST_EPOCH" ]]; then + _update_zsh_update && return 0; + fi + + epoch_diff=$((${_current_epoch} - $LAST_EPOCH)) if [ $epoch_diff -gt 6 ] then echo "[Oh My Zsh] Would you like to check for updates?" @@ -15,14 +26,9 @@ then then /bin/sh $ZSH/tools/upgrade.sh fi - - # Set the last epoch to the current so that we don't ask for another week - echo "LAST_EPOCH=${current_epoch}" > ~/.zsh-update fi -else - # TODO: refactor this so remove duplicates - # Create the ~/.zsh-update file with the current epoch info - echo "LAST_EPOCH=${current_epoch}" > ~/.zsh-update fi +# update the zsh file +_update_zsh_update From 1273b9722a80b6bf4cdf33badc5b04e9853303ae Mon Sep 17 00:00:00 2001 From: johnmaxwelliv Date: Sat, 12 Dec 2009 21:23:36 -0700 Subject: [PATCH 135/614] Instead of using the user's standard shell, this script should be run using zsh, since that was the shell it was written for. On my machine changes to my default shell only take effect when I log out and then long in again. Plus, it's nice for people to be able to try oh-my-zsh out even if zsh isn't their default shell right? :-) --- oh-my-zsh.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index eadf02d00..d31e059f0 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -15,5 +15,5 @@ if [ "$DISABLE_AUTO_UPDATE" = "true" ] then return else - /bin/sh $ZSH/tools/check_for_upgrade.sh + /bin/zsh $ZSH/tools/check_for_upgrade.sh fi From d2a87be173ab98cac534c530d10968b8d9b55b8f Mon Sep 17 00:00:00 2001 From: johnmaxwelliv Date: Sun, 13 Dec 2009 12:38:37 -0700 Subject: [PATCH 136/614] Based on a suggestion from robbyrussel, using env for greater compatibility. --- oh-my-zsh.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index d31e059f0..fa2738e18 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -15,5 +15,5 @@ if [ "$DISABLE_AUTO_UPDATE" = "true" ] then return else - /bin/zsh $ZSH/tools/check_for_upgrade.sh + /usr/bin/env zsh $ZSH/tools/check_for_upgrade.sh fi From 23dea51b864b44bc84b989f68ded28b42fc4c53d Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Sun, 13 Dec 2009 11:48:03 -0800 Subject: [PATCH 137/614] Adding a nocorrect for the heroku command as it was getting triggered by heroku logs. --- lib/correction.zsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/correction.zsh b/lib/correction.zsh index 62d46da19..a96f7ffd8 100644 --- a/lib/correction.zsh +++ b/lib/correction.zsh @@ -4,4 +4,5 @@ alias man='nocorrect man' alias mv='nocorrect mv' alias mysql='nocorrect mysql' alias mkdir='nocorrect mkdir' -alias gist='nocorrect gist' \ No newline at end of file +alias gist='nocorrect gist' +alias heroku='nocorrect heroku' From 4e57305bddcc8406f2e1f87a685ca396f2dba9e3 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Wed, 16 Dec 2009 11:23:41 -0800 Subject: [PATCH 138/614] Adding a function that will open up a ticket in Lighthouse based on the number and there being a URL in a hidden file. --- lib/functions.zsh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/functions.zsh b/lib/functions.zsh index 2fb096dd6..f95a59827 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -58,3 +58,20 @@ function tm() { cd $1 mate $1 } + +# To use: add a .lighthouse file into your directory with the URL to the +# individual project. For example: +# https://rails.lighthouseapp.com/projects/8994 +# Example usage: http://screencast.com/t/ZDgwNDUwNT +open_lighthouse_ticket () { + if [ ! -f .lighthouse-url ]; then + echo "There is no .lighthouse file in the current directory..." + return 0; + else + lighthouse_url=$(cat .lighthouse-url); + echo "Opening ticket #$1"; + `open $lighthouse_url/tickets/$1`; + fi +} + +alias lho='open_lighthouse_ticket' From a8367b0df51036eedca4d0521e701bc164568226 Mon Sep 17 00:00:00 2001 From: Dale Campbell Date: Sat, 26 Dec 2009 00:41:37 -0600 Subject: [PATCH 139/614] adding quotes to tab() --- lib/functions.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/functions.zsh b/lib/functions.zsh index f95a59827..74b93f00e 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -44,7 +44,7 @@ function tab() { end tell application "Terminal" activate - do script with command "cd $PWD; $*" in window 1 + do script with command "cd \"$PWD\"; $*" in window 1 end tell EOF } From 0d00b8a63643e5f572ba3c62b36a4a790a1a783a Mon Sep 17 00:00:00 2001 From: Martin Klepsch Date: Sat, 19 Dec 2009 14:35:57 +0100 Subject: [PATCH 140/614] Putting Git related aliases into git.zsh to have them in context. --- lib/aliases.zsh | 17 +---------------- lib/git.zsh | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/aliases.zsh b/lib/aliases.zsh index d3ee2dd8c..f97daf41a 100644 --- a/lib/aliases.zsh +++ b/lib/aliases.zsh @@ -25,21 +25,6 @@ alias ss='sudo su -' #alias g='grep -in' -# Git related -alias g='git' -alias gst='git status' -alias gl='git pull' -alias gup='git fetch && git rebase' -alias gp='git push' -alias gd='git diff | mate' -alias gdv='git diff -w "$@" | vim -R -' -alias gc='git commit -v' -alias gca='git commit -v -a' -alias gb='git branch' -alias gba='git branch -a' -alias gcount='git shortlog -sn' -alias gcp='git cherry-pick' - # Show history alias history='fc -l 1' @@ -65,4 +50,4 @@ alias etp='mate app config lib db public spec test vendor/plugins vendor/gems Ra alias etts='mate app config lib db public script spec test vendor/plugins vendor/gems Rakefile Capfile Todo &' # Editor Ruby file in TextMate -alias mr='mate CHANGELOG app config db lib public script spec test' \ No newline at end of file +alias mr='mate CHANGELOG app config db lib public script spec test' diff --git a/lib/git.zsh b/lib/git.zsh index 52c7969f3..629a08b0e 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -20,3 +20,18 @@ function current_branch() { ref=$(git symbolic-ref HEAD 2> /dev/null) || return echo ${ref#refs/heads/} } + +# Aliases +alias g='git' +alias gst='git status' +alias gl='git pull' +alias gup='git fetch && git rebase' +alias gp='git push' +alias gd='git diff | mate' +alias gdv='git diff -w "$@" | vim -R -' +alias gc='git commit -v' +alias gca='git commit -v -a' +alias gb='git branch' +alias gba='git branch -a' +alias gcount='git shortlog -sn' +alias gcp='git cherry-pick' From 3eb991dfe3f25ca1c1481db51e08f66695696d74 Mon Sep 17 00:00:00 2001 From: Ryan Wilcox Date: Sun, 13 Dec 2009 17:39:40 -0500 Subject: [PATCH 141/614] fork xiong-chiamiov theme for git support --- themes/xiong-chiamiov-plus.zsh-theme | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 themes/xiong-chiamiov-plus.zsh-theme diff --git a/themes/xiong-chiamiov-plus.zsh-theme b/themes/xiong-chiamiov-plus.zsh-theme new file mode 100644 index 000000000..095dae290 --- /dev/null +++ b/themes/xiong-chiamiov-plus.zsh-theme @@ -0,0 +1,6 @@ +# 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 +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{"%a %b %d, %I:%M"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} +%{\e[0;34m%}%B└─%B[%{\e[1;35m%}$%{\e[0;34m%}%B] <$(git_prompt_info)>%{\e[0m%}%b ' +PS2=$' \e[0;34m%}%B>%{\e[0m%}%b ' From d084c5a1cda1e6bfea7bc9ee5054621ee1eadad8 Mon Sep 17 00:00:00 2001 From: Evandro Myller Date: Sat, 2 Jan 2010 02:12:46 -0300 Subject: [PATCH 142/614] added "clean" theme --- themes/clean.zsh-theme | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 themes/clean.zsh-theme diff --git a/themes/clean.zsh-theme b/themes/clean.zsh-theme new file mode 100644 index 000000000..0ab0ac0de --- /dev/null +++ b/themes/clean.zsh-theme @@ -0,0 +1,12 @@ +PROMPT='%n:%{$fg[blue]%}%B%c%b%{$reset_color%} $(git_prompt_info)%(!.#.$) ' +RPROMPT='[%*]' + +# git theming +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}(%{$fg_no_bold[yellow]%}%B" +ZSH_THEME_GIT_PROMPT_SUFFIX="%b%{$fg_bold[blue]%})%{$reset_color%} " +ZSH_THEME_GIT_PROMPT_CLEAN="" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%}✗" + +# LS colors, made with http://geoff.greer.fm/lscolors/ +export LSCOLORS="Gxfxcxdxbxegedabagacad" +export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:' From 603ef440c5fd4b366c70910391332ac93a9bdb26 Mon Sep 17 00:00:00 2001 From: Evandro Myller Date: Sat, 2 Jan 2010 02:51:49 -0300 Subject: [PATCH 143/614] improvements to the 'clean' theme --- themes/clean.zsh-theme | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/themes/clean.zsh-theme b/themes/clean.zsh-theme index 0ab0ac0de..d81eeaa63 100644 --- a/themes/clean.zsh-theme +++ b/themes/clean.zsh-theme @@ -1,4 +1,6 @@ -PROMPT='%n:%{$fg[blue]%}%B%c%b%{$reset_color%} $(git_prompt_info)%(!.#.$) ' +if [ "$(whoami)" = "root" ]; then NCOLOR="red"; else NCOLOR="white"; fi + +PROMPT='%{$fg[$NCOLOR]%}%n%{$reset_color%}:%{$fg[blue]%}%B%c/%b%{$reset_color%} $(git_prompt_info)%(!.#.$) ' RPROMPT='[%*]' # git theming From 5b06b4c2b654ed218901b29549ab922916f7446a Mon Sep 17 00:00:00 2001 From: Evandro Myller Date: Sat, 2 Jan 2010 17:59:11 -0300 Subject: [PATCH 144/614] clean theme: username is now bold --- themes/clean.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/clean.zsh-theme b/themes/clean.zsh-theme index d81eeaa63..95f532a82 100644 --- a/themes/clean.zsh-theme +++ b/themes/clean.zsh-theme @@ -1,6 +1,6 @@ if [ "$(whoami)" = "root" ]; then NCOLOR="red"; else NCOLOR="white"; fi -PROMPT='%{$fg[$NCOLOR]%}%n%{$reset_color%}:%{$fg[blue]%}%B%c/%b%{$reset_color%} $(git_prompt_info)%(!.#.$) ' +PROMPT='%{$fg[$NCOLOR]%}%B%n%b%{$reset_color%}:%{$fg[blue]%}%B%c/%b%{$reset_color%} $(git_prompt_info)%(!.#.$) ' RPROMPT='[%*]' # git theming From 8682ab61ad058de38566f80ff580cb5586df8406 Mon Sep 17 00:00:00 2001 From: Matt Fletcher Date: Thu, 14 Jan 2010 03:45:10 +0800 Subject: [PATCH 145/614] add fletcherm theme; a slightly modified copy of an old tonotdo theme --- themes/fletcherm.zsh-theme | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 themes/fletcherm.zsh-theme diff --git a/themes/fletcherm.zsh-theme b/themes/fletcherm.zsh-theme new file mode 100644 index 000000000..e96188544 --- /dev/null +++ b/themes/fletcherm.zsh-theme @@ -0,0 +1,12 @@ +# Copied from old version of tonotdo's theme. LSCOLORS modified. +PROMPT='%{$fg_no_bold[cyan]%}%n%{$fg_no_bold[magenta]%}•%{$fg_no_bold[green]%}%3~$(git_prompt_info)%{$reset_color%}» ' +RPROMPT='[%*]' + +# git theming +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}(%{$fg_no_bold[red]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[blue]%})" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[yellow]%}⚡%{$fg_bold[blue]%})" + +export LSCOLORS="exfxcxdxbxegedabagacad" +export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:' From 0055b01bfa961d2cdf614e7361fb6eda53118c38 Mon Sep 17 00:00:00 2001 From: Matt Cable Date: Sat, 27 Feb 2010 16:15:47 -0700 Subject: [PATCH 146/614] Initial pass at pesistant directory stack --- lib/dirspersist.zsh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 lib/dirspersist.zsh diff --git a/lib/dirspersist.zsh b/lib/dirspersist.zsh new file mode 100644 index 000000000..a7c077ae0 --- /dev/null +++ b/lib/dirspersist.zsh @@ -0,0 +1,19 @@ +#!/bin/zsh +# +# Make the dirstack more persistant +# +# Run dirpersiststore in ~/.zlogout + +dirpersiststore () { + dirs -p | sed 's/ /\\ /g;s/^/pushd -q /;1!G;h;$!d;' > ~/.zdirstore +} + +dirpersistrestore () { + if [ -f ~/.zdirstore ]; then + source ~/.zdirstore + fi +} + +DIRSTACKSIZE=10 +setopt autopushd pushdminus pushdsilent pushdtohome pushdignoredups +dirpersistrestore \ No newline at end of file From 2db18cb0505068e782687c2eb40b9dbf4ac6dd93 Mon Sep 17 00:00:00 2001 From: Andy Fowler Date: Tue, 4 May 2010 16:18:57 -0400 Subject: [PATCH 147/614] makes git status prompt 4x faster (via git status -s, benchmarked) --- lib/git.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/git.zsh b/lib/git.zsh index 629a08b0e..1d1d24deb 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -5,7 +5,7 @@ function git_prompt_info() { } parse_git_dirty () { - if [[ $((git status 2> /dev/null) | tail -n1) != "nothing to commit (working directory clean)" ]]; then + if [[ -n $(git status -s 2> /dev/null) ]]; then echo "$ZSH_THEME_GIT_PROMPT_DIRTY" else echo "$ZSH_THEME_GIT_PROMPT_CLEAN" From 5b7b5bc9d10b37e36e0c899419abf2cd03fe1dac Mon Sep 17 00:00:00 2001 From: canthiswait Date: Mon, 26 Apr 2010 16:02:19 -0700 Subject: [PATCH 148/614] Added scpectrum script for easy 256 color theaming --- lib/spectrum.zsh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 lib/spectrum.zsh diff --git a/lib/spectrum.zsh b/lib/spectrum.zsh new file mode 100644 index 000000000..4864654cb --- /dev/null +++ b/lib/spectrum.zsh @@ -0,0 +1,20 @@ +#! /bin/zsh +# A script to make using 256 colors in zsh less painful. +# P.C. Shyamshankar +# Copied from http://github.com/sykora/etc/blob/master/zsh/functions/spectrum/ + +typeset -Ag FX FG BG + +FX=( + reset "" + bold "" no-bold "" + italic "" no-italic "" + underline "" no-underline "" + blink "" no-blink "" + reverse "" no-reverse "" +) + +for color in {000..255}; do + FG[$color]="[38;5;${color}m" + BG[$color]="[48;5;${color}m" +done From 32b8cedb7213e99ac73c046aa62d62814ded0ebe Mon Sep 17 00:00:00 2001 From: canthiswait Date: Mon, 26 Apr 2010 22:01:41 -0700 Subject: [PATCH 149/614] escape sequences so rprompt doesn't mess up --- lib/spectrum.zsh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/spectrum.zsh b/lib/spectrum.zsh index 4864654cb..4006a7fe1 100644 --- a/lib/spectrum.zsh +++ b/lib/spectrum.zsh @@ -6,15 +6,15 @@ typeset -Ag FX FG BG FX=( - reset "" - bold "" no-bold "" - italic "" no-italic "" - underline "" no-underline "" - blink "" no-blink "" - reverse "" no-reverse "" + reset "%{%}" + bold "%{%}" no-bold "%{%}" + italic "%{%}" no-italic "%{%}" + underline "%{%}" no-underline "%{%}" + blink "%{%}" no-blink "%{%}" + reverse "%{%}" no-reverse "%{%}" ) for color in {000..255}; do - FG[$color]="[38;5;${color}m" - BG[$color]="[48;5;${color}m" + FG[$color]="%{[38;5;${color}m%}" + BG[$color]="%{[48;5;${color}m%}" done From 96e33c6f6bb6f5a6610fbc7bba6775b039f1f254 Mon Sep 17 00:00:00 2001 From: canthiswait Date: Mon, 26 Apr 2010 22:27:32 -0700 Subject: [PATCH 150/614] 256 color theme with bright blue and orange --- themes/sporty_256.zsh-theme | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 themes/sporty_256.zsh-theme diff --git a/themes/sporty_256.zsh-theme b/themes/sporty_256.zsh-theme new file mode 100644 index 000000000..66c86980c --- /dev/null +++ b/themes/sporty_256.zsh-theme @@ -0,0 +1,13 @@ +# zsh theme requires 256 color enabled terminal +# i.e TERM=xterm-256color +# Preview - http://www.flickr.com/photos/adelcampo/4556482563/sizes/o/ +# based on robbyrussell's shell but louder! + +PROMPT='%{$fg_bold[blue]%}$(git_prompt_info) %F{208}%c%f +%{$fg_bold[white]%}%# %{$reset_color%}' +RPROMPT='%B%F{208}%n%f%{$fg_bold[white]%}@%F{039}%m%f%{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX="%F{154}±|%f%F{124}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}%B✘%b%F{154}|%f%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN=" %{$fg[green]%}✔%{$fg[blue]%}|" From f53b74bddb20333c834d9e2a31f9a80b0212de02 Mon Sep 17 00:00:00 2001 From: canthiswait Date: Tue, 27 Apr 2010 00:55:15 -0700 Subject: [PATCH 151/614] Fixed color in last character of clean git info --- themes/sporty_256.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/sporty_256.zsh-theme b/themes/sporty_256.zsh-theme index 66c86980c..db0fc4277 100644 --- a/themes/sporty_256.zsh-theme +++ b/themes/sporty_256.zsh-theme @@ -10,4 +10,4 @@ RPROMPT='%B%F{208}%n%f%{$fg_bold[white]%}@%F{039}%m%f%{$reset_color%}' ZSH_THEME_GIT_PROMPT_PREFIX="%F{154}±|%f%F{124}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}%B✘%b%F{154}|%f%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_CLEAN=" %{$fg[green]%}✔%{$fg[blue]%}|" +ZSH_THEME_GIT_PROMPT_CLEAN=" %{$fg[green]%}✔%F{154}|" From 2e1eaf4040c8fb233a3ab15fa074231131703507 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Thu, 6 May 2010 21:04:09 -0700 Subject: [PATCH 152/614] Removing rake autocompletion as this is apparently baked into recent versions of zsh --- lib/rake_completion.zsh | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/lib/rake_completion.zsh b/lib/rake_completion.zsh index c425a625e..8336182d5 100644 --- a/lib/rake_completion.zsh +++ b/lib/rake_completion.zsh @@ -1,24 +1,3 @@ -_rake_does_task_list_need_generating () { - if [ ! -f .rake_tasks~ ]; then return 0; - else - accurate=$(stat -f%m .rake_tasks~) - changed=$(stat -f%m Rakefile) - return $(expr $accurate '>=' $changed) - fi -} - -_rake () { - if [ -f Rakefile ]; then - if _rake_does_task_list_need_generating; then - echo "\nGenerating .rake_tasks~..." > /dev/stderr - rake --silent --tasks | cut -d " " -f 2 > .rake_tasks~ - fi - compadd `cat .rake_tasks~` - fi -} - -compctl -K _rake rake - function _cap_does_task_list_need_generating () { if [ ! -f .cap_tasks~ ]; then return 0; else From 9ec6086282b0090f562c39285602e0a161aa7f3c Mon Sep 17 00:00:00 2001 From: kremso Date: Tue, 9 Mar 2010 14:09:08 +0100 Subject: [PATCH 153/614] Don't autoselect first completion entry (Fixes #14) The key here is not using MENU_COMPLETE which autoselects the first entry, but using AUTO_MENU which displays the menu but autoselects on successive tab hit. Also, do not use zstyle menu yes because that somehow overrides the setopts. --- lib/completion.zsh | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/completion.zsh b/lib/completion.zsh index 46b6d8f65..619dc0243 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -1,11 +1,11 @@ ## fixme - the load process here seems a bit bizarre -setopt noautomenu +unsetopt menu_complete # do not autoselect the first completion entry +unsetopt flowcontrol +setopt auto_menu # show completion menu on succesive tab press setopt complete_in_word setopt always_to_end -unsetopt flowcontrol - WORDCHARS='' autoload -U compinit @@ -23,14 +23,10 @@ fi zstyle ':completion:*' list-colors '' - -unsetopt MENU_COMPLETE -#setopt AUTO_MENU - # should this be in keybindings? bindkey -M menuselect '^o' accept-and-infer-next-history -zstyle ':completion:*:*:*:*:*' menu yes select +zstyle ':completion:*:*:*:*:*' menu select # zstyle ':completion:*:*:*:*:processes' force-list always zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01' From a7641c92b9e4d8720c1d97c83e2f9745601ded4e Mon Sep 17 00:00:00 2001 From: Nikita Vasilyev Date: Sun, 14 Mar 2010 23:08:27 +0300 Subject: [PATCH 154/614] Arrow theme: http://elv1s.ru/i/zsh-arrow-theme.png --- themes/arrow.zsh-theme | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 themes/arrow.zsh-theme diff --git a/themes/arrow.zsh-theme b/themes/arrow.zsh-theme new file mode 100644 index 000000000..cfe558c0e --- /dev/null +++ b/themes/arrow.zsh-theme @@ -0,0 +1,9 @@ +if [ "$(whoami)" = "root" ]; then NCOLOR="red"; else NCOLOR="yellow"; fi + +PROMPT='%{$fg[$NCOLOR]%}%c ➤ %{$reset_color%}' +RPROMPT='%{$fg[$NCOLOR]%}%p $(git_prompt_info)%{$reset_color%}' + +# See http://geoff.greer.fm/lscolors/ +export LSCOLORS="exfxcxdxbxbxbxbxbxbxbx" +export LS_COLORS="di=34;40:ln=35;40:so=32;40:pi=33;40:ex=31;40:bd=31;40:cd=31;40:su=31;40:sg=31;40:tw=31;40:ow=31;40:" + From 751f34c9621fa08f909324a5367b0b4d8e2338e0 Mon Sep 17 00:00:00 2001 From: Matt Cable Date: Mon, 15 Mar 2010 20:34:26 -0600 Subject: [PATCH 155/614] Alias popd to remove deleted dirs from persistance --- lib/dirspersist.zsh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/dirspersist.zsh b/lib/dirspersist.zsh index a7c077ae0..8364a879c 100644 --- a/lib/dirspersist.zsh +++ b/lib/dirspersist.zsh @@ -16,4 +16,7 @@ dirpersistrestore () { DIRSTACKSIZE=10 setopt autopushd pushdminus pushdsilent pushdtohome pushdignoredups -dirpersistrestore \ No newline at end of file +dirpersistrestore + +# Make popd changes permanent without having to wait for logout +alias popd="popd;dirpersiststore" \ No newline at end of file From 33e99a145ba87a237ceb71bcb6dbaf3c84115c3d Mon Sep 17 00:00:00 2001 From: Nikita Vasilyev Date: Tue, 16 Mar 2010 23:44:01 +0300 Subject: [PATCH 156/614] git:(master) --> git:master Parenthesis removed --- themes/arrow.zsh-theme | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/themes/arrow.zsh-theme b/themes/arrow.zsh-theme index cfe558c0e..a23efd1d7 100644 --- a/themes/arrow.zsh-theme +++ b/themes/arrow.zsh-theme @@ -3,6 +3,11 @@ if [ "$(whoami)" = "root" ]; then NCOLOR="red"; else NCOLOR="yellow"; fi PROMPT='%{$fg[$NCOLOR]%}%c ➤ %{$reset_color%}' RPROMPT='%{$fg[$NCOLOR]%}%p $(git_prompt_info)%{$reset_color%}' +ZSH_THEME_GIT_PROMPT_PREFIX="git:" +ZSH_THEME_GIT_PROMPT_SUFFIX="" +ZSH_THEME_GIT_PROMPT_DIRTY="*" +ZSH_THEME_GIT_PROMPT_CLEAN="" + # See http://geoff.greer.fm/lscolors/ export LSCOLORS="exfxcxdxbxbxbxbxbxbxbx" export LS_COLORS="di=34;40:ln=35;40:so=32;40:pi=33;40:ex=31;40:bd=31;40:cd=31;40:su=31;40:sg=31;40:tw=31;40:ow=31;40:" From bd481dd34641afb2095b4739e72632ead3ca023d Mon Sep 17 00:00:00 2001 From: Dallas Reedy Date: Wed, 17 Mar 2010 11:25:17 -0700 Subject: [PATCH 157/614] added my personal theme: the dallas them --- themes/dallas.zsh-theme | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 themes/dallas.zsh-theme diff --git a/themes/dallas.zsh-theme b/themes/dallas.zsh-theme new file mode 100644 index 000000000..10e019be0 --- /dev/null +++ b/themes/dallas.zsh-theme @@ -0,0 +1,14 @@ +# Personalized! +# [red][normal][purple][yellow][normal] +# dallas@lappy ~/Sites % +# PROMPT="%{$fg[red]%}%n%{$reset_color%}@%{$fg[blue]%}%m %{$fg[yellow]%}%~ %{$reset_color%}%% " +# PROMPT="{white}\{{yellow}{time}{white}\}{green}{host}{white}:{cyan}{pwd} {red,bold}{user}{white}%{normal} " + +DALLAS_CURRENT_TIME_="%{$fg[white]%}{%{$fg[yellow]%}%T%{$fg[white]%}}%{$reset_color%}" +DALLAS_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[magenta]%}\$(~/.rvm/bin/rvm-prompt i v)%{$fg[white]%}]%{$reset_color%}" +DALLAS_CURRENT_MACH_="%{$fg[green]%}%m%{$fg[white]%}:%{$reset_color%}" +DALLAS_CURRENT_LOCA_="%{$fg[cyan]%}%~%{$reset_color%}" +DALLAS_CURRENT_USER_="%{$fg[red]%}%n%{$reset_color%}" +DALLAS_PROMPT_CHAR_="%{$fg[white]%}%%%{$reset_color%}" + +PROMPT="$DALLAS_CURRENT_TIME_$DALLAS_CURRENT_RUBY_$DALLAS_CURRENT_MACH_$DALLAS_CURRENT_LOCA_ $DALLAS_CURRENT_USER_$DALLAS_PROMPT_CHAR_ " From 5edeaf9e115da68a896a5edf4c004c271858c027 Mon Sep 17 00:00:00 2001 From: Tomas Kramar Date: Mon, 22 Mar 2010 21:44:15 +0100 Subject: [PATCH 158/614] Make Shift+Tab move backwards in the menu --- lib/key-bindings.zsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/key-bindings.zsh b/lib/key-bindings.zsh index 87e47bab6..8d22eb2b3 100644 --- a/lib/key-bindings.zsh +++ b/lib/key-bindings.zsh @@ -20,6 +20,7 @@ bindkey "^[[F" end-of-line bindkey "^[[4~" end-of-line bindkey ' ' magic-space # also do history expansion on space +bindkey '^[[Z' reverse-menu-complete # consider emacs keybindings: @@ -38,4 +39,4 @@ bindkey ' ' magic-space # also do history expansion on space #bindkey '^I' complete-word ## Fix weird sequence that rxvt produces #bindkey -s '^[[Z' '\t' -# \ No newline at end of file +# From 1faec3fbd882e583a9e211f50993ef49d5d0b37e Mon Sep 17 00:00:00 2001 From: John Reese Date: Thu, 8 Apr 2010 14:11:42 -0400 Subject: [PATCH 159/614] Added theme "jreese" to oh-my-zsh --- themes/jreese.zsh-theme | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 themes/jreese.zsh-theme diff --git a/themes/jreese.zsh-theme b/themes/jreese.zsh-theme new file mode 100644 index 000000000..0f91776c6 --- /dev/null +++ b/themes/jreese.zsh-theme @@ -0,0 +1,14 @@ +if [ "$(whoami)" = "root" ]; then NCOLOR="red"; else NCOLOR="green"; fi +local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" + +PROMPT='%{$fg[$NCOLOR]%}%n%{$fg[green]%}@%m%{$reset_color%} %2~ \ +$(git_prompt_info)\ +%{$fg[red]%}%(!.#.»)%{$reset_color%} ' +PROMPT2='%{$fg[red]%}\ %{$reset_color%}' +RPS1='${return_code}' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}±%{$fg[yellow]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " +ZSH_THEME_GIT_PROMPT_CLEAN="" +ZSH_THEME_GIT_PROMPT_DIRTY="⚡" + From 7d186816290bbc3011ff3d48e39ea6724fbd6d52 Mon Sep 17 00:00:00 2001 From: John Reese Date: Thu, 8 Apr 2010 15:02:56 -0400 Subject: [PATCH 160/614] Added screenshot link for jreese theme --- themes/jreese.zsh-theme | 2 ++ 1 file changed, 2 insertions(+) diff --git a/themes/jreese.zsh-theme b/themes/jreese.zsh-theme index 0f91776c6..111dc0dee 100644 --- a/themes/jreese.zsh-theme +++ b/themes/jreese.zsh-theme @@ -1,3 +1,5 @@ +# ZSH Theme - Preview: http://dl.dropbox.com/u/1552408/Screenshots/2010-04-08-oh-my-zsh.png + if [ "$(whoami)" = "root" ]; then NCOLOR="red"; else NCOLOR="green"; fi local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" From 3ecabe4f5b2963d7dec7f76e668347a0e3a2f7cf Mon Sep 17 00:00:00 2001 From: John Reese Date: Thu, 8 Apr 2010 15:07:43 -0400 Subject: [PATCH 161/614] Remove limit of two segments to PWD --- themes/jreese.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/jreese.zsh-theme b/themes/jreese.zsh-theme index 111dc0dee..534664f11 100644 --- a/themes/jreese.zsh-theme +++ b/themes/jreese.zsh-theme @@ -3,7 +3,7 @@ if [ "$(whoami)" = "root" ]; then NCOLOR="red"; else NCOLOR="green"; fi local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" -PROMPT='%{$fg[$NCOLOR]%}%n%{$fg[green]%}@%m%{$reset_color%} %2~ \ +PROMPT='%{$fg[$NCOLOR]%}%n%{$fg[green]%}@%m%{$reset_color%} %~ \ $(git_prompt_info)\ %{$fg[red]%}%(!.#.»)%{$reset_color%} ' PROMPT2='%{$fg[red]%}\ %{$reset_color%}' From ab010947aec9751ab879653dbd904b3580f7701e Mon Sep 17 00:00:00 2001 From: John Reese Date: Thu, 8 Apr 2010 22:35:35 -0400 Subject: [PATCH 162/614] Ignore errors from compaudit when using `sudo -s` --- lib/completion.zsh | 2 +- lib/key-bindings.zsh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/completion.zsh b/lib/completion.zsh index 46b6d8f65..b58612dbf 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -9,7 +9,7 @@ unsetopt flowcontrol WORDCHARS='' autoload -U compinit -compinit +compinit -i zmodload -i zsh/complist diff --git a/lib/key-bindings.zsh b/lib/key-bindings.zsh index 87e47bab6..2e282d66a 100644 --- a/lib/key-bindings.zsh +++ b/lib/key-bindings.zsh @@ -1,6 +1,6 @@ # TODO: Explain what some of this does.. autoload -U compinit -compinit +compinit -i bindkey -e bindkey '\ew' kill-region @@ -38,4 +38,4 @@ bindkey ' ' magic-space # also do history expansion on space #bindkey '^I' complete-word ## Fix weird sequence that rxvt produces #bindkey -s '^[[Z' '\t' -# \ No newline at end of file +# From e3027eee8ab23f859805d869494dd9d8592eef51 Mon Sep 17 00:00:00 2001 From: Jon Duell Date: Tue, 27 Apr 2010 05:47:02 +0800 Subject: [PATCH 163/614] Adds new duellj theme --- themes/duellj.zsh-theme | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 themes/duellj.zsh-theme diff --git a/themes/duellj.zsh-theme b/themes/duellj.zsh-theme new file mode 100644 index 000000000..7350b4335 --- /dev/null +++ b/themes/duellj.zsh-theme @@ -0,0 +1,8 @@ + +# 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 +PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;34m%}@%{\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%}%!%{\e[0;34m%}%B]%b%{\e[0m%} +%{\e[0;34m%}%B└─%B[%{\e[1;35m%}$%{\e[0;34m%}%B]%{\e[0m%}%b ' +RPROMPT='[%*]' +PS2=$' \e[0;34m%}%B>%{\e[0m%}%b ' From 91c98643260c9a5535871106c20c27493a80fe87 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Thu, 6 May 2010 21:13:59 -0700 Subject: [PATCH 164/614] Unsetting config_file after loading config --- oh-my-zsh.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index fa2738e18..a41f3d89e 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -17,3 +17,5 @@ then else /usr/bin/env zsh $ZSH/tools/check_for_upgrade.sh fi + +unset config_file \ No newline at end of file From f2c600a709aa18c860cb326e2747167fa694fafb Mon Sep 17 00:00:00 2001 From: Dallas Reedy Date: Fri, 7 May 2010 11:17:12 -0700 Subject: [PATCH 165/614] updated my theme with the date and git branch (+ dirty or not) --- themes/dallas.zsh-theme | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/themes/dallas.zsh-theme b/themes/dallas.zsh-theme index 10e019be0..eef32e998 100644 --- a/themes/dallas.zsh-theme +++ b/themes/dallas.zsh-theme @@ -1,14 +1,26 @@ # Personalized! -# [red][normal][purple][yellow][normal] -# dallas@lappy ~/Sites % -# PROMPT="%{$fg[red]%}%n%{$reset_color%}@%{$fg[blue]%}%m %{$fg[yellow]%}%~ %{$reset_color%}%% " -# PROMPT="{white}\{{yellow}{time}{white}\}{green}{host}{white}:{cyan}{pwd} {red,bold}{user}{white}%{normal} " -DALLAS_CURRENT_TIME_="%{$fg[white]%}{%{$fg[yellow]%}%T%{$fg[white]%}}%{$reset_color%}" +# Grab the current date (%D) and time (%T) wrapped in {}: {%D %T} +DALLAS_CURRENT_TIME_="%{$fg[white]%}{%{$fg[yellow]%}%D %T%{$fg[white]%}}%{$reset_color%}" +# Grab the current version of ruby in use (via RVM): [ruby-1.8.7] DALLAS_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[magenta]%}\$(~/.rvm/bin/rvm-prompt i v)%{$fg[white]%}]%{$reset_color%}" +# Grab the current machine name: muscato DALLAS_CURRENT_MACH_="%{$fg[green]%}%m%{$fg[white]%}:%{$reset_color%}" -DALLAS_CURRENT_LOCA_="%{$fg[cyan]%}%~%{$reset_color%}" +# Grab the current filepath, use shortcuts: ~/Desktop +# Append the current git branch, if in a git repository: ~aw@master +DALLAS_CURRENT_LOCA_="%{$fg[cyan]%}%~\$(git_prompt_info)%{$reset_color%}" +# Grab the current username: dallas DALLAS_CURRENT_USER_="%{$fg[red]%}%n%{$reset_color%}" -DALLAS_PROMPT_CHAR_="%{$fg[white]%}%%%{$reset_color%}" +# Use a % for normal users and a # for privelaged (root) users. +DALLAS_PROMPT_CHAR_="%{$fg[white]%}%(!.#.%%)%{$reset_color%}" +# For the git prompt, use a white @ and blue text for the branch name +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[white]%}@%{$fg[blue]%}" +# Close it all off by resetting the color and styles. +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +# Do nothing if the branch is clean (no changes). +ZSH_THEME_GIT_PROMPT_CLEAN="" +# Add 3 cyan ✗s if this branch is diiirrrty! Dirty branch! +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[cyan]%}✗✗✗" +# Put it all together! PROMPT="$DALLAS_CURRENT_TIME_$DALLAS_CURRENT_RUBY_$DALLAS_CURRENT_MACH_$DALLAS_CURRENT_LOCA_ $DALLAS_CURRENT_USER_$DALLAS_PROMPT_CHAR_ " From af0e77b0c1b88b82e9c2b9b8551c0ac4d21858b3 Mon Sep 17 00:00:00 2001 From: Mario Gutierrez Date: Wed, 21 Apr 2010 19:24:53 +0800 Subject: [PATCH 166/614] my theme --- themes/mgutz.zsh-theme | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 themes/mgutz.zsh-theme diff --git a/themes/mgutz.zsh-theme b/themes/mgutz.zsh-theme new file mode 100644 index 000000000..dcf327041 --- /dev/null +++ b/themes/mgutz.zsh-theme @@ -0,0 +1,6 @@ +PROMPT='%{$fg_bold[magenta]%}%1~$(git_prompt_info) %{$fg_bold[magenta]%}%# %{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[yellow]%}[" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="*]" +ZSH_THEME_GIT_PROMPT_CLEAN="]" From 8ca0e16e0578470f62456d1da52f7d498fdd4a58 Mon Sep 17 00:00:00 2001 From: Dylan Clendenin Date: Tue, 4 May 2010 02:49:48 +0800 Subject: [PATCH 167/614] two aliases set to 'ss', clobbering rails script/server --- lib/aliases.zsh | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/aliases.zsh b/lib/aliases.zsh index f97daf41a..d891cc0a8 100644 --- a/lib/aliases.zsh +++ b/lib/aliases.zsh @@ -21,7 +21,6 @@ alias -- -='cd -' # Super user alias _='sudo' -alias ss='sudo su -' #alias g='grep -in' From 749960fe30a253e2fb9466c97cf84b084ed784a7 Mon Sep 17 00:00:00 2001 From: Mike Hostetler Date: Wed, 31 Mar 2010 00:21:42 +0800 Subject: [PATCH 168/614] added my theme, based on xiong-chiamiov-plus but using vcs_info instead of just git --- themes/mikeh.zsh-theme | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 themes/mikeh.zsh-theme diff --git a/themes/mikeh.zsh-theme b/themes/mikeh.zsh-theme new file mode 100644 index 000000000..943f04d38 --- /dev/null +++ b/themes/mikeh.zsh-theme @@ -0,0 +1,23 @@ +setopt prompt_subst +autoload colors +colors + +autoload -U add-zsh-hook +autoload -Uz vcs_info + +# check-for-changes can be really slow. +# you should disable it, if you work with large repositories +zstyle ':vcs_info:*:prompt:*' check-for-changes true + +add-zsh-hook precmd mikeh_precmd + +mikeh_precmd() { + vcs_info +} + +# 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 +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{"%a %b %d, %I:%M"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} +%{\e[0;34m%}%B..%B[%{\e[1;35m%}$%{\e[0;34m%}%B] <($vcs_info_msg_0_)>%{\e[0m%}%b ' +PS2=$' \e[0;34m%}%B>%{\e[0m%}%b ' \ No newline at end of file From 1d93b2346fca1e85dd25571c835fc84896ce2e72 Mon Sep 17 00:00:00 2001 From: Mike Hostetler Date: Wed, 31 Mar 2010 01:31:41 +0800 Subject: [PATCH 169/614] share history with your zsh's on the same host --- lib/history.zsh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/history.zsh b/lib/history.zsh index 527c32762..509be8f09 100644 --- a/lib/history.zsh +++ b/lib/history.zsh @@ -10,3 +10,6 @@ setopt hist_verify setopt inc_append_history setopt extended_history setopt hist_expire_dups_first + +setopt SHARE_HISTORY +setopt APPEND_HISTORY From 9b479c6af25b950e2b3a458ec47af1ae5bebecc1 Mon Sep 17 00:00:00 2001 From: Matthew Gadd Date: Tue, 6 Apr 2010 08:24:33 +0800 Subject: [PATCH 170/614] Add my oh-my-zsh theme --- themes/dst.zsh-theme | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 themes/dst.zsh-theme diff --git a/themes/dst.zsh-theme b/themes/dst.zsh-theme new file mode 100644 index 000000000..fa0d9cb06 --- /dev/null +++ b/themes/dst.zsh-theme @@ -0,0 +1,16 @@ + +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 [ "$(whoami)" = "root" ]; 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 30ad562db9566bd5a5596b965f8b2fb327461419 Mon Sep 17 00:00:00 2001 From: dstufft Date: Wed, 24 Mar 2010 08:51:57 +0800 Subject: [PATCH 171/614] added the dstufft theme (based on prose by sjl) --- themes/dstufft.zsh-theme | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 themes/dstufft.zsh-theme diff --git a/themes/dstufft.zsh-theme b/themes/dstufft.zsh-theme new file mode 100644 index 000000000..5a23fcea5 --- /dev/null +++ b/themes/dstufft.zsh-theme @@ -0,0 +1,19 @@ +function prompt_char { + git branch >/dev/null 2>/dev/null && echo '±' && return + hg root >/dev/null 2>/dev/null && echo 'Hg' && return + echo '○' +} + +function virtualenv_info { + [ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') ' +} + +PROMPT=' +%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$(git_prompt_info) +$(virtualenv_info)$(prompt_char) ' + +ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}!" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[green]%}?" +ZSH_THEME_GIT_PROMPT_CLEAN="" From 87920fb11177e37c6f16f441790605c762ce861d Mon Sep 17 00:00:00 2001 From: Matt Cable Date: Fri, 2 Apr 2010 15:24:41 -0600 Subject: [PATCH 172/614] Escape &'s in path name. Need to find general function for escaping all shell metacharacters. --- lib/dirspersist.zsh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/dirspersist.zsh b/lib/dirspersist.zsh index 8364a879c..973107c52 100644 --- a/lib/dirspersist.zsh +++ b/lib/dirspersist.zsh @@ -5,7 +5,8 @@ # Run dirpersiststore in ~/.zlogout dirpersiststore () { - dirs -p | sed 's/ /\\ /g;s/^/pushd -q /;1!G;h;$!d;' > ~/.zdirstore +# FIXME: need to escape all shell metacharacters, not just spaces! + dirs -p | sed 's/ /\\ /g;s/&/\\&/;s/^/pushd -q /;1!G;h;$!d;' > ~/.zdirstore } dirpersistrestore () { @@ -19,4 +20,4 @@ setopt autopushd pushdminus pushdsilent pushdtohome pushdignoredups dirpersistrestore # Make popd changes permanent without having to wait for logout -alias popd="popd;dirpersiststore" \ No newline at end of file +alias popd="popd;dirpersiststore" From 1a6a29e8880d2d050a5b83728e7dd11eeeafa764 Mon Sep 17 00:00:00 2001 From: Ryan McCuaig Date: Fri, 16 Apr 2010 08:22:50 +0800 Subject: [PATCH 173/614] Add my preferred prompt --- themes/rgm.zsh-theme | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 themes/rgm.zsh-theme diff --git a/themes/rgm.zsh-theme b/themes/rgm.zsh-theme new file mode 100644 index 000000000..9452a8b0d --- /dev/null +++ b/themes/rgm.zsh-theme @@ -0,0 +1,8 @@ +PROMPT=' +%n@%m %{$fg[cyan]%}%~ +%? $(git_prompt_info)%{$fg_bold[blue]%}%% %{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[red]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%}" From ea0a1a9f5130aa55c995f264f197ae499937964e Mon Sep 17 00:00:00 2001 From: Christopher Chow Date: Fri, 30 Apr 2010 16:36:03 +0800 Subject: [PATCH 174/614] Added my own theme. --- themes/Soliah.zsh-theme | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 themes/Soliah.zsh-theme diff --git a/themes/Soliah.zsh-theme b/themes/Soliah.zsh-theme new file mode 100644 index 000000000..7ad876d41 --- /dev/null +++ b/themes/Soliah.zsh-theme @@ -0,0 +1,6 @@ +PROMPT='%{$fg[blue]%}%B%20~%b%{$reset_color%}%{$(git_prompt_info)%} $ ' + +ZSH_THEME_GIT_PROMPT_PREFIX="(%{$fg[green]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%})" +ZSH_THEME_GIT_PROMPT_DIRTY="*%{$reset_color%}" + From e5b7072ab3d29cf78df8009856dc6134108def3f Mon Sep 17 00:00:00 2001 From: Andy Fowler Date: Wed, 5 May 2010 04:19:09 +0800 Subject: [PATCH 175/614] my WIP theme --- themes/afowler.zsh-theme | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 themes/afowler.zsh-theme diff --git a/themes/afowler.zsh-theme b/themes/afowler.zsh-theme new file mode 100644 index 000000000..f82e7bc25 --- /dev/null +++ b/themes/afowler.zsh-theme @@ -0,0 +1,8 @@ +local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" + +PROMPT='%m %{${fg_bold[blue]}%}:: %{$reset_color%}%{${fg[green]}%}%3~ $(git_prompt_info)%{${fg[blue]}%}»%{${reset_color}%} ' + +RPS1="${return_code}" + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹" +ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}" From d2be10e7e4fabec8711a60c2ab85387a4e00dd5b Mon Sep 17 00:00:00 2001 From: Andy Fowler Date: Wed, 5 May 2010 04:58:10 +0800 Subject: [PATCH 176/614] happy with my theme. caret turns red for root --- themes/afowler.zsh-theme | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/themes/afowler.zsh-theme b/themes/afowler.zsh-theme index f82e7bc25..b5a9bb173 100644 --- a/themes/afowler.zsh-theme +++ b/themes/afowler.zsh-theme @@ -1,6 +1,8 @@ +if [ "$(whoami)" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="blue"; fi + local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" -PROMPT='%m %{${fg_bold[blue]}%}:: %{$reset_color%}%{${fg[green]}%}%3~ $(git_prompt_info)%{${fg[blue]}%}»%{${reset_color}%} ' +PROMPT='%m %{${fg_bold[blue]}%}:: %{$reset_color%}%{${fg[green]}%}%3~ $(git_prompt_info)%{${fg_bold[$CARETCOLOR]}%}»%{${reset_color}%} ' RPS1="${return_code}" From 142490d04a6d2c9f6737201ed54036beb784dfe4 Mon Sep 17 00:00:00 2001 From: Parker McGee Date: Fri, 30 Apr 2010 00:12:26 +0800 Subject: [PATCH 177/614] added my own theme --- themes/pmcgee.zsh-theme | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 themes/pmcgee.zsh-theme diff --git a/themes/pmcgee.zsh-theme b/themes/pmcgee.zsh-theme new file mode 100644 index 000000000..4eb54df5b --- /dev/null +++ b/themes/pmcgee.zsh-theme @@ -0,0 +1,16 @@ +if [ "$(whoami)" = "root" ]; then NCOLOR="red"; else NCOLOR="green"; fi + +PROMPT=' +%{$fg[$NCOLOR]%}%B%n@%m%b%{$reset_color%} %{$fg[white]%}%B${PWD/#$HOME/~}%b%{$reset_color%} +$(git_prompt_info)%(!.#.$) ' +RPROMPT='[%*]' + +# git theming +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_no_bold[yellow]%}%B" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " +ZSH_THEME_GIT_PROMPT_CLEAN="" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%}*" + +# LS colors, made with http://geoff.greer.fm/lscolors/ +export LSCOLORS="Gxfxcxdxbxegedabagacad" +export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:' From 6ccca35e9de3ad8135628058568ca77e6422a9d8 Mon Sep 17 00:00:00 2001 From: Dave Verwer Date: Thu, 22 Apr 2010 17:32:36 +0800 Subject: [PATCH 178/614] New theme "daveverwer", based on "geoffgarside". --- themes/daveverwer.zsh-theme | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 themes/daveverwer.zsh-theme diff --git a/themes/daveverwer.zsh-theme b/themes/daveverwer.zsh-theme new file mode 100644 index 000000000..89aef926e --- /dev/null +++ b/themes/daveverwer.zsh-theme @@ -0,0 +1,7 @@ +# Copied and modified from the oh-my-zsh theme from geoffgarside +# Red server name, green cwd, blue git status + +PROMPT='%{$fg[red]%}%m%{$reset_color%}:%{$fg[green]%}%c%{$reset_color%}$(git_prompt_info) %(!.#.$) ' + +ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[blue]%}(" +ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}" From 73aa7d3fa636621f7513c2b20542175ef815bcc8 Mon Sep 17 00:00:00 2001 From: Edvard Majakari Date: Wed, 14 Apr 2010 04:44:51 +0800 Subject: [PATCH 179/614] added my theme --- themes/edvardm.zsh-theme | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 themes/edvardm.zsh-theme diff --git a/themes/edvardm.zsh-theme b/themes/edvardm.zsh-theme new file mode 100644 index 000000000..f9ca1a9e2 --- /dev/null +++ b/themes/edvardm.zsh-theme @@ -0,0 +1,6 @@ +PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg_bold[white]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" From b716d1c12c080ba066b089004aaaa42a94b94b08 Mon Sep 17 00:00:00 2001 From: Doug Fritz Date: Sat, 3 Apr 2010 15:48:35 +0800 Subject: [PATCH 180/614] added skaro theme --- themes/skaro.zsh-theme | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 themes/skaro.zsh-theme diff --git a/themes/skaro.zsh-theme b/themes/skaro.zsh-theme new file mode 100644 index 000000000..84b7b11b0 --- /dev/null +++ b/themes/skaro.zsh-theme @@ -0,0 +1,7 @@ +PROMPT='%{$fg_bold[green]%}%h %{$fg[cyan]%}%2~ %{$fg_bold[blue]%}$(git_prompt_info) %{$reset_color%}» ' + +ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" + From faca005fe6682611273fd2769cd7a6d0a5c6706e Mon Sep 17 00:00:00 2001 From: Matt Cable Date: Thu, 22 Apr 2010 11:26:08 -0600 Subject: [PATCH 181/614] Escape some metachars that trip up .zdirstore script --- lib/dirspersist.zsh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/dirspersist.zsh b/lib/dirspersist.zsh index 973107c52..d694c55e2 100644 --- a/lib/dirspersist.zsh +++ b/lib/dirspersist.zsh @@ -5,8 +5,7 @@ # Run dirpersiststore in ~/.zlogout dirpersiststore () { -# FIXME: need to escape all shell metacharacters, not just spaces! - dirs -p | sed 's/ /\\ /g;s/&/\\&/;s/^/pushd -q /;1!G;h;$!d;' > ~/.zdirstore + dirs -p | tail -r | perl -ne 'chomp;s/([& ])/\\$1/g ;print "if [ -d $_ ]; then pushd -q $_; fi\n"' > ~/.zdirstore } dirpersistrestore () { From 9056b681fb29cd17d59b8e57a216e6290aafb564 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Fri, 7 May 2010 15:35:03 -0700 Subject: [PATCH 182/614] Sprinkling some candy on this muffin. --- tools/install.sh | 9 ++++++++- tools/upgrade.sh | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/install.sh b/tools/install.sh index 5a7c00950..004b252f4 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -24,6 +24,13 @@ echo "export PATH=$PATH" >> ~/.zshrc echo "Time to change your default shell to zsh!" chsh -s /bin/zsh -echo "Hooray! Oh My Zsh has been installed." +echo ' __ __ ' +echo ' ____ / /_ ____ ___ __ __ ____ _____/ /_ ' +echo ' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ ' +echo '/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / ' +echo '\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ ' +echo ' /____/' + +echo "\n\n ....is now installed." /bin/zsh source ~/.zshrc diff --git a/tools/upgrade.sh b/tools/upgrade.sh index f749404e9..6dee42c25 100644 --- a/tools/upgrade.sh +++ b/tools/upgrade.sh @@ -2,4 +2,5 @@ current_path=`pwd` echo "Upgrading Oh My Zsh" ( cd $ZSH && git pull origin master ) echo "Hooray! Oh My Zsh has been updated and/or is at the current version. \nAny new updates will be reflected when you start your next terminal session." +echo "To keep up on the latest, be sure to follow Oh My Zsh on twitter: http://twitter.com/ohmyzsh" cd $current_path \ No newline at end of file From 6bb4e2388af05243afe3be7267b2ac5bcdaedbd3 Mon Sep 17 00:00:00 2001 From: Hayes Williams Date: Wed, 26 May 2010 21:49:55 -0700 Subject: [PATCH 183/614] Adds a new theme that only seems to work on Linux --- themes/linuxonly | 80 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 themes/linuxonly diff --git a/themes/linuxonly b/themes/linuxonly new file mode 100644 index 000000000..a11b80d7f --- /dev/null +++ b/themes/linuxonly @@ -0,0 +1,80 @@ +# vim: set ts=2 textwidth=0 + +autoload -U add-zsh-hook +autoload -Uz vcs_info +local c0=$(printf "\033[0m") +local c1=$(printf "\033[38;5;215m") +local c2=$(printf "\033[38;5;209m") +local c3=$(printf "\033[38;5;203m") +local c4=$(printf "\033[33;4m") +local c5=$(printf "\033[38;5;137m") +local c6=$(printf "\033[38;5;240m") +local c7=$(printf "\033[38;5;149m") +local c8=$(printf "\033[38;5;126m") +local c9=$(printf "\033[38;5;162m") + +local foopath=$(perl /home/scp1/bin/foopath) + +if [ "$TERM" = "linux" ]; then + c1=$(printf "\033[34;1m") + c2=$(printf "\033[35m") + c3=$(printf "\033[31m") + c4=$(printf "\033[31;1m") + c5=$(printf "\033[32m") + c6=$(printf "\033[32;1m") + c7=$(printf "\033[33m") + c8=$(printf "\033[33;1m") + c9=$(printf "\033[34m") +fi + +#local newtv=$(perl $HOME/devel/newtv.pl) +local newtv='' + +zstyle ':vcs_info:*' actionformats \ + '%{$c8%}(%f%s)%{$c7%}-%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f ' +zstyle ':vcs_info:*' formats \ + "%{$c8%}%s%{$c7%}:%{$c7%}(%{$c9%}%b%{$c7%})%f " +zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r' +zstyle ':vcs_info:*' enable git + +add-zsh-hook precmd prompt_jnrowe_precmd + +prompt_jnrowe_precmd () { + vcs_info + + if [ "${vcs_info_msg_0_}" = "" ]; then + #dir_status="|%F{3}%n%F{7}@%F{3}%m%F{7}:%F{9}%l%f" + #dir_status="$c1%n%F{7}@%F{9}%m%F{7}:%F{12}%/" + dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$c4%}%/ %{$c0%}(%{$c5%}%?%{$c0%})" + #dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$foopath%} %{$c0%}(%{$c5%}%?%{$c0%})" + + PROMPT='%{$fg_bold[green]%}%p%{$reset_color%}${vcs_info_msg_0_}${dir_status} ${ret_status}%{$reset_color%} +> ' + elif [[ $(git diff --cached --name-status 2>/dev/null ) != "" ]]; then + dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$c4%}%/ %{$c0%}(%{$c5%}%?%{$c0%})" + PROMPT='${vcs_info_msg_0_} +%{$fg_bold[green]%}%p%{$reset_color%}${dir_status} ${vcs_info_msg_0_}%{$reset_color%} +> ' + + elif [[ $(git diff --name-status 2>/dev/null ) != "" ]]; then + dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$c4%}%/ %{$c0%}(%{$c5%}%?%{$c0%})" + + PROMPT='${vcs_info_msg_0_} +%{$fg_bold[green]%}%p%{$reset_color%}${dir_status}%{$reset_color%} +%{$c9%}·>%{$c0%} ' + else + dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$c4%}%/ %{$c0%}(%{$c5%}%?%{$c0%})" + PROMPT='${vcs_info_msg_0_} +%{$fg_bold[green]%}%p%{$reset_color%}${dir_status} ${vcs_info_msg_0_}%{$reset_color%} +> ' + + fi +} + + +#PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$reset_color%} ${vcs_info_msg_0_}${dir_status}%{$reset_color%} +#> ' + +# vim: set ft=zsh ts=4 sw=4 et: + + From f399d215aa704bd869055d7a35d86f62261748a7 Mon Sep 17 00:00:00 2001 From: lunks Date: Fri, 14 May 2010 04:42:24 +0800 Subject: [PATCH 184/614] modified macovsky to support ruby version --- themes/macovsky.zsh-theme | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/macovsky.zsh-theme b/themes/macovsky.zsh-theme index db7f9148c..4eb410233 100644 --- a/themes/macovsky.zsh-theme +++ b/themes/macovsky.zsh-theme @@ -1,8 +1,8 @@ # ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" -PROMPT='%{$fg[green]%}%~%{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b ' +PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(~/.rvm/bin/rvm-prompt i v)› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b ' RPS1="${return_code}" ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹" -ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}" \ No newline at end of file +ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}" From 61172d3713706d8b1a989f7040b1a92daa3709e9 Mon Sep 17 00:00:00 2001 From: lunks Date: Fri, 14 May 2010 07:15:31 +0800 Subject: [PATCH 185/614] macowsky modified theme with ruby version on prompt --- themes/macovsky-ruby.zsh-theme | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 themes/macovsky-ruby.zsh-theme diff --git a/themes/macovsky-ruby.zsh-theme b/themes/macovsky-ruby.zsh-theme new file mode 100644 index 000000000..4eb410233 --- /dev/null +++ b/themes/macovsky-ruby.zsh-theme @@ -0,0 +1,8 @@ +# ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png +local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" + +PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(~/.rvm/bin/rvm-prompt i v)› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b ' +RPS1="${return_code}" + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹" +ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}" From f961374db3db289d761d4d9da8bba50698d2eca1 Mon Sep 17 00:00:00 2001 From: Alan Harper Date: Wed, 19 May 2010 14:53:16 +0800 Subject: [PATCH 186/614] Import rvm prompt --- lib/rvm.zsh | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 lib/rvm.zsh diff --git a/lib/rvm.zsh b/lib/rvm.zsh new file mode 100644 index 000000000..597be1b33 --- /dev/null +++ b/lib/rvm.zsh @@ -0,0 +1,7 @@ +# get the name of the branch we are on +function rvm_prompt_info() { + ruby_version=$(~/.rvm/bin/rvm-prompt 2> /dev/null) || return + echo "($ruby_version)" +} + + From d9294f9878a6b59ef66b235e58e46f279c040776 Mon Sep 17 00:00:00 2001 From: Alan Harper Date: Wed, 19 May 2010 14:53:38 +0800 Subject: [PATCH 187/614] aussiegeek theme (include showing rvm prompt) --- themes/aussiegeek.zsh-theme | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 themes/aussiegeek.zsh-theme diff --git a/themes/aussiegeek.zsh-theme b/themes/aussiegeek.zsh-theme new file mode 100644 index 000000000..c2c7f65b9 --- /dev/null +++ b/themes/aussiegeek.zsh-theme @@ -0,0 +1,8 @@ + +PROMPT='$fg_bold[blue][ $fg[red]%t $fg_bold[blue]] $fg_bold[blue] [ $fg[red]%n@%m:%~$(git_prompt_info)$fg[yellow]$(rvm_prompt_info)$fg_bold[blue] ]$reset_color + $ ' +# git theming +ZSH_THEME_GIT_PROMPT_PREFIX="$fg_bold[green](" +ZSH_THEME_GIT_PROMPT_SUFFIX=")" +ZSH_THEME_GIT_PROMPT_CLEAN="✔" +ZSH_THEME_GIT_PROMPT_DIRTY="✗" From 6878f3ad22ad395e451f5850ca9856b41e009b0f Mon Sep 17 00:00:00 2001 From: Thomas J Bradley Date: Thu, 27 May 2010 06:37:52 +0800 Subject: [PATCH 188/614] Added my zsh theme file, heavily based on sjl's --- themes/thomasjbradley.zsh-theme | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 themes/thomasjbradley.zsh-theme diff --git a/themes/thomasjbradley.zsh-theme b/themes/thomasjbradley.zsh-theme new file mode 100644 index 000000000..857301d19 --- /dev/null +++ b/themes/thomasjbradley.zsh-theme @@ -0,0 +1,29 @@ +function prompt_char { + git branch >/dev/null 2>/dev/null && echo '±' && return + hg root >/dev/null 2>/dev/null && echo '☿' && return + echo '○' +} + +function virtualenv_info { + [ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') ' +} + +function hg_prompt_info { + hg prompt --angle-brackets "\ +< on %{$fg[magenta]%}%{$reset_color%}>\ +< at %{$fg[yellow]%}%{$reset_color%}>\ +%{$fg[green]%}%{$reset_color%}< +patches: >" 2>/dev/null +} + +PROMPT=' +%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$(hg_prompt_info)$(git_prompt_info) +$(virtualenv_info)$(prompt_char) ' + +ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}!" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[green]%}?" +ZSH_THEME_GIT_PROMPT_CLEAN="" + +. ~/bin/dotfiles/zsh/aliases From 02f43b2e8b3c398cb2869d3cd1fa988a9fd68c25 Mon Sep 17 00:00:00 2001 From: Vincent Driessen Date: Fri, 28 May 2010 03:20:27 +0800 Subject: [PATCH 189/614] Added customized version of the wezm theme (mainly added username/host in the prompt). --- themes/wezm+.zsh-theme | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 themes/wezm+.zsh-theme diff --git a/themes/wezm+.zsh-theme b/themes/wezm+.zsh-theme new file mode 100644 index 000000000..fee3eb08e --- /dev/null +++ b/themes/wezm+.zsh-theme @@ -0,0 +1,7 @@ +PROMPT='%{${fg_bold[yellow]}%}%n%{$reset_color%}%{${fg[yellow]}%}@%m%{$reset_color%} $(git_prompt_info)%(?,,%{${fg_bold[white]}%}[%?]%{$reset_color%} )%{$fg[yellow]%}%#%{$reset_color%} ' +RPROMPT='%{$fg[green]%}%~%{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[blue]%}(" +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]%})" From 073d75e490bb6a084ca5e267dcd16a97793c7e0b Mon Sep 17 00:00:00 2001 From: Joseph Bergantine Date: Mon, 24 May 2010 04:03:27 +0800 Subject: [PATCH 190/614] adding my zsh theme -- only difference from robby's being that i'm using white instead of blue for legibility over brown --- themes/jbergantine.zsh-theme | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 themes/jbergantine.zsh-theme diff --git a/themes/jbergantine.zsh-theme b/themes/jbergantine.zsh-theme new file mode 100644 index 000000000..d84247cff --- /dev/null +++ b/themes/jbergantine.zsh-theme @@ -0,0 +1,6 @@ +PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[white]%}$(git_prompt_info)%{$fg_bold[white]%} % %{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[white]%}) %{$fg[yellow]%}✗%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[white]%})" From ac13115d22a4a1f16f6c512f600d38317484e108 Mon Sep 17 00:00:00 2001 From: Takashi Yoshida Date: Mon, 31 May 2010 00:56:26 +0800 Subject: [PATCH 191/614] Added my own theme. --- themes/takashiyoshida.zsh-theme | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 themes/takashiyoshida.zsh-theme diff --git a/themes/takashiyoshida.zsh-theme b/themes/takashiyoshida.zsh-theme new file mode 100644 index 000000000..419a8cf3f --- /dev/null +++ b/themes/takashiyoshida.zsh-theme @@ -0,0 +1,27 @@ +# +# PROMPT +# +PROMPT_BRACKET_BEGIN='%{$fg_bold[white]%}[' +PROMPT_HOST='%{$fg_bold[cyan]%}%m' +PROMPT_SEPARATOR='%{$reset_color%}:' +PROMPT_DIR='%{$fg_bold[yellow]%}%c' +PROMPT_BRACKET_END='%{$fg_bold[white]%}]' + +PROMPT_USER='%{$fg_bold[white]%}%n' +PROMPT_SIGN='%{$reset_color%}%#' + +GIT_PROMPT_INFO='$(git_prompt_info)' + +# My current prompt looks like: +# [host:current_dir] (git_prompt_info) +# [username]% +PROMPT="${PROMPT_BRACKET_BEGIN}${PROMPT_HOST}${PROMPT_SEPARATOR}${PROMPT_DIR}${PROMPT_BRACKET_END}${GIT_PROMPT_INFO} +${PROMPT_BRACKET_BEGIN}${PROMPT_USER}${PROMPT_BRACKET_END}${PROMPT_SIGN} " + +# +# Git repository +# +ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}!" +ZSH_THEME_GIT_PROMPT_CLEAN='' From 0b56ae5020ce86cf3c5f38b005c93739c16b9bff Mon Sep 17 00:00:00 2001 From: MasterLambaster Date: Mon, 31 May 2010 17:09:45 +0800 Subject: [PATCH 192/614] Eastwood theme with optional RVM support --- themes/eastwood.zsh-theme | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 themes/eastwood.zsh-theme diff --git a/themes/eastwood.zsh-theme b/themes/eastwood.zsh-theme new file mode 100644 index 000000000..83664515a --- /dev/null +++ b/themes/eastwood.zsh-theme @@ -0,0 +1,19 @@ +#RVM settings +if [[ -s ~/.rvm/scripts/rvm ]] ; then + RPS1="%{$fg[yellow]%}rvm:%{$reset_color%}%{$fg[red]%}\$(~/.rvm/bin/rvm-prompt)%{$reset_color%} $EPS1" +fi + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}[" +ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="" + +#Customized git status, oh-my-zsh currently does not allow render dirty status before branch +git_custom_status() { + local cb=$(current_branch) + if [ -n "$cb" ]; then + echo "$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_PREFIX$(current_branch)$ZSH_THEME_GIT_PROMPT_SUFFIX" + fi +} + +PROMPT='$(git_custom_status)%{$fg[cyan]%}[%~% ]%{$reset_color%}%B$%b ' From 210a72b44110741fc347fd93723f48f08fc87a46 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Thu, 3 Jun 2010 12:03:26 -0700 Subject: [PATCH 193/614] Initial implementation of a new plugin system, so that people can managed which aliases/functions they want. --- lib/aliases.zsh | 28 ---------------------------- lib/functions.zsh | 21 --------------------- lib/git.zsh | 15 --------------- oh-my-zsh.sh | 4 ++++ plugins/git.plugin.zsh | 21 +++++++++++++++++++++ plugins/lighthouse.plugin.zsh | 16 ++++++++++++++++ plugins/rails.plugin.zsh | 10 ++++++++++ plugins/ruby.plugin.zsh | 4 ++++ plugins/textmate.plugin.zsh | 14 ++++++++++++++ 9 files changed, 69 insertions(+), 64 deletions(-) create mode 100644 plugins/git.plugin.zsh create mode 100644 plugins/lighthouse.plugin.zsh create mode 100644 plugins/rails.plugin.zsh create mode 100644 plugins/ruby.plugin.zsh create mode 100644 plugins/textmate.plugin.zsh diff --git a/lib/aliases.zsh b/lib/aliases.zsh index d891cc0a8..89c904a7e 100644 --- a/lib/aliases.zsh +++ b/lib/aliases.zsh @@ -1,19 +1,7 @@ -#!/bin/zsh - # Push and pop directories on directory stack alias pu='pushd' alias po='popd' -alias ss='thin --stats "/thin/stats" start' -alias sg='ruby script/generate' -alias sd='ruby script/destroy' -alias sp='ruby script/plugin' -alias ssp='ruby script/spec' -alias rdbm='rake db:migrate' -alias sc='ruby script/console' -alias sd='ruby script/server --debugger' -alias devlog='tail -f log/development.log' - # Basic directory operations alias .='pwd' alias ...='cd ../..' @@ -33,20 +21,4 @@ alias l='ls -la' alias ll='ls -alr' alias sl=ls # often screw this up -alias sgem='sudo gem' - -# Find ruby file -alias rfind='find . -name *.rb | xargs grep -n' alias afind='ack-grep -il' - -# Git and svn mix -alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk' - -# TextMate -alias et='mate . &' -alias ett='mate app config lib db public spec test Rakefile Capfile Todo &' -alias etp='mate app config lib db public spec test vendor/plugins vendor/gems Rakefile Capfile Todo &' -alias etts='mate app config lib db public script spec test vendor/plugins vendor/gems Rakefile Capfile Todo &' - -# Editor Ruby file in TextMate -alias mr='mate CHANGELOG app config db lib public script spec test' diff --git a/lib/functions.zsh b/lib/functions.zsh index 74b93f00e..35c3f3ce7 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -54,24 +54,3 @@ function take() { cd $1 } -function tm() { - cd $1 - mate $1 -} - -# To use: add a .lighthouse file into your directory with the URL to the -# individual project. For example: -# https://rails.lighthouseapp.com/projects/8994 -# Example usage: http://screencast.com/t/ZDgwNDUwNT -open_lighthouse_ticket () { - if [ ! -f .lighthouse-url ]; then - echo "There is no .lighthouse file in the current directory..." - return 0; - else - lighthouse_url=$(cat .lighthouse-url); - echo "Opening ticket #$1"; - `open $lighthouse_url/tickets/$1`; - fi -} - -alias lho='open_lighthouse_ticket' diff --git a/lib/git.zsh b/lib/git.zsh index 1d1d24deb..a54e5bcbb 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -20,18 +20,3 @@ function current_branch() { ref=$(git symbolic-ref HEAD 2> /dev/null) || return echo ${ref#refs/heads/} } - -# Aliases -alias g='git' -alias gst='git status' -alias gl='git pull' -alias gup='git fetch && git rebase' -alias gp='git push' -alias gd='git diff | mate' -alias gdv='git diff -w "$@" | vim -R -' -alias gc='git commit -v' -alias gca='git commit -v -a' -alias gb='git branch' -alias gba='git branch -a' -alias gcount='git shortlog -sn' -alias gcp='git cherry-pick' diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index a41f3d89e..bb45c71eb 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -10,6 +10,10 @@ for config_file ($ZSH/lib/*.zsh) source $config_file # Load all of your custom configurations from custom/ for config_file ($ZSH/custom/*.zsh) source $config_file +# Load all of the plugins that were defined in ~/.zshrc +plugin=${plugin:=()} +for plugin ($plugins) source $ZSH/plugins/$plugin.plugin.zsh + # Check for updates on initial load... if [ "$DISABLE_AUTO_UPDATE" = "true" ] then diff --git a/plugins/git.plugin.zsh b/plugins/git.plugin.zsh new file mode 100644 index 000000000..26777a62a --- /dev/null +++ b/plugins/git.plugin.zsh @@ -0,0 +1,21 @@ +# Aliases +alias g='git' +alias gst='git status' +alias gl='git pull' +alias gup='git fetch && git rebase' +alias gp='git push' +alias gd='git diff | mate' +alias gdv='git diff -w "$@" | vim -R -' +alias gc='git commit -v' +alias gca='git commit -v -a' +alias gb='git branch' +alias gba='git branch -a' +alias gcount='git shortlog -sn' +alias gcp='git cherry-pick' + + +# Git and svn mix +alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk' + +alias ggpull='git pull origin $(current_branch)' +alias ggpush='git push origin $(current_branch)' diff --git a/plugins/lighthouse.plugin.zsh b/plugins/lighthouse.plugin.zsh new file mode 100644 index 000000000..4eb06a997 --- /dev/null +++ b/plugins/lighthouse.plugin.zsh @@ -0,0 +1,16 @@ +# To use: add a .lighthouse file into your directory with the URL to the +# individual project. For example: +# https://rails.lighthouseapp.com/projects/8994 +# Example usage: http://screencast.com/t/ZDgwNDUwNT +open_lighthouse_ticket () { + if [ ! -f .lighthouse-url ]; then + echo "There is no .lighthouse file in the current directory..." + return 0; + else + lighthouse_url=$(cat .lighthouse-url); + echo "Opening ticket #$1"; + `open $lighthouse_url/tickets/$1`; + fi +} + +alias lho='open_lighthouse_ticket' \ No newline at end of file diff --git a/plugins/rails.plugin.zsh b/plugins/rails.plugin.zsh new file mode 100644 index 000000000..fb21da846 --- /dev/null +++ b/plugins/rails.plugin.zsh @@ -0,0 +1,10 @@ + +alias ss='thin --stats "/thin/stats" start' +alias sg='ruby script/generate' +alias sd='ruby script/destroy' +alias sp='ruby script/plugin' +alias ssp='ruby script/spec' +alias rdbm='rake db:migrate' +alias sc='ruby script/console' +alias sd='ruby script/server --debugger' +alias devlog='tail -f log/development.log' \ No newline at end of file diff --git a/plugins/ruby.plugin.zsh b/plugins/ruby.plugin.zsh new file mode 100644 index 000000000..82bf5d49d --- /dev/null +++ b/plugins/ruby.plugin.zsh @@ -0,0 +1,4 @@ +alias sgem='sudo gem' + +# Find ruby file +alias rfind='find . -name *.rb | xargs grep -n' \ No newline at end of file diff --git a/plugins/textmate.plugin.zsh b/plugins/textmate.plugin.zsh new file mode 100644 index 000000000..7b73e2751 --- /dev/null +++ b/plugins/textmate.plugin.zsh @@ -0,0 +1,14 @@ + +# TextMate +alias et='mate . &' +alias ett='mate app config lib db public spec test Rakefile Capfile Todo &' +alias etp='mate app config lib db public spec test vendor/plugins vendor/gems Rakefile Capfile Todo &' +alias etts='mate app config lib db public script spec test vendor/plugins vendor/gems Rakefile Capfile Todo &' + +# Editor Ruby file in TextMate +alias mr='mate CHANGELOG app config db lib public script spec test' + +function tm() { + cd $1 + mate $1 +} From 96e5f542003a5d03c728419dd53dad6619278f3c Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Thu, 3 Jun 2010 12:05:12 -0700 Subject: [PATCH 194/614] Updating default .zshrc template file to include plugins declaration --- templates/zshrc.zsh-template | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template index d905be04b..8022b3506 100644 --- a/templates/zshrc.zsh-template +++ b/templates/zshrc.zsh-template @@ -14,6 +14,10 @@ export ZSH_THEME="robbyrussell" # Uncomment following line if you want to disable colors in ls # export DISABLE_LS_COLORS="true" +# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) +# Example format: plugins=(rails git textmate ruby lighthouse) +plugins=(git) + source $ZSH/oh-my-zsh.sh # Customize to your needs... From 7e8fd8922c0cfcc8a75a70b4395936a228116cac Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Thu, 3 Jun 2010 12:32:55 -0700 Subject: [PATCH 195/614] Moving capistrano functions to rails plugin --- plugins/rails.plugin.zsh | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/plugins/rails.plugin.zsh b/plugins/rails.plugin.zsh index fb21da846..b7f62a0c6 100644 --- a/plugins/rails.plugin.zsh +++ b/plugins/rails.plugin.zsh @@ -7,4 +7,26 @@ alias ssp='ruby script/spec' alias rdbm='rake db:migrate' alias sc='ruby script/console' alias sd='ruby script/server --debugger' -alias devlog='tail -f log/development.log' \ No newline at end of file +alias devlog='tail -f log/development.log' + +function _cap_does_task_list_need_generating () { + if [ ! -f .cap_tasks~ ]; then return 0; + else + accurate=$(stat -f%m .cap_tasks~) + changed=$(stat -f%m config/deploy.rb) + return $(expr $accurate '>=' $changed) + fi +} + +function _cap () { + if [ -f config/deploy.rb ]; then + if _cap_does_task_list_need_generating; then + echo "\nGenerating .cap_tasks~..." > /dev/stderr + cap show_tasks -q | cut -d " " -f 1 | sed -e '/^ *$/D' -e '1,2D' +> .cap_tasks~ + fi + compadd `cat .cap_tasks~` + fi +} + +compctl -K _cap cap From 318ff007d3de86c7900af6998adace6b0f81119a Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Thu, 3 Jun 2010 12:33:15 -0700 Subject: [PATCH 196/614] Removing rake completion from lib/ as it was moved to rails plugin --- lib/rake_completion.zsh | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 lib/rake_completion.zsh diff --git a/lib/rake_completion.zsh b/lib/rake_completion.zsh deleted file mode 100644 index 8336182d5..000000000 --- a/lib/rake_completion.zsh +++ /dev/null @@ -1,21 +0,0 @@ -function _cap_does_task_list_need_generating () { - if [ ! -f .cap_tasks~ ]; then return 0; - else - accurate=$(stat -f%m .cap_tasks~) - changed=$(stat -f%m config/deploy.rb) - return $(expr $accurate '>=' $changed) - fi -} - -function _cap () { - if [ -f config/deploy.rb ]; then - if _cap_does_task_list_need_generating; then - echo "\nGenerating .cap_tasks~..." > /dev/stderr - cap show_tasks -q | cut -d " " -f 1 | sed -e '/^ *$/D' -e '1,2D' -> .cap_tasks~ - fi - compadd `cat .cap_tasks~` - fi -} - -compctl -K _cap cap From 4381863fd2d934568f48d8e5816cd71e8e63a1a7 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Thu, 3 Jun 2010 12:54:40 -0700 Subject: [PATCH 197/614] Removing legacy completion code --- lib/completion.zsh | 8 -------- 1 file changed, 8 deletions(-) diff --git a/lib/completion.zsh b/lib/completion.zsh index b627ef878..cba90179f 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -27,8 +27,6 @@ zstyle ':completion:*' list-colors '' bindkey -M menuselect '^o' accept-and-infer-next-history zstyle ':completion:*:*:*:*:*' menu select -# zstyle ':completion:*:*:*:*:processes' force-list always - zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01' zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm -w -w" @@ -37,9 +35,3 @@ if [ -f ~/.ssh/known_hosts ]; then zstyle ':completion:*' hosts $( sed 's/[, ].*$//' $HOME/.ssh/known_hosts ) zstyle ':completion:*:*:(ssh|scp):*:*' hosts `sed 's/^\([^ ,]*\).*$/\1/' ~/.ssh/known_hosts` fi - -# Complete on history -#zstyle ':completion:*:history-words' stop yes -#zstyle ':completion:*:history-words' remove-all-dups yes -#zstyle ':completion:*:history-words' list false -#zstyle ':completion:*:history-words' menu yes From a77aceaf5eee42227993b8da7dd55c9f0e6375d0 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Thu, 3 Jun 2010 12:55:07 -0700 Subject: [PATCH 198/614] Moving some rails and osx-specific functions to their corresponding plugin files --- lib/functions.zsh | 16 ---------------- plugins/osx.plugin.zsh | 11 +++++++++++ plugins/rails.plugin.zsh | 4 ++++ 3 files changed, 15 insertions(+), 16 deletions(-) create mode 100644 plugins/osx.plugin.zsh diff --git a/lib/functions.zsh b/lib/functions.zsh index 35c3f3ce7..fcbe994be 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -21,10 +21,6 @@ function preexec { title $cmd[1]:t "$cmd[2,-1]" } -function remote_console() { - /usr/bin/env ssh $1 "( cd $2 && ruby script/console production )" -} - function zsh_stats() { history | awk '{print $2}' | sort | uniq -c | sort -rn | head } @@ -37,18 +33,6 @@ function upgrade_oh_my_zsh() { /bin/sh $ZSH/tools/upgrade.sh } -function tab() { - osascript 2>/dev/null </dev/null < Date: Thu, 3 Jun 2010 12:56:11 -0700 Subject: [PATCH 199/614] Moving current_branch() to git plugin --- lib/git.zsh | 9 --------- plugins/git.plugin.zsh | 10 ++++++++++ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/git.zsh b/lib/git.zsh index a54e5bcbb..889dd98df 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -11,12 +11,3 @@ parse_git_dirty () { echo "$ZSH_THEME_GIT_PROMPT_CLEAN" fi } - -# -# Will return the current branch name -# Usage example: git pull origin $(current_branch) -# -function current_branch() { - ref=$(git symbolic-ref HEAD 2> /dev/null) || return - echo ${ref#refs/heads/} -} diff --git a/plugins/git.plugin.zsh b/plugins/git.plugin.zsh index 26777a62a..e0d967056 100644 --- a/plugins/git.plugin.zsh +++ b/plugins/git.plugin.zsh @@ -17,5 +17,15 @@ alias gcp='git cherry-pick' # Git and svn mix alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk' +# +# Will return the current branch name +# Usage example: git pull origin $(current_branch) +# +function current_branch() { + ref=$(git symbolic-ref HEAD 2> /dev/null) || return + echo ${ref#refs/heads/} +} + +# these aliases take advangate of the previous function alias ggpull='git pull origin $(current_branch)' alias ggpush='git push origin $(current_branch)' From b025e7ed470182a41b6254f68a529d838a52a0df Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Thu, 3 Jun 2010 12:59:49 -0700 Subject: [PATCH 200/614] Moving brew functions to it's own plugin --- functions/_brew => plugins/brew.plugin.zsh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename functions/_brew => plugins/brew.plugin.zsh (100%) diff --git a/functions/_brew b/plugins/brew.plugin.zsh similarity index 100% rename from functions/_brew rename to plugins/brew.plugin.zsh From a367c83463ce438cc0aecbb73667a13eeaaeb9fb Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Thu, 3 Jun 2010 13:01:41 -0700 Subject: [PATCH 201/614] Adding some candy to the upgrade script --- tools/upgrade.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/upgrade.sh b/tools/upgrade.sh index 6dee42c25..6bdd02e38 100644 --- a/tools/upgrade.sh +++ b/tools/upgrade.sh @@ -1,6 +1,12 @@ current_path=`pwd` echo "Upgrading Oh My Zsh" ( cd $ZSH && git pull origin master ) +echo ' __ __ ' +echo ' ____ / /_ ____ ___ __ __ ____ _____/ /_ ' +echo ' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ ' +echo '/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / ' +echo '\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ ' +echo ' /____/' echo "Hooray! Oh My Zsh has been updated and/or is at the current version. \nAny new updates will be reflected when you start your next terminal session." echo "To keep up on the latest, be sure to follow Oh My Zsh on twitter: http://twitter.com/ohmyzsh" cd $current_path \ No newline at end of file From 65b43db5b374a57943121053863422e41208c5bc Mon Sep 17 00:00:00 2001 From: Tobias Birmili Date: Sun, 6 Jun 2010 18:42:25 +0800 Subject: [PATCH 202/614] added plugin to control macports mysql-server installation --- plugins/mysql-macports.plugin.zsh | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 plugins/mysql-macports.plugin.zsh diff --git a/plugins/mysql-macports.plugin.zsh b/plugins/mysql-macports.plugin.zsh new file mode 100644 index 000000000..63b881c9f --- /dev/null +++ b/plugins/mysql-macports.plugin.zsh @@ -0,0 +1,6 @@ +# commands to control local mysql-server installation +# paths are for osx installtion via macports + +alias mysqlstart='sudo /opt/local/bin/mysqld_safe5' +alias mysqlstop='/opt/local/bin/mysqladmin5 -u root -p shutdown' +alias mysqlstatus='mysqladmin5 -u root -p ping' \ No newline at end of file From 33d4faa92889734fd6f1ac145cc9a906af39d45a Mon Sep 17 00:00:00 2001 From: toabi Date: Sun, 6 Jun 2010 22:14:13 +0800 Subject: [PATCH 203/614] updated the readme --- README.textile | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/README.textile b/README.textile index 23d8b5390..8b1b6875a 100644 --- a/README.textile +++ b/README.textile @@ -27,22 +27,19 @@ h3. The manual way @chsh -s /bin/zsh@ -4. Start / restart zsh (open a new terminal is easy enough..) +4. Start / restart zsh (open a new terminal is easy enough...) h3. Problems? -You _might_ need to modify your PATH in ~/.zshrc if you're not able to find some commands after switching to oh-my-zsh. +You _might_ need to modify your PATH in ~/.zshrc if you're not able to find some commands after switching to _Oh My Zsh_. h2. Usage -TODO: Update this.. - -* Rake autocomplete: @rake (tab)@. Will generate a cache of all your rake tasks and then let you auto-complete and/or select the task to run. -* ssh autocomplete: @ssh (tab)@ or @scp (tab)@ -* Git branch, it'll tell you which branch you're in when you're in a git repository directory. +* enable the plugins you want in your @~/.zshrc@ (take a look at @plugins/@ to see what's possible) +** example: @plugins=(git osx ruby)@ * Theme support: Change the @ZSH_THEME@ environment variable in @~/.zshrc@. -** Take a look at the "current themes":http://wiki.github.com/robbyrussell/oh-my-zsh/themes that come bundled with Oh My Zsh. -* much much more.. +** Take a look at the "current themes":http://wiki.github.com/robbyrussell/oh-my-zsh/themes that come bundled with _Oh My Zsh_. +* much much more... take a look at @lib/@ what _Oh My Zsh_ offers... h2. Useful @@ -51,6 +48,7 @@ the "refcard":http://www.bash2zsh.com/zsh_refcard/refcard.pdf is pretty tasty fo h3. Customization If you want to override any of the default behavior, just add a new file (ending in @.zsh@) into the @custom/@ directory. +If you have many functions which go good together you can put them as a *.plugin.zsh file in the @plugin/@ directory and then enable this plugin. h3. Uninstalling @@ -68,8 +66,4 @@ I'm far from being a zsh-expert and suspect there are many ways to improve. If y h3. Send us your theme! -I'm hoping to collect a bunch of themes for our command prompts. You can see existing ones in the @themes/@ directory. - -h3. Todo from imajes: - -* need to make the title bar support git folder \ No newline at end of file +I'm hoping to collect a bunch of themes for our command prompts. You can see existing ones in the @themes/@ directory. \ No newline at end of file From ba9b9111b58e64398715613fc38cadb1025fbc41 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Thu, 10 Jun 2010 07:50:13 -0700 Subject: [PATCH 204/614] Adding a ggpnp which does a git pull followed by a git push. --- plugins/git.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/git.plugin.zsh b/plugins/git.plugin.zsh index e0d967056..655eaf728 100644 --- a/plugins/git.plugin.zsh +++ b/plugins/git.plugin.zsh @@ -29,3 +29,4 @@ function current_branch() { # these aliases take advangate of the previous function alias ggpull='git pull origin $(current_branch)' alias ggpush='git push origin $(current_branch)' +alias ggpnp='git pull origin $(current_branch) && git push origin $(current_branch)' \ No newline at end of file From 7ce4e09887699a5c855fcf77a4c8849ddfa728aa Mon Sep 17 00:00:00 2001 From: NanoTech Date: Sat, 12 Jun 2010 16:31:02 -0600 Subject: [PATCH 205/614] Added my theme (nanotech). --- themes/nanotech.zsh-theme | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 themes/nanotech.zsh-theme diff --git a/themes/nanotech.zsh-theme b/themes/nanotech.zsh-theme new file mode 100644 index 000000000..eddb23c94 --- /dev/null +++ b/themes/nanotech.zsh-theme @@ -0,0 +1,7 @@ +PROMPT=' %{$fg_bold[green]%}%2c %{$fg_bold[blue]%}%{[%}%{$reset_color%} ' +RPROMPT='$(git_prompt_info) %{$fg[blue]%}] %{$fg[green]%}%D{%L:%M} %{$fg[yellow]%}%D{%p}%{$reset_color%} ' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}*%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="" From 48bc6718a27feb41147c9e3446bbc4ddf3b19bb3 Mon Sep 17 00:00:00 2001 From: Ubiratan Pires Alberton Date: Fri, 30 Jul 2010 09:27:32 -0300 Subject: [PATCH 206/614] Added my own theme, based on macovsky-ruby and funky --- themes/bira.zsh-theme | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 themes/bira.zsh-theme diff --git a/themes/bira.zsh-theme b/themes/bira.zsh-theme new file mode 100644 index 000000000..f0ee6a5bd --- /dev/null +++ b/themes/bira.zsh-theme @@ -0,0 +1,14 @@ +# ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png +local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" + +local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}' +local current_dir='%{$terminfo[bold]$fg[blue]%} %~%{$reset_color%}' +local rvm_ruby='%{$fg[red]%}‹$(~/.rvm/bin/rvm-prompt i v g)›%{$reset_color%}' +local git_branch='$(git_prompt_info)%{$reset_color%}' + +PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch} +╰─%B$%b " +RPS1="${return_code}" + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹" +ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}" From 5f62c6af832c72b96961f2075b4a4b0ae05d329d Mon Sep 17 00:00:00 2001 From: Alessandro Ghedini Date: Mon, 16 Aug 2010 21:47:21 +0200 Subject: [PATCH 207/614] add candy theme --- themes/candy.zsh-theme | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 themes/candy.zsh-theme diff --git a/themes/candy.zsh-theme b/themes/candy.zsh-theme new file mode 100644 index 000000000..bc125c5ce --- /dev/null +++ b/themes/candy.zsh-theme @@ -0,0 +1,7 @@ +PROMPT=$'%{$fg_bold[green]%}%n@%m %{$fg[blue]%}%D{[%I:%M:%S]} %{$reset_color%}%{$fg[white]%}[%~]%{$reset_color%} $(git_prompt_info)\ +%{$fg[blue]%}->%{$fg_bold[blue]%} %#%{$reset_color%} ' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}[" +ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}*%{$fg[green]%}" +ZSH_THEME_GIT_PROMPT_CLEAN="" From 5137931254379e892bfe5b22da607686c1e7771a Mon Sep 17 00:00:00 2001 From: Josh Price Date: Tue, 17 Aug 2010 22:45:10 +1000 Subject: [PATCH 208/614] Added my own theme based on pat's --- themes/josh.zsh-theme | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 themes/josh.zsh-theme diff --git a/themes/josh.zsh-theme b/themes/josh.zsh-theme new file mode 100644 index 000000000..9d59bd91e --- /dev/null +++ b/themes/josh.zsh-theme @@ -0,0 +1,43 @@ +grey='\e[0;90m' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$grey%}(" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$grey%}) %{$fg[yellow]%}✗%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$grey%})" + +function pat_prompt { + (( spare_width = ${COLUMNS} )) + prompt=" " + + branch=$(current_branch) + ruby_version=$(rvm_prompt_info) + path_size=${#PWD} + branch_size=${#branch} + ruby_size=${#ruby_version} + machine_size=11 + + if [[ ${#branch} -eq 0 ]] + then (( ruby_size = ruby_size + 1 )) + else + (( branch_size = branch_size + 4 )) + if [[ -n $(git status -s 2> /dev/null) ]]; then + (( branch_size = branch_size + 2 )) + fi + fi + + (( spare_width = ${spare_width} - (${machine_size} + ${path_size} + ${branch_size} + ${ruby_size}) )) + + while [ ${#prompt} -lt $spare_width ]; do + prompt=" $prompt" + done + + prompt="%{%F{green}%}$PWD$prompt%{%F{red}%}$(rvm_prompt_info)%{$reset_color%} $(git_prompt_info)" + + echo $prompt +} + +setopt prompt_subst + +PROMPT=' +%n@%m $(pat_prompt) +%(?,%{%F{green}%},%{%F{red}%})⚡%{$reset_color%} ' From b0b7915d9d65bd2d036d203c39dd6b364a784b9e Mon Sep 17 00:00:00 2001 From: Josh Price Date: Tue, 17 Aug 2010 23:22:26 +1000 Subject: [PATCH 209/614] Made the user_machine_size calculation generic. Pwned the function name. --- themes/josh.zsh-theme | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/themes/josh.zsh-theme b/themes/josh.zsh-theme index 9d59bd91e..6bed1a70e 100644 --- a/themes/josh.zsh-theme +++ b/themes/josh.zsh-theme @@ -5,7 +5,7 @@ ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" ZSH_THEME_GIT_PROMPT_DIRTY="%{$grey%}) %{$fg[yellow]%}✗%{$reset_color%}" ZSH_THEME_GIT_PROMPT_CLEAN="%{$grey%})" -function pat_prompt { +function josh_prompt { (( spare_width = ${COLUMNS} )) prompt=" " @@ -14,7 +14,7 @@ function pat_prompt { path_size=${#PWD} branch_size=${#branch} ruby_size=${#ruby_version} - machine_size=11 + user_machine_size=${#${(%):-%n@%m-}} if [[ ${#branch} -eq 0 ]] then (( ruby_size = ruby_size + 1 )) @@ -25,7 +25,7 @@ function pat_prompt { fi fi - (( spare_width = ${spare_width} - (${machine_size} + ${path_size} + ${branch_size} + ${ruby_size}) )) + (( spare_width = ${spare_width} - (${user_machine_size} + ${path_size} + ${branch_size} + ${ruby_size}) )) while [ ${#prompt} -lt $spare_width ]; do prompt=" $prompt" @@ -39,5 +39,5 @@ function pat_prompt { setopt prompt_subst PROMPT=' -%n@%m $(pat_prompt) +%n@%m $(josh_prompt) %(?,%{%F{green}%},%{%F{red}%})⚡%{$reset_color%} ' From 2f2a4a1372f9a6b6c8fd9cc13fbd242cd2172e07 Mon Sep 17 00:00:00 2001 From: Daniel Schauenberg Date: Mon, 9 Aug 2010 15:45:40 +0200 Subject: [PATCH 210/614] update brew plugin from homebrew contributions --- plugins/brew.plugin.zsh | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/plugins/brew.plugin.zsh b/plugins/brew.plugin.zsh index 91397bf3a..162eb6442 100644 --- a/plugins/brew.plugin.zsh +++ b/plugins/brew.plugin.zsh @@ -1,6 +1,6 @@ #compdef brew -# copied from _fink +# imported from the latest homebrew contributions _brew_all_formulae() { formulae=(`brew search`) @@ -12,19 +12,25 @@ _brew_installed_formulae() { local -a _1st_arguments _1st_arguments=( - 'install:install a formula' - 'remove:remove a formula' - 'search:search for a formula (/regex/ or string)' - 'list:list files in a formula or not-installed formulae' - 'link:link a formula' - 'unlink:unlink a formula' + 'cat:display formula file for a formula' + 'cleanup:uninstall unused and old versions of packages' + 'create:create a new formula' + 'deps:list dependencies and dependants of a formula' + 'doctor:audits your installation for common issues' + 'edit:edit a formula' 'home:visit the homepage of a formula or the brew project' 'info:information about a formula' - 'prune:remove dead links' - 'update:freshen up links' + 'install:install a formula' + 'link:link a formula' + 'list:list files in a formula or not-installed formulae' 'log:git commit log for a formula' - 'create:create a new formula' - 'edit:edit a formula' + 'outdated:list formulas for which a newer version is available' + 'prune:remove dead links' + 'remove:remove a formula' + 'search:search for a formula (/regex/ or string)' + 'unlink:unlink a formula' + 'update:freshen up links' + 'uses:show formulas which depend on a formula' ) local expl @@ -47,12 +53,12 @@ case "$words[1]" in _arguments \ '(--unbrewed)--unbrewed[files in brew --prefix not controlled by brew]' \ '1: :->forms' && return 0 - + if [[ "$state" == forms ]]; then _brew_installed_formulae _requested installed_formulae expl 'installed formulae' compadd -a installed_formulae fi ;; - install|home|log|info) + install|home|log|info|uses|cat|deps) _brew_all_formulae _wanted formulae expl 'all formulae' compadd -a formulae ;; remove|edit|xo) From 3205628a51608ab68d6e1db4908130df806edc20 Mon Sep 17 00:00:00 2001 From: Daniel Schauenberg Date: Sun, 8 Aug 2010 19:45:49 +0200 Subject: [PATCH 211/614] add simple mrtazz theme based on robbyrussell - simple theme - hostname and current folder on left prompt - git branch and working tree status on the right --- themes/mrtazz.zsh-theme | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 themes/mrtazz.zsh-theme diff --git a/themes/mrtazz.zsh-theme b/themes/mrtazz.zsh-theme new file mode 100644 index 000000000..214ba5a47 --- /dev/null +++ b/themes/mrtazz.zsh-theme @@ -0,0 +1,7 @@ +PROMPT='%{$fg_bold[red]%}%m%{$reset_color%}:%{$fg[cyan]%}%c%{$reset_color%}:%# ' +RPROMPT='%{$fg_bold[green]%}$(git_prompt_info)%{$reset_color%}% ' + +ZSH_THEME_GIT_PROMPT_PREFIX="<%{$fg[red]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%} %{$fg[yellow]%}✗%{$fg[green]%}>%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%}>" From d0eb0d9fbc846530fd3ec4812762ce18462c1e87 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Thu, 19 Aug 2010 08:04:18 -0700 Subject: [PATCH 212/614] Switching to /usr/bin/env zsh instead of /bin/zsh in the installer --- tools/install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/install.sh b/tools/install.sh index 004b252f4..6e3872bb9 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -22,7 +22,7 @@ echo "Copying your current PATH and adding it to the end of ~/.zshrc for you." echo "export PATH=$PATH" >> ~/.zshrc echo "Time to change your default shell to zsh!" -chsh -s /bin/zsh +chsh -s "/usr/bin/env zsh" echo ' __ __ ' echo ' ____ / /_ ____ ___ __ __ ____ _____/ /_ ' @@ -32,5 +32,5 @@ echo '\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ ' echo ' /____/' echo "\n\n ....is now installed." -/bin/zsh +/usr/bin/env zsh source ~/.zshrc From 688e9c7ffd757e790e1c079ac410570ccef9793e Mon Sep 17 00:00:00 2001 From: Daniel Schauenberg Date: Fri, 20 Aug 2010 18:55:30 +0200 Subject: [PATCH 213/614] fix problems with brew completion - update plugin architecture - completion function in $ZSH/functions/brew - plugins/brew.plugin.zsh only activates --- functions/brew/_brew | 69 +++++++++++++++++++++++++++++++++++++++ plugins/brew.plugin.zsh | 71 +++-------------------------------------- 2 files changed, 73 insertions(+), 67 deletions(-) create mode 100644 functions/brew/_brew diff --git a/functions/brew/_brew b/functions/brew/_brew new file mode 100644 index 000000000..4e590ac63 --- /dev/null +++ b/functions/brew/_brew @@ -0,0 +1,69 @@ +#compdef brew +#autoload + +# imported from the latest homebrew contributions + +_brew_all_formulae() { + formulae=(`brew search`) +} + +_brew_installed_formulae() { + installed_formulae=(`brew list`) +} + +local -a _1st_arguments +_1st_arguments=( + 'cat:display formula file for a formula' + 'cleanup:uninstall unused and old versions of packages' + 'create:create a new formula' + 'deps:list dependencies and dependants of a formula' + 'doctor:audits your installation for common issues' + 'edit:edit a formula' + 'home:visit the homepage of a formula or the brew project' + 'info:information about a formula' + 'install:install a formula' + 'link:link a formula' + 'list:list files in a formula or not-installed formulae' + 'log:git commit log for a formula' + 'outdated:list formulas for which a newer version is available' + 'prune:remove dead links' + 'remove:remove a formula' + 'search:search for a formula (/regex/ or string)' + 'unlink:unlink a formula' + 'update:freshen up links' + 'uses:show formulas which depend on a formula' +) + +local expl +local -a formula installed_formulae + +_arguments \ + '(-v --verbose)'{-v,--verbose}'[verbose]' \ + '(--version)--version[version information]' \ + '(--prefix)--prefix[where brew lives on this system]' \ + '(--cache)--cache[brew cache]' \ + '*:: :->subcmds' && return 0 + +if (( CURRENT == 1 )); then + _describe -t commands "brew subcommand" _1st_arguments + return +fi + +case "$words[1]" in + list) + _arguments \ + '(--unbrewed)--unbrewed[files in brew --prefix not controlled by brew]' \ + '1: :->forms' && return 0 + + if [[ "$state" == forms ]]; then + _brew_installed_formulae + _requested installed_formulae expl 'installed formulae' compadd -a installed_formulae + fi ;; + install|home|log|info|uses|cat|deps) + _brew_all_formulae + _wanted formulae expl 'all formulae' compadd -a formulae ;; + remove|edit|xo) + _brew_installed_formulae + _wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae ;; +esac + diff --git a/plugins/brew.plugin.zsh b/plugins/brew.plugin.zsh index 162eb6442..a30540966 100644 --- a/plugins/brew.plugin.zsh +++ b/plugins/brew.plugin.zsh @@ -1,67 +1,4 @@ -#compdef brew - -# imported from the latest homebrew contributions - -_brew_all_formulae() { - formulae=(`brew search`) -} - -_brew_installed_formulae() { - installed_formulae=(`brew list`) -} - -local -a _1st_arguments -_1st_arguments=( - 'cat:display formula file for a formula' - 'cleanup:uninstall unused and old versions of packages' - 'create:create a new formula' - 'deps:list dependencies and dependants of a formula' - 'doctor:audits your installation for common issues' - 'edit:edit a formula' - 'home:visit the homepage of a formula or the brew project' - 'info:information about a formula' - 'install:install a formula' - 'link:link a formula' - 'list:list files in a formula or not-installed formulae' - 'log:git commit log for a formula' - 'outdated:list formulas for which a newer version is available' - 'prune:remove dead links' - 'remove:remove a formula' - 'search:search for a formula (/regex/ or string)' - 'unlink:unlink a formula' - 'update:freshen up links' - 'uses:show formulas which depend on a formula' -) - -local expl -local -a formula installed_formulae - -_arguments \ - '(-v --verbose)'{-v,--verbose}'[verbose]' \ - '(--version)--version[version information]' \ - '(--prefix)--prefix[where brew lives on this system]' \ - '(--cache)--cache[brew cache]' \ - '*:: :->subcmds' && return 0 - -if (( CURRENT == 1 )); then - _describe -t commands "brew subcommand" _1st_arguments - return -fi - -case "$words[1]" in - list) - _arguments \ - '(--unbrewed)--unbrewed[files in brew --prefix not controlled by brew]' \ - '1: :->forms' && return 0 - - if [[ "$state" == forms ]]; then - _brew_installed_formulae - _requested installed_formulae expl 'installed formulae' compadd -a installed_formulae - fi ;; - install|home|log|info|uses|cat|deps) - _brew_all_formulae - _wanted formulae expl 'all formulae' compadd -a formulae ;; - remove|edit|xo) - _brew_installed_formulae - _wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae ;; -esac +# add brew completion function to path +fpath=($ZSH/functions/brew $fpath) +autoload -U compinit +compinit -i From 1d4098bd293285b7f008b9d76a4dfe7f1bbc1808 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Tue, 24 Aug 2010 11:08:20 -0700 Subject: [PATCH 214/614] Removing '.' alias as it is overwriting a bash/zsh feature. Closes #63 --- lib/aliases.zsh | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/aliases.zsh b/lib/aliases.zsh index 80760a1f5..d2d3aed81 100644 --- a/lib/aliases.zsh +++ b/lib/aliases.zsh @@ -3,7 +3,6 @@ alias pu='pushd' alias po='popd' # Basic directory operations -alias .='pwd' alias ...='cd ../..' alias -- -='cd -' From 4f72ce160736987fc6938bb7fd6ec19fb81cc92b Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Mon, 30 Aug 2010 14:59:23 -0400 Subject: [PATCH 215/614] Added the truly epic kennethreitz theme. --- themes/kennethreitz.zsh-theme | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 themes/kennethreitz.zsh-theme diff --git a/themes/kennethreitz.zsh-theme b/themes/kennethreitz.zsh-theme new file mode 100644 index 000000000..109be0c22 --- /dev/null +++ b/themes/kennethreitz.zsh-theme @@ -0,0 +1,13 @@ +local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" + +PROMPT='%{$fg[green]%}%c \ +$(git_prompt_info)\ +%{$fg[red]%}%(!.#.»)%{$reset_color%} ' +PROMPT2='%{$fg[red]%}\ %{$reset_color%}' +RPS1='%{$fg[blue]%}%~%{$reset_color%} ${return_code} ' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}:: %{$fg[yellow]%}(" +ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%} " +ZSH_THEME_GIT_PROMPT_CLEAN="" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*%{$fg[yellow]%}" + From dfc4b850008a04007126f7c19caa08042aa1e40c Mon Sep 17 00:00:00 2001 From: Daniel Schauenberg Date: Wed, 1 Sep 2010 13:07:11 +0200 Subject: [PATCH 216/614] add gem completion function and plugin --- functions/gem/_gem | 64 ++++++++++++++++++++++++++++++++++++++++++ plugins/gem.plugin.zsh | 4 +++ 2 files changed, 68 insertions(+) create mode 100644 functions/gem/_gem create mode 100644 plugins/gem.plugin.zsh diff --git a/functions/gem/_gem b/functions/gem/_gem new file mode 100644 index 000000000..83cba40d1 --- /dev/null +++ b/functions/gem/_gem @@ -0,0 +1,64 @@ +#compdef gem +#autoload + +# gem zsh completion, based on homebrew completion + +_gem_installed() { + installed_gems=(`gem list --local --no-versions`) +} + +local -a _1st_arguments +_1st_arguments=( + 'cert:Manage RubyGems certificates and signing settings' + 'check:Check installed gems' + 'cleanup:Clean up old versions of installed gems in the local repository' + 'contents:Display the contents of the installed gems' + 'dependency:Show the dependencies of an installed gem' + 'environment:Display information about the RubyGems environment' + 'fetch:Download a gem and place it in the current directory' + 'generate_index:Generates the index files for a gem server directory' + 'help:Provide help on the `gem` command' + 'install:Install a gem into the local repository' + 'list:Display gems whose name starts with STRING' + 'lock:Generate a lockdown list of gems' + 'mirror:Mirror a gem repository' + 'outdated:Display all gems that need updates' + 'owner:Manage gem owners on RubyGems.org.' + 'pristine:Restores installed gems to pristine condition from files located in the gem cache' + 'push:Push a gem up to RubyGems.org' + 'query:Query gem information in local or remote repositories' + 'rdoc:Generates RDoc for pre-installed gems' + 'search:Display all gems whose name contains STRING' + 'server:Documentation and gem repository HTTP server' + 'sources:Manage the sources and cache file RubyGems uses to search for gems' + 'specification:Display gem specification (in yaml)' + 'stale:List gems along with access times' + 'uninstall:Uninstall gems from the local repository' + 'unpack:Unpack an installed gem to the current directory' + 'update:Update the named gems (or all installed gems) in the local repository' + 'which:Find the location of a library file you can require' +) + +local expl +local -a gems installed_gems + +_arguments \ + '(-v --version)'{-v,--version}'[show version]' \ + '(-h --help)'{-h,--help}'[show help]' \ + '*:: :->subcmds' && return 0 + +if (( CURRENT == 1 )); then + _describe -t commands "gem subcommand" _1st_arguments + return +fi + +case "$words[1]" in + list) + if [[ "$state" == forms ]]; then + _gem_installed + _requested installed_gems expl 'installed gems' compadd -a installed_gems + fi ;; + uninstall|update) + _gem_installed + _wanted installed_gems expl 'installed gems' compadd -a installed_gems ;; +esac diff --git a/plugins/gem.plugin.zsh b/plugins/gem.plugin.zsh new file mode 100644 index 000000000..0b6ef3c86 --- /dev/null +++ b/plugins/gem.plugin.zsh @@ -0,0 +1,4 @@ +# add brew completion function to path +fpath=($ZSH/functions/gem $fpath) +autoload -U compinit +compinit -i From 9aba2eed488a814214f6ed3df2c6532d1fdf6c21 Mon Sep 17 00:00:00 2001 From: Daniel Schauenberg Date: Wed, 1 Sep 2010 13:21:11 +0200 Subject: [PATCH 217/614] add pip completion and plugin --- functions/pip/_pip | 46 ++++++++++++++++++++++++++++++++++++++++++ plugins/pip.plugin.zsh | 4 ++++ 2 files changed, 50 insertions(+) create mode 100644 functions/pip/_pip create mode 100644 plugins/pip.plugin.zsh diff --git a/functions/pip/_pip b/functions/pip/_pip new file mode 100644 index 000000000..b58010173 --- /dev/null +++ b/functions/pip/_pip @@ -0,0 +1,46 @@ +#compdef pip +#autoload + +# pip zsh completion, based on homebrew completion + +_pip_installed() { + installed_pkgs=(`pip freeze`) +} + +local -a _1st_arguments +_1st_arguments=( + 'bundle:Create pybundles (archives containing multiple packages)' + 'freeze:Output all currently installed packages (exact versions) to stdout' + 'help:Show available commands' + 'install:Install packages' + 'search:Search PyPI' + 'uninstall:Uninstall packages' + 'unzip:Unzip individual packages' + 'zip:Zip individual packages' +) + +local expl +local -a pkgs installed_pkgs + +_arguments \ + '(--version)--version[Show version number of program and exit]' \ + '(-v --verbose)'{-v,--verbose}'[Give more output]' \ + '(-q --quiet)'{-q,--quiet}'[Give less output]' \ + '(-h --help)'{-h,--help}'[Show help]' \ + '*:: :->subcmds' && return 0 + +if (( CURRENT == 1 )); then + _describe -t commands "pip subcommand" _1st_arguments + return +fi + +case "$words[1]" in + list) + if [[ "$state" == forms ]]; then + _pip_installed + _requested installed_pkgs expl 'installed packages' compadd -a installed_pkgs + fi ;; + uninstall) + _pip_installed + _wanted installed_pkgs expl 'installed packages' compadd -a installed_pkgs ;; +esac diff --git a/plugins/pip.plugin.zsh b/plugins/pip.plugin.zsh new file mode 100644 index 000000000..69e21f8d7 --- /dev/null +++ b/plugins/pip.plugin.zsh @@ -0,0 +1,4 @@ +# add brew completion function to path +fpath=($ZSH/functions/pip $fpath) +autoload -U compinit +compinit -i From be63480e2272ad95a783357e7f2416ff67274657 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Thu, 30 Sep 2010 21:34:06 -0700 Subject: [PATCH 218/614] Reorganizing plugins so that each plugin has it's own directory now so that any plugin-specific functions can be bundled within there. --- oh-my-zsh.sh | 2 +- plugins/{ => brew}/brew.plugin.zsh | 0 plugins/{ => dirpersist}/dirpersist.plugin.zsh | 0 plugins/{ => git}/git.plugin.zsh | 0 plugins/{ => lighthouse}/lighthouse.plugin.zsh | 0 plugins/{ => macports}/macports.plugin.zsh | 0 plugins/{ => mysql}/mysql-macports.plugin.zsh | 0 plugins/{ => osx}/osx.plugin.zsh | 0 plugins/{ => rails}/rails.plugin.zsh | 0 plugins/{ => ruby}/ruby.plugin.zsh | 0 plugins/{ => ssh-agent}/ssh-agent.plugin.zsh | 0 plugins/{ => textmate}/textmate.plugin.zsh | 0 plugins/{ => vi-mode}/vi-mode.plugin.zsh | 0 13 files changed, 1 insertion(+), 1 deletion(-) rename plugins/{ => brew}/brew.plugin.zsh (100%) rename plugins/{ => dirpersist}/dirpersist.plugin.zsh (100%) rename plugins/{ => git}/git.plugin.zsh (100%) rename plugins/{ => lighthouse}/lighthouse.plugin.zsh (100%) rename plugins/{ => macports}/macports.plugin.zsh (100%) rename plugins/{ => mysql}/mysql-macports.plugin.zsh (100%) rename plugins/{ => osx}/osx.plugin.zsh (100%) rename plugins/{ => rails}/rails.plugin.zsh (100%) rename plugins/{ => ruby}/ruby.plugin.zsh (100%) rename plugins/{ => ssh-agent}/ssh-agent.plugin.zsh (100%) rename plugins/{ => textmate}/textmate.plugin.zsh (100%) rename plugins/{ => vi-mode}/vi-mode.plugin.zsh (100%) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index c46aea7ac..848e48eb5 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -12,7 +12,7 @@ for config_file ($ZSH/custom/*.zsh) source $config_file # Load all of the plugins that were defined in ~/.zshrc plugin=${plugin:=()} -for plugin ($plugins) source $ZSH/plugins/$plugin.plugin.zsh +for plugin ($plugins) source $ZSH/plugins/$plugin/$plugin.plugin.zsh # Check for updates on initial load... if [ "$DISABLE_AUTO_UPDATE" = "true" ] diff --git a/plugins/brew.plugin.zsh b/plugins/brew/brew.plugin.zsh similarity index 100% rename from plugins/brew.plugin.zsh rename to plugins/brew/brew.plugin.zsh diff --git a/plugins/dirpersist.plugin.zsh b/plugins/dirpersist/dirpersist.plugin.zsh similarity index 100% rename from plugins/dirpersist.plugin.zsh rename to plugins/dirpersist/dirpersist.plugin.zsh diff --git a/plugins/git.plugin.zsh b/plugins/git/git.plugin.zsh similarity index 100% rename from plugins/git.plugin.zsh rename to plugins/git/git.plugin.zsh diff --git a/plugins/lighthouse.plugin.zsh b/plugins/lighthouse/lighthouse.plugin.zsh similarity index 100% rename from plugins/lighthouse.plugin.zsh rename to plugins/lighthouse/lighthouse.plugin.zsh diff --git a/plugins/macports.plugin.zsh b/plugins/macports/macports.plugin.zsh similarity index 100% rename from plugins/macports.plugin.zsh rename to plugins/macports/macports.plugin.zsh diff --git a/plugins/mysql-macports.plugin.zsh b/plugins/mysql/mysql-macports.plugin.zsh similarity index 100% rename from plugins/mysql-macports.plugin.zsh rename to plugins/mysql/mysql-macports.plugin.zsh diff --git a/plugins/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh similarity index 100% rename from plugins/osx.plugin.zsh rename to plugins/osx/osx.plugin.zsh diff --git a/plugins/rails.plugin.zsh b/plugins/rails/rails.plugin.zsh similarity index 100% rename from plugins/rails.plugin.zsh rename to plugins/rails/rails.plugin.zsh diff --git a/plugins/ruby.plugin.zsh b/plugins/ruby/ruby.plugin.zsh similarity index 100% rename from plugins/ruby.plugin.zsh rename to plugins/ruby/ruby.plugin.zsh diff --git a/plugins/ssh-agent.plugin.zsh b/plugins/ssh-agent/ssh-agent.plugin.zsh similarity index 100% rename from plugins/ssh-agent.plugin.zsh rename to plugins/ssh-agent/ssh-agent.plugin.zsh diff --git a/plugins/textmate.plugin.zsh b/plugins/textmate/textmate.plugin.zsh similarity index 100% rename from plugins/textmate.plugin.zsh rename to plugins/textmate/textmate.plugin.zsh diff --git a/plugins/vi-mode.plugin.zsh b/plugins/vi-mode/vi-mode.plugin.zsh similarity index 100% rename from plugins/vi-mode.plugin.zsh rename to plugins/vi-mode/vi-mode.plugin.zsh From d3e391216fc09d1602fb1b2869679b4e2f9667cd Mon Sep 17 00:00:00 2001 From: Daniel Schauenberg Date: Fri, 1 Oct 2010 10:59:48 +0200 Subject: [PATCH 219/614] adapt brew,gem,pip plugin to new structure --- {functions => plugins}/brew/_brew | 0 plugins/brew/brew.plugin.zsh | 2 +- {functions => plugins}/gem/_gem | 0 plugins/{ => gem}/gem.plugin.zsh | 2 +- {functions => plugins}/pip/_pip | 0 plugins/{ => pip}/pip.plugin.zsh | 2 +- 6 files changed, 3 insertions(+), 3 deletions(-) rename {functions => plugins}/brew/_brew (100%) rename {functions => plugins}/gem/_gem (100%) rename plugins/{ => gem}/gem.plugin.zsh (67%) rename {functions => plugins}/pip/_pip (100%) rename plugins/{ => pip}/pip.plugin.zsh (67%) diff --git a/functions/brew/_brew b/plugins/brew/_brew similarity index 100% rename from functions/brew/_brew rename to plugins/brew/_brew diff --git a/plugins/brew/brew.plugin.zsh b/plugins/brew/brew.plugin.zsh index a30540966..353a18942 100644 --- a/plugins/brew/brew.plugin.zsh +++ b/plugins/brew/brew.plugin.zsh @@ -1,4 +1,4 @@ # add brew completion function to path -fpath=($ZSH/functions/brew $fpath) +fpath=($ZSH/plugins/brew $fpath) autoload -U compinit compinit -i diff --git a/functions/gem/_gem b/plugins/gem/_gem similarity index 100% rename from functions/gem/_gem rename to plugins/gem/_gem diff --git a/plugins/gem.plugin.zsh b/plugins/gem/gem.plugin.zsh similarity index 67% rename from plugins/gem.plugin.zsh rename to plugins/gem/gem.plugin.zsh index 0b6ef3c86..65d3766f3 100644 --- a/plugins/gem.plugin.zsh +++ b/plugins/gem/gem.plugin.zsh @@ -1,4 +1,4 @@ # add brew completion function to path -fpath=($ZSH/functions/gem $fpath) +fpath=($ZSH/plugins/gem $fpath) autoload -U compinit compinit -i diff --git a/functions/pip/_pip b/plugins/pip/_pip similarity index 100% rename from functions/pip/_pip rename to plugins/pip/_pip diff --git a/plugins/pip.plugin.zsh b/plugins/pip/pip.plugin.zsh similarity index 67% rename from plugins/pip.plugin.zsh rename to plugins/pip/pip.plugin.zsh index 69e21f8d7..bf9f23968 100644 --- a/plugins/pip.plugin.zsh +++ b/plugins/pip/pip.plugin.zsh @@ -1,4 +1,4 @@ # add brew completion function to path -fpath=($ZSH/functions/pip $fpath) +fpath=($ZSH/plugins/pip $fpath) autoload -U compinit compinit -i From d73ed29d8a9ce05c5e80ee511c9d07749c012eff Mon Sep 17 00:00:00 2001 From: Luke Randall Date: Sun, 5 Sep 2010 16:52:38 +0200 Subject: [PATCH 220/614] Add lukerandall.zsh-theme --- themes/lukerandall.zsh-theme | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 themes/lukerandall.zsh-theme diff --git a/themes/lukerandall.zsh-theme b/themes/lukerandall.zsh-theme new file mode 100644 index 000000000..24a0612b7 --- /dev/null +++ b/themes/lukerandall.zsh-theme @@ -0,0 +1,10 @@ +# ZSH Theme - Preview: http://cl.ly/f701d00760f8059e06dc +# Thanks to gallifrey, upon whose theme this is based + +local return_code="%(?..%{$fg_bold[red]%}%? ↵%{$reset_color%})" + +PROMPT='%{$fg_bold[green]%}%n@%m%{$reset_color%} %{$fg_bold[blue]%}%2~%{$reset_color%} $(git_prompt_info)%{$reset_color%}%B»%b ' +RPS1="${return_code}" + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}(" +ZSH_THEME_GIT_PROMPT_SUFFIX=") %{$reset_color%}" From e26bfbcd23e698b66dbabafc5caf280234ce147c Mon Sep 17 00:00:00 2001 From: Vivek Prahlad Date: Fri, 10 Sep 2010 10:50:42 +0530 Subject: [PATCH 221/614] Adding a plugin with aliases for macports --- plugins/macports.plugin.zsh | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 plugins/macports.plugin.zsh diff --git a/plugins/macports.plugin.zsh b/plugins/macports.plugin.zsh new file mode 100644 index 000000000..94a5f5ef2 --- /dev/null +++ b/plugins/macports.plugin.zsh @@ -0,0 +1,6 @@ +alias pc="sudo port clean --all installed" +alias pi="sudo port install $1" +alias psu="sudo port selfupdate" +alias puni="sudo port uninstall inactive" +alias puo="sudo port upgrade outdated" +alias pup="psu && puo" From ce1d94528eda5a8b3fe18aa666294ff003ead9d9 Mon Sep 17 00:00:00 2001 From: Vivek Prahlad Date: Fri, 10 Sep 2010 10:55:17 +0530 Subject: [PATCH 222/614] Adding comments --- plugins/macports.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/macports.plugin.zsh b/plugins/macports.plugin.zsh index 94a5f5ef2..9564829b0 100644 --- a/plugins/macports.plugin.zsh +++ b/plugins/macports.plugin.zsh @@ -1,3 +1,4 @@ +#Aliases alias pc="sudo port clean --all installed" alias pi="sudo port install $1" alias psu="sudo port selfupdate" From daf855f2ed88bdbdc14e2bd63929966e93924db6 Mon Sep 17 00:00:00 2001 From: Matt Cable Date: Sun, 19 Sep 2010 19:39:51 -0600 Subject: [PATCH 223/614] Move dirpersist to plugin --- lib/dirspersist.zsh => plugins/dirpersist.plugin.zsh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename lib/dirspersist.zsh => plugins/dirpersist.plugin.zsh (100%) diff --git a/lib/dirspersist.zsh b/plugins/dirpersist.plugin.zsh similarity index 100% rename from lib/dirspersist.zsh rename to plugins/dirpersist.plugin.zsh From e3e284016c8de8889150fa6f59f78bff93b14e83 Mon Sep 17 00:00:00 2001 From: Matt Cable Date: Sun, 19 Sep 2010 19:43:49 -0600 Subject: [PATCH 224/614] Added installation function --- plugins/dirpersist.plugin.zsh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/plugins/dirpersist.plugin.zsh b/plugins/dirpersist.plugin.zsh index d694c55e2..48ca94d7c 100644 --- a/plugins/dirpersist.plugin.zsh +++ b/plugins/dirpersist.plugin.zsh @@ -4,6 +4,17 @@ # # Run dirpersiststore in ~/.zlogout +dirpersistinstall () { + if grep -qL 'dirpersiststore' ~/.zlogout; then + else + if read -q \?"Would you like to set up your .zlogout file for use with dirspersist? (y/n) "; then + echo "# Store dirs stack\n# See ~/.oh-my-zsh/plugins/dirspersist.plugin.zsh\ndirpersiststore" >> ~/.zlogout + else + echo "If you don't want this message to appear, remove dirspersist from \$plugins" + fi + fi +} + dirpersiststore () { dirs -p | tail -r | perl -ne 'chomp;s/([& ])/\\$1/g ;print "if [ -d $_ ]; then pushd -q $_; fi\n"' > ~/.zdirstore } @@ -16,6 +27,8 @@ dirpersistrestore () { DIRSTACKSIZE=10 setopt autopushd pushdminus pushdsilent pushdtohome pushdignoredups + +dirpersistinstall dirpersistrestore # Make popd changes permanent without having to wait for logout From 515315e46773f160e6660e41c1e7a0c66186e785 Mon Sep 17 00:00:00 2001 From: Matt Cable Date: Sun, 19 Sep 2010 22:39:11 -0600 Subject: [PATCH 225/614] Added install instructions --- plugins/dirpersist.plugin.zsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/dirpersist.plugin.zsh b/plugins/dirpersist.plugin.zsh index 48ca94d7c..4decd8b30 100644 --- a/plugins/dirpersist.plugin.zsh +++ b/plugins/dirpersist.plugin.zsh @@ -2,7 +2,8 @@ # # Make the dirstack more persistant # -# Run dirpersiststore in ~/.zlogout +# Add dirpersist to $plugins in ~/.zshrc to load +# dirpersistinstall () { if grep -qL 'dirpersiststore' ~/.zlogout; then From 5539b3c72b4c38e382a89c633defd120901e3f47 Mon Sep 17 00:00:00 2001 From: Matt Cable Date: Sun, 19 Sep 2010 22:40:47 -0600 Subject: [PATCH 226/614] Change zdirstore to variable --- plugins/dirpersist.plugin.zsh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/dirpersist.plugin.zsh b/plugins/dirpersist.plugin.zsh index 4decd8b30..5b3fdfb3d 100644 --- a/plugins/dirpersist.plugin.zsh +++ b/plugins/dirpersist.plugin.zsh @@ -5,6 +5,9 @@ # Add dirpersist to $plugins in ~/.zshrc to load # +# $zdirstore is the file used to persist the stack +zdirstore=~/.zdirstore + dirpersistinstall () { if grep -qL 'dirpersiststore' ~/.zlogout; then else @@ -17,12 +20,12 @@ dirpersistinstall () { } dirpersiststore () { - dirs -p | tail -r | perl -ne 'chomp;s/([& ])/\\$1/g ;print "if [ -d $_ ]; then pushd -q $_; fi\n"' > ~/.zdirstore + dirs -p | tail -r | perl -ne 'chomp;s/([& ])/\\$1/g ;print "if [ -d $_ ]; then pushd -q $_; fi\n"' > $zdirstore } dirpersistrestore () { - if [ -f ~/.zdirstore ]; then - source ~/.zdirstore + if [ -f $zdirstore ]; then + source $zdirstore fi } From 9d9fcaf232c37d28784a452b43e0a7e8ce787319 Mon Sep 17 00:00:00 2001 From: gwjo Date: Fri, 24 Sep 2010 20:46:52 -0400 Subject: [PATCH 227/614] ssh-agent module Implement a simple module that automatically launches the ssh-agent when you login and adds your default key. Useful for anyone that does remote work and thus doesn't have access to a keychain tool. --- plugins/ssh-agent.plugin.zsh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 plugins/ssh-agent.plugin.zsh diff --git a/plugins/ssh-agent.plugin.zsh b/plugins/ssh-agent.plugin.zsh new file mode 100644 index 000000000..fa8c45ea2 --- /dev/null +++ b/plugins/ssh-agent.plugin.zsh @@ -0,0 +1,24 @@ +# Based on code from Joseph M. Reagle +# http://www.cygwin.com/ml/cygwin/2001-06/msg00537.html + +local SSH_ENV=$HOME/.ssh/environment + +function start_agent { + /usr/bin/ssh-agent | sed 's/^echo/#echo/' > ${SSH_ENV} + chmod 600 ${SSH_ENV} + . ${SSH_ENV} > /dev/null + /usr/bin/ssh-add; +} + +# Source SSH settings, if applicable + +if [ -f "${SSH_ENV}" ]; then + . ${SSH_ENV} > /dev/null + #ps ${SSH_AGENT_PID} doesn't work under cywgin + ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || { + start_agent; + } +else + start_agent; +fi + From 8dc552cfb748b41aac53d4ec7879859518a2d989 Mon Sep 17 00:00:00 2001 From: Jake Bell Date: Sat, 25 Sep 2010 00:48:19 -0500 Subject: [PATCH 228/614] Added theunraveler theme. --- themes/theunraveler.zsh-theme | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 themes/theunraveler.zsh-theme diff --git a/themes/theunraveler.zsh-theme b/themes/theunraveler.zsh-theme new file mode 100644 index 000000000..4eec8e827 --- /dev/null +++ b/themes/theunraveler.zsh-theme @@ -0,0 +1,6 @@ +# Comment + +ZSH_THEME_GIT_PROMPT_PREFIX=' (git:' +ZSH_THEME_GIT_PROMPT_SUFFIX=')' + +PROMPT='%{$fg[magenta]%}[%c]$(git_prompt_info) $ %{$reset_color%}' \ No newline at end of file From 18568a23105bfece55670de14b1d43bf6320dc2b Mon Sep 17 00:00:00 2001 From: Tomas Kramar Date: Sun, 26 Sep 2010 16:05:53 +0200 Subject: [PATCH 229/614] unset config_file is useless --- oh-my-zsh.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index bb45c71eb..c46aea7ac 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -21,5 +21,3 @@ then else /usr/bin/env zsh $ZSH/tools/check_for_upgrade.sh fi - -unset config_file \ No newline at end of file From 3570f0d243eddfef3b34e4b34363f8ff8245867d Mon Sep 17 00:00:00 2001 From: Tomas Kramar Date: Sun, 26 Sep 2010 16:03:44 +0200 Subject: [PATCH 230/614] Do not complete named-directories --- lib/completion.zsh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/completion.zsh b/lib/completion.zsh index cba90179f..52cc5b53c 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -1,4 +1,4 @@ -## fixme - the load process here seems a bit bizarre +# fixme - the load process here seems a bit bizarre unsetopt menu_complete # do not autoselect the first completion entry unsetopt flowcontrol @@ -30,6 +30,11 @@ zstyle ':completion:*:*:*:*:*' menu select zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01' zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm -w -w" +# disable named-directories autocompletion +zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories +cdpath=(.) + + # Load known hosts file for auto-completion with ssh and scp commands if [ -f ~/.ssh/known_hosts ]; then zstyle ':completion:*' hosts $( sed 's/[, ].*$//' $HOME/.ssh/known_hosts ) From 572a66395511814a1b973ba13c4f7cf3eb65ee7c Mon Sep 17 00:00:00 2001 From: Tomas Kramar Date: Sun, 26 Sep 2010 22:25:31 +0200 Subject: [PATCH 231/614] Add vi-mode plugin for vi-like editing --- plugins/vi-mode.plugin.zsh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 plugins/vi-mode.plugin.zsh diff --git a/plugins/vi-mode.plugin.zsh b/plugins/vi-mode.plugin.zsh new file mode 100644 index 000000000..c47ab7211 --- /dev/null +++ b/plugins/vi-mode.plugin.zsh @@ -0,0 +1,22 @@ +function zle-line-init zle-keymap-select { + zle reset-prompt +} + +zle -N zle-line-init +zle -N zle-keymap-select + +bindkey -v + +# if mode indicator wasn't setup by theme, define default +if [[ "$MODE_INDICATOR" == "" ]]; then + MODE_INDICATOR="%{$fg_bold[red]%}<%{$fg[red]%}<<%{$reset_color%}" +fi + +function vi_mode_prompt_info() { + echo "${${KEYMAP/vicmd/$MODE_INDICATOR}/(main|viins)/}" +} + +# define right prompt, if it wasn't defined by a theme +if [[ "$RPS1" == "" && "$RPROMPT" == "" ]]; then + RPS1='$(vi_mode_prompt_info)' +fi From 800cfb5c41797110719569ddff7da08369d80a66 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Thu, 30 Sep 2010 20:54:45 -0700 Subject: [PATCH 232/614] Tidying up the spacing to bring in line with coding standards --- plugins/ssh-agent.plugin.zsh | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/plugins/ssh-agent.plugin.zsh b/plugins/ssh-agent.plugin.zsh index fa8c45ea2..ce0d645c1 100644 --- a/plugins/ssh-agent.plugin.zsh +++ b/plugins/ssh-agent.plugin.zsh @@ -4,21 +4,20 @@ local SSH_ENV=$HOME/.ssh/environment function start_agent { - /usr/bin/ssh-agent | sed 's/^echo/#echo/' > ${SSH_ENV} - chmod 600 ${SSH_ENV} - . ${SSH_ENV} > /dev/null - /usr/bin/ssh-add; + /usr/bin/env ssh-agent | sed 's/^echo/#echo/' > ${SSH_ENV} + chmod 600 ${SSH_ENV} + . ${SSH_ENV} > /dev/null + /usr/bin/ssh-add; } # Source SSH settings, if applicable if [ -f "${SSH_ENV}" ]; then - . ${SSH_ENV} > /dev/null - #ps ${SSH_AGENT_PID} doesn't work under cywgin - ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || { - start_agent; - } + . ${SSH_ENV} > /dev/null + ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || { + start_agent; + } else - start_agent; + start_agent; fi From 36bc60455b77fcad45ec628ca1e7f360692699bf Mon Sep 17 00:00:00 2001 From: Trevor Creech Date: Mon, 20 Sep 2010 17:31:17 -0700 Subject: [PATCH 233/614] Match xterm-color, the default OS X terminal --- lib/functions.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/functions.zsh b/lib/functions.zsh index fcbe994be..561586cba 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -5,7 +5,7 @@ function title { print -nR $'\033k'$1$'\033'\\\ print -nR $'\033]0;'$2$'\a' - elif [[ $TERM == "xterm" || $TERM == "rxvt" ]]; then + elif [[ $TERM =~ "^xterm" || $TERM == "rxvt" ]]; then # Use this one instead for XTerms: print -nR $'\033]0;'$*$'\a' fi From f31b3728db40ca894bf190f451b4c505d6021569 Mon Sep 17 00:00:00 2001 From: Matt Cable Date: Tue, 21 Sep 2010 12:07:02 -0600 Subject: [PATCH 234/614] Removed unportable (and unnecessary) grep flags --- plugins/dirpersist.plugin.zsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/dirpersist.plugin.zsh b/plugins/dirpersist.plugin.zsh index 5b3fdfb3d..b5e825bff 100644 --- a/plugins/dirpersist.plugin.zsh +++ b/plugins/dirpersist.plugin.zsh @@ -9,7 +9,7 @@ zdirstore=~/.zdirstore dirpersistinstall () { - if grep -qL 'dirpersiststore' ~/.zlogout; then + if grep 'dirpersiststore' ~/.zlogout > /dev/null; then else if read -q \?"Would you like to set up your .zlogout file for use with dirspersist? (y/n) "; then echo "# Store dirs stack\n# See ~/.oh-my-zsh/plugins/dirspersist.plugin.zsh\ndirpersiststore" >> ~/.zlogout @@ -19,6 +19,7 @@ dirpersistinstall () { fi } +# FIXME solaris doesn't support tail -r dirpersiststore () { dirs -p | tail -r | perl -ne 'chomp;s/([& ])/\\$1/g ;print "if [ -d $_ ]; then pushd -q $_; fi\n"' > $zdirstore } From 6fe935d59e08982fcb7652fe10cce8c3dec60abb Mon Sep 17 00:00:00 2001 From: Matt Cable Date: Sun, 26 Sep 2010 21:30:57 -0600 Subject: [PATCH 235/614] Portable perl dirpersiststore because 'tail -r' doesn't work everywhere. --- plugins/dirpersist.plugin.zsh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/dirpersist.plugin.zsh b/plugins/dirpersist.plugin.zsh index b5e825bff..6a2b289a2 100644 --- a/plugins/dirpersist.plugin.zsh +++ b/plugins/dirpersist.plugin.zsh @@ -19,9 +19,8 @@ dirpersistinstall () { fi } -# FIXME solaris doesn't support tail -r dirpersiststore () { - dirs -p | tail -r | perl -ne 'chomp;s/([& ])/\\$1/g ;print "if [ -d $_ ]; then pushd -q $_; fi\n"' > $zdirstore + dirs -p | perl -e 'foreach (reverse ) {chomp;s/([& ])/\\$1/g ;print "if [ -d $_ ]; then pushd -q $_; fi\n"}' > $zdirstore } dirpersistrestore () { From 9385d6686002121c4e168b6739de9f500f451278 Mon Sep 17 00:00:00 2001 From: steeef Date: Thu, 30 Sep 2010 19:56:56 -0700 Subject: [PATCH 236/614] added steeef theme --- themes/steeef.zsh-theme | 68 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 themes/steeef.zsh-theme diff --git a/themes/steeef.zsh-theme b/themes/steeef.zsh-theme new file mode 100644 index 000000000..a54cdce14 --- /dev/null +++ b/themes/steeef.zsh-theme @@ -0,0 +1,68 @@ +# prompt style and colors based on Steve Losh's Prose theme: +# http://github.com/sjl/oh-my-zsh/blob/master/themes/prose.zsh-theme +# +# vcs_info modifications from Bart Trojanowski's zsh prompt: +# http://www.jukie.net/bart/blog/pimping-out-zsh-prompt + +function virtualenv_info { + [ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') ' +} +PR_GIT_UPDATE=1 + +setopt prompt_subst +autoload colors +colors + +autoload -U add-zsh-hook +autoload -Uz vcs_info + + +# check-for-changes can be really slow. +# you should disable it, if you work with large repositories +zstyle ':vcs_info:*:prompt:*' check-for-changes true + +# set formats +# %b - branchname +# %u - unstagedstr (see below) +# %c - stagedstr (see below) +# %a - action (e.g. rebase-i) +# %R - repository path +# %S - path in the repository +PR_RST="%{${reset_color}%}" +FMT_BRANCH="(%{$fg[magenta]%}%b%u%c${PR_RST})" +FMT_ACTION="(%{$fg[green]%}%a${PR_RST})" +FMT_UNSTAGED="%{$fg[yellow]%}!" +FMT_STAGED="%{$fg[yellow]%}?" + +zstyle ':vcs_info:*:prompt:*' unstagedstr "${FMT_UNSTAGED}" +zstyle ':vcs_info:*:prompt:*' stagedstr "${FMT_STAGED}" +zstyle ':vcs_info:*:prompt:*' actionformats "${FMT_BRANCH}${FMT_ACTION}" +zstyle ':vcs_info:*:prompt:*' formats "${FMT_BRANCH}" +zstyle ':vcs_info:*:prompt:*' nvcsformats "" + + +function steeef_preexec { + case "$(history $HISTCMD)" in + *git*) + PR_GIT_UPDATE=1 + ;; + esac +} +add-zsh-hook preexec steeef_preexec + +function steeef_chpwd { + PR_GIT_UPDATE=1 +} +add-zsh-hook chpwd steeef_chpwd + +function steeef_precmd { + if [[ -n "$PR_GIT_UPDATE" ]] ; then + vcs_info 'prompt' + PR_GIT_UPDATE= + fi +} +add-zsh-hook precmd steeef_precmd + +PROMPT=$' +%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%}%~%{$reset_color%} $vcs_info_msg_0_ +$(virtualenv_info)$ ' From 2c1236e047d0e82ab921876f6eb3118afe33dbe0 Mon Sep 17 00:00:00 2001 From: Jake Bell Date: Fri, 1 Oct 2010 14:15:52 -0500 Subject: [PATCH 237/614] Removing capistrano aliases/functions from rails plugin (since cap is not rails-specific). --- plugins/cap/cap.plugin.zsh | 21 +++++++++++++++++++++ plugins/rails/rails.plugin.zsh | 23 ----------------------- 2 files changed, 21 insertions(+), 23 deletions(-) create mode 100644 plugins/cap/cap.plugin.zsh diff --git a/plugins/cap/cap.plugin.zsh b/plugins/cap/cap.plugin.zsh new file mode 100644 index 000000000..a0fa21d00 --- /dev/null +++ b/plugins/cap/cap.plugin.zsh @@ -0,0 +1,21 @@ +function _cap_does_task_list_need_generating () { + if [ ! -f .cap_tasks~ ]; then return 0; + else + accurate=$(stat -f%m .cap_tasks~) + changed=$(stat -f%m config/deploy.rb) + return $(expr $accurate '>=' $changed) + fi +} + +function _cap () { + if [ -f config/deploy.rb ]; then + if _cap_does_task_list_need_generating; then + echo "\nGenerating .cap_tasks~..." > /dev/stderr + cap show_tasks -q | cut -d " " -f 1 | sed -e '/^ *$/D' -e '1,2D' +> .cap_tasks~ + fi + compadd `cat .cap_tasks~` + fi +} + +compctl -K _cap cap \ No newline at end of file diff --git a/plugins/rails/rails.plugin.zsh b/plugins/rails/rails.plugin.zsh index 45bebb722..ac8119e83 100644 --- a/plugins/rails/rails.plugin.zsh +++ b/plugins/rails/rails.plugin.zsh @@ -1,4 +1,3 @@ - alias ss='thin --stats "/thin/stats" start' alias sg='ruby script/generate' alias sd='ruby script/destroy' @@ -9,28 +8,6 @@ alias sc='ruby script/console' alias sd='ruby script/server --debugger' alias devlog='tail -f log/development.log' -function _cap_does_task_list_need_generating () { - if [ ! -f .cap_tasks~ ]; then return 0; - else - accurate=$(stat -f%m .cap_tasks~) - changed=$(stat -f%m config/deploy.rb) - return $(expr $accurate '>=' $changed) - fi -} - -function _cap () { - if [ -f config/deploy.rb ]; then - if _cap_does_task_list_need_generating; then - echo "\nGenerating .cap_tasks~..." > /dev/stderr - cap show_tasks -q | cut -d " " -f 1 | sed -e '/^ *$/D' -e '1,2D' -> .cap_tasks~ - fi - compadd `cat .cap_tasks~` - fi -} - -compctl -K _cap cap - function remote_console() { /usr/bin/env ssh $1 "( cd $2 && ruby script/console production )" } From 162ffc8682d6f9222f01c725bcf2fafaf8ca931d Mon Sep 17 00:00:00 2001 From: steeef Date: Fri, 1 Oct 2010 14:11:53 -0700 Subject: [PATCH 238/614] merge steeef.zsh-theme from master --- themes/steeef.zsh-theme | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/themes/steeef.zsh-theme b/themes/steeef.zsh-theme index a54cdce14..abb8f2994 100644 --- a/themes/steeef.zsh-theme +++ b/themes/steeef.zsh-theme @@ -3,6 +3,9 @@ # # vcs_info modifications from Bart Trojanowski's zsh prompt: # http://www.jukie.net/bart/blog/pimping-out-zsh-prompt +# +# git untracked files modification from Brian Carper: +# http://briancarper.net/blog/570/git-info-in-your-zsh-prompt function virtualenv_info { [ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') ' @@ -17,6 +20,9 @@ autoload -U add-zsh-hook autoload -Uz vcs_info +# enable VCS systems you use +zstyle ':vcs_info:*' enable git svn + # check-for-changes can be really slow. # you should disable it, if you work with large repositories zstyle ':vcs_info:*:prompt:*' check-for-changes true @@ -31,8 +37,8 @@ zstyle ':vcs_info:*:prompt:*' check-for-changes true PR_RST="%{${reset_color}%}" FMT_BRANCH="(%{$fg[magenta]%}%b%u%c${PR_RST})" FMT_ACTION="(%{$fg[green]%}%a${PR_RST})" -FMT_UNSTAGED="%{$fg[yellow]%}!" -FMT_STAGED="%{$fg[yellow]%}?" +FMT_UNSTAGED="%{$fg[yellow]%}●" +FMT_STAGED="%{$fg[green]%}●" zstyle ':vcs_info:*:prompt:*' unstagedstr "${FMT_UNSTAGED}" zstyle ':vcs_info:*:prompt:*' stagedstr "${FMT_STAGED}" @@ -46,6 +52,9 @@ function steeef_preexec { *git*) PR_GIT_UPDATE=1 ;; + *svn*) + PR_GIT_UPDATE=1 + ;; esac } add-zsh-hook preexec steeef_preexec @@ -56,6 +65,15 @@ function steeef_chpwd { add-zsh-hook chpwd steeef_chpwd function steeef_precmd { + # check for untracked files or updated submodules, since vcs_info doesn't + if [[ -n $(git ls-files --other --exclude-standard 2> /dev/null) || -n $(git ls-files -m --exclude-standard 2> /dev/null) ]]; then + PR_GIT_UPDATE=1 + FMT_BRANCH="(%{$fg[magenta]%}%b%u%c%{$fg[red]%}●${PR_RST})" + else + FMT_BRANCH="(%{$fg[magenta]%}%b%u%c${PR_RST})" + fi + zstyle ':vcs_info:*:prompt:*' formats "${FMT_BRANCH}" + if [[ -n "$PR_GIT_UPDATE" ]] ; then vcs_info 'prompt' PR_GIT_UPDATE= From 0b3c68af0fd3e106c8c10ad1f94f5336888a1cba Mon Sep 17 00:00:00 2001 From: steeef Date: Fri, 1 Oct 2010 14:17:13 -0700 Subject: [PATCH 239/614] merge steeef.zsh-theme from master (removed submodule check) --- themes/steeef.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/steeef.zsh-theme b/themes/steeef.zsh-theme index abb8f2994..a43192743 100644 --- a/themes/steeef.zsh-theme +++ b/themes/steeef.zsh-theme @@ -66,7 +66,7 @@ add-zsh-hook chpwd steeef_chpwd function steeef_precmd { # check for untracked files or updated submodules, since vcs_info doesn't - if [[ -n $(git ls-files --other --exclude-standard 2> /dev/null) || -n $(git ls-files -m --exclude-standard 2> /dev/null) ]]; then + if [[ -n $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then PR_GIT_UPDATE=1 FMT_BRANCH="(%{$fg[magenta]%}%b%u%c%{$fg[red]%}●${PR_RST})" else From 517971fd107a77307c3e6819d372628467e5e8e2 Mon Sep 17 00:00:00 2001 From: steeef Date: Fri, 1 Oct 2010 14:40:06 -0700 Subject: [PATCH 240/614] fix untracked files checking --- themes/steeef.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/steeef.zsh-theme b/themes/steeef.zsh-theme index a43192743..8c4c80265 100644 --- a/themes/steeef.zsh-theme +++ b/themes/steeef.zsh-theme @@ -66,7 +66,7 @@ add-zsh-hook chpwd steeef_chpwd function steeef_precmd { # check for untracked files or updated submodules, since vcs_info doesn't - if [[ -n $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then + if [[ ! -z $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then PR_GIT_UPDATE=1 FMT_BRANCH="(%{$fg[magenta]%}%b%u%c%{$fg[red]%}●${PR_RST})" else From dd54c7dc8b1a372b840a0ed81e2bcdec5b0722e8 Mon Sep 17 00:00:00 2001 From: atom smith Date: Sun, 3 Oct 2010 17:41:45 -0400 Subject: [PATCH 241/614] adding my zsh-theme --- themes/re5et.zsh-theme | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 themes/re5et.zsh-theme diff --git a/themes/re5et.zsh-theme b/themes/re5et.zsh-theme new file mode 100644 index 000000000..fadb1fef8 --- /dev/null +++ b/themes/re5et.zsh-theme @@ -0,0 +1,15 @@ +if [ "$(whoami)" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="magenta"; fi + +local return_code="%(?..%{$fg_bold[red]%}:( %?%{$reset_color%})" + +PROMPT=' +%{$fg_bold[cyan]%}%n%{$reset_color%}%{$fg[yellow]%}@%{$reset_color%}%{$fg_bold[blue]%}%m%{$reset_color%}:%{${fg_bold[green]}%}%~%{$reset_color%}$(git_prompt_info) +%{${fg[$CARETCOLOR]}%}%# %{${reset_color}%}' + +RPS1='${return_code} %D - %*' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[magenta]%}^%{$reset_color%}%{$fg_bold[yellow]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%} ±" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ?" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[red]%} ♥" \ No newline at end of file From 91acdb772fea4ba64ae4e46910e1c8e8a26857f1 Mon Sep 17 00:00:00 2001 From: atom smith Date: Sun, 3 Oct 2010 17:42:57 -0400 Subject: [PATCH 242/614] should have newline at end of file. --- themes/re5et.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/re5et.zsh-theme b/themes/re5et.zsh-theme index fadb1fef8..5bded76a3 100644 --- a/themes/re5et.zsh-theme +++ b/themes/re5et.zsh-theme @@ -12,4 +12,4 @@ ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[magenta]%}^%{$reset_color%}%{$fg_bold[ye ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%} ±" ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ?" -ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[red]%} ♥" \ No newline at end of file +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[red]%} ♥" From eb5ebc1ea407c5085f1bb92f17271db0e651fa9e Mon Sep 17 00:00:00 2001 From: steeef Date: Mon, 4 Oct 2010 18:05:01 -0700 Subject: [PATCH 243/614] use 256 colors, if available --- themes/steeef.zsh-theme | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/themes/steeef.zsh-theme b/themes/steeef.zsh-theme index 8c4c80265..d8f9306cd 100644 --- a/themes/steeef.zsh-theme +++ b/themes/steeef.zsh-theme @@ -19,6 +19,20 @@ colors autoload -U add-zsh-hook autoload -Uz vcs_info +#use extended color pallete if available +if [ $TERM = "xterm-256color" ]; then + turquoise="%F{81}" + orange="%F{166}" + purple="%F{135}" + hotpink="%F{161}" + limegreen="%F{118}" +else + turquoise="$fg[cyan]" + orange="$fg[yellow]" + purple="$fg[magenta]" + hotpink="$fg[red]" + limegreen="$fg[green]" +fi # enable VCS systems you use zstyle ':vcs_info:*' enable git svn @@ -35,10 +49,10 @@ zstyle ':vcs_info:*:prompt:*' check-for-changes true # %R - repository path # %S - path in the repository PR_RST="%{${reset_color}%}" -FMT_BRANCH="(%{$fg[magenta]%}%b%u%c${PR_RST})" -FMT_ACTION="(%{$fg[green]%}%a${PR_RST})" -FMT_UNSTAGED="%{$fg[yellow]%}●" -FMT_STAGED="%{$fg[green]%}●" +FMT_BRANCH="(%{$turquoise%}%b%u%c${PR_RST})" +FMT_ACTION="(%{$limegreen%}%a${PR_RST})" +FMT_UNSTAGED="%{$orange%}●" +FMT_STAGED="%{$limegreen%}●" zstyle ':vcs_info:*:prompt:*' unstagedstr "${FMT_UNSTAGED}" zstyle ':vcs_info:*:prompt:*' stagedstr "${FMT_STAGED}" @@ -68,9 +82,9 @@ function steeef_precmd { # check for untracked files or updated submodules, since vcs_info doesn't if [[ ! -z $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then PR_GIT_UPDATE=1 - FMT_BRANCH="(%{$fg[magenta]%}%b%u%c%{$fg[red]%}●${PR_RST})" + FMT_BRANCH="(%{$turquoise%}%b%u%c%{$hotpink%}●${PR_RST})" else - FMT_BRANCH="(%{$fg[magenta]%}%b%u%c${PR_RST})" + FMT_BRANCH="(%{$turquoise%}%b%u%c${PR_RST})" fi zstyle ':vcs_info:*:prompt:*' formats "${FMT_BRANCH}" @@ -82,5 +96,5 @@ function steeef_precmd { add-zsh-hook precmd steeef_precmd PROMPT=$' -%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%}%~%{$reset_color%} $vcs_info_msg_0_ +%{$purple%}%n%{$reset_color%} at %{$orange%}%m%{$reset_color%} in %{$limegreen%}%~%{$reset_color%} $vcs_info_msg_0_ $(virtualenv_info)$ ' From 53498bc4eff8018e9870f6370b2bcbf771a0511f Mon Sep 17 00:00:00 2001 From: steeef Date: Mon, 4 Oct 2010 22:08:38 -0700 Subject: [PATCH 244/614] merge master --- themes/steeef.zsh-theme | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/themes/steeef.zsh-theme b/themes/steeef.zsh-theme index d8f9306cd..a5cf0f9a1 100644 --- a/themes/steeef.zsh-theme +++ b/themes/steeef.zsh-theme @@ -79,16 +79,16 @@ function steeef_chpwd { add-zsh-hook chpwd steeef_chpwd function steeef_precmd { - # check for untracked files or updated submodules, since vcs_info doesn't - if [[ ! -z $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then - PR_GIT_UPDATE=1 - FMT_BRANCH="(%{$turquoise%}%b%u%c%{$hotpink%}●${PR_RST})" - else - FMT_BRANCH="(%{$turquoise%}%b%u%c${PR_RST})" - fi - zstyle ':vcs_info:*:prompt:*' formats "${FMT_BRANCH}" - if [[ -n "$PR_GIT_UPDATE" ]] ; then + # check for untracked files or updated submodules, since vcs_info doesn't + if [[ ! -z $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then + PR_GIT_UPDATE=1 + FMT_BRANCH="(%{$turquoise%}%b%u%c%{$hotpink%}●${PR_RST})" + else + FMT_BRANCH="(%{$turquoise%}%b%u%c${PR_RST})" + fi + zstyle ':vcs_info:*:prompt:*' formats "${FMT_BRANCH}" + vcs_info 'prompt' PR_GIT_UPDATE= fi From 287585dd654b623b0f933b5c6a3cbd27ef959dd5 Mon Sep 17 00:00:00 2001 From: Phillip Ridlen Date: Tue, 5 Oct 2010 17:06:08 -0500 Subject: [PATCH 245/614] Add cloud.zsh-theme --- themes/cloud.zsh-theme | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 themes/cloud.zsh-theme diff --git a/themes/cloud.zsh-theme b/themes/cloud.zsh-theme new file mode 100644 index 000000000..ad5e2834b --- /dev/null +++ b/themes/cloud.zsh-theme @@ -0,0 +1,6 @@ +PROMPT='%{$fg_bold[cyan]%}☁ %{$fg_bold[green]%}%p %{$fg[green]%}%c %{$fg_bold[cyan]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}[%{$fg[cyan]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}] %{$fg[yellow]%}⚡%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%}]" \ No newline at end of file From aa2f553023fbb5a909edcc431b6fbcda43a39c9b Mon Sep 17 00:00:00 2001 From: Irakli Gozalishvili Date: Sat, 9 Oct 2010 01:27:40 +0200 Subject: [PATCH 246/614] Improving git plugin so it can display much more data. --- lib/git.zsh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/lib/git.zsh b/lib/git.zsh index 889dd98df..57a78e27f 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -11,3 +11,31 @@ parse_git_dirty () { echo "$ZSH_THEME_GIT_PROMPT_CLEAN" fi } + +# get the status of the working tree +git_prompt_status() { + INDEX=$(git status --porcelain 2> /dev/null) + STATUS="" + if $(echo "$INDEX" | grep '^?? ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_UNTRACKED$STATUS" + fi + if $(echo "$INDEX" | grep '^A ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS" + elif $(echo "$INDEX" | grep '^M ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS" + fi + if $(echo "$INDEX" | grep '^ M ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS" + fi + if $(echo "$INDEX" | grep '^R ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_RENAMED$STATUS" + fi + if $(echo "$INDEX" | grep '^ D ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS" + fi + if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS" + fi + echo $STATUS +} + From c4322f2955a4ee9923fc8744ebec411053536d1e Mon Sep 17 00:00:00 2001 From: Irakli Gozalishvili Date: Sat, 9 Oct 2010 01:49:35 +0200 Subject: [PATCH 247/614] Adding new gozilla theme --- themes/gozilla.zsh-theme | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 themes/gozilla.zsh-theme diff --git a/themes/gozilla.zsh-theme b/themes/gozilla.zsh-theme new file mode 100644 index 000000000..3112b3670 --- /dev/null +++ b/themes/gozilla.zsh-theme @@ -0,0 +1,15 @@ +PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p%{$fg[cyan]%}%c%{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' +RPROMPT='$(git_prompt_status)' + +ZSH_THEME_GIT_PROMPT_PREFIX="(%{%}" +ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[cyan]%} ✈%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[yellow]%} ✭%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✗%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%} ➦%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[magenta]%} ⚡%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[grey]%} ⚑%{$reset_color%}" + +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}" + From 3ce9bb3ef01be5057ec192a70ace8a8545f80861 Mon Sep 17 00:00:00 2001 From: Irakli Gozalishvili Date: Sat, 9 Oct 2010 02:16:10 +0200 Subject: [PATCH 248/614] Fixing some minor redrew issue --- themes/gozilla.zsh-theme | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/themes/gozilla.zsh-theme b/themes/gozilla.zsh-theme index 3112b3670..97566e380 100644 --- a/themes/gozilla.zsh-theme +++ b/themes/gozilla.zsh-theme @@ -1,8 +1,12 @@ -PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p%{$fg[cyan]%}%c%{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' -RPROMPT='$(git_prompt_status)' +PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' ZSH_THEME_GIT_PROMPT_PREFIX="(%{%}" ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%}" + +RPROMPT='$(git_prompt_status)' + ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[cyan]%} ✈%{$reset_color%}" ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[yellow]%} ✭%{$reset_color%}" ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✗%{$reset_color%}" @@ -10,6 +14,3 @@ ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%} ➦%{$reset_color%}" ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[magenta]%} ⚡%{$reset_color%}" ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[grey]%} ⚑%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%}" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}" - From e7ddaaa2b06c75eb1cefc749cc8f9a44a8b22752 Mon Sep 17 00:00:00 2001 From: Brandon Philips Date: Fri, 8 Oct 2010 22:44:42 -0700 Subject: [PATCH 249/614] functions: fix title() to not match any $TERM On my linux virtual terminals, where TERM="linux", I was getting annoying output that was messing up my prompt. It turns out the title function was always matching on the elif statement for xterm/rxvt no matter what and the linux vt doesn't know what to do with the title special control sequence and thus was printing out garbage. Through experimentation I figured out that the || inside of the [[ ]] did not work: export TERM=linux $ if [[ $TERM =~ "^xterm" || $TERM == "rxvt" ]]; then echo $TERM; fi linux $ if [[ $TERM =~ "^xterm" ]] || [[ $TERM == "rxvt" ]]; then echo $TERM; fi Signed-off-by: Brandon Philips openSUSE running zsh 4.3.10 --- lib/functions.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/functions.zsh b/lib/functions.zsh index 561586cba..e494f1f4d 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -5,7 +5,7 @@ function title { print -nR $'\033k'$1$'\033'\\\ print -nR $'\033]0;'$2$'\a' - elif [[ $TERM =~ "^xterm" || $TERM == "rxvt" ]]; then + elif [[ ($TERM =~ "^xterm") ]] || [[ ($TERM == "rxvt") ]]; then # Use this one instead for XTerms: print -nR $'\033]0;'$*$'\a' fi From e0789782bcafe38d38698421443e6a1608ad8afc Mon Sep 17 00:00:00 2001 From: Brandon Philips Date: Fri, 8 Oct 2010 22:57:43 -0700 Subject: [PATCH 250/614] themes: add philips theme Theme based on clean that is more suitable for white background terminals. Signed-off-by: Brandon Philips --- themes/philips.zsh-theme | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 themes/philips.zsh-theme diff --git a/themes/philips.zsh-theme b/themes/philips.zsh-theme new file mode 100644 index 000000000..fa7c59035 --- /dev/null +++ b/themes/philips.zsh-theme @@ -0,0 +1,14 @@ +if [ "$(whoami)" = "root" ]; then NCOLOR="red"; else NCOLOR="green"; fi + +PROMPT='%{$fg[$NCOLOR]%}%B%n%b%{$reset_color%}:%{$fg[blue]%}%B%c/%b%{$reset_color%} $(git_prompt_info)%(!.#.$) ' +RPROMPT='[%*]' + +# git theming +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}(%{$fg_no_bold[red]%}%B" +ZSH_THEME_GIT_PROMPT_SUFFIX="%b%{$fg_bold[blue]%})%{$reset_color%} " +ZSH_THEME_GIT_PROMPT_CLEAN="" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%}" + +# LS colors, made with http://geoff.greer.fm/lscolors/ +export LSCOLORS="Gxfxcxdxbxegedabagacad" +export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:' From 0348dc0721a8753ac058752ea81f02301d4ca1a9 Mon Sep 17 00:00:00 2001 From: Sven Lito Date: Sat, 9 Oct 2010 14:29:24 +0100 Subject: [PATCH 251/614] adding github plugin --- plugins/github/_github | 39 ++++++++++++++++++++++++++++++++ plugins/github/github.plugin.zsh | 4 ++++ 2 files changed, 43 insertions(+) create mode 100644 plugins/github/_github create mode 100644 plugins/github/github.plugin.zsh diff --git a/plugins/github/_github b/plugins/github/_github new file mode 100644 index 000000000..5295081e5 --- /dev/null +++ b/plugins/github/_github @@ -0,0 +1,39 @@ +#compdef github +#autoload + +# github zsh completion, based on homebrew completion + +local -a _1st_arguments +_1st_arguments=( + 'browse:Open this repo in a web browser' + 'clone:Clone a repo' + 'config:Automatically set configuration info, or pass args to specify' + 'create-from-local:Create a new GitHub repository from the current local repository' + 'create:Create a new empty GitHub repository' + 'fetch:Fetch from a remote to a local branch' + 'fetch_all:Fetch all refs from a user' + 'fork:Forks a GitHub repository' + 'home:Open this repos master branch in a web browser' + 'ignore:Ignore a SHA from github network commits' + 'info:Info about this project' + 'issues:Project issues tools' + 'network:Project network tools - sub-commands : web [user], list, fetch, commits' + 'network --after:Only show commits after a certain date' + 'network --applies:Filter commits to patches that apply cleanly' + 'open:Open the given user/project in a web browser' + 'pull-request:Generate the text for a pull request' + 'pull:Pull from a remote' + 'search:Search GitHub for the given repository name' + 'track:Track another users repository' +) + +local expl +local -a pkgs installed_pkgs + +_arguments \ + '*:: :->subcmds' && return 0 + +if (( CURRENT == 1 )); then + _describe -t commands "github subcommand" _1st_arguments + return +fi diff --git a/plugins/github/github.plugin.zsh b/plugins/github/github.plugin.zsh new file mode 100644 index 000000000..c23504b85 --- /dev/null +++ b/plugins/github/github.plugin.zsh @@ -0,0 +1,4 @@ +# add github completion function to path +fpath=($ZSH/plugins/github $fpath) +autoload -U compinit +compinit -i From 220d9533961800ba7631ec428f33d40c1d5953e8 Mon Sep 17 00:00:00 2001 From: Sven Lito Date: Sat, 9 Oct 2010 15:03:08 +0100 Subject: [PATCH 252/614] added git log incl. stats for the past 5 commits --- plugins/git/git.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 655eaf728..d317d179d 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -12,7 +12,7 @@ alias gb='git branch' alias gba='git branch -a' alias gcount='git shortlog -sn' alias gcp='git cherry-pick' - +alias glg='git log --stat --max-count=5' # Git and svn mix alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk' From 2865b56b13aa558aa488d85eb38d68a727998a17 Mon Sep 17 00:00:00 2001 From: Sven Lito Date: Sat, 9 Oct 2010 15:18:35 +0100 Subject: [PATCH 253/614] adding comment and URL to github gem --- plugins/github/_github | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/github/_github b/plugins/github/_github index 5295081e5..72178946a 100644 --- a/plugins/github/_github +++ b/plugins/github/_github @@ -1,3 +1,6 @@ +# in order to make this work, you would need to have the github gem installed +# http://github.com/defunkt/github-gem + #compdef github #autoload From c3e72870c80fd40e13eef5dd6c8a1879b799bca4 Mon Sep 17 00:00:00 2001 From: Sven Lito Date: Sat, 9 Oct 2010 15:29:28 +0100 Subject: [PATCH 254/614] leaving out subcommands for now --- plugins/github/_github | 2 -- 1 file changed, 2 deletions(-) diff --git a/plugins/github/_github b/plugins/github/_github index 72178946a..b8e1a9ada 100644 --- a/plugins/github/_github +++ b/plugins/github/_github @@ -21,8 +21,6 @@ _1st_arguments=( 'info:Info about this project' 'issues:Project issues tools' 'network:Project network tools - sub-commands : web [user], list, fetch, commits' - 'network --after:Only show commits after a certain date' - 'network --applies:Filter commits to patches that apply cleanly' 'open:Open the given user/project in a web browser' 'pull-request:Generate the text for a pull request' 'pull:Pull from a remote' From ff33d69d00b2affa1613f197f11ef33cd2d7f8bd Mon Sep 17 00:00:00 2001 From: Irakli Gozalishvili Date: Sat, 9 Oct 2010 18:06:00 +0200 Subject: [PATCH 255/614] changeing unicode characters that were causing issues --- themes/gozilla.zsh-theme | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/themes/gozilla.zsh-theme b/themes/gozilla.zsh-theme index 97566e380..c6b752e9b 100644 --- a/themes/gozilla.zsh-theme +++ b/themes/gozilla.zsh-theme @@ -1,16 +1,15 @@ PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' -ZSH_THEME_GIT_PROMPT_PREFIX="(%{%}" -ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}" -ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%}" +ZSH_THEME_GIT_PROMPT_PREFIX="(" +ZSH_THEME_GIT_PROMPT_SUFFIX=")" +ZSH_THEME_GIT_PROMPT_DIRTY="" +ZSH_THEME_GIT_PROMPT_CLEAN="" -RPROMPT='$(git_prompt_status)' - -ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[cyan]%} ✈%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[yellow]%} ✭%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✗%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%} ➦%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[magenta]%} ⚡%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[grey]%} ⚑%{$reset_color%}" +RPROMPT='$(git_prompt_status)%{$reset_color%}' +ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[cyan]%} ✈" +ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[yellow]%} ✭" +ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✗" +ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%} ➦" +ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[magenta]%} ✂" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[grey]%} ✱" From 95da4abe98f9a5f1ed2b2fbfe8f528c63b6f46db Mon Sep 17 00:00:00 2001 From: Sven Lito Date: Sat, 9 Oct 2010 18:38:01 +0100 Subject: [PATCH 256/614] bugfix - moved gem info --- plugins/github/_github | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/github/_github b/plugins/github/_github index b8e1a9ada..83e1713c7 100644 --- a/plugins/github/_github +++ b/plugins/github/_github @@ -1,9 +1,9 @@ -# in order to make this work, you would need to have the github gem installed -# http://github.com/defunkt/github-gem - #compdef github #autoload +# in order to make this work, you will need to have the github gem installed +# http://github.com/defunkt/github-gem + # github zsh completion, based on homebrew completion local -a _1st_arguments From d89d3a27038b8d70b790ded71a8193bdc271e8a5 Mon Sep 17 00:00:00 2001 From: Sven Lito Date: Sat, 9 Oct 2010 19:11:07 +0100 Subject: [PATCH 257/614] merging in changes from robby's repo --- lib/functions.zsh | 1 - lib/git.zsh | 1 - 2 files changed, 2 deletions(-) diff --git a/lib/functions.zsh b/lib/functions.zsh index e494f1f4d..e3c0de43e 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -37,4 +37,3 @@ function take() { mkdir -p $1 cd $1 } - diff --git a/lib/git.zsh b/lib/git.zsh index 57a78e27f..75fdc1f9c 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -38,4 +38,3 @@ git_prompt_status() { fi echo $STATUS } - From 949eab773550843fa377dffa134f87410b7b92a2 Mon Sep 17 00:00:00 2001 From: Florian Walch Date: Fri, 15 Oct 2010 11:05:47 +0200 Subject: [PATCH 258/614] Added own theme (based on robbyrussell) --- themes/fwalch.zsh-theme | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 themes/fwalch.zsh-theme diff --git a/themes/fwalch.zsh-theme b/themes/fwalch.zsh-theme new file mode 100644 index 000000000..24edf55c0 --- /dev/null +++ b/themes/fwalch.zsh-theme @@ -0,0 +1,6 @@ +PROMPT='%{$fg_bold[green]%}%p %{$fg[cyan]%}%c%{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX=" (%{$fg[red]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" From 45a13d3dd6c36fbc0009134424203c8b97bdf336 Mon Sep 17 00:00:00 2001 From: Florian Walch Date: Fri, 15 Oct 2010 16:50:39 +0200 Subject: [PATCH 259/614] Added gpg-agent plugin Based on ssh-agent plugin. --- plugins/gpg-agent/gpg-agent.plugin.zsh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 plugins/gpg-agent/gpg-agent.plugin.zsh diff --git a/plugins/gpg-agent/gpg-agent.plugin.zsh b/plugins/gpg-agent/gpg-agent.plugin.zsh new file mode 100644 index 000000000..8cc71fd57 --- /dev/null +++ b/plugins/gpg-agent/gpg-agent.plugin.zsh @@ -0,0 +1,26 @@ +# Based on ssh-agent code + +local GPG_ENV=$HOME/.gnupg/gpg-agent.env + +function start_agent { + /usr/bin/env gpg-agent --daemon --enable-ssh-support --write-env-file ${GPG_ENV} > /dev/null + chmod 600 ${GPG_ENV} + . ${GPG_ENV} > /dev/null +} + +# Source GPG agent settings, if applicable +if [ -f "${GPG_ENV}" ]; then + . ${GPG_ENV} > /dev/null + ps -ef | grep ${SSH_AGENT_PID} | grep gpg-agent > /dev/null || { + start_agent; + } +else + start_agent; +fi + +export GPG_AGENT_INFO +export SSH_AUTH_SOCK +export SSH_AGENT_PID + +GPG_TTY=$(tty) +export GPG_TTY From 616dedc11aee69526911004cd73c8f0caf255662 Mon Sep 17 00:00:00 2001 From: steeef Date: Fri, 22 Oct 2010 10:39:33 -0700 Subject: [PATCH 260/614] merge with master --- themes/steeef.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/steeef.zsh-theme b/themes/steeef.zsh-theme index a5cf0f9a1..07c1d3def 100644 --- a/themes/steeef.zsh-theme +++ b/themes/steeef.zsh-theme @@ -20,7 +20,7 @@ autoload -U add-zsh-hook autoload -Uz vcs_info #use extended color pallete if available -if [ $TERM = "xterm-256color" ]; then +if [ $TERM = "xterm-256color" || $TERM = "linux" || $TERM = "rxvt-256color" || $TERM = "rxvt-unicode-256color" ]; then turquoise="%F{81}" orange="%F{166}" purple="%F{135}" From 5dabb392f33aa84255c82566a3d491bd03057370 Mon Sep 17 00:00:00 2001 From: steeef Date: Fri, 22 Oct 2010 10:42:49 -0700 Subject: [PATCH 261/614] merge with master --- themes/steeef.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/steeef.zsh-theme b/themes/steeef.zsh-theme index 07c1d3def..6bca57eec 100644 --- a/themes/steeef.zsh-theme +++ b/themes/steeef.zsh-theme @@ -20,7 +20,7 @@ autoload -U add-zsh-hook autoload -Uz vcs_info #use extended color pallete if available -if [ $TERM = "xterm-256color" || $TERM = "linux" || $TERM = "rxvt-256color" || $TERM = "rxvt-unicode-256color" ]; then +if [ [ $TERM = "xterm-256color" ] || [ $TERM = "linux"] || [ $TERM = "rxvt-256color" ] || [ $TERM = "rxvt-unicode-256color" ] ]; then turquoise="%F{81}" orange="%F{166}" purple="%F{135}" From ed2880e1844b0468b0015933025b9b341a7f53f8 Mon Sep 17 00:00:00 2001 From: steeef Date: Fri, 22 Oct 2010 10:51:58 -0700 Subject: [PATCH 262/614] merge theme fixes from master --- themes/steeef.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/steeef.zsh-theme b/themes/steeef.zsh-theme index 6bca57eec..f81300242 100644 --- a/themes/steeef.zsh-theme +++ b/themes/steeef.zsh-theme @@ -20,7 +20,7 @@ autoload -U add-zsh-hook autoload -Uz vcs_info #use extended color pallete if available -if [ [ $TERM = "xterm-256color" ] || [ $TERM = "linux"] || [ $TERM = "rxvt-256color" ] || [ $TERM = "rxvt-unicode-256color" ] ]; then +if [[ $TERM = *256color* || $TERM = "linux" ]]; then turquoise="%F{81}" orange="%F{166}" purple="%F{135}" From b93ff2a76f0e366cad903c412202f4be8ad68da6 Mon Sep 17 00:00:00 2001 From: steeef Date: Fri, 22 Oct 2010 11:34:52 -0700 Subject: [PATCH 263/614] merge from master --- themes/steeef.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/steeef.zsh-theme b/themes/steeef.zsh-theme index f81300242..a2583b028 100644 --- a/themes/steeef.zsh-theme +++ b/themes/steeef.zsh-theme @@ -20,7 +20,7 @@ autoload -U add-zsh-hook autoload -Uz vcs_info #use extended color pallete if available -if [[ $TERM = *256color* || $TERM = "linux" ]]; then +if [[ $TERM = *256color* || $TERM = *rxvt* ]]; then turquoise="%F{81}" orange="%F{166}" purple="%F{135}" From 1d78c876040272fb11102d367a07391e292dad9f Mon Sep 17 00:00:00 2001 From: Joseph Jon Booker Date: Mon, 25 Oct 2010 16:02:16 -0500 Subject: [PATCH 264/614] command-not-found package in ubuntu --- plugins/command-not-found/command-not-found.plugin.zsh | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 plugins/command-not-found/command-not-found.plugin.zsh diff --git a/plugins/command-not-found/command-not-found.plugin.zsh b/plugins/command-not-found/command-not-found.plugin.zsh new file mode 100644 index 000000000..5ab03d5a9 --- /dev/null +++ b/plugins/command-not-found/command-not-found.plugin.zsh @@ -0,0 +1,5 @@ +# Uses the command-not-found package zsh support +# as seen in http://www.porcheron.info/command-not-found-for-zsh/ +# this is installed in Ubuntu + +source /etc/zsh_command_not_found From a2be11e42dccb12f7f82bed9075fb98c00a4597c Mon Sep 17 00:00:00 2001 From: Tom Stuart Date: Tue, 2 Nov 2010 11:26:49 +0000 Subject: [PATCH 265/614] Fix lighthouse plugin error message --- plugins/lighthouse/lighthouse.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/lighthouse/lighthouse.plugin.zsh b/plugins/lighthouse/lighthouse.plugin.zsh index 4eb06a997..7661c6add 100644 --- a/plugins/lighthouse/lighthouse.plugin.zsh +++ b/plugins/lighthouse/lighthouse.plugin.zsh @@ -4,7 +4,7 @@ # Example usage: http://screencast.com/t/ZDgwNDUwNT open_lighthouse_ticket () { if [ ! -f .lighthouse-url ]; then - echo "There is no .lighthouse file in the current directory..." + echo "There is no .lighthouse-url file in the current directory..." return 0; else lighthouse_url=$(cat .lighthouse-url); @@ -13,4 +13,4 @@ open_lighthouse_ticket () { fi } -alias lho='open_lighthouse_ticket' \ No newline at end of file +alias lho='open_lighthouse_ticket' From 86ca51a6b701a3e6df6dfa0d58ebb8177c65e8a0 Mon Sep 17 00:00:00 2001 From: gwjo Date: Wed, 3 Nov 2010 16:57:15 -0400 Subject: [PATCH 266/614] Completion fixes Use /etc/hosts in addtion to $HOME/.ssh/known_hosts as the source for hostname completion Turn on completion caching to speed up certain comands When completing usernames, don't include system accounts by default --- lib/completion.zsh | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/lib/completion.zsh b/lib/completion.zsh index 52cc5b53c..9c2dfecca 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -34,9 +34,31 @@ zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories cdpath=(.) +# use /etc/hosts and known_hosts for hostname completion +[ -r ~/.ssh/known_hosts ] && _ssh_hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=() +[ -r /etc/hosts ] && : ${(A)_etc_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$( Date: Tue, 9 Nov 2010 14:56:26 +0100 Subject: [PATCH 267/614] Added phing plugin --- plugins/phing/phing.plugin.zsh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 plugins/phing/phing.plugin.zsh diff --git a/plugins/phing/phing.plugin.zsh b/plugins/phing/phing.plugin.zsh new file mode 100644 index 000000000..80e334629 --- /dev/null +++ b/plugins/phing/phing.plugin.zsh @@ -0,0 +1,20 @@ +_phing_does_target_list_need_generating () { + if [ ! -f .phing_targets ]; then return 0; + else + accurate=$(stat -f%m .phing_targets) + changed=$(stat -f%m build.xml) + return $(expr $accurate '>=' $changed) + fi +} + +_phing () { + if [ -f build.xml ]; then + if _phing_does_target_list_need_generating; then + echo "\nGenerating .phing_targets..." > /dev/stderr + phing -l |grep -v ":" |grep -v "^$"|grep -v "\-" > .phing_targets + fi + compadd `cat .phing_targets` + fi +} + +compdef _phing phing From 241ebf6e4a972c6e31c8085a3185fcea36eb2559 Mon Sep 17 00:00:00 2001 From: NanoTech Date: Sun, 14 Nov 2010 16:51:19 -0600 Subject: [PATCH 268/614] themes/nanotech: Use the new built-in zsh color variables. --- themes/nanotech.zsh-theme | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/themes/nanotech.zsh-theme b/themes/nanotech.zsh-theme index eddb23c94..5d3331639 100644 --- a/themes/nanotech.zsh-theme +++ b/themes/nanotech.zsh-theme @@ -1,7 +1,7 @@ -PROMPT=' %{$fg_bold[green]%}%2c %{$fg_bold[blue]%}%{[%}%{$reset_color%} ' -RPROMPT='$(git_prompt_info) %{$fg[blue]%}] %{$fg[green]%}%D{%L:%M} %{$fg[yellow]%}%D{%p}%{$reset_color%} ' +PROMPT='%F{green}%2c%F{blue} [%f ' +RPROMPT='$(git_prompt_info) %F{blue}] %F{green}%D{%L:%M} %F{yellow}%D{%p}%f' -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}*%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_PREFIX="%F{yellow}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%f" +ZSH_THEME_GIT_PROMPT_DIRTY=" %F{red}*%f" ZSH_THEME_GIT_PROMPT_CLEAN="" From 2a5651f012f889fa5d08c94776d0725f6a5694f5 Mon Sep 17 00:00:00 2001 From: Fedyashev Nikita Date: Mon, 15 Nov 2010 14:45:04 -0500 Subject: [PATCH 269/614] vagrant plugin autocompletion - initial version --- plugins/vagrant/_vagrant | 139 +++++++++++++++++++++++++++++ plugins/vagrant/vagrant.plugin.zsh | 3 + 2 files changed, 142 insertions(+) create mode 100644 plugins/vagrant/_vagrant create mode 100644 plugins/vagrant/vagrant.plugin.zsh diff --git a/plugins/vagrant/_vagrant b/plugins/vagrant/_vagrant new file mode 100644 index 000000000..4cd6a46d2 --- /dev/null +++ b/plugins/vagrant/_vagrant @@ -0,0 +1,139 @@ +#compdef vagrant +#autoload + +# vagrant zsh completion, based on homebrew completion + +__task_list () +{ + local expl + declare -a tasks + + tasks=(box destroy halt init package provision reload resume ssh ssh_config status suspend up version) + + _wanted tasks expl 'help' compadd $tasks +} + +__box_list () +{ + _wanted application expl 'hxlp' compadd $(command ls -1 $HOME/.vagrant/boxes 2>/dev/null| sed -e 's/ /\\ /g') +} + +__vagrant-box () +{ + 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 branche.' + # 'list:List all your release branches. (Alias to `git flow release`)' + # ) + # _describe -t commands 'git flow release' subcommands + # _arguments \ + # -v'[Verbose (more) output]' + _describe -t commands "gem subcommand" _box_arguments + return + ;; + + (options) + case $line[1] in + + (repackage) + _arguments \ + -F'[Fetch from origin before performing finish]' \ + -r'[Rebase instead of merge]'\ + ':feature:__box_list' + + + + ;; + esac + ;; + esac + +} + +local -a _1st_arguments +_1st_arguments=( + 'box:Box commands' + 'destroy:Destroys the vagrant environment' + 'halt:Halts the currently running vagrant environment' + 'help:[TASK] Describe available tasks or one specific task' + 'init:[box_name] [box_url] Initializes current folder for Vagrant usage' + 'package:Packages a vagrant environment for distribution' + 'provision:Run the provisioner' + 'reload:Reload the vagrant environment' + 'resume:Resumes a suspend vagrant environment' + 'ssh:SSH into the currently running environment' + 'ssh_config:outputs .ssh/config valid syntax for connecting to this environment via ssh.' + 'status:Shows the status of the current Vagrant environment.' + 'suspend:Suspends the currently running vagrant environment' + 'up:Creates the vagrant environment' + 'version:Prints the Vagrant version information' +) + +local -a _box_arguments +_box_arguments=( + 'add:NAME URI Add a box to the system' + 'help:COMMAND Describe subcommands or one specific subcommand' + 'list:Lists all installed boxes' + 'remove:NAME Remove a box from the system' + 'repackage:NAME Repackage an installed box into a `.box` file.' +) + +local expl +local -a boxes installed_boxes + +#_arguments \ +# '(-v --version)'{-v,--version}'[show version]' \ +# '(-h --help)'{-h,--help}'[show help]' \ +# '*:: :->subcmds' && return 0 + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + + + +#echo $state +#echo -e "\n\n\n\n" +#echo $line[1] + +case $state in + + (command) + + _describe -t commands "gem subcommand" _1st_arguments + return + ;; + + (options) + + case $line[1] in + + (help) + _arguments \ + -F'[Fetch from origin before performing finish]' \ + -r'[Rebase instead of merge]'\ + ':feature:__task_list' + + ;; + + (box) + + __vagrant-box + ;; + esac + ;; +esac diff --git a/plugins/vagrant/vagrant.plugin.zsh b/plugins/vagrant/vagrant.plugin.zsh new file mode 100644 index 000000000..5e9bcf10a --- /dev/null +++ b/plugins/vagrant/vagrant.plugin.zsh @@ -0,0 +1,3 @@ +fpath=($ZSH/plugins/vagrant $fpath) +autoload -U compinit +compinit -i From e0c6769c939a168addb6dbf55769d955c847d52c Mon Sep 17 00:00:00 2001 From: Fedyashev Nikita Date: Mon, 15 Nov 2010 14:56:01 -0500 Subject: [PATCH 270/614] fixed formatting; dead code deleted --- plugins/vagrant/_vagrant | 147 +++++++++++++++------------------------ 1 file changed, 58 insertions(+), 89 deletions(-) diff --git a/plugins/vagrant/_vagrant b/plugins/vagrant/_vagrant index 4cd6a46d2..ea7fd5f74 100644 --- a/plugins/vagrant/_vagrant +++ b/plugins/vagrant/_vagrant @@ -5,134 +5,103 @@ __task_list () { - local expl - declare -a tasks + local expl + declare -a tasks - tasks=(box destroy halt init package provision reload resume ssh ssh_config status suspend up version) + tasks=(box destroy halt init package provision reload resume ssh ssh_config status suspend up version) - _wanted tasks expl 'help' compadd $tasks + _wanted tasks expl 'help' compadd $tasks } __box_list () { - _wanted application expl 'hxlp' compadd $(command ls -1 $HOME/.vagrant/boxes 2>/dev/null| sed -e 's/ /\\ /g') + _wanted application expl 'command' compadd $(command ls -1 $HOME/.vagrant/boxes 2>/dev/null| sed -e 's/ /\\ /g') } __vagrant-box () { - local curcontext="$curcontext" state line - typeset -A opt_args + local curcontext="$curcontext" state line + typeset -A opt_args - _arguments -C \ - ':command:->command' \ - '*::options:->options' + _arguments -C \ + ':command:->command' \ + '*::options:->options' - case $state in - (command) - - # local -a subcommands - # subcommands=( - # 'start:Start a new release branch' - # 'finish:Finish a release branche.' - # 'list:List all your release branches. (Alias to `git flow release`)' - # ) - # _describe -t commands 'git flow release' subcommands - # _arguments \ - # -v'[Verbose (more) output]' - _describe -t commands "gem subcommand" _box_arguments - return - ;; - - (options) - case $line[1] in - - (repackage) - _arguments \ - -F'[Fetch from origin before performing finish]' \ - -r'[Rebase instead of merge]'\ - ':feature:__box_list' - - - - ;; - esac - ;; - esac + case $state in + (command) + _describe -t commands "gem subcommand" _box_arguments + return + ;; + (options) + case $line[1] in + (repackage|remove) + _arguments \ + -F'[Fetch from origin before performing finish]' \ + -r'[Rebase instead of merge]'\ + ':feature:__box_list' + ;; + esac + ;; + esac } local -a _1st_arguments _1st_arguments=( - 'box:Box commands' - 'destroy:Destroys the vagrant environment' - 'halt:Halts the currently running vagrant environment' - 'help:[TASK] Describe available tasks or one specific task' - 'init:[box_name] [box_url] Initializes current folder for Vagrant usage' - 'package:Packages a vagrant environment for distribution' - 'provision:Run the provisioner' - 'reload:Reload the vagrant environment' - 'resume:Resumes a suspend vagrant environment' - 'ssh:SSH into the currently running environment' - 'ssh_config:outputs .ssh/config valid syntax for connecting to this environment via ssh.' - 'status:Shows the status of the current Vagrant environment.' - 'suspend:Suspends the currently running vagrant environment' - 'up:Creates the vagrant environment' - 'version:Prints the Vagrant version information' + 'box:Box commands' + 'destroy:Destroys the vagrant environment' + 'halt:Halts the currently running vagrant environment' + 'help:[TASK] Describe available tasks or one specific task' + 'init:[box_name] [box_url] Initializes current folder for Vagrant usage' + 'package:Packages a vagrant environment for distribution' + 'provision:Run the provisioner' + 'reload:Reload the vagrant environment' + 'resume:Resumes a suspend vagrant environment' + 'ssh:SSH into the currently running environment' + 'ssh_config:outputs .ssh/config valid syntax for connecting to this environment via ssh.' + 'status:Shows the status of the current Vagrant environment.' + 'suspend:Suspends the currently running vagrant environment' + 'up:Creates the vagrant environment' + 'version:Prints the Vagrant version information' ) local -a _box_arguments _box_arguments=( - 'add:NAME URI Add a box to the system' - 'help:COMMAND Describe subcommands or one specific subcommand' - 'list:Lists all installed boxes' - 'remove:NAME Remove a box from the system' - 'repackage:NAME Repackage an installed box into a `.box` file.' + 'add:NAME URI Add a box to the system' + 'help:COMMAND Describe subcommands or one specific subcommand' + 'list:Lists all installed boxes' + 'remove:NAME Remove a box from the system' + 'repackage:NAME Repackage an installed box into a `.box` file.' ) local expl local -a boxes installed_boxes -#_arguments \ -# '(-v --version)'{-v,--version}'[show version]' \ -# '(-h --help)'{-h,--help}'[show help]' \ -# '*:: :->subcmds' && return 0 - local curcontext="$curcontext" state line - typeset -A opt_args +local curcontext="$curcontext" state line +typeset -A opt_args - _arguments -C \ - ':command:->command' \ - '*::options:->options' +_arguments -C \ + ':command:->command' \ + '*::options:->options' - - -#echo $state -#echo -e "\n\n\n\n" -#echo $line[1] - case $state in - (command) - - _describe -t commands "gem subcommand" _1st_arguments - return + _describe -t commands "gem subcommand" _1st_arguments + return ;; (options) - case $line[1] in - (help) - _arguments \ - -F'[Fetch from origin before performing finish]' \ - -r'[Rebase instead of merge]'\ - ':feature:__task_list' - + _arguments \ + -F'[Fetch from origin before performing finish]' \ + -r'[Rebase instead of merge]'\ + ':feature:__task_list' ;; (box) - - __vagrant-box + __vagrant-box ;; esac ;; From 0ad1d6654d99adb97c4d5eaa8748f57dced64330 Mon Sep 17 00:00:00 2001 From: Fedyashev Nikita Date: Mon, 15 Nov 2010 15:18:58 -0500 Subject: [PATCH 271/614] improved formatting; redundant attributes deleted --- plugins/vagrant/_vagrant | 68 +++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 36 deletions(-) diff --git a/plugins/vagrant/_vagrant b/plugins/vagrant/_vagrant index ea7fd5f74..483b29c53 100644 --- a/plugins/vagrant/_vagrant +++ b/plugins/vagrant/_vagrant @@ -1,7 +1,35 @@ #compdef vagrant #autoload -# vagrant zsh completion, based on homebrew completion +# vagrant zsh completion + +local -a _1st_arguments +_1st_arguments=( + 'box:Box commands' + 'destroy:Destroys the vagrant environment' + 'halt:Halts the currently running vagrant environment' + 'help:[TASK] Describe available tasks or one specific task' + 'init:[box_name] [box_url] Initializes current folder for Vagrant usage' + 'package:Packages a vagrant environment for distribution' + 'provision:Run the provisioner' + 'reload:Reload the vagrant environment' + 'resume:Resumes a suspend vagrant environment' + 'ssh:SSH into the currently running environment' + 'ssh_config:outputs .ssh/config valid syntax for connecting to this environment via ssh.' + 'status:Shows the status of the current Vagrant environment.' + 'suspend:Suspends the currently running vagrant environment' + 'up:Creates the vagrant environment' + 'version:Prints the Vagrant version information' +) + +local -a _box_arguments +_box_arguments=( + 'add:NAME URI Add a box to the system' + 'help:COMMAND Describe subcommands or one specific subcommand' + 'list:Lists all installed boxes' + 'remove:NAME Remove a box from the system' + 'repackage:NAME Repackage an installed box into a `.box` file.' +) __task_list () { @@ -36,43 +64,15 @@ __vagrant-box () (options) case $line[1] in (repackage|remove) - _arguments \ - -F'[Fetch from origin before performing finish]' \ - -r'[Rebase instead of merge]'\ - ':feature:__box_list' + _arguments ':feature:__box_list' ;; esac ;; esac } -local -a _1st_arguments -_1st_arguments=( - 'box:Box commands' - 'destroy:Destroys the vagrant environment' - 'halt:Halts the currently running vagrant environment' - 'help:[TASK] Describe available tasks or one specific task' - 'init:[box_name] [box_url] Initializes current folder for Vagrant usage' - 'package:Packages a vagrant environment for distribution' - 'provision:Run the provisioner' - 'reload:Reload the vagrant environment' - 'resume:Resumes a suspend vagrant environment' - 'ssh:SSH into the currently running environment' - 'ssh_config:outputs .ssh/config valid syntax for connecting to this environment via ssh.' - 'status:Shows the status of the current Vagrant environment.' - 'suspend:Suspends the currently running vagrant environment' - 'up:Creates the vagrant environment' - 'version:Prints the Vagrant version information' -) -local -a _box_arguments -_box_arguments=( - 'add:NAME URI Add a box to the system' - 'help:COMMAND Describe subcommands or one specific subcommand' - 'list:Lists all installed boxes' - 'remove:NAME Remove a box from the system' - 'repackage:NAME Repackage an installed box into a `.box` file.' -) + local expl local -a boxes installed_boxes @@ -84,7 +84,6 @@ _arguments -C \ ':command:->command' \ '*::options:->options' - case $state in (command) _describe -t commands "gem subcommand" _1st_arguments @@ -94,10 +93,7 @@ case $state in (options) case $line[1] in (help) - _arguments \ - -F'[Fetch from origin before performing finish]' \ - -r'[Rebase instead of merge]'\ - ':feature:__task_list' + _arguments ':feature:__task_list' ;; (box) From d794a5d67928aee15614dddac04053eb0dcb905d Mon Sep 17 00:00:00 2001 From: Claus Witt Date: Wed, 17 Nov 2010 11:17:03 +0100 Subject: [PATCH 272/614] Removed the echo statement - no need for that. --- plugins/phing/phing.plugin.zsh | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/phing/phing.plugin.zsh b/plugins/phing/phing.plugin.zsh index 80e334629..8f4adca08 100644 --- a/plugins/phing/phing.plugin.zsh +++ b/plugins/phing/phing.plugin.zsh @@ -10,7 +10,6 @@ _phing_does_target_list_need_generating () { _phing () { if [ -f build.xml ]; then if _phing_does_target_list_need_generating; then - echo "\nGenerating .phing_targets..." > /dev/stderr phing -l |grep -v ":" |grep -v "^$"|grep -v "\-" > .phing_targets fi compadd `cat .phing_targets` From c53ab8ee011a6c8483796aaa202d43478b3f65b0 Mon Sep 17 00:00:00 2001 From: Julien Nicoulaud Date: Sat, 20 Nov 2010 18:06:23 +0100 Subject: [PATCH 273/614] Rename appearance.zsh so that it gets loaded after spectrum.zsh. Allows to use 256 colors in prompt themes. --- lib/{appearance.zsh => theme-and-appearance.zsh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename lib/{appearance.zsh => theme-and-appearance.zsh} (100%) diff --git a/lib/appearance.zsh b/lib/theme-and-appearance.zsh similarity index 100% rename from lib/appearance.zsh rename to lib/theme-and-appearance.zsh From 41cca0586154c3a1c00b4dfdcf04ddf5171c8d22 Mon Sep 17 00:00:00 2001 From: Julien Nicoulaud Date: Sat, 20 Nov 2010 18:07:45 +0100 Subject: [PATCH 274/614] Add my prompt theme --- themes/nicoulaj.zsh-theme | 43 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 themes/nicoulaj.zsh-theme diff --git a/themes/nicoulaj.zsh-theme b/themes/nicoulaj.zsh-theme new file mode 100644 index 000000000..edcdb158d --- /dev/null +++ b/themes/nicoulaj.zsh-theme @@ -0,0 +1,43 @@ +#!/usr/bin/env zsh +# ------------------------------------------------------------------------------ +# Prompt for the Zsh shell: +# * One line. +# * VCS info on the right prompt. +# * Only shows the path on the left prompt by default. +# * Crops the path to a defined length and only shows the path relative to +# the current VCS repository root. +# * Wears a different color wether the last command succeeded/failed. +# * Shows user@hostname if connected through SSH. +# * Shows if logged in as root or not. +# ------------------------------------------------------------------------------ + +# Customizable parameters. +PROMPT_PATH_MAX_LENGTH=30 +PROMPT_DEFAULT_END=❯ +PROMPT_ROOT_END=❯❯❯ +PROMPT_SUCCESS_COLOR=$FG[071] +PROMPT_FAILURE_COLOR=$FG[124] +PROMPT_VCS_INFO_COLOR=$FG[242] + +# Set required options. +setopt promptsubst + +# Load required modules. +autoload -U add-zsh-hook +autoload -Uz vcs_info + +# Add hook for calling vcs_info before each command. +add-zsh-hook precmd vcs_info + +# Set vcs_info parameters. +zstyle ':vcs_info:*' enable hg bzr git +zstyle ':vcs_info:*:*' check-for-changes true # Can be slow on big repos. +zstyle ':vcs_info:*:*' unstagedstr '!' +zstyle ':vcs_info:*:*' stagedstr '+' +zstyle ':vcs_info:*:*' actionformats "%S" "%r/%s/%b %u%c (%a)" +zstyle ':vcs_info:*:*' formats "%S" "%r/%s/%b %u%c" +zstyle ':vcs_info:*:*' nvcsformats "%$PROMPT_PATH_MAX_LENGTH<..<%~%<<" "" + +# Define prompts. +PROMPT="%(0?.%{$PROMPT_SUCCESS_COLOR%}.%{$PROMPT_FAILURE_COLOR%})${SSH_TTY:+[%n@%m]}%{$FX[bold]%}%$PROMPT_PATH_MAX_LENGTH<..<"'${vcs_info_msg_0_%%.}'"%<<%(!.$PROMPT_ROOT_END.$PROMPT_DEFAULT_END)%{$FX[no-bold]%}%{$FX[reset]%} " +RPROMPT="%{$PROMPT_VCS_INFO_COLOR%}"'$vcs_info_msg_1_'"%{$FX[reset]%}" From fc03db4e65d7bbfe5d0d7c23f586dd435025c23c Mon Sep 17 00:00:00 2001 From: Julien Nicoulaud Date: Sat, 20 Nov 2010 20:12:19 +0100 Subject: [PATCH 275/614] Avoid duplicate path cropping --- themes/nicoulaj.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/nicoulaj.zsh-theme b/themes/nicoulaj.zsh-theme index edcdb158d..333aa5e70 100644 --- a/themes/nicoulaj.zsh-theme +++ b/themes/nicoulaj.zsh-theme @@ -36,7 +36,7 @@ zstyle ':vcs_info:*:*' unstagedstr '!' zstyle ':vcs_info:*:*' stagedstr '+' zstyle ':vcs_info:*:*' actionformats "%S" "%r/%s/%b %u%c (%a)" zstyle ':vcs_info:*:*' formats "%S" "%r/%s/%b %u%c" -zstyle ':vcs_info:*:*' nvcsformats "%$PROMPT_PATH_MAX_LENGTH<..<%~%<<" "" +zstyle ':vcs_info:*:*' nvcsformats "%~" "" # Define prompts. PROMPT="%(0?.%{$PROMPT_SUCCESS_COLOR%}.%{$PROMPT_FAILURE_COLOR%})${SSH_TTY:+[%n@%m]}%{$FX[bold]%}%$PROMPT_PATH_MAX_LENGTH<..<"'${vcs_info_msg_0_%%.}'"%<<%(!.$PROMPT_ROOT_END.$PROMPT_DEFAULT_END)%{$FX[no-bold]%}%{$FX[reset]%} " From da99b9b739d4b5fa0aac854d3ebb265105900874 Mon Sep 17 00:00:00 2001 From: Murilo Soares Pereira Date: Tue, 23 Nov 2010 02:05:33 -0200 Subject: [PATCH 276/614] Added my theme. --- themes/murilo.zsh-theme | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 themes/murilo.zsh-theme diff --git a/themes/murilo.zsh-theme b/themes/murilo.zsh-theme new file mode 100644 index 000000000..310357b45 --- /dev/null +++ b/themes/murilo.zsh-theme @@ -0,0 +1,14 @@ +local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" +local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}' +local current_dir='%{$terminfo[bold]$fg[blue]%}%~%{$reset_color%}' +local rvm_ruby='%{$fg[red]%}$(rvm_prompt_info)%{$reset_color%}' +local git_branch='%{$fg[blue]%}$(git_prompt_info)%{$reset_color%}' + +PROMPT="${user_host}:${current_dir} ${rvm_ruby} +${git_branch} %B$%b " +RPS1="${return_code}" + +ZSH_THEME_GIT_PROMPT_PREFIX="" +ZSH_THEME_GIT_PROMPT_SUFFIX="" +ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}✗%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN=" %{$fg[green]%}✔%{$reset_color%}" From 14fb86dd2415d9e4c72da4755ab00835e2c38409 Mon Sep 17 00:00:00 2001 From: Murilo Soares Pereira Date: Wed, 24 Nov 2010 02:22:55 -0200 Subject: [PATCH 277/614] Renamed theme. --- themes/{murilo.zsh-theme => murilasso.zsh-theme} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename themes/{murilo.zsh-theme => murilasso.zsh-theme} (100%) diff --git a/themes/murilo.zsh-theme b/themes/murilasso.zsh-theme similarity index 100% rename from themes/murilo.zsh-theme rename to themes/murilasso.zsh-theme From 2dec362881a4ba7fa83b61cb652f3d10110ebbc8 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Wed, 24 Nov 2010 18:03:14 +0100 Subject: [PATCH 278/614] add dieter theme v1 --- themes/dieter.zsh-theme | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 themes/dieter.zsh-theme diff --git a/themes/dieter.zsh-theme b/themes/dieter.zsh-theme new file mode 100644 index 000000000..5b61c80ce --- /dev/null +++ b/themes/dieter.zsh-theme @@ -0,0 +1,33 @@ +# the idea of this theme is to contain a lot of info in a small string, by compressing some parts, +# and colorcoding, which bring useful visual cues. While limiting the amount of colors and such to keep +# it easy on the eyes +# exact return code (when >0) is on the right, so it stays out of the way + +# TODO: reset exit code visual cues (not exit code itself) after showing once +# TODO: compress hostname in window title + +typeset -A host_repr +host_repr=('dieter-ws-a7n8x-arch' "%{$fg_bold[green]%}ws" 'dieter-p4sci-arch' "%{$fg_bold[blue]%}p4") + + +# local time, color coded after last return code +local time="%(?.%{$fg[green]%}.%{$fg[red]%})%*%{$reset_color%}" +# user part, color coded after privileges +local user="%(!.%{$fg[blue]%}.%{$fg[blue]%})%n%{$reset_color%}" +# Hostname part. compressed and colorcoded per host_repr array +# if not found, regular hostname in default color +local host="@${host_repr[$(hostname)]:-$(hostname)}%{$reset_color%}" +# Compacted $PWD +local pwd="%{$fg[blue]%}%c%{$reset_color%}" + +PROMPT='${time} ${user}${host} ${pwd} $(git_prompt_info)' + +# i would prefer 1 icon that shows the "most drastic" deviation from head, but lets see how this works out +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%} %{$fg[yellow]%}?%{$fg[green]%}%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%}" + +# elaborate exitcode on the right when >0 +local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" +RPS1="${return_code}" From 5a40696650a4233dabcc786f989e7b78903c1466 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Wed, 24 Nov 2010 19:58:03 +0100 Subject: [PATCH 279/614] reset exit code visual cues (not exit code itself) after showing once --- themes/dieter.zsh-theme | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/themes/dieter.zsh-theme b/themes/dieter.zsh-theme index 5b61c80ce..a14829fc0 100644 --- a/themes/dieter.zsh-theme +++ b/themes/dieter.zsh-theme @@ -2,21 +2,25 @@ # and colorcoding, which bring useful visual cues. While limiting the amount of colors and such to keep # it easy on the eyes # exact return code (when >0) is on the right, so it stays out of the way - -# TODO: reset exit code visual cues (not exit code itself) after showing once -# TODO: compress hostname in window title +# The visual cues for >0 exit codes will only display once +# (i.e. they will be reset, even if you hit enter a few times on empty command prompts) typeset -A host_repr host_repr=('dieter-ws-a7n8x-arch' "%{$fg_bold[green]%}ws" 'dieter-p4sci-arch' "%{$fg_bold[blue]%}p4") # local time, color coded after last return code -local time="%(?.%{$fg[green]%}.%{$fg[red]%})%*%{$reset_color%}" +time_enabled="%(?.%{$fg[green]%}.%{$fg[red]%})%*%{$reset_color%}" +time_disabled="%{$fg[green]%}%*%{$reset_color%}" +time=$time_enabled + # user part, color coded after privileges local user="%(!.%{$fg[blue]%}.%{$fg[blue]%})%n%{$reset_color%}" + # Hostname part. compressed and colorcoded per host_repr array # if not found, regular hostname in default color local host="@${host_repr[$(hostname)]:-$(hostname)}%{$reset_color%}" + # Compacted $PWD local pwd="%{$fg[blue]%}%c%{$reset_color%}" @@ -29,5 +33,21 @@ ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%} %{$fg[yellow]%}?%{$fg[green]%}%{$rese ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%}" # elaborate exitcode on the right when >0 -local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" -RPS1="${return_code}" +return_code_enabled="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" +return_code_disabled= +return_code=$return_code_enabled + +RPS1='${return_code}' + +function accept-line-or-clear-warning () { + if [[ -z $BUFFER ]]; then + time=$time_disabled + return_code=$return_code_disabled + else + time=$time_enabled + return_code=$return_code_enabled + fi + zle accept-line +} +zle -N accept-line-or-clear-warning +bindkey '^M' accept-line-or-clear-warning From af4784e627dd64bafef5f72d2a6eca41c1702cd4 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Wed, 24 Nov 2010 20:04:40 +0100 Subject: [PATCH 280/614] better phrasing/documentation --- themes/dieter.zsh-theme | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/themes/dieter.zsh-theme b/themes/dieter.zsh-theme index a14829fc0..0a5e9265b 100644 --- a/themes/dieter.zsh-theme +++ b/themes/dieter.zsh-theme @@ -1,20 +1,22 @@ -# the idea of this theme is to contain a lot of info in a small string, by compressing some parts, -# and colorcoding, which bring useful visual cues. While limiting the amount of colors and such to keep -# it easy on the eyes -# exact return code (when >0) is on the right, so it stays out of the way -# The visual cues for >0 exit codes will only display once +# the idea of this theme is to contain a lot of info in a small string, by +# compressing some parts and colorcoding, which bring useful visual cues, +# while limiting the amount of colors and such to keep it easy on the eyes. +# When a command exited >0, the timestamp will be in red and the exit code +# will be on the right edge. +# The exit code visual cues will only display once. # (i.e. they will be reset, even if you hit enter a few times on empty command prompts) typeset -A host_repr + +# translate hostnames into shortened, colorcoded strings host_repr=('dieter-ws-a7n8x-arch' "%{$fg_bold[green]%}ws" 'dieter-p4sci-arch' "%{$fg_bold[blue]%}p4") - -# local time, color coded after last return code +# local time, color coded by last return code time_enabled="%(?.%{$fg[green]%}.%{$fg[red]%})%*%{$reset_color%}" time_disabled="%{$fg[green]%}%*%{$reset_color%}" time=$time_enabled -# user part, color coded after privileges +# user part, color coded by privileges local user="%(!.%{$fg[blue]%}.%{$fg[blue]%})%n%{$reset_color%}" # Hostname part. compressed and colorcoded per host_repr array @@ -26,7 +28,8 @@ local pwd="%{$fg[blue]%}%c%{$reset_color%}" PROMPT='${time} ${user}${host} ${pwd} $(git_prompt_info)' -# i would prefer 1 icon that shows the "most drastic" deviation from head, but lets see how this works out +# i would prefer 1 icon that shows the "most drastic" deviation from HEAD, +# but lets see how this works out ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%} %{$fg[yellow]%}?%{$fg[green]%}%{$reset_color%}" From ea7bc1362cf5ffbe0bae0a71e72f3dd61779a4e0 Mon Sep 17 00:00:00 2001 From: Claus Witt Date: Thu, 25 Nov 2010 21:48:07 +0100 Subject: [PATCH 281/614] Added ant plugin --- plugins/ant/ant.plugin.zsh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 plugins/ant/ant.plugin.zsh diff --git a/plugins/ant/ant.plugin.zsh b/plugins/ant/ant.plugin.zsh new file mode 100644 index 000000000..0544ac92c --- /dev/null +++ b/plugins/ant/ant.plugin.zsh @@ -0,0 +1,19 @@ +_ant_does_target_list_need_generating () { + if [ ! -f .ant_targets ]; then return 0; + else + accurate=$(stat -f%m .ant_targets) + changed=$(stat -f%m build.xml) + return $(expr $accurate '>=' $changed) + fi +} + +_ant () { + if [ -f build.xml ]; then + if _ant_does_target_list_need_generating; then + sed -n '/ .ant_targets + fi + compadd `cat .ant_targets` + fi +} + +compdef _ant ant From 5b5f503040e3608941483489ae24350bcf728735 Mon Sep 17 00:00:00 2001 From: Igor Vinokurov Date: Thu, 2 Dec 2010 03:49:13 +0300 Subject: [PATCH 282/614] gentoo-like theme w/ git_prompt_info --- themes/gentoo.zsh-theme | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 themes/gentoo.zsh-theme diff --git a/themes/gentoo.zsh-theme b/themes/gentoo.zsh-theme new file mode 100644 index 000000000..cba143d42 --- /dev/null +++ b/themes/gentoo.zsh-theme @@ -0,0 +1,4 @@ +PROMPT='%(!.%{$fg_bold[red]%}.%{$fg_bold[green]%}%n@)%m %{$fg_bold[blue]%}%(!.%1~.%~) $(git_prompt_info)%#%{$reset_color%} ' + +ZSH_THEME_GIT_PROMPT_PREFIX="(" +ZSH_THEME_GIT_PROMPT_SUFFIX=") " From 77035debe7bfafd125fa6e9503f720991b531e41 Mon Sep 17 00:00:00 2001 From: Daniel Karlsson Date: Fri, 3 Dec 2010 15:51:34 +0100 Subject: [PATCH 283/614] Added new kardan theme. --- themes/kardan.zsh-theme | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 themes/kardan.zsh-theme diff --git a/themes/kardan.zsh-theme b/themes/kardan.zsh-theme new file mode 100644 index 000000000..f2b036fde --- /dev/null +++ b/themes/kardan.zsh-theme @@ -0,0 +1,12 @@ +# Comment + +function get_host { + echo '@'`hostname`'' +} + +RPROMPT='%~$(git_prompt_info)$(get_host)' +export PS1='> ' + +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}✗%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_PREFIX="(" +ZSH_THEME_GIT_PROMPT_SUFFIX=")" \ No newline at end of file From 2b5d7e75f138132bfd9bf90131b9e40d71d2a537 Mon Sep 17 00:00:00 2001 From: Daniel Karlsson Date: Fri, 3 Dec 2010 15:58:18 +0100 Subject: [PATCH 284/614] Updated the PROMT. --- themes/kardan.zsh-theme | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/themes/kardan.zsh-theme b/themes/kardan.zsh-theme index f2b036fde..fd6586a9d 100644 --- a/themes/kardan.zsh-theme +++ b/themes/kardan.zsh-theme @@ -1,11 +1,11 @@ -# Comment +# Simple theme based on my old zsh settings. function get_host { echo '@'`hostname`'' } -RPROMPT='%~$(git_prompt_info)$(get_host)' -export PS1='> ' +PROMPT='> ' +RPROMPT='%~$(git_prompt_info)$(get_host)' ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}✗%{$reset_color%}" ZSH_THEME_GIT_PROMPT_PREFIX="(" From 8712dc2894315c31587c8a5df7ad679b23e9248c Mon Sep 17 00:00:00 2001 From: Jake Bell Date: Sun, 19 Dec 2010 21:08:21 -0600 Subject: [PATCH 285/614] Updating theunraveler theme to include more detailed git info. --- themes/theunraveler.zsh-theme | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/themes/theunraveler.zsh-theme b/themes/theunraveler.zsh-theme index 4eec8e827..e4bfb79c5 100644 --- a/themes/theunraveler.zsh-theme +++ b/themes/theunraveler.zsh-theme @@ -1,6 +1,16 @@ -# Comment +# Comment -ZSH_THEME_GIT_PROMPT_PREFIX=' (git:' -ZSH_THEME_GIT_PROMPT_SUFFIX=')' +PROMPT='%{$fg[magenta]%}[%c] %{$reset_color%}' -PROMPT='%{$fg[magenta]%}[%c]$(git_prompt_info) $ %{$reset_color%}' \ No newline at end of file +RPROMPT='%{$fg[magenta]%}$(git_prompt_info)%{$reset_color%} $(git_prompt_status)%{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX="" +ZSH_THEME_GIT_PROMPT_SUFFIX="" +ZSH_THEME_GIT_PROMPT_DIRTY="" +ZSH_THEME_GIT_PROMPT_CLEAN="" +ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[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]%} ✱" \ No newline at end of file From 137534788bbed3b4c78978829be44e41e3b8348a Mon Sep 17 00:00:00 2001 From: Hakan Ensari Date: Mon, 20 Dec 2010 11:13:46 -0300 Subject: [PATCH 286/614] Fixed typo --- plugins/gem/gem.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/gem/gem.plugin.zsh b/plugins/gem/gem.plugin.zsh index 65d3766f3..d4e5c6584 100644 --- a/plugins/gem/gem.plugin.zsh +++ b/plugins/gem/gem.plugin.zsh @@ -1,4 +1,4 @@ -# add brew completion function to path +# add gem completion function to path fpath=($ZSH/plugins/gem $fpath) autoload -U compinit compinit -i From f89eb829876c0e6e097982caad3ccfe56f2d94fb Mon Sep 17 00:00:00 2001 From: Hakan Ensari Date: Mon, 20 Dec 2010 12:13:47 -0300 Subject: [PATCH 287/614] Aliased git checkout as `gco` --- 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 d317d179d..09b1f16cc 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -8,6 +8,7 @@ alias gd='git diff | mate' alias gdv='git diff -w "$@" | vim -R -' alias gc='git commit -v' alias gca='git commit -v -a' +alias gco='git checkout' alias gb='git branch' alias gba='git branch -a' alias gcount='git shortlog -sn' From 7eeb7d5ea7460a19ccefa7c892f7e40f820791a6 Mon Sep 17 00:00:00 2001 From: Hakan Ensari Date: Mon, 20 Dec 2010 12:19:59 -0300 Subject: [PATCH 288/614] A rails3 plugin based on the rails plugin --- plugins/rails3/rails3.plugin.zsh | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 plugins/rails3/rails3.plugin.zsh diff --git a/plugins/rails3/rails3.plugin.zsh b/plugins/rails3/rails3.plugin.zsh new file mode 100644 index 000000000..5c1930af3 --- /dev/null +++ b/plugins/rails3/rails3.plugin.zsh @@ -0,0 +1,12 @@ +alias rs='ruby script/rails server' +alias rg='ruby script/rails generate' +alias rd='ruby script/rails destroy' +alias rp='ruby script/rails plugin' +alias rdbm='rake db:migrate db:test:clone' +alias rc='ruby script/rails console' +alias rd='ruby script/rais server --debugger' +alias devlog='tail -f log/development.log' + +function remote_console() { + /usr/bin/env ssh $1 "( cd $2 && ruby script/rails console production )" +} From 14628eef371a79df478973731ce49fc3eb45de36 Mon Sep 17 00:00:00 2001 From: Hakan Ensari Date: Mon, 20 Dec 2010 12:50:55 -0300 Subject: [PATCH 289/614] Removed remote_console. It doesn't handle rvm, capistrano, and so on. --- plugins/rails3/rails3.plugin.zsh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/plugins/rails3/rails3.plugin.zsh b/plugins/rails3/rails3.plugin.zsh index 5c1930af3..20ba0408c 100644 --- a/plugins/rails3/rails3.plugin.zsh +++ b/plugins/rails3/rails3.plugin.zsh @@ -6,7 +6,3 @@ alias rdbm='rake db:migrate db:test:clone' alias rc='ruby script/rails console' alias rd='ruby script/rais server --debugger' alias devlog='tail -f log/development.log' - -function remote_console() { - /usr/bin/env ssh $1 "( cd $2 && ruby script/rails console production )" -} From 088fae93f20ba78ce172b564bf1a1759875afa8c Mon Sep 17 00:00:00 2001 From: Hakan Ensari Date: Mon, 20 Dec 2010 12:57:23 -0300 Subject: [PATCH 290/614] Typo --- plugins/git/git.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 09b1f16cc..71a62819b 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -27,7 +27,7 @@ function current_branch() { echo ${ref#refs/heads/} } -# these aliases take advangate of the previous function +# these aliases take advantage of the previous function alias ggpull='git pull origin $(current_branch)' alias ggpush='git push origin $(current_branch)' -alias ggpnp='git pull origin $(current_branch) && git push origin $(current_branch)' \ No newline at end of file +alias ggpnp='git pull origin $(current_branch) && git push origin $(current_branch)' From 5f0afcdd3cd8870954087c7c05dd40ae5ed0ef4e Mon Sep 17 00:00:00 2001 From: Derek Prior Date: Tue, 21 Dec 2010 14:28:40 -0500 Subject: [PATCH 291/614] Added function to mkdir and immediately change to it --- lib/directories.zsh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/directories.zsh b/lib/directories.zsh index 56d7a2316..bb114f615 100644 --- a/lib/directories.zsh +++ b/lib/directories.zsh @@ -36,5 +36,9 @@ cd () { alias md='mkdir -p' alias rd=rmdir +alias d='dirs -v' -alias d='dirs -v' \ No newline at end of file +# mkdir & cd to it +function mcd() { + mkdir -p "$1" && cd "$1"; +} \ No newline at end of file From cd35d86fffc44f998fb2a3c9ba28ab1a2b21a99e Mon Sep 17 00:00:00 2001 From: SuprDewd Date: Fri, 24 Dec 2010 22:20:57 +0000 Subject: [PATCH 292/614] Added a function to extract various archives. Also an alias for the function. --- lib/aliases.zsh | 2 ++ lib/functions.zsh | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/lib/aliases.zsh b/lib/aliases.zsh index d2d3aed81..b47de5bde 100644 --- a/lib/aliases.zsh +++ b/lib/aliases.zsh @@ -21,3 +21,5 @@ alias ll='ls -l' alias sl=ls # often screw this up alias afind='ack-grep -il' + +alias x=extract diff --git a/lib/functions.zsh b/lib/functions.zsh index e3c0de43e..99b75409c 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -37,3 +37,24 @@ function take() { mkdir -p $1 cd $1 } + +function extract() { + if [[ -f $1 ]]; then + case $1 in + *.tar.bz2) tar xvjf $1;; + *.tar.gz) tar xvzf $1;; + *.bz2) bunzip $1;; + *.rar) unrar $1;; + *.gz) gunzip $1;; + *.tar) tar xvf $1;; + *.tbz2) tar xvjf $1;; + *.tgz) tar xvzf $1;; + *.zip) unzip $1;; + *.Z) uncompress $1;; + *.7z) 7z x $1;; + *) echo "'$1' cannot be extracted via >extract<";; + esac + else + echo "'$1' is not a valid file" + fi +} From ea5c866c7ee85a14d1c92670a9a79def998c3266 Mon Sep 17 00:00:00 2001 From: SuprDewd Date: Sat, 25 Dec 2010 13:28:16 +0000 Subject: [PATCH 293/614] Support for more archive formats. --- lib/functions.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/functions.zsh b/lib/functions.zsh index 99b75409c..4246f8811 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -43,6 +43,8 @@ function extract() { case $1 in *.tar.bz2) tar xvjf $1;; *.tar.gz) tar xvzf $1;; + *.tar.xz) tar xvJf $1;; + *.tar.lzma) tar --lzma -xvf $1;; *.bz2) bunzip $1;; *.rar) unrar $1;; *.gz) gunzip $1;; From 6f0001c579dbd464e31902bb44b05f69facdaefd Mon Sep 17 00:00:00 2001 From: "Suraj N. Kurapati" Date: Tue, 28 Dec 2010 20:36:29 -0800 Subject: [PATCH 294/614] add "fishy" theme to emulate Fish shell's prompt --- themes/fishy.zsh-theme | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 themes/fishy.zsh-theme diff --git a/themes/fishy.zsh-theme b/themes/fishy.zsh-theme new file mode 100644 index 000000000..f22eda868 --- /dev/null +++ b/themes/fishy.zsh-theme @@ -0,0 +1,9 @@ +# ZSH Theme emulating the Fish shell's default prompt. + +local user_color='green'; [ $UID -eq 0 ] && user_color='red' +PROMPT='%n@%m %{$fg[$user_color]%}%~%{$reset_color%}%(!.#.>) ' +PROMPT2='%{$fg[red]%}\ %{$reset_color%}' +RPS1='%(?..%{$fg[red]%}%? ↵%{$reset_color%})$(git_prompt_info)' + +ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[cyan]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" From c56082c6905836e5436c036562249cfabe6cf0f0 Mon Sep 17 00:00:00 2001 From: "Suraj N. Kurapati" Date: Sat, 8 Jan 2011 18:15:57 -0800 Subject: [PATCH 295/614] avoid forking subshell to test if user is root --- themes/afowler.zsh-theme | 2 +- themes/arrow.zsh-theme | 2 +- themes/clean.zsh-theme | 2 +- themes/dst.zsh-theme | 2 +- themes/jreese.zsh-theme | 2 +- themes/philips.zsh-theme | 2 +- themes/pmcgee.zsh-theme | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/themes/afowler.zsh-theme b/themes/afowler.zsh-theme index b5a9bb173..3a4753fc1 100644 --- a/themes/afowler.zsh-theme +++ b/themes/afowler.zsh-theme @@ -1,4 +1,4 @@ -if [ "$(whoami)" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="blue"; fi +if [ $UID -eq 0 ]; then CARETCOLOR="red"; else CARETCOLOR="blue"; fi local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" diff --git a/themes/arrow.zsh-theme b/themes/arrow.zsh-theme index a23efd1d7..d62dcdcb9 100644 --- a/themes/arrow.zsh-theme +++ b/themes/arrow.zsh-theme @@ -1,4 +1,4 @@ -if [ "$(whoami)" = "root" ]; then NCOLOR="red"; else NCOLOR="yellow"; fi +if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="yellow"; fi PROMPT='%{$fg[$NCOLOR]%}%c ➤ %{$reset_color%}' RPROMPT='%{$fg[$NCOLOR]%}%p $(git_prompt_info)%{$reset_color%}' diff --git a/themes/clean.zsh-theme b/themes/clean.zsh-theme index 95f532a82..7ee29cb8c 100644 --- a/themes/clean.zsh-theme +++ b/themes/clean.zsh-theme @@ -1,4 +1,4 @@ -if [ "$(whoami)" = "root" ]; then NCOLOR="red"; else NCOLOR="white"; fi +if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="white"; fi PROMPT='%{$fg[$NCOLOR]%}%B%n%b%{$reset_color%}:%{$fg[blue]%}%B%c/%b%{$reset_color%} $(git_prompt_info)%(!.#.$) ' RPROMPT='[%*]' diff --git a/themes/dst.zsh-theme b/themes/dst.zsh-theme index fa0d9cb06..3e2539d57 100644 --- a/themes/dst.zsh-theme +++ b/themes/dst.zsh-theme @@ -5,7 +5,7 @@ ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}!" ZSH_THEME_GIT_PROMPT_CLEAN="" function prompt_char { - if [ "$(whoami)" = "root" ]; then echo "%{$fg[red]%}#%{$reset_color%}"; else echo $; fi + if [ $UID -eq 0 ]; then echo "%{$fg[red]%}#%{$reset_color%}"; else echo $; fi } PROMPT='%(?, ,%{$fg[red]%}FAIL%{$reset_color%} diff --git a/themes/jreese.zsh-theme b/themes/jreese.zsh-theme index 534664f11..0fa6b4ecd 100644 --- a/themes/jreese.zsh-theme +++ b/themes/jreese.zsh-theme @@ -1,6 +1,6 @@ # ZSH Theme - Preview: http://dl.dropbox.com/u/1552408/Screenshots/2010-04-08-oh-my-zsh.png -if [ "$(whoami)" = "root" ]; then NCOLOR="red"; else NCOLOR="green"; fi +if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="green"; fi local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" PROMPT='%{$fg[$NCOLOR]%}%n%{$fg[green]%}@%m%{$reset_color%} %~ \ diff --git a/themes/philips.zsh-theme b/themes/philips.zsh-theme index fa7c59035..e7ea51a2f 100644 --- a/themes/philips.zsh-theme +++ b/themes/philips.zsh-theme @@ -1,4 +1,4 @@ -if [ "$(whoami)" = "root" ]; then NCOLOR="red"; else NCOLOR="green"; fi +if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="green"; fi PROMPT='%{$fg[$NCOLOR]%}%B%n%b%{$reset_color%}:%{$fg[blue]%}%B%c/%b%{$reset_color%} $(git_prompt_info)%(!.#.$) ' RPROMPT='[%*]' diff --git a/themes/pmcgee.zsh-theme b/themes/pmcgee.zsh-theme index 4eb54df5b..e4e45c71a 100644 --- a/themes/pmcgee.zsh-theme +++ b/themes/pmcgee.zsh-theme @@ -1,4 +1,4 @@ -if [ "$(whoami)" = "root" ]; then NCOLOR="red"; else NCOLOR="green"; fi +if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="green"; fi PROMPT=' %{$fg[$NCOLOR]%}%B%n@%m%b%{$reset_color%} %{$fg[white]%}%B${PWD/#$HOME/~}%b%{$reset_color%} From 15eadb9e4daf1aabdfdc1c0b3570a0333d2e83e4 Mon Sep 17 00:00:00 2001 From: Michael Komitee Date: Sat, 8 Jan 2011 23:34:47 -0500 Subject: [PATCH 296/614] Postponing sourcing of the theme until after local customizations --- lib/appearance.zsh | 2 -- oh-my-zsh.sh | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/appearance.zsh b/lib/appearance.zsh index ffee52b5e..aec67721a 100644 --- a/lib/appearance.zsh +++ b/lib/appearance.zsh @@ -34,5 +34,3 @@ ZSH_THEME_GIT_PROMPT_CLEAN="" # Text to display if the branch is c # Setup the prompt with pretty colors setopt prompt_subst -# Load the theme -source "$ZSH/themes/$ZSH_THEME.zsh-theme" \ No newline at end of file diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 848e48eb5..291772dfe 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -14,6 +14,9 @@ for config_file ($ZSH/custom/*.zsh) source $config_file plugin=${plugin:=()} for plugin ($plugins) source $ZSH/plugins/$plugin/$plugin.plugin.zsh +# Load the theme +source "$ZSH/themes/$ZSH_THEME.zsh-theme" + # Check for updates on initial load... if [ "$DISABLE_AUTO_UPDATE" = "true" ] then From 515a86ef799a3588116bbd80223fe3e411901c94 Mon Sep 17 00:00:00 2001 From: Danny Tatom Date: Sat, 8 Jan 2011 21:07:03 -0800 Subject: [PATCH 297/614] Added lambda theme --- themes/lambda.zsh-theme | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 themes/lambda.zsh-theme diff --git a/themes/lambda.zsh-theme b/themes/lambda.zsh-theme new file mode 100644 index 000000000..63292d331 --- /dev/null +++ b/themes/lambda.zsh-theme @@ -0,0 +1,6 @@ +# ZSH Theme - Preview: http://cl.ly/350F0F0k1M2y3A2i3p1S + +PROMPT='λ %~/ $(git_prompt_info)%{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " From 74b066485619736ed7e0e04fff6778492913d073 Mon Sep 17 00:00:00 2001 From: Francesco Lazzarino Date: Mon, 10 Jan 2011 10:16:04 -0500 Subject: [PATCH 298/614] theme based on afowler with vi-mode support --- themes/flazz.zsh-theme | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 themes/flazz.zsh-theme diff --git a/themes/flazz.zsh-theme b/themes/flazz.zsh-theme new file mode 100644 index 000000000..280794f2b --- /dev/null +++ b/themes/flazz.zsh-theme @@ -0,0 +1,19 @@ +if [ "$(whoami)" = "root" ] +then CARETCOLOR="red" +else CARETCOLOR="blue" +fi + +local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" + +PROMPT='%m%{${fg_bold[magenta]}%} :: %{$reset_color%}%{${fg[green]}%}%3~ $(git_prompt_info)%{${fg_bold[$CARETCOLOR]}%}%#%{${reset_color}%} ' + +RPS1='$(vi_mode_prompt_info) ${return_code}' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[cyan]%}‹" +ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}" + +MODE_INDICATOR="%{$fg_bold[magenta]%}<%{$reset_color%}%{$fg[magenta]%}<<%{$reset_color%}" + +# TODO use 265 colors +#MODE_INDICATOR="$FX[bold]$FG[020]<$FX[no_bold]%{$fg[blue]%}<<%{$reset_color%}" +# TODO use two lines if git From 0608baceb56e2c5c83e5aa849b5830bab57b6869 Mon Sep 17 00:00:00 2001 From: Robin Ramael Date: Mon, 10 Jan 2011 17:01:11 +0100 Subject: [PATCH 299/614] Made git ignore everything in custom, not only the .zsh files. --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index f84db6dc2..8d19d100c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ locals.zsh log/.zsh_history projects.zsh -custom/*.zsh +custom/* !custom/example.zsh \ No newline at end of file From 33bb6e797e27ca6e253057513e79f11524626006 Mon Sep 17 00:00:00 2001 From: Robin Ramael Date: Mon, 10 Jan 2011 17:34:38 +0100 Subject: [PATCH 300/614] Added an option to remove file afterwards. --- lib/functions.zsh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/functions.zsh b/lib/functions.zsh index 4246f8811..914f2ef25 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -39,6 +39,12 @@ function take() { } function extract() { + unset REMOVE_ARCHIVE + + if test "$1" = "-r"; then + REMOVE=1 + shift + fi if [[ -f $1 ]]; then case $1 in *.tar.bz2) tar xvjf $1;; @@ -56,7 +62,14 @@ function extract() { *.7z) 7z x $1;; *) echo "'$1' cannot be extracted via >extract<";; esac + + if [[ $REMOVE_ARCHIVE -eq 1 ]]; then + echo removing "$1"; + /bin/rm "$1"; + fi + else echo "'$1' is not a valid file" fi } + From a42aea147dc2b32a9992cae4f3c9d4decf2d33d8 Mon Sep 17 00:00:00 2001 From: Robin Ramael Date: Mon, 10 Jan 2011 18:18:31 +0100 Subject: [PATCH 301/614] Added svn info in prompt with plugin. If the svn plugin is used, svn info (repo name and wether the repo is dirty) is displayed in the prompt like with git. Just lke with git, the colors can be manipulated with variables (see awesomepanda theme for example). --- plugins/svn/svn.plugin.zsh | 42 +++++++++++++++++++++++++++++++++++ themes/awesomepanda.zsh-theme | 18 +++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 plugins/svn/svn.plugin.zsh create mode 100644 themes/awesomepanda.zsh-theme diff --git a/plugins/svn/svn.plugin.zsh b/plugins/svn/svn.plugin.zsh new file mode 100644 index 000000000..45d461306 --- /dev/null +++ b/plugins/svn/svn.plugin.zsh @@ -0,0 +1,42 @@ +function svn_prompt_info { + if [[ -d .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 +} + + +function in_svn() { + if [[ -d .svn ]]; then + echo 1 + fi +} + +function svn_get_repo_name { + if [ is_svn ]; then + svn info | sed -n 's/Repository\ Root:\ .*\///p' | read SVN_ROOT + + svn info | sed -n "s/URL:\ .*$SVN_ROOT\///p" | sed "s/\/.*$//" + fi +} + +function svn_get_rev_nr { + if [ is_svn ]; then + svn info 2> /dev/null | sed -n s/Revision:\ //p + fi +} + +function svn_dirty_choose { + if [ is_svn ]; then + s=$(svn status 2>/dev/null) + if [ $s ]; then + echo $1 + else + echo $2 + fi + fi +} + +function svn_dirty { + svn_dirty_choose $ZSH_THEME_SVN_PROMPT_DIRTY $ZSH_THEME_SVN_PROMPT_CLEAN +} \ No newline at end of file diff --git a/themes/awesomepanda.zsh-theme b/themes/awesomepanda.zsh-theme new file mode 100644 index 000000000..411b89837 --- /dev/null +++ b/themes/awesomepanda.zsh-theme @@ -0,0 +1,18 @@ +# the svn plugin has to be activated for this to work. + +PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%}$(svn_prompt_info)%{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%})%{$fg[yellow]%} ✗ %{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%}) " + + + +ZSH_PROMPT_BASE_COLOR="%{$fg_bold[blue]%}" +ZSH_THEME_REPO_NAME_COLOR="%{$fg_bold[red]%}" + +ZSH_THEME_SVN_PROMPT_PREFIX="svn:(" +ZSH_THEME_SVN_PROMPT_SUFFIX=")" +ZSH_THEME_SVN_PROMPT_DIRTY="%{$fg[red]%} ✘ %{$reset_color%}" +ZSH_THEME_SVN_PROMPT_CLEAN=" " \ No newline at end of file From 572006a66b0003f64e2e208cdaa5f36725dcf2e8 Mon Sep 17 00:00:00 2001 From: Stephen Middleton Date: Thu, 13 Jan 2011 23:52:41 -0600 Subject: [PATCH 302/614] add Rixius-Theme --- themes/rixius.zsh-theme | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 themes/rixius.zsh-theme diff --git a/themes/rixius.zsh-theme b/themes/rixius.zsh-theme new file mode 100644 index 000000000..2a283ebca --- /dev/null +++ b/themes/rixius.zsh-theme @@ -0,0 +1,16 @@ +function collapse_pwd { + echo $(pwd | sed -e "s,^$HOME,~,") +} +function prompt_char { + git branch >/dev/null 2>/dev/null && echo "%{$fg[green]%}±%{$reset_color%}" && return + echo "%{$fg[red]%}≈%{$reset_color%}" +} + +PROMPT=' +%{$fg[magenta]%}%n%{$reset_color%} in %{$fg_bold[green]%}$(collapse_pwd)%{$reset_color%}$(git_prompt_info) +$(prompt_char) ' + +ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}!" +ZSH_THEME_GIT_PROMPT_CLEAN="" \ No newline at end of file From c511a9f8e83e8d6d7b64f1aa2df7565514b80e49 Mon Sep 17 00:00:00 2001 From: Stephen Middleton Date: Fri, 14 Jan 2011 00:05:06 -0600 Subject: [PATCH 303/614] changes to theme --- themes/rixius.zsh-theme | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/themes/rixius.zsh-theme b/themes/rixius.zsh-theme index 2a283ebca..322bdad24 100644 --- a/themes/rixius.zsh-theme +++ b/themes/rixius.zsh-theme @@ -6,11 +6,10 @@ function prompt_char { echo "%{$fg[red]%}≈%{$reset_color%}" } -PROMPT=' -%{$fg[magenta]%}%n%{$reset_color%} in %{$fg_bold[green]%}$(collapse_pwd)%{$reset_color%}$(git_prompt_info) +PROMPT='%{$fg[magenta]%}%n%{$reset_color%} in %{$fg_bold[green]%}$(collapse_pwd)%{$reset_color%}$(git_prompt_info) $(prompt_char) ' ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}!" -ZSH_THEME_GIT_PROMPT_CLEAN="" \ No newline at end of file +ZSH_THEME_GIT_PROMPT_DIRTY="%{$bg[white]%}%{$fg[red]%}!%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$bg[white]%}%{$fg[red]%}√%{$reset_color%}" \ No newline at end of file From b0e4a2ad37539c08de9d3d9f40fe4b22f28a5788 Mon Sep 17 00:00:00 2001 From: Stephen Middleton Date: Fri, 14 Jan 2011 01:26:31 -0600 Subject: [PATCH 304/614] theme changes --- themes/rixius.zsh-theme | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/themes/rixius.zsh-theme b/themes/rixius.zsh-theme index 322bdad24..8837d8840 100644 --- a/themes/rixius.zsh-theme +++ b/themes/rixius.zsh-theme @@ -2,14 +2,18 @@ function collapse_pwd { echo $(pwd | sed -e "s,^$HOME,~,") } function prompt_char { - git branch >/dev/null 2>/dev/null && echo "%{$fg[green]%}±%{$reset_color%}" && return - echo "%{$fg[red]%}≈%{$reset_color%}" + echo -n "%{$bg[white]%}%{$fg[red]%}" + git branch >/dev/null 2>/dev/null && echo "±%{$reset_color%}" && return + echo "≥%{$reset_color%}" } +RIXIUS_PRE="%{$bg[white]%}%{$fg[red]%}" -PROMPT='%{$fg[magenta]%}%n%{$reset_color%} in %{$fg_bold[green]%}$(collapse_pwd)%{$reset_color%}$(git_prompt_info) +PROMPT=' +%{$RIXIUS_PRE%}%n%{$reset_color%} in %{$fg_bold[green]%}$(collapse_pwd)%{$reset_color%}$(git_prompt_info) $(prompt_char) ' +RPROMPT='%{$RIXIUS_PRE%}%T%{$reset_color%}' ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$bg[white]%}%{$fg[red]%}!%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_CLEAN="%{$bg[white]%}%{$fg[red]%}√%{$reset_color%}" \ No newline at end of file +ZSH_THEME_GIT_PROMPT_DIRTY=" %{$RIXIUS_PRE%}!%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN=" %{$RIXIUS_PRE%}√%{$reset_color%}" \ No newline at end of file From e26bdc45e7add5115d92a82469ce78a53868c9fa Mon Sep 17 00:00:00 2001 From: Stephen Middleton Date: Fri, 14 Jan 2011 01:29:24 -0600 Subject: [PATCH 305/614] Personal Style --- themes/rixius.zsh-theme | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/themes/rixius.zsh-theme b/themes/rixius.zsh-theme index 8837d8840..3e5381425 100644 --- a/themes/rixius.zsh-theme +++ b/themes/rixius.zsh-theme @@ -1,3 +1,8 @@ +# /|/ Code by Stephen +# /|/ "Rixius" Middleton +# +# name in folder (github) +# ± if in github repo, or ≥ if otherwise Time in 24-hour format is on right. function collapse_pwd { echo $(pwd | sed -e "s,^$HOME,~,") } From 115cd2f21b8dabf6ea56066b348f0ff09a85271c Mon Sep 17 00:00:00 2001 From: Stephen Middleton Date: Fri, 14 Jan 2011 01:31:21 -0600 Subject: [PATCH 306/614] added newline --- themes/rixius.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/rixius.zsh-theme b/themes/rixius.zsh-theme index 3e5381425..c0c5c9c71 100644 --- a/themes/rixius.zsh-theme +++ b/themes/rixius.zsh-theme @@ -21,4 +21,4 @@ RPROMPT='%{$RIXIUS_PRE%}%T%{$reset_color%}' ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" ZSH_THEME_GIT_PROMPT_DIRTY=" %{$RIXIUS_PRE%}!%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_CLEAN=" %{$RIXIUS_PRE%}√%{$reset_color%}" \ No newline at end of file +ZSH_THEME_GIT_PROMPT_CLEAN=" %{$RIXIUS_PRE%}√%{$reset_color%}" From ea88855e5bff567b1c928b96b854289fd76ef014 Mon Sep 17 00:00:00 2001 From: Lorenzo Manacorda Date: Mon, 24 Jan 2011 15:49:49 +0100 Subject: [PATCH 307/614] add missing unrar flag --- lib/functions.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/functions.zsh b/lib/functions.zsh index 914f2ef25..86545c7b6 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -52,7 +52,7 @@ function extract() { *.tar.xz) tar xvJf $1;; *.tar.lzma) tar --lzma -xvf $1;; *.bz2) bunzip $1;; - *.rar) unrar $1;; + *.rar) unrar x $1;; *.gz) gunzip $1;; *.tar) tar xvf $1;; *.tbz2) tar xvjf $1;; From da8b3f00103948fa80c1cc57e45594caf737eae8 Mon Sep 17 00:00:00 2001 From: "Renaud (Nel) Morvan" Date: Sun, 30 Jan 2011 08:21:49 +0100 Subject: [PATCH 308/614] Refactor window and tab title in tty Term window title and tab title are now skinable Tab title can be different from window title (when supported by term) Default theme is optimized of usuability (no %u@%m: $~ in a 10 char tab) Cleanup code duplication and add comment for supported terms On osX it works great on iterm, and is decent once you tweak Terminal pref Tested under GNU screen, iTerm and Apple Terminal, need to be tested on linux TODO implement Konsole support (via dbus) --- lib/functions.zsh | 23 ---------------------- lib/termsupport.zsh | 47 +++++++++++++++++++++++++-------------------- 2 files changed, 26 insertions(+), 44 deletions(-) diff --git a/lib/functions.zsh b/lib/functions.zsh index 914f2ef25..6f5d015f7 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -1,26 +1,3 @@ -## fixme, i duplicated this in xterms - oops -function title { - if [[ $TERM == "screen" ]]; then - # Use these two for GNU Screen: - print -nR $'\033k'$1$'\033'\\\ - - print -nR $'\033]0;'$2$'\a' - elif [[ ($TERM =~ "^xterm") ]] || [[ ($TERM == "rxvt") ]]; then - # Use this one instead for XTerms: - print -nR $'\033]0;'$*$'\a' - fi -} - -function precmd { - title zsh "$PWD" -} - -function preexec { - emulate -L zsh - local -a cmd; cmd=(${(z)1}) - title $cmd[1]:t "$cmd[2,-1]" -} - function zsh_stats() { history | awk '{print $2}' | sort | uniq -c | sort -rn | head } diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index fef978748..e1e536690 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -1,21 +1,26 @@ -case "$TERM" in - xterm*|rxvt*) - preexec () { - print -Pn "\e]0;%n@%m: $1\a" # xterm - } - precmd () { - print -Pn "\e]0;%n@%m: %~\a" # xterm - } - ;; - screen*) - preexec () { - local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]} - echo -ne "\ek$CMD\e\\" - print -Pn "\e]0;%n@%m: $1\a" # xterm - } - precmd () { - echo -ne "\ekzsh\e\\" - print -Pn "\e]0;%n@%m: %~\a" # xterm - } - ;; -esac \ No newline at end of file +#usage: title short_tab_title looooooooooooooooooooooggggggg_windows_title +#http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#ss3.1 +#Fully support screen, iterm, and probably most modern xterm and rxvt +#Limited support for Apple Terminal (Terminal can't set window or tab separately) +function title { + if [[ "$TERM" == "screen" ]]; then + print -Pn "\ek$1\e\\" #set screen hardstatus, usually truncated at 20 chars + elif [[ ($TERM =~ "^xterm") ]] || [[ ($TERM == "rxvt") ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then + print -Pn "\e]2;$2\a" #set window name + print -Pn "\e]1;$1\a" #set icon (=tab) name (will override window name on broken terminal) + fi +} + +ZSH_THEME_TERM_TAB_TITLE_IDLE="%15<..<%~%<<" #15 char left truncated PWD +ZSH_THEME_TERM_TITLE_IDLE="%n@%m: %~" + +#Appears when you have the prompt +function precmd { + title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE +} + +#Appears at the beginning of (and during) of command execution +function preexec { + local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd + title "$CMD" "%100>...>$2%<<" +} From 7896b58b32cd4ec103cd9e833f17edbb58db4fda Mon Sep 17 00:00:00 2001 From: Christopher Chow Date: Fri, 4 Feb 2011 01:37:39 +1100 Subject: [PATCH 309/614] Added time since last commit to Soliah theme and changed some colours. --- themes/Soliah.zsh-theme | 63 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 60 insertions(+), 3 deletions(-) diff --git a/themes/Soliah.zsh-theme b/themes/Soliah.zsh-theme index 7ad876d41..1c0ab3cc9 100644 --- a/themes/Soliah.zsh-theme +++ b/themes/Soliah.zsh-theme @@ -1,6 +1,63 @@ -PROMPT='%{$fg[blue]%}%B%20~%b%{$reset_color%}%{$(git_prompt_info)%} $ ' +PROMPT='%{$fg[blue]%}%n%{$reset_color%} on %{$fg[red]%}%M%{$reset_color%} in %{$fg[blue]%}%~%b%{$reset_color%}$(git_time_since_commit)$(git_prompt_info) +$ ' -ZSH_THEME_GIT_PROMPT_PREFIX="(%{$fg[green]%}" +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[white]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%})" -ZSH_THEME_GIT_PROMPT_DIRTY="*%{$reset_color%}" +# Text to display if the branch is dirty +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*%{$reset_color%}" + +# Text to display if the branch is clean +ZSH_THEME_GIT_PROMPT_CLEAN="" + +# Colors vary depending on time lapsed. +ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT="%{$fg[green]%}" +ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM="%{$fg[yellow]%}" +ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG="%{$fg[red]%}" +ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[cyan]%}" + +# Determine the time since last commit. If branch is clean, +# use a neutral color, otherwise colors will vary according to time. +function git_time_since_commit() { + if git rev-parse --git-dir > /dev/null 2>&1; then + # Only proceed if there is actually a commit. + if [[ $(git log 2>&1 > /dev/null | grep -c "^fatal: bad default revision") == 0 ]]; then + # Get the last commit. + last_commit=`git log --pretty=format:'%at' -1 2> /dev/null` + now=`date +%s` + seconds_since_last_commit=$((now-last_commit)) + + # Totals + MINUTES=$((seconds_since_last_commit / 60)) + HOURS=$((seconds_since_last_commit/3600)) + + # Sub-hours and sub-minutes + DAYS=$((seconds_since_last_commit / 86400)) + SUB_HOURS=$((HOURS % 24)) + SUB_MINUTES=$((MINUTES % 60)) + + if [[ -n $(git status -s 2> /dev/null) ]]; then + if [ "$MINUTES" -gt 30 ]; then + COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG" + elif [ "$MINUTES" -gt 10 ]; then + COLOR="$ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM" + else + COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT" + fi + else + COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL" + fi + + if [ "$HOURS" -gt 24 ]; then + echo "($COLOR${DAYS}d${SUB_HOURS}h${SUB_MINUTES}m%{$reset_color%}|" + elif [ "$MINUTES" -gt 60 ]; then + echo "($COLOR${HOURS}h${SUB_MINUTES}m%{$reset_color%}|" + else + echo "($COLOR${MINUTES}m%{$reset_color%}|" + fi + else + COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL" + echo "($COLOR~|" + fi + fi +} From 8d487d4f6c2d38cb108d7c8c0c2de9f0385da402 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 3 Feb 2011 16:47:08 -0500 Subject: [PATCH 310/614] Added sorin oh-my-zsh theme. --- themes/sorin.zsh-theme | 48 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 themes/sorin.zsh-theme diff --git a/themes/sorin.zsh-theme b/themes/sorin.zsh-theme new file mode 100644 index 000000000..601dbe5d7 --- /dev/null +++ b/themes/sorin.zsh-theme @@ -0,0 +1,48 @@ +# ------------------------------------------------------------------------------ +# FILE: sorin.zsh-theme +# DESCRIPTION: oh-my-zsh theme file. +# AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com) +# VERSION: 1.0.2 +# SCREENSHOT: http://i.imgur.com/aipDQ.png +# ------------------------------------------------------------------------------ + + +if [[ "$TERM" != "dumb" ]] && [[ "$DISABLE_LS_COLORS" != "true" ]]; then + MODE_INDICATOR="%{$fg_bold[red]%}❮%{$reset_color%}%{$fg[red]%}❮❮%{$reset_color%}" + local return_status="%{$fg[red]%}%(?..⏎)%{$reset_color%}" + + PROMPT='%{$fg[cyan]%}%c$(git_prompt_info) %(!.%{$fg_bold[red]%}#.%{$fg_bold[green]%}❯)%{$reset_color%} ' + + ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[blue]%}git%{$reset_color%}:%{$fg[red]%}" + ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" + ZSH_THEME_GIT_PROMPT_DIRTY="" + ZSH_THEME_GIT_PROMPT_CLEAN="" + + RPROMPT='${return_status}$(git_prompt_status)%{$reset_color%}' + + ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} ✚" + ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} ✹" + ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖" + ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜" + ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═" + ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭" +else + MODE_INDICATOR="❮❮❮" + local return_status="%(?::⏎)" + + PROMPT='%c$(git_prompt_info) %(!.#.❯) ' + + ZSH_THEME_GIT_PROMPT_PREFIX=" git:" + ZSH_THEME_GIT_PROMPT_SUFFIX="" + ZSH_THEME_GIT_PROMPT_DIRTY="" + ZSH_THEME_GIT_PROMPT_CLEAN="" + + RPROMPT='${return_status}$(git_prompt_status)' + + ZSH_THEME_GIT_PROMPT_ADDED=" ✚" + ZSH_THEME_GIT_PROMPT_MODIFIED=" ✹" + ZSH_THEME_GIT_PROMPT_DELETED=" ✖" + ZSH_THEME_GIT_PROMPT_RENAMED=" ➜" + ZSH_THEME_GIT_PROMPT_UNMERGED=" ═" + ZSH_THEME_GIT_PROMPT_UNTRACKED=" ✭" +fi From 903426ceeb7ed243d59a0365118cc5136114c3de Mon Sep 17 00:00:00 2001 From: Christopher Chow Date: Fri, 4 Feb 2011 11:33:20 +1100 Subject: [PATCH 311/614] Fixed auto update. Paramater substitution instead of command subsitution was being used causing the calculation of time since last check to be incorrect. --- tools/check_for_upgrade.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh index c59ebaed4..4643739ca 100644 --- a/tools/check_for_upgrade.sh +++ b/tools/check_for_upgrade.sh @@ -16,7 +16,7 @@ then _update_zsh_update && return 0; fi - epoch_diff=$((${_current_epoch} - $LAST_EPOCH)) + epoch_diff=$(($(_current_epoch) - $LAST_EPOCH)) if [ $epoch_diff -gt 6 ] then echo "[Oh My Zsh] Would you like to check for updates?" From ccdf25946837150d473c0667669deb4e930bfa03 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 3 Feb 2011 23:24:33 -0500 Subject: [PATCH 312/614] Added modified while newly added and type change detection to git prompt modified status. --- lib/git.zsh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/git.zsh b/lib/git.zsh index 75fdc1f9c..8512de8a4 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -26,6 +26,10 @@ git_prompt_status() { fi if $(echo "$INDEX" | grep '^ M ' &> /dev/null); then STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS" + elif $(echo "$INDEX" | grep '^AM ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS" + elif $(echo "$INDEX" | grep '^ T ' &> /dev/null); then + STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS" fi if $(echo "$INDEX" | grep '^R ' &> /dev/null); then STATUS="$ZSH_THEME_GIT_PROMPT_RENAMED$STATUS" From 843f0a7ea5e8acd4cda10b46e488ae3ea7d379e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tadas=20Tamo=C5=A1auskas?= Date: Sun, 13 Feb 2011 11:05:12 +0000 Subject: [PATCH 313/614] fixed typo in rails3 plugin and added one alias for migrating and redoing migration if it was successful --- plugins/rails3/rails3.plugin.zsh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/rails3/rails3.plugin.zsh b/plugins/rails3/rails3.plugin.zsh index 20ba0408c..6bf2ba088 100644 --- a/plugins/rails3/rails3.plugin.zsh +++ b/plugins/rails3/rails3.plugin.zsh @@ -3,6 +3,8 @@ alias rg='ruby script/rails generate' alias rd='ruby script/rails destroy' alias rp='ruby script/rails plugin' alias rdbm='rake db:migrate db:test:clone' +alias rdbmr='rake db:migrate && rake db:migrate:redo' alias rc='ruby script/rails console' -alias rd='ruby script/rais server --debugger' +alias rd='ruby script/rails server --debugger' alias devlog='tail -f log/development.log' + From dd7e1d4945fde8b5278f8dab061479af3bb138b9 Mon Sep 17 00:00:00 2001 From: Wim Date: Mon, 14 Feb 2011 01:19:01 -0800 Subject: [PATCH 314/614] Should use https for all GitHub urls. --- README.textile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.textile b/README.textile index 8b1b6875a..0659aded8 100644 --- a/README.textile +++ b/README.textile @@ -8,7 +8,7 @@ h2. Setup h3. The automatic installer... (do you trust me?) -@wget http://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh@ +@wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh@ h3. The manual way @@ -38,7 +38,7 @@ h2. Usage * enable the plugins you want in your @~/.zshrc@ (take a look at @plugins/@ to see what's possible) ** example: @plugins=(git osx ruby)@ * Theme support: Change the @ZSH_THEME@ environment variable in @~/.zshrc@. -** Take a look at the "current themes":http://wiki.github.com/robbyrussell/oh-my-zsh/themes that come bundled with _Oh My Zsh_. +** Take a look at the "current themes":https://wiki.github.com/robbyrussell/oh-my-zsh/themes that come bundled with _Oh My Zsh_. * much much more... take a look at @lib/@ what _Oh My Zsh_ offers... h2. Useful From 613e3773a90d7a05c7566490d2aa7ed65ef3214e Mon Sep 17 00:00:00 2001 From: Myron Marston Date: Tue, 15 Feb 2011 11:27:25 -0800 Subject: [PATCH 315/614] Add bundler plugin with aliases. --- plugins/bundler/bundler.plugin.zsh | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 plugins/bundler/bundler.plugin.zsh diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh new file mode 100644 index 000000000..fb40e2cec --- /dev/null +++ b/plugins/bundler/bundler.plugin.zsh @@ -0,0 +1,3 @@ +alias be="bundle exec" +alias bi="bundle install" +alias bu="bundle update" From 8060e2530178cf34dc9632080bde0d047db70393 Mon Sep 17 00:00:00 2001 From: Ben Langfeld Date: Fri, 18 Feb 2011 12:17:00 +0000 Subject: [PATCH 316/614] Make a cleaner version of the OS X tab function --- plugins/osx/osx.plugin.zsh | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh index fce88c796..eb995eb2e 100644 --- a/plugins/osx/osx.plugin.zsh +++ b/plugins/osx/osx.plugin.zsh @@ -1,11 +1,32 @@ +function savepath() { + pwd > ~/.current_path~ +} + function tab() { - osascript 2>/dev/null </dev/null < Date: Fri, 18 Feb 2011 12:48:27 +0000 Subject: [PATCH 317/614] Add iTerm version of tab function (itab) --- plugins/osx/osx.plugin.zsh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh index eb995eb2e..81eed5e92 100644 --- a/plugins/osx/osx.plugin.zsh +++ b/plugins/osx/osx.plugin.zsh @@ -30,3 +30,28 @@ end do_submenu do_submenu("Terminal", "Shell", "New Tab", 1) EOF } + +function itab() { +savepath +osascript >/dev/null < Date: Wed, 23 Feb 2011 02:56:25 +1100 Subject: [PATCH 318/614] Add tab completion for rvm. --- plugins/rvm/_rvm | 147 +++++++++++++++++++++++++++++++++++++ plugins/rvm/rvm.plugin.zsh | 3 + 2 files changed, 150 insertions(+) create mode 100644 plugins/rvm/_rvm create mode 100644 plugins/rvm/rvm.plugin.zsh diff --git a/plugins/rvm/_rvm b/plugins/rvm/_rvm new file mode 100644 index 000000000..bba5304a0 --- /dev/null +++ b/plugins/rvm/_rvm @@ -0,0 +1,147 @@ +#compdef rvm + +local curcontext="$curcontext" state line cmds ret=1 + +_arguments -C \ + '(- 1 *)'{-v,--version}'[display version information]' \ + '(-l|--level)'{-l,--level}'+[patch level to use with rvm use / install]:number' \ + '(--prefix)--prefix[path for all rvm files (~/.rvm/), with trailing slash!]:path:_files' \ + '(--bin)--bin[path for binaries to be placed (~/.rvm/bin/)]:path:_files' \ + '(--source)--source[src directory to use (~/.rvm/src/)]:path:_files' \ + '(--archives)--archives[directory for downladed files (~/.rvm/archives/)]:path:_files' \ + '-S[Specify a script file to attempt to load and run (rubydo)]:file:_files' \ + '-e[Execute code from the command line]:code' \ + '(-G)-G[root gem path to use]:path:_files' \ + '(--gems)--gems[Used to set the gems_flag, use with remove to remove gems]' \ + '(--archive)--archive[Used to set the archive_flag, use with remove to remove archive]' \ + '(--patch)--patch[With MRI Rubies you may specify one or more full paths to patches]' \ + '(-C|--configure)'{-C,--configure}'=[custom configure options]' \ + '(--nice)--nice[process niceness (for slow computers, default 0)]:number' \ + '(--ree)--ree-options[Options passed directly to ree ./installer on the command line]:options' \ + '(--head)--head[with update, updates rvm to git head version]' \ + '(--rubygems)--rubygems[with update, updates rubygems for selected ruby]' \ + '(--default)--default[with ruby select, sets a default ruby for new shells]' \ + '(--debug)--debug[Toggle debug mode on for very verbose output]' \ + '(--trace)--trace[Toggle trace mode on to see EVERYTHING rvm is doing]' \ + '(--force)--force[Force install, removes old install & source before install]' \ + '(--summary)--summary[Used with rubydo to print out a summary of the commands run]' \ + '(--latest)--latest[with gemset --dump skips version strings for latest gem]' \ + '(--gems)--gems[with uninstall/remove removes gems with the interpreter]' \ + '(--docs)--docs[with install, attempt to generate ri after installation]' \ + '(--reconfigure)--reconfigure[Force ./configure on install even if Makefile already exists]' \ + '1: :->cmds' \ + '*: :->args' && ret=0 + +case $state in + cmds) + cmds=( + "version:show the rvm version installed in rvm_path" + "use:setup current shell to use a specific ruby version" + "reload:reload rvm source itself (useful after changing rvm source)" + "implode:(seppuku) removes the rvm installation completely. This means everything in $rvm_path (~/.rvm)." + "update:upgrades rvm to the latest version." + "reset:remove current and stored default & system settings." + "info :show the *current* environment information for current ruby" + "current:print the *current* ruby version and the name of any gemset being used." + "debug:show info plus additional information for common issues" + "install:install one or many ruby versions" + "uninstall:uninstall one or many ruby versions, leaves their sources" + "remove:uninstall one or many ruby versions and remove their sources" + "migrate:Lets you migrate all gemsets from one ruby to another." + "upgrade:Lets you upgrade from one version of a ruby to another, including migrating your gemsets semi-automatically." + "wrapper:generates a set of wrapper executables for a given ruby with the specified ruby and gemset combination. Used under the hood for passenger support and the like." + "cleanup:Lets you remove stale source folders / archives and other miscellaneous data associated with rvm." + "repair:Lets you repair parts of your environment e.g. wrappers, env files and and similar files (e.g. general maintenance)." + "snapshot:Lets your backup / restore an rvm installation in a lightweight manner." + "disk-usage:Tells you how much disk space rvm install is using." + "tools:Provides general information about the ruby environment, primarily useful when scripting rvm." + "docs:Tools to make installing ri and rdoc documentation easier." + "rvmrc:Tools related to managing rvmrc trust and loading." + "exec:runs an arbitrary command as a set operation." + "ruby:runs a named ruby file against specified and/or all rubies" + "gem:runs a gem command using selected ruby's 'gem'" + "rake:runs a rake task against specified and/or all rubies" + "tests:runs 'rake test' across selected ruby versions" + "specs:runs 'rake spec' across selected ruby versions" + "monitor:Monitor cwd for testing, run rake {spec,test} on changes." + "gemset:gemsets: http://rvm.beginrescueend.com/gemsets/" + "rubygems:Switches the installed version of rubygems for the current ruby." + "gemdir:display the path to the current gem directory (GEM_HOME)." + "srcdir:display the path to rvm source directory (may be yanked)" + "fetch:Performs an archive / src fetch only of the selected ruby." + "list:show currently installed rubies, interactive output." + "package:Install a dependency package {readline,iconv,zlib,openssl}" + "notes:Display notes, with operating system specifics." + "export:Temporarily set an environment variable in the current shell." + "unexport:Undo changes made to the environment by 'rvm export'." + ) + _describe -t commands 'rvm command' cmds && ret=0 + ;; + args) + case $line[1] in + (use|uninstall|remove|list) + _values -S , 'rubies' $(rvm list strings | sed -e 's/ruby-\([^) ]*\)-\([^) ]*\)/ruby-\1-\2 \1-\2 \1/g') default system && ret=0 + ;; + (install|fetch) + _values -S , 'rubies' $(rvm list known_strings) && ret=0 + ;; + gemset) + if (( CURRENT == 3 )); then + _values 'gemset_commands' \ + 'import' \ + 'export' \ + 'create' \ + 'copy' \ + 'rename' \ + 'empty' \ + 'delete' \ + 'name' \ + 'dir' \ + 'list' \ + 'list_all' \ + 'gemdir' \ + 'install' \ + 'pristine' \ + 'clear' \ + 'use' \ + 'update' \ + 'unpack' \ + 'globalcache' + else + _values -S , 'gemsets' $(rvm gemset list | grep -v gemset 2>/dev/null) + fi + ret=0 + ;; + package) + if (( CURRENT == 3 )); then + _values 'package_commands' \ + 'install' \ + 'uninstall' + else + _values 'packages' \ + 'readline' \ + 'iconv' \ + 'curl' \ + 'openssl' \ + 'zlib' \ + 'autoconf' \ + 'ncurses' \ + 'pkgconfig' \ + 'gettext' \ + 'glib' \ + 'mono' \ + 'llvm' \ + 'libxml2' \ + 'libxslt' \ + 'libyaml' + fi + ret=0 + ;; + *) + (( ret )) && _message 'no more arguments' + ;; + esac + ;; +esac + +return ret diff --git a/plugins/rvm/rvm.plugin.zsh b/plugins/rvm/rvm.plugin.zsh new file mode 100644 index 000000000..ef934d547 --- /dev/null +++ b/plugins/rvm/rvm.plugin.zsh @@ -0,0 +1,3 @@ +fpath=($ZSH/plugins/rvm $fpath) +autoload -U compinit +compinit -i From 4951097271359f8805febc2e5b89b32cc67d0f6d Mon Sep 17 00:00:00 2001 From: "Suraj N. Kurapati" Date: Wed, 23 Feb 2011 00:38:15 -0800 Subject: [PATCH 319/614] fishy theme: text indicators for $? and git status The git status indicators were taken from sorin.zsh-theme and changed to use ASCII symbols instead of Unicode ones because my preferred terminal font, DejaVu Sans Mono, renders Unicode symbols poorly and also because Unicode rendering is not available in standard Linux virtual terminals. --- themes/fishy.zsh-theme | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/themes/fishy.zsh-theme b/themes/fishy.zsh-theme index f22eda868..f9e506cae 100644 --- a/themes/fishy.zsh-theme +++ b/themes/fishy.zsh-theme @@ -3,7 +3,18 @@ local user_color='green'; [ $UID -eq 0 ] && user_color='red' PROMPT='%n@%m %{$fg[$user_color]%}%~%{$reset_color%}%(!.#.>) ' PROMPT2='%{$fg[red]%}\ %{$reset_color%}' -RPS1='%(?..%{$fg[red]%}%? ↵%{$reset_color%})$(git_prompt_info)' -ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[cyan]%}" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +local return_status="%{$fg_bold[red]%}%(?..%?)%{$reset_color%}" +RPROMPT='${return_status}$(git_prompt_info)$(git_prompt_status)%{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX=" " +ZSH_THEME_GIT_PROMPT_SUFFIX="" +ZSH_THEME_GIT_PROMPT_DIRTY="" +ZSH_THEME_GIT_PROMPT_CLEAN="" + +ZSH_THEME_GIT_PROMPT_ADDED="%{$fg_bold[green]%}+" +ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg_bold[blue]%}!" +ZSH_THEME_GIT_PROMPT_DELETED="%{$fg_bold[red]%}-" +ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg_bold[magenta]%}>" +ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg_bold[yellow]%}#" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg_bold[cyan]%}?" From e4ded4e6ff222b5020b4d52a4953502aabd56b5d Mon Sep 17 00:00:00 2001 From: Jakub Nawalaniec Date: Sun, 3 Apr 2011 21:28:19 +0200 Subject: [PATCH 320/614] Further git completion improovements In detail: gup - now completes with remotes like git fetch would gdv - got git diff completions gc/gca - now zsh will suggest files in staging area gba - suggestions as for git branch --- plugins/git/git.plugin.zsh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 8470c28a4..9fe7a6467 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -6,24 +6,24 @@ compdef _git gst=git-status alias gl='git pull' compdef _git gl=git-pull alias gup='git fetch && git rebase' -compdef gup=git +compdef _git gup=git-fetch alias gp='git push' compdef _git gp=git-push alias gd='git diff | mate' # WTF is mate?? compdef _git gd=git-diff alias gdv='git diff -w "$@" | vim -R -' -compdef gdv=git +compdef _git gdv=git-diff alias gc='git commit -v' -compdef gc=git +compdef _git gc=git-commit alias gca='git commit -v -a' -compdef gca=git +compdef _git gca=git-commit alias gco='git checkout' compdef _git gco=git-checkout alias gb='git branch' compdef _git gb=git-branch alias gba='git branch -a' -compdef gba=git +compdef _git gba=git-branch alias gcount='git shortlog -sn' compdef gcount=git alias gcp='git cherry-pick' From bb8bbf33b72cc3dea91c9603c111921d10c29e9e Mon Sep 17 00:00:00 2001 From: "Renaud (Nel) Morvan" Date: Mon, 4 Apr 2011 13:30:39 +0200 Subject: [PATCH 321/614] Escape characters used in escape sequence to avoid triggering bugs in Apple Terminal Closes #45 #57 #58 #86. --- lib/termsupport.zsh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index b250833ed..494ef8923 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -4,10 +4,10 @@ #Limited support for Apple Terminal (Terminal can't set window or tab separately) function title { if [[ "$TERM" == "screen" ]]; then - print -Pn "\ek$1\e\\" #set screen hardstatus, usually truncated at 20 chars + print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars elif [[ ($TERM =~ "^xterm") ]] || [[ ($TERM == "rxvt") ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then - print -Pn "\e]2;$2\a" #set window name - print -Pn "\e]1;$1\a" #set icon (=tab) name (will override window name on broken terminal) + print -Pn "\e]2;$2:q\a" #set window name + print -Pn "\e]1;$1:q\a" #set icon (=tab) name (will override window name on broken terminal) fi } From 044012b9653ff4b46ddab0884cc935035eeddf7a Mon Sep 17 00:00:00 2001 From: "Renaud (Nel) Morvan" Date: Mon, 4 Apr 2011 13:44:48 +0200 Subject: [PATCH 322/614] Command title behavior no longer depend on local zsh configuration Fix by derekjw. closes #52. --- lib/termsupport.zsh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index 494ef8923..42bbb9ef2 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -3,7 +3,7 @@ #Fully support screen, iterm, and probably most modern xterm and rxvt #Limited support for Apple Terminal (Terminal can't set window or tab separately) function title { - if [[ "$TERM" == "screen" ]]; then + if [[ $TERM =~ "^screen" ]]; then print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars elif [[ ($TERM =~ "^xterm") ]] || [[ ($TERM == "rxvt") ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then print -Pn "\e]2;$2:q\a" #set window name @@ -24,6 +24,8 @@ function precmd { #Appears at the beginning of (and during) of command execution function preexec { if [ "$DISABLE_AUTO_TITLE" != "true" ]; then + emulate -L zsh + setopt extended_glob local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd title "$CMD" "%100>...>$2%<<" fi From bb609fce12648ca6728bb5b97b373f88bf3c336b Mon Sep 17 00:00:00 2001 From: "Renaud (Nel) Morvan" Date: Mon, 4 Apr 2011 14:02:50 +0200 Subject: [PATCH 323/614] Refactor DISABLE_AUTO_TITLE to be more DRY --- lib/termsupport.zsh | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index 42bbb9ef2..3152751e4 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -3,6 +3,7 @@ #Fully support screen, iterm, and probably most modern xterm and rxvt #Limited support for Apple Terminal (Terminal can't set window or tab separately) function title { + [ "$DISABLE_AUTO_TITLE" != "true" ] || return if [[ $TERM =~ "^screen" ]]; then print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars elif [[ ($TERM =~ "^xterm") ]] || [[ ($TERM == "rxvt") ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then @@ -16,17 +17,13 @@ ZSH_THEME_TERM_TITLE_IDLE="%n@%m: %~" #Appears when you have the prompt function precmd { - if [ "$DISABLE_AUTO_TITLE" != "true" ]; then - title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE - fi + title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE } #Appears at the beginning of (and during) of command execution function preexec { - if [ "$DISABLE_AUTO_TITLE" != "true" ]; then - emulate -L zsh - setopt extended_glob - local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd - title "$CMD" "%100>...>$2%<<" - fi + emulate -L zsh + setopt extended_glob + local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd + title "$CMD" "%100>...>$2%<<" } From d15d88cf813cc6a99b92ee3621dad14ea621299f Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Mon, 4 Apr 2011 00:54:43 +0200 Subject: [PATCH 324/614] Fix `gdv`: make it a function, and use `view`. I've changed it to use `view` instead of `vim -R` to make it hopefully more editor-agnostic. --- plugins/git/git.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 8470c28a4..b21c6a8e0 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -12,7 +12,7 @@ compdef _git gp=git-push alias gd='git diff | mate' # WTF is mate?? compdef _git gd=git-diff -alias gdv='git diff -w "$@" | vim -R -' +gdv() { git diff -w "$@" | view - } compdef gdv=git alias gc='git commit -v' compdef gc=git From ca710c949a5c9a902e45728e9bb86f88e9fe0d1a Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Tue, 12 Apr 2011 10:19:15 +0200 Subject: [PATCH 325/614] Using git-diff instead of git diff --- plugins/git/git.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 85eabced0..bc340e86b 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -9,7 +9,7 @@ alias gup='git fetch && git rebase' compdef _git gup=git-fetch alias gp='git push' compdef _git gp=git-push -gdv() { git diff -w "$@" | view - } +gdv() { git-diff -w "$@" | view - } compdef _git gdv=git-diff alias gc='git commit -v' compdef _git gc=git-commit From 49b4a1b14bcda0ae8a3baf97266e2285044b6cba Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sun, 20 Mar 2011 16:29:00 -0400 Subject: [PATCH 326/614] Added npm plugin. --- plugins/npm/_npm | 19 +++++++++++++++++++ plugins/npm/npm.plugin.zsh | 4 ++++ 2 files changed, 23 insertions(+) create mode 100644 plugins/npm/_npm create mode 100644 plugins/npm/npm.plugin.zsh diff --git a/plugins/npm/_npm b/plugins/npm/_npm new file mode 100644 index 000000000..24b536188 --- /dev/null +++ b/plugins/npm/_npm @@ -0,0 +1,19 @@ +#compdef npm + +# Node Package Manager 0.3.15 completion, letting npm do all the completion work + +_npm() { + compadd -- $(_npm_complete $words) +} + +# We want to show all errors of any substance, but never the "npm (not )ok" one. +# (Also doesn't consider "ERR! no match found" worth breaking the terminal for.) +_npm_complete() { + local ask_npm + ask_npm=(npm completion --color false --loglevel error -- $@) + { _call_program npm $ask_npm 2>&1 >&3 \ + | egrep -v '^(npm (not |)ok|ERR! no match found)$' >&2; \ + } 3>&1 +} + +_npm "$@" diff --git a/plugins/npm/npm.plugin.zsh b/plugins/npm/npm.plugin.zsh new file mode 100644 index 000000000..826f0f7b0 --- /dev/null +++ b/plugins/npm/npm.plugin.zsh @@ -0,0 +1,4 @@ +# add npm completion function to path +fpath=($ZSH/plugins/npm $fpath) +autoload -U compinit +compinit -i From 7b8cf376d1d0937330416c7394f4791b90d53503 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Tue, 12 Apr 2011 10:24:06 +0200 Subject: [PATCH 327/614] Revert "Enable alias completion, do not limit completion to just files" This reverts commit c3a58b00040018743ead1e6672910433fc1ca7c2. --- lib/completion.zsh | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/completion.zsh b/lib/completion.zsh index e8e9776a5..9c2dfecca 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -4,7 +4,6 @@ unsetopt menu_complete # do not autoselect the first completion entry unsetopt flowcontrol setopt auto_menu # show completion menu on succesive tab press setopt complete_in_word -setopt complete_aliases setopt always_to_end WORDCHARS='' From 1dae8c088bc082e925722a48ec9de31db87ecc6e Mon Sep 17 00:00:00 2001 From: Theodore Robert Campbell Jr Date: Tue, 1 Mar 2011 01:04:10 -0500 Subject: [PATCH 328/614] added hub plugin from defunkt --- plugins/hub/hub.plugin.zsh | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 plugins/hub/hub.plugin.zsh diff --git a/plugins/hub/hub.plugin.zsh b/plugins/hub/hub.plugin.zsh new file mode 100644 index 000000000..e82a0ec25 --- /dev/null +++ b/plugins/hub/hub.plugin.zsh @@ -0,0 +1,5 @@ +# hub alias from defunkt +# https://github.com/defunkt/hub +if [ $( which hub > /dev/null 2>&1 ; echo -n $? ) -lt 1 ]; then + eval $( hub alias -s $( ps -o comm= -p $$ ) ) +fi From d7375c3b545ce2e32cea11f2406b6dac2f605f26 Mon Sep 17 00:00:00 2001 From: Theodore Robert Campbell Jr Date: Tue, 1 Mar 2011 21:34:25 -0500 Subject: [PATCH 329/614] no need for an extra fork --- plugins/hub/hub.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/hub/hub.plugin.zsh b/plugins/hub/hub.plugin.zsh index e82a0ec25..9f95c6361 100644 --- a/plugins/hub/hub.plugin.zsh +++ b/plugins/hub/hub.plugin.zsh @@ -1,5 +1,5 @@ # hub alias from defunkt # https://github.com/defunkt/hub if [ $( which hub > /dev/null 2>&1 ; echo -n $? ) -lt 1 ]; then - eval $( hub alias -s $( ps -o comm= -p $$ ) ) + eval $( hub alias -s zsh ) fi From c642dec2569642466ba8c5d8fca87beef71b1dcb Mon Sep 17 00:00:00 2001 From: Theodore Robert Campbell Jr Date: Wed, 2 Mar 2011 20:00:40 -0500 Subject: [PATCH 330/614] blueyed's ZSH-fu is much stronger than mine. --- plugins/hub/hub.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/hub/hub.plugin.zsh b/plugins/hub/hub.plugin.zsh index 9f95c6361..48e1fa4ad 100644 --- a/plugins/hub/hub.plugin.zsh +++ b/plugins/hub/hub.plugin.zsh @@ -1,5 +1,5 @@ # hub alias from defunkt # https://github.com/defunkt/hub -if [ $( which hub > /dev/null 2>&1 ; echo -n $? ) -lt 1 ]; then - eval $( hub alias -s zsh ) +if which hub > /dev/null; then + eval $(hub alias -s zsh) fi From 0e423ff98864720cb16beb8f83cfa8ebf4d5c4c7 Mon Sep 17 00:00:00 2001 From: Theodore Robert Campbell Jr Date: Thu, 3 Mar 2011 21:36:35 -0500 Subject: [PATCH 331/614] Moved this to the existing github plugin --- plugins/hub/hub.plugin.zsh | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 plugins/hub/hub.plugin.zsh diff --git a/plugins/hub/hub.plugin.zsh b/plugins/hub/hub.plugin.zsh deleted file mode 100644 index 48e1fa4ad..000000000 --- a/plugins/hub/hub.plugin.zsh +++ /dev/null @@ -1,5 +0,0 @@ -# hub alias from defunkt -# https://github.com/defunkt/hub -if which hub > /dev/null; then - eval $(hub alias -s zsh) -fi From 7380c1b7833b32d9bd1ca638ceae5661898143e5 Mon Sep 17 00:00:00 2001 From: Theodore Robert Campbell Jr Date: Thu, 3 Mar 2011 21:38:56 -0500 Subject: [PATCH 332/614] Whoops, this was supposed to be in the last commit! --- plugins/github/github.plugin.zsh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/github/github.plugin.zsh b/plugins/github/github.plugin.zsh index c23504b85..72e9b07b9 100644 --- a/plugins/github/github.plugin.zsh +++ b/plugins/github/github.plugin.zsh @@ -1,3 +1,9 @@ +# hub alias from defunkt +# https://github.com/defunkt/hub +if which hub > /dev/null; then + eval $(hub alias -s zsh) +fi + # add github completion function to path fpath=($ZSH/plugins/github $fpath) autoload -U compinit From 4a46f72bb4bcb80ce472c78474e46db6ac885f1c Mon Sep 17 00:00:00 2001 From: Theodore Robert Campbell Jr Date: Sat, 19 Mar 2011 10:29:22 -0400 Subject: [PATCH 333/614] changes recommended by blueyed --- plugins/github/github.plugin.zsh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/github/github.plugin.zsh b/plugins/github/github.plugin.zsh index 72e9b07b9..8d4580654 100644 --- a/plugins/github/github.plugin.zsh +++ b/plugins/github/github.plugin.zsh @@ -1,7 +1,8 @@ # hub alias from defunkt # https://github.com/defunkt/hub -if which hub > /dev/null; then - eval $(hub alias -s zsh) +if [ "$commands[(I)hub]" ]; then + # eval `hub alias -s zsh` + function git(){hub "$@"} fi # add github completion function to path From dc768085b7f42e13157b6477f14d97538664fffe Mon Sep 17 00:00:00 2001 From: Dmitry Maksimov Date: Sat, 26 Feb 2011 10:04:45 +0300 Subject: [PATCH 334/614] kolo.zsh-theme --- themes/kolo.zsh-theme | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 themes/kolo.zsh-theme diff --git a/themes/kolo.zsh-theme b/themes/kolo.zsh-theme new file mode 100644 index 000000000..6e04e1595 --- /dev/null +++ b/themes/kolo.zsh-theme @@ -0,0 +1,21 @@ +autoload -U colors && colors + +autoload -Uz vcs_info + +zstyle ':vcs_info:*' stagedstr '%F{green}●' +zstyle ':vcs_info:*' unstagedstr '%F{yellow}●' +zstyle ':vcs_info:*' check-for-changes true +zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{11}%r' +zstyle ':vcs_info:*' enable git svn +precmd () { + if [[ -z $(git ls-files --other --exclude-standard 2> /dev/null) ]] { + zstyle ':vcs_info:*' formats ' [%b%c%u%B%F{green}]' + } else { + zstyle ':vcs_info:*' formats ' [%b%c%u%B%F{red}●%F{green}]' + } + + vcs_info +} + +setopt prompt_subst +PROMPT='%B%F{magenta}%c%B%F{green}${vcs_info_msg_0_}%B%F{magenta} %{$reset_color%}%% ' From 477749a0afc9c693dcddbd29aafe5f85e20a5a43 Mon Sep 17 00:00:00 2001 From: Theodore Robert Campbell Jr Date: Tue, 1 Mar 2011 00:21:49 -0500 Subject: [PATCH 335/614] ssh-agent plugin now ends in "-$HOST" so an agent is started properly with nfs shared homes. --- plugins/ssh-agent/ssh-agent.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/ssh-agent/ssh-agent.plugin.zsh b/plugins/ssh-agent/ssh-agent.plugin.zsh index ce0d645c1..0efc4546f 100644 --- a/plugins/ssh-agent/ssh-agent.plugin.zsh +++ b/plugins/ssh-agent/ssh-agent.plugin.zsh @@ -1,7 +1,7 @@ # Based on code from Joseph M. Reagle # http://www.cygwin.com/ml/cygwin/2001-06/msg00537.html -local SSH_ENV=$HOME/.ssh/environment +local SSH_ENV=$HOME/.ssh/environment-$HOST function start_agent { /usr/bin/env ssh-agent | sed 's/^echo/#echo/' > ${SSH_ENV} From 6fa11377dd777b8ef37a0634317ab9b60dccdc7f Mon Sep 17 00:00:00 2001 From: Sankara Rameswaran Date: Wed, 2 Mar 2011 15:20:43 +0530 Subject: [PATCH 336/614] Lein completion --- plugins/lein/lein.plugin.zsh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 plugins/lein/lein.plugin.zsh diff --git a/plugins/lein/lein.plugin.zsh b/plugins/lein/lein.plugin.zsh new file mode 100644 index 000000000..19af3556a --- /dev/null +++ b/plugins/lein/lein.plugin.zsh @@ -0,0 +1,27 @@ +function _lein_commands() { + local ret=1 state + _arguments ':subcommand:->subcommand' && ret=0 + + case $state in + subcommand) + subcommands=( + "clean:remove compiled files and dependencies from project" + "compile:ahead-of-time compile the project" + "deps:download and install all dependencies" + "help:display a list of tasks or help for a given task" + "install:install the project and its dependencies in your local repository" + "jar:create a jar file containing the compiled .class files" + "new:create a new project skeleton" + "pom:write a pom.xml file to disk for maven interop" + "test:run the project's tests" + "uberjar:Create a jar including the contents of each of deps" + "upgrade:upgrade leiningen to the latest stable release" + "version:print leiningen's version" + ) + _describe -t subcommands 'leiningen subcommands' subcommands && ret=0 + esac + + return ret +} + +compdef _lein_commands lein From b900162b21206c48363ed8e227e507e1603e3f4d Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Tue, 12 Apr 2011 10:36:45 +0200 Subject: [PATCH 337/614] Updating the README... now links to contributors page --- README.textile | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/README.textile b/README.textile index 86d2652bb..d01c3310a 100644 --- a/README.textile +++ b/README.textile @@ -54,12 +54,6 @@ h3. Uninstalling If you want to uninstall it, just run @uninstall_oh_my_zsh@ from the command line and it'll remove itself and revert you to bash (or your previous zsh config). -h2. Thanks - -* Rick Olson (technoweenie) might remember some of the configuration, which I took from a pastie a few years ago. -* Marcel (noradio) provided Rick the original zsh configuration. -* Nicholas (ulysses) for the "rake autocompletion code":http://weblog.rubyonrails.org/2006/3/9/fast-rake-task-completion-for-zsh. - h2. Help out! I'm far from being a zsh-expert and suspect there are many ways to improve. If you have ideas on how to make the configuration easier to maintain (and faster), don't hesitate to fork and send pull requests! @@ -67,3 +61,11 @@ I'm far from being a zsh-expert and suspect there are many ways to improve. If y h3. Send us your theme! I'm hoping to collect a bunch of themes for our command prompts. You can see existing ones in the @themes/@ directory. + +h2. Contributors + +This project wouldn't exist without all of our awesome users and contributors. + +* "View our growing list of contributors":https://github.com/robbyrussell/oh-my-zsh/contributors + +Thank you so much! \ No newline at end of file From 0190b07feab22c64514e3eae9667927426e76c04 Mon Sep 17 00:00:00 2001 From: James Frasca Date: Thu, 17 Mar 2011 11:22:51 -0700 Subject: [PATCH 338/614] Added the Frisk theme --- themes/frisk.zsh-theme | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 themes/frisk.zsh-theme diff --git a/themes/frisk.zsh-theme b/themes/frisk.zsh-theme new file mode 100644 index 000000000..f181aec90 --- /dev/null +++ b/themes/frisk.zsh-theme @@ -0,0 +1,10 @@ +PROMPT=$' +%{$fg[blue]%}%/%{$reset_color%} $(git_prompt_info)%{$fg[white]%}[%n@%m]%{$reset_color%} %{$fg[white]%}[%T]%{$reset_color%} +%{$fg_bold[black]%}>%{$reset_color%} ' + +PROMPT2="%{$fg_blod[black]%}%_> %{$reset_color%}" + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}[" +ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%} " +ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}*%{$fg[green]%}" +ZSH_THEME_GIT_PROMPT_CLEAN="" From 4330218e1187bd39aa06288e648e2956ae275ade Mon Sep 17 00:00:00 2001 From: James Frasca Date: Thu, 17 Mar 2011 11:22:51 -0700 Subject: [PATCH 339/614] Added the Frisk theme --- themes/frisk.zsh-theme | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 themes/frisk.zsh-theme diff --git a/themes/frisk.zsh-theme b/themes/frisk.zsh-theme new file mode 100644 index 000000000..f181aec90 --- /dev/null +++ b/themes/frisk.zsh-theme @@ -0,0 +1,10 @@ +PROMPT=$' +%{$fg[blue]%}%/%{$reset_color%} $(git_prompt_info)%{$fg[white]%}[%n@%m]%{$reset_color%} %{$fg[white]%}[%T]%{$reset_color%} +%{$fg_bold[black]%}>%{$reset_color%} ' + +PROMPT2="%{$fg_blod[black]%}%_> %{$reset_color%}" + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}[" +ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%} " +ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}*%{$fg[green]%}" +ZSH_THEME_GIT_PROMPT_CLEAN="" From 68335ebbe929d29ebc18212e71cdfc766acfaf45 Mon Sep 17 00:00:00 2001 From: kphoen Date: Mon, 7 Mar 2011 15:15:46 +0100 Subject: [PATCH 340/614] Add: new theme --- themes/kphoen.zsh-theme | 50 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 themes/kphoen.zsh-theme diff --git a/themes/kphoen.zsh-theme b/themes/kphoen.zsh-theme new file mode 100644 index 000000000..0e9b5e73c --- /dev/null +++ b/themes/kphoen.zsh-theme @@ -0,0 +1,50 @@ +# ------------------------------------------------------------------------------ +# FILE: kphoen.zsh-theme +# DESCRIPTION: oh-my-zsh theme file. +# AUTHOR: Kévin Gomez (geek63@gmail.com) +# VERSION: 1.0.0 +# SCREENSHOT: +# ------------------------------------------------------------------------------ + + +if [[ "$TERM" != "dumb" ]] && [[ "$DISABLE_LS_COLORS" != "true" ]]; then + PROMPT='[%{$fg[red]%}%n%{$reset_color%}@%{$fg[magenta]%}%m%{$reset_color%}:%{$fg[blue]%}%~%{$reset_color%}$(git_prompt_info)] +%# ' + + ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[green]%}" + ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" + ZSH_THEME_GIT_PROMPT_DIRTY="" + ZSH_THEME_GIT_PROMPT_CLEAN="" + + # display exitcode on the right when >0 + return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" + + RPROMPT='${return_code}$(git_prompt_status)%{$reset_color%}' + + ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} ✚" + ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} ✹" + ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖" + ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜" + ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═" + ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭" +else + PROMPT='[%n@%m:%~$(git_prompt_info)] +%# ' + + ZSH_THEME_GIT_PROMPT_PREFIX=" on" + ZSH_THEME_GIT_PROMPT_SUFFIX="" + ZSH_THEME_GIT_PROMPT_DIRTY="" + ZSH_THEME_GIT_PROMPT_CLEAN="" + + # display exitcode on the right when >0 + return_code="%(?..%? ↵)" + + RPROMPT='${return_code}$(git_prompt_status)' + + ZSH_THEME_GIT_PROMPT_ADDED=" ✚" + ZSH_THEME_GIT_PROMPT_MODIFIED=" ✹" + ZSH_THEME_GIT_PROMPT_DELETED=" ✖" + ZSH_THEME_GIT_PROMPT_RENAMED=" ➜" + ZSH_THEME_GIT_PROMPT_UNMERGED=" ═" + ZSH_THEME_GIT_PROMPT_UNTRACKED=" ✭" +fi From 88faaec7c9269e22998392f33e1b13ea270d46cb Mon Sep 17 00:00:00 2001 From: Woody Gilk Date: Fri, 11 Mar 2011 21:44:12 -0600 Subject: [PATCH 341/614] Enable alias completion, do not limit completion to just files --- lib/completion.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/completion.zsh b/lib/completion.zsh index 9c2dfecca..e8e9776a5 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -4,6 +4,7 @@ unsetopt menu_complete # do not autoselect the first completion entry unsetopt flowcontrol setopt auto_menu # show completion menu on succesive tab press setopt complete_in_word +setopt complete_aliases setopt always_to_end WORDCHARS='' From 21b5525ea0361ab297e3949e356264f358adf573 Mon Sep 17 00:00:00 2001 From: Alessandro Ghedini Date: Sat, 12 Mar 2011 16:23:55 +0100 Subject: [PATCH 342/614] add 'lol' plugin (based on lolbash) --- plugins/lol/lol.plugin.zsh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 plugins/lol/lol.plugin.zsh diff --git a/plugins/lol/lol.plugin.zsh b/plugins/lol/lol.plugin.zsh new file mode 100644 index 000000000..a7153bb57 --- /dev/null +++ b/plugins/lol/lol.plugin.zsh @@ -0,0 +1,26 @@ +# LOL!!1 +# Source: http://aur.archlinux.org/packages/lolbash/lolbash/lolbash.sh + +alias wtf='dmesg' +alias onoz='cat /var/log/errors.log' +alias rtfm='man' + +alias visible='echo' +alias invisible='cat' +alias moar='more' + +alias icanhas='mkdir' +alias donotwant='rm' +alias dowant='cp' +alias gtfo='mv' + +alias hai='cd' +alias plz='pwd' + +alias inur='locate' + +alias nomz='ps -aux' +alias nomnom='killall' + +alias cya='reboot' +alias kthxbai='halt' From 0f42666575903961c7ec782baa4a7b0485a89b39 Mon Sep 17 00:00:00 2001 From: Alessandro Ghedini Date: Sat, 12 Mar 2011 16:24:20 +0100 Subject: [PATCH 343/614] add completion plugin 'cpanm' for cpanminus --- plugins/cpanm/_cpanm | 67 ++++++++++++++++++++++++++++++++++ plugins/cpanm/cpanm.plugin.zsh | 4 ++ 2 files changed, 71 insertions(+) create mode 100644 plugins/cpanm/_cpanm create mode 100644 plugins/cpanm/cpanm.plugin.zsh diff --git a/plugins/cpanm/_cpanm b/plugins/cpanm/_cpanm new file mode 100644 index 000000000..58451d35a --- /dev/null +++ b/plugins/cpanm/_cpanm @@ -0,0 +1,67 @@ +#compdef cpanm + +## +# cpanminus Z Shell completion script +## +# +# Current supported cpanm version: 1.4000 (Tue Mar 8 01:00:49 PST 2011) +# +# The latest code is always located at: +# https://github.com/rshhh/cpanminus/blob/master/etc/_cpanm +# + +local arguments curcontext="$curcontext" +typeset -A opt_args + + +arguments=( + +# Commands +# '(--install -i)'{--install,-i}'[Installs the modules]' + '(- :)--self-upgrade[Upgrades itself]' + '(- :)--info[Displays distribution info on CPAN]' + '(--installdeps)--installdeps[Only install dependencies]' + '(--look)--look[Download/unpack the distribution and then open the directory with your shell]' + '(- :)'{--help,-h}'[Displays help information]' + '(- :)'{--version,-V}'[Displays software version]' + +# Options + {--force,-f}'[Force install]' + {--notest,-n}'[Do not run unit tests]' + {--sudo,-S}'[sudo to run install commands]' + '(-v --verbose --quiet -q)'{--verbose,-v}'[Turns on chatty output]' + '(-q --quiet --verbose -v)'{--quiet,-q}'[Turns off all output]' + {--local-lib,-l}'[Specify the install base to install modules]' + {--local-lib-contained,-L}'[Specify the install base to install all non-core modules]' + '--mirror[Specify the base URL for the mirror (e.g. http://cpan.cpantesters.org/)]:URLs:_urls' + '--mirror-only[Use the mirror\''s index file instead of the CPAN Meta DB]' + '--prompt[Prompt when configure/build/test fails]' + '--reinstall[Reinstall the distribution even if you already have the latest version installed]' + '--interactive[Turn on interactive configure]' + + '--scandeps[Scan the depencencies of given modules and output the tree in a text format]' + '--format[Specify what format to display the scanned dependency tree]:scandeps format:(tree json yaml dists)' + + '--save-dists[Specify the optional directory path to copy downloaded tarballs]' +# '--uninst-shadows[Uninstalls the shadow files of the distribution that you\''re installing]' + + '--auto-cleanup[Number of days that cpanm\''s work directories expire in. Defaults to 7]' + '(--no-man-pages)--man-pages[Generates man pages for executables (man1) and libraries (man3)]' + '(--man-pages)--no-man-pages[Do not generate man pages]' + + + # Note: Normally with "--lwp", "--wget" and "--curl" options set to true (which is the default) cpanm tries LWP, + # Wget, cURL and HTTP::Tiny (in that order) and uses the first one available. + # (So that the exclusions are not enabled here for the completion) + '(--lwp)--lwp[Use LWP module to download stuff]' + '(--wget)--wget[Use GNU Wget (if available) to download stuff]' + '(--curl)--curl[Use cURL (if available) to download stuff]' + +# Other completions + '*:Local directory or archive:_files -/ -g "*.(tar.gz|tgz|tar.bz2|zip)(-.)"' + # '*::args: _normal' # this looks for default files (any files) +) +_arguments -s $arguments \ + && return 0 + +return 1 diff --git a/plugins/cpanm/cpanm.plugin.zsh b/plugins/cpanm/cpanm.plugin.zsh new file mode 100644 index 000000000..af52d3e8b --- /dev/null +++ b/plugins/cpanm/cpanm.plugin.zsh @@ -0,0 +1,4 @@ +# add cpanm completion function to path +fpath=($ZSH/plugins/cpanm $fpath) +autoload -U compinit +compinit -i From 076957a8d9253eb6f9165eb669c97b7d73859ad9 Mon Sep 17 00:00:00 2001 From: Alessandro Ghedini Date: Sat, 12 Mar 2011 16:25:27 +0100 Subject: [PATCH 344/614] add 'deb' plugin with Debian's apt aliases --- plugins/deb/deb.plugin.zsh | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 plugins/deb/deb.plugin.zsh diff --git a/plugins/deb/deb.plugin.zsh b/plugins/deb/deb.plugin.zsh new file mode 100644 index 000000000..732294a87 --- /dev/null +++ b/plugins/deb/deb.plugin.zsh @@ -0,0 +1,12 @@ +# 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 ac="sudo apt-get clean && sudo apt-get autoclean" # clean apt cache From ea4222d5c8c25e18367145c8a056d99b10f33841 Mon Sep 17 00:00:00 2001 From: Matt Cable Date: Sun, 13 Mar 2011 16:08:12 -0600 Subject: [PATCH 345/614] Add completion for port command --- plugins/macports/_port | 89 ++++++++++++++++++++++++++++ plugins/macports/macports.plugin.zsh | 5 ++ 2 files changed, 94 insertions(+) create mode 100644 plugins/macports/_port diff --git a/plugins/macports/_port b/plugins/macports/_port new file mode 100644 index 000000000..06d7fb426 --- /dev/null +++ b/plugins/macports/_port @@ -0,0 +1,89 @@ +#compdef port + +local subcmds + +# we cache the list of ports +# we shall use some cache policy to avoid problems with new ports +if (( ! $+portlist )); then + portlist=($(port echo all; echo "all current active inactive installed uninstalled outdated")) +fi + +subcmds=( +'activate' +'archive' +'build' +'cat' +'clean' +'configure' +'contents' +'deactivate' +'dependents' +'deps' +'destroot' +'dir' +'distcheck' +'distclean' +'dmg' +'echo' +'edit' +'extract' +'fetch' +'file' +'help' +'info' +'install' +'installed' +'list' +'livecheck' +'location' +'mpkg' +'outdated' +'patch' +'pkg' +'provides' +'rpmpackage' +'search' +'selfupdate' +'sync' +'test' +'unarchive' +'uninstall' +'upgrade' +'variants' +'version' +) + +_arguments -C \ +'-v[verbose mode (generate verbose messages)]' \ +'-d[debug mode (generate debugging messages)]' \ +'-q[quiet mode (suppress messages)]' \ +'-D[specify portdir]' \ +'-k[keep mode (do not autoclean after install)]' \ +'-n[dont follow dependencies in upgrade (only for upgrading)]' \ +'-a[upgrade all installed ports (only for upgrading)]' \ +'-u[uninstall non-active ports when upgrading and uninstalling]' \ +'-f[force mode (ignore state file)]' \ +'-s[source-only mode]' \ +'-b[binary-only mode]' \ +'-o[honor state files older than Portfile]' \ +'*::command:->command' \ +&& return 0 + +case $state in + command) + if ((CURRENT == 1)); then + state=subcommands + else + state=portname + fi + ;; +esac + +case $state in + subcommands) + _describe -t commands 'port commands' subcmds + ;; + portname) + _describe -t commands 'available ports' portlist + ;; +esac diff --git a/plugins/macports/macports.plugin.zsh b/plugins/macports/macports.plugin.zsh index 9564829b0..cbbc49265 100644 --- a/plugins/macports/macports.plugin.zsh +++ b/plugins/macports/macports.plugin.zsh @@ -5,3 +5,8 @@ alias psu="sudo port selfupdate" alias puni="sudo port uninstall inactive" alias puo="sudo port upgrade outdated" alias pup="psu && puo" + +# add macports completion function to path +fpath=($ZSH/plugins/macports $fpath) +autoload -U compinit +compinit -i From 2f6d6909b3535fdf785906a6dfa1bf6d383525ea Mon Sep 17 00:00:00 2001 From: Matt Cable Date: Sun, 13 Mar 2011 17:10:13 -0600 Subject: [PATCH 346/614] Re-order title/tab setting to make window titles work on OSX terminal which doesn't support tabs titles. --- lib/termsupport.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index e1e536690..2843eb075 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -6,8 +6,8 @@ function title { if [[ "$TERM" == "screen" ]]; then print -Pn "\ek$1\e\\" #set screen hardstatus, usually truncated at 20 chars elif [[ ($TERM =~ "^xterm") ]] || [[ ($TERM == "rxvt") ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then - print -Pn "\e]2;$2\a" #set window name print -Pn "\e]1;$1\a" #set icon (=tab) name (will override window name on broken terminal) + print -Pn "\e]2;$2\a" #set window name fi } From 37bf208fdb2f518638f54548f10c6a04bad7b344 Mon Sep 17 00:00:00 2001 From: Daniel Bolton Date: Mon, 14 Mar 2011 01:43:33 -0400 Subject: [PATCH 347/614] add Perl plugins file --- plugins/perl/perl.plugin.zsh | 62 ++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 plugins/perl/perl.plugin.zsh diff --git a/plugins/perl/perl.plugin.zsh b/plugins/perl/perl.plugin.zsh new file mode 100644 index 000000000..f94c4195d --- /dev/null +++ b/plugins/perl/perl.plugin.zsh @@ -0,0 +1,62 @@ +# https://github.com/dbbolton +# +# Below are some useful Perl-related aliases/functions that I use with zsh. + + +# Aliases ################################################################### + +# perlbrew ######## +alias pbi='perlbrew install' +alias pbl='perlbrew list' +alias pbo='perlbrew off' +alias pbs='perlbrew switch' +alias pbu='perlbrew use' + +# Perl ############ + +# perldoc` +alias pd='perldoc' + +# use perl like awk/sed +alias ple='perl -wlne' + +# show the latest stable release of Perl +alias latest-perl='curl -s http://www.perl.org/get.html | perl -wlne '\''if (/perl\-([\d\.]+)\.tar\.gz/) { print $1; exit;}'\' + + + +# Functions ################################################################# + +# newpl - creates a basic Perl script file and opens it with $EDITOR +newpl () { + # set $EDITOR to 'vim' if it is undefined + [[ -z $EDITOR ]] && EDITOR=vim + + # if the file exists, just open it + [[ -e $1 ]] && print "$1 exists; not modifying.\n" && $EDITOR $1 + + # if it doesn't, make it, and open it + [[ ! -e $1 ]] && print '#!/usr/bin/perl'"\n"'use strict;'"\n"'use warnings;'\ + "\n\n" > $1 && $EDITOR $1 +} + + +# pgs - Perl Global Substitution +# find pattern = 1st arg +# replace pattern = 2nd arg +# filename = 3rd arg +pgs() { # [find] [replace] [filename] + perl -i.orig -pe 's/'"$1"'/'"$2"'/g' "$3" +} + + +# Perl grep, because 'grep -P' is terrible. Lets you work with pipes or files. +prep() { # [pattern] [filename unless STDOUT] + perl -nle 'print if /'"$1"'/;' $2 +} + +# say - append a newline to 'print' +say() { + print "$1\n" +} + From ce0e441f34041c8d6baf29c3f6ed841ef02dccc7 Mon Sep 17 00:00:00 2001 From: Tom Kirchner Date: Tue, 15 Mar 2011 00:41:51 +0000 Subject: [PATCH 348/614] Make personal theme based on dst --- themes/tjkirch.zsh-theme | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 themes/tjkirch.zsh-theme diff --git a/themes/tjkirch.zsh-theme b/themes/tjkirch.zsh-theme new file mode 100644 index 000000000..3e2539d57 --- /dev/null +++ b/themes/tjkirch.zsh-theme @@ -0,0 +1,16 @@ + +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 9cd985abac4eeb765e5a9f389f27a62bb239626f Mon Sep 17 00:00:00 2001 From: Tom Kirchner Date: Tue, 15 Mar 2011 00:42:12 +0000 Subject: [PATCH 349/614] Remove unnecessary whitespace --- themes/tjkirch.zsh-theme | 1 - 1 file changed, 1 deletion(-) diff --git a/themes/tjkirch.zsh-theme b/themes/tjkirch.zsh-theme index 3e2539d57..5c5364002 100644 --- a/themes/tjkirch.zsh-theme +++ b/themes/tjkirch.zsh-theme @@ -1,4 +1,3 @@ - ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[green]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}!" From b10dc2f73f45ca578a3c2e8ce53bba6edead7e37 Mon Sep 17 00:00:00 2001 From: Tom Kirchner Date: Tue, 15 Mar 2011 00:42:51 +0000 Subject: [PATCH 350/614] Sweet lightning bolt on uncommitted git changes --- themes/tjkirch.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/tjkirch.zsh-theme b/themes/tjkirch.zsh-theme index 5c5364002..1a93502f8 100644 --- a/themes/tjkirch.zsh-theme +++ b/themes/tjkirch.zsh-theme @@ -1,6 +1,6 @@ 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_DIRTY=" %{$fg[red]%}⚡" ZSH_THEME_GIT_PROMPT_CLEAN="" function prompt_char { From ee31ffdfe56ccc1cdc05b61421e357375d3a03f3 Mon Sep 17 00:00:00 2001 From: Tom Kirchner Date: Tue, 15 Mar 2011 00:43:22 +0000 Subject: [PATCH 351/614] Actually show return code on failure --- themes/tjkirch.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/tjkirch.zsh-theme b/themes/tjkirch.zsh-theme index 1a93502f8..458ee1721 100644 --- a/themes/tjkirch.zsh-theme +++ b/themes/tjkirch.zsh-theme @@ -7,7 +7,7 @@ function prompt_char { if [ $UID -eq 0 ]; then echo "%{$fg[red]%}#%{$reset_color%}"; else echo $; fi } -PROMPT='%(?, ,%{$fg[red]%}FAIL%{$reset_color%} +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) ' From bb1a7c00c0779498ea9fa9ee5687f928b36bad95 Mon Sep 17 00:00:00 2001 From: Tom Kirchner Date: Tue, 15 Mar 2011 00:43:37 +0000 Subject: [PATCH 352/614] No space before prompt char at beginning of line --- themes/tjkirch.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/tjkirch.zsh-theme b/themes/tjkirch.zsh-theme index 458ee1721..446cde724 100644 --- a/themes/tjkirch.zsh-theme +++ b/themes/tjkirch.zsh-theme @@ -10,6 +10,6 @@ function prompt_char { 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) ' +%_$(prompt_char) ' RPROMPT='%{$fg[green]%}[%*]%{$reset_color%}' From 6df8d73e2778f7a946805d86d69e180aac7e8615 Mon Sep 17 00:00:00 2001 From: Daniel Bolton Date: Tue, 15 Mar 2011 20:31:14 -0400 Subject: [PATCH 353/614] Add debian plugins file --- plugins/debian/debian.plugin.zsh | 60 ++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 plugins/debian/debian.plugin.zsh diff --git a/plugins/debian/debian.plugin.zsh b/plugins/debian/debian.plugin.zsh new file mode 100644 index 000000000..f8865a412 --- /dev/null +++ b/plugins/debian/debian.plugin.zsh @@ -0,0 +1,60 @@ +# https://github.com/dbbolton/ +# +# Debian-related zsh aliases and functions for zsh + + +# Aliases ################################################################### + +# Some self-explanatory aliases +alias afs='apt-file search --regexp' +alias aps='aptitude search' +alias apsrc='apt-get source' +alias apv='apt-cache policy' + +alias apdg='su -c "aptitude update && aptitude safe-upgrade"' +alias apud='su -c "aptitude update"' +alias apug='su -c "aptitude safe-upgrade"' + +# 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 -c "dpkg -i ./*.deb"' + +# 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' + + + +# Functions ################################################################# + +# create a simple script that can be used to 'duplicate' a system +apt-copy() { + 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;') + + print 'aptitude install '"$list\n" >> apt-copy.sh + + chmod +x apt-copy.sh +} + + +# Kernel-package building shortcut +dbb-build () { + MAKEFLAGS='' # temporarily unset MAKEFLAGS ( '-j3' will fail ) + appendage='-custom' # this shows up in $ (uname -r ) + revision=$(date +"%Y%m%d") # this shows up in the .deb file name + + make-kpkg clean + + time fakeroot make-kpkg --append-to-version "$appendage" --revision \ + "$revision" kernel_image kernel_headers +} + + From 2a8a861ac30f4ddf0be59622b7d70841deae9cc2 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Wed, 16 Mar 2011 12:20:35 -0700 Subject: [PATCH 354/614] Revert "Re-order title/tab setting to make window titles work on OSX terminal which" Was causing iTerm title to disappear entirely.. This reverts commit d4ea399b04ef57dd31097eadc316305d1e42a194. --- lib/termsupport.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index 2843eb075..e1e536690 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -6,8 +6,8 @@ function title { if [[ "$TERM" == "screen" ]]; then print -Pn "\ek$1\e\\" #set screen hardstatus, usually truncated at 20 chars elif [[ ($TERM =~ "^xterm") ]] || [[ ($TERM == "rxvt") ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then - print -Pn "\e]1;$1\a" #set icon (=tab) name (will override window name on broken terminal) print -Pn "\e]2;$2\a" #set window name + print -Pn "\e]1;$1\a" #set icon (=tab) name (will override window name on broken terminal) fi } From c02b29159b036e7dd70caa2acd071f9817007b0a Mon Sep 17 00:00:00 2001 From: Lorrin Nelson Date: Wed, 23 Mar 2011 21:20:08 -0700 Subject: [PATCH 355/614] Introduce DISABLE_AUTO_TITLE option --- lib/termsupport.zsh | 10 +++++++--- templates/zshrc.zsh-template | 3 +++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index e1e536690..b250833ed 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -16,11 +16,15 @@ ZSH_THEME_TERM_TITLE_IDLE="%n@%m: %~" #Appears when you have the prompt function precmd { - title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE + if [ "$DISABLE_AUTO_TITLE" != "true" ]; then + title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE + fi } #Appears at the beginning of (and during) of command execution function preexec { - local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd - title "$CMD" "%100>...>$2%<<" + if [ "$DISABLE_AUTO_TITLE" != "true" ]; then + local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd + title "$CMD" "%100>...>$2%<<" + fi } diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template index 8022b3506..506daa9a2 100644 --- a/templates/zshrc.zsh-template +++ b/templates/zshrc.zsh-template @@ -14,6 +14,9 @@ export ZSH_THEME="robbyrussell" # Uncomment following line if you want to disable colors in ls # export DISABLE_LS_COLORS="true" +# Uncomment following line if you want to disable autosetting terminal title. +# export DISABLE_AUTO_TITLE="true" + # Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) # Example format: plugins=(rails git textmate ruby lighthouse) plugins=(git) From 91911bf3b9b70bf7783863bfe5b6f6b9581adde8 Mon Sep 17 00:00:00 2001 From: Simon Elsbrock Date: Thu, 24 Mar 2011 09:47:48 +0100 Subject: [PATCH 356/614] fixed wget command in readme github uses a wildcard certificate which is not accepted by wget --- README.textile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.textile b/README.textile index 0659aded8..86d2652bb 100644 --- a/README.textile +++ b/README.textile @@ -8,7 +8,7 @@ h2. Setup h3. The automatic installer... (do you trust me?) -@wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh@ +@wget --no-check-certificate https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh@ h3. The manual way @@ -66,4 +66,4 @@ I'm far from being a zsh-expert and suspect there are many ways to improve. If y h3. Send us your theme! -I'm hoping to collect a bunch of themes for our command prompts. You can see existing ones in the @themes/@ directory. \ No newline at end of file +I'm hoping to collect a bunch of themes for our command prompts. You can see existing ones in the @themes/@ directory. From 56b3bc69544b99816f637975ea2a4cafab58198f Mon Sep 17 00:00:00 2001 From: "Matthew M. Nelson" Date: Thu, 31 Mar 2011 13:51:29 -0500 Subject: [PATCH 357/614] Adding dogenpunk theme --- themes/dogenpunk.zsh-theme | 85 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 themes/dogenpunk.zsh-theme diff --git a/themes/dogenpunk.zsh-theme b/themes/dogenpunk.zsh-theme new file mode 100644 index 000000000..f4d65ab74 --- /dev/null +++ b/themes/dogenpunk.zsh-theme @@ -0,0 +1,85 @@ +# ----------------------------------------------------------------------------- +# FILE: dogenpunk.zsh-theme +# DESCRIPTION: oh-my-zsh theme file. +# AUTHOR: Matthew Nelson (dogenpunk@gmail.com) +# VERSION: 0.1 +# SCREENSHOT: coming soon +# ----------------------------------------------------------------------------- + +MODE_INDICATOR="%{$fg_bold[red]%}❮%{$reset_color%}%{$fg[red]%}❮❮%{$reset_color%}" +local return_status="%{$fg[red]%}%(?..⏎)%{$reset_color%}" + +PROMPT='%{$fg[blue]%}%m%{$reset_color%}%{$fg_bold[white]%} ओम् %{$reset_color%}%{$fg[cyan]%}%~:%{$reset_color%}$(git_time_since_commit)$(git_prompt_info) +%{$fg[red]%}%!%{$reset_color%} $(prompt_char) ' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[green]%}git%{$reset_color%}@%{$bg[white]%}%{$fg[black]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%})" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}!%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="" + +RPROMPT='${return_status}$(git_prompt_status)%{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} ✚" +ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} ✹" +ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖" +ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜" +ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭" + +function prompt_char() { + git branch >/dev/null 2>/dev/null && echo "%{$fg[green]%}±%{$reset_color%}" && return + hg root >/dev/null 2>/dev/null && echo "%{$fg_bold[red]%}☿%{$reset_color%}" && return + echo "%{$fg[cyan]%}◯ %{$reset_color%}" +} + +# Colors vary depending on time lapsed. +ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT="%{$fg[green]%}" +ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM="%{$fg[yellow]%}" +ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG="%{$fg[red]%}" +ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[cyan]%}" + +# Determine the time since last commit. If branch is clean, +# use a neutral color, otherwise colors will vary according to time. +function git_time_since_commit() { + if git rev-parse --git-dir > /dev/null 2>&1; then + # Only proceed if there is actually a commit. + if [[ $(git log 2>&1 > /dev/null | grep -c "^fatal: bad default revision") == 0 ]]; then + # Get the last commit. + last_commit=`git log --pretty=format:'%at' -1 2> /dev/null` + now=`date +%s` + seconds_since_last_commit=$((now-last_commit)) + + # Totals + MINUTES=$((seconds_since_last_commit / 60)) + HOURS=$((seconds_since_last_commit/3600)) + + # Sub-hours and sub-minutes + DAYS=$((seconds_since_last_commit / 86400)) + SUB_HOURS=$((HOURS % 24)) + SUB_MINUTES=$((MINUTES % 60)) + + if [[ -n $(git status -s 2> /dev/null) ]]; then + if [ "$MINUTES" -gt 30 ]; then + COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG" + elif [ "$MINUTES" -gt 10 ]; then + COLOR="$ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM" + else + COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT" + fi + else + COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL" + fi + + if [ "$HOURS" -gt 24 ]; then + echo "($COLOR${DAYS}d${SUB_HOURS}h${SUB_MINUTES}m%{$reset_color%}|" + elif [ "$MINUTES" -gt 60 ]; then + echo "($COLOR${HOURS}h${SUB_MINUTES}m%{$reset_color%}|" + else + echo "($COLOR${MINUTES}m%{$reset_color%}|" + fi + else + COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL" + echo "($COLOR~|" + fi + fi +} From 758b415e72dfbb3f1e6f0088e8792d6ba039ada5 Mon Sep 17 00:00:00 2001 From: Jakub Nawalaniec Date: Sun, 3 Apr 2011 13:50:05 +0200 Subject: [PATCH 358/614] Zsh will now complete git aliases with git stuff --- plugins/git/git.plugin.zsh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 71a62819b..fc4e56fac 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -1,19 +1,34 @@ # Aliases alias g='git' +compdef g=git alias gst='git status' +compdef gst=git alias gl='git pull' +compdef gl=git alias gup='git fetch && git rebase' +compdef gup=git alias gp='git push' +compdef gp=git alias gd='git diff | mate' +compdef gd=git alias gdv='git diff -w "$@" | vim -R -' +compdef gdv=git alias gc='git commit -v' +compdef gc=git alias gca='git commit -v -a' +compdef gca=git alias gco='git checkout' +compdef gco=git alias gb='git branch' +compdef gb=git alias gba='git branch -a' +compdef gba=git alias gcount='git shortlog -sn' +compdef gcount=git alias gcp='git cherry-pick' +compdef gcp=git alias glg='git log --stat --max-count=5' +compdef glg=git # Git and svn mix alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk' @@ -29,5 +44,8 @@ function current_branch() { # these aliases take advantage of the previous function alias ggpull='git pull origin $(current_branch)' +compdef ggpull=git alias ggpush='git push origin $(current_branch)' +compdef ggpush=git alias ggpnp='git pull origin $(current_branch) && git push origin $(current_branch)' +compdef ggpnp=git From e684afcba0bc15f7330f03d4f1f652e1865b3d6a Mon Sep 17 00:00:00 2001 From: Jakub Nawalaniec Date: Sun, 3 Apr 2011 15:43:39 +0200 Subject: [PATCH 359/614] Completions are git subdommand-aware now --- plugins/git/git.plugin.zsh | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index fc4e56fac..8470c28a4 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -2,15 +2,16 @@ alias g='git' compdef g=git alias gst='git status' -compdef gst=git +compdef _git gst=git-status alias gl='git pull' -compdef gl=git +compdef _git gl=git-pull alias gup='git fetch && git rebase' compdef gup=git alias gp='git push' -compdef gp=git +compdef _git gp=git-push alias gd='git diff | mate' -compdef gd=git +# WTF is mate?? +compdef _git gd=git-diff alias gdv='git diff -w "$@" | vim -R -' compdef gdv=git alias gc='git commit -v' @@ -18,20 +19,21 @@ compdef gc=git alias gca='git commit -v -a' compdef gca=git alias gco='git checkout' -compdef gco=git +compdef _git gco=git-checkout alias gb='git branch' -compdef gb=git +compdef _git gb=git-branch alias gba='git branch -a' compdef gba=git alias gcount='git shortlog -sn' compdef gcount=git alias gcp='git cherry-pick' -compdef gcp=git +compdef _git gcp=git-cherry-pick alias glg='git log --stat --max-count=5' -compdef glg=git +compdef _git glg=git-log # Git and svn mix alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk' +compdef git-svn-dcommit-push=git # # Will return the current branch name From a6b806080a5a2b3ca0751ce9351e2e05f6dd1b8d Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 7 Apr 2011 10:23:06 +0200 Subject: [PATCH 360/614] new yum plugin with useful aliases --- plugins/yum/yum.plugin.zsh | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 plugins/yum/yum.plugin.zsh diff --git a/plugins/yum/yum.plugin.zsh b/plugins/yum/yum.plugin.zsh new file mode 100644 index 000000000..d6ba7ed62 --- /dev/null +++ b/plugins/yum/yum.plugin.zsh @@ -0,0 +1,12 @@ +## Aliases + +alias ys="yum search" # search package +alias yp="yum info" # show package info +alias yl="yum list" # list packages +alias yli="yum list installed" # print all installed packages + +alias yu="sudo yum update" # upgrate packages +alias yi="sudo yum install" # install package +alias yr="sudo yum remove" # remove package +alias yrl="sudo yum remove --remove-leaves" # remove package and leaves +alias yc="sudo yum clean all" # clean cache From 782883b5d8db1971cc14948b9c2adc51f17f8898 Mon Sep 17 00:00:00 2001 From: Pat Regan Date: Fri, 8 Apr 2011 10:12:22 -0400 Subject: [PATCH 361/614] Replace redundant calls to compinit with a single call. --- lib/completion.zsh | 3 --- lib/key-bindings.zsh | 2 -- oh-my-zsh.sh | 4 ++++ plugins/brew/brew.plugin.zsh | 2 -- plugins/cpanm/cpanm.plugin.zsh | 2 -- plugins/gem/gem.plugin.zsh | 2 -- plugins/github/github.plugin.zsh | 2 -- plugins/macports/macports.plugin.zsh | 2 -- plugins/pip/pip.plugin.zsh | 2 -- plugins/vagrant/vagrant.plugin.zsh | 2 -- 10 files changed, 4 insertions(+), 19 deletions(-) diff --git a/lib/completion.zsh b/lib/completion.zsh index e8e9776a5..3c5a41e14 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -9,9 +9,6 @@ setopt always_to_end WORDCHARS='' -autoload -U compinit -compinit -i - zmodload -i zsh/complist ## case-insensitive (all),partial-word and then substring completion diff --git a/lib/key-bindings.zsh b/lib/key-bindings.zsh index 7196a88ff..c7ad907d7 100644 --- a/lib/key-bindings.zsh +++ b/lib/key-bindings.zsh @@ -1,6 +1,4 @@ # TODO: Explain what some of this does.. -autoload -U compinit -compinit -i bindkey -e bindkey '\ew' kill-region diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 291772dfe..805e92428 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -17,6 +17,10 @@ for plugin ($plugins) source $ZSH/plugins/$plugin/$plugin.plugin.zsh # Load the theme source "$ZSH/themes/$ZSH_THEME.zsh-theme" +# Load and run compinit +autoload -U compinit +compinit -i + # Check for updates on initial load... if [ "$DISABLE_AUTO_UPDATE" = "true" ] then diff --git a/plugins/brew/brew.plugin.zsh b/plugins/brew/brew.plugin.zsh index 353a18942..079c0fba0 100644 --- a/plugins/brew/brew.plugin.zsh +++ b/plugins/brew/brew.plugin.zsh @@ -1,4 +1,2 @@ # add brew completion function to path fpath=($ZSH/plugins/brew $fpath) -autoload -U compinit -compinit -i diff --git a/plugins/cpanm/cpanm.plugin.zsh b/plugins/cpanm/cpanm.plugin.zsh index af52d3e8b..8425b5ad8 100644 --- a/plugins/cpanm/cpanm.plugin.zsh +++ b/plugins/cpanm/cpanm.plugin.zsh @@ -1,4 +1,2 @@ # add cpanm completion function to path fpath=($ZSH/plugins/cpanm $fpath) -autoload -U compinit -compinit -i diff --git a/plugins/gem/gem.plugin.zsh b/plugins/gem/gem.plugin.zsh index d4e5c6584..cdfad7ad6 100644 --- a/plugins/gem/gem.plugin.zsh +++ b/plugins/gem/gem.plugin.zsh @@ -1,4 +1,2 @@ # add gem completion function to path fpath=($ZSH/plugins/gem $fpath) -autoload -U compinit -compinit -i diff --git a/plugins/github/github.plugin.zsh b/plugins/github/github.plugin.zsh index c23504b85..0858783cc 100644 --- a/plugins/github/github.plugin.zsh +++ b/plugins/github/github.plugin.zsh @@ -1,4 +1,2 @@ # add github completion function to path fpath=($ZSH/plugins/github $fpath) -autoload -U compinit -compinit -i diff --git a/plugins/macports/macports.plugin.zsh b/plugins/macports/macports.plugin.zsh index cbbc49265..492a665b5 100644 --- a/plugins/macports/macports.plugin.zsh +++ b/plugins/macports/macports.plugin.zsh @@ -8,5 +8,3 @@ alias pup="psu && puo" # add macports completion function to path fpath=($ZSH/plugins/macports $fpath) -autoload -U compinit -compinit -i diff --git a/plugins/pip/pip.plugin.zsh b/plugins/pip/pip.plugin.zsh index bf9f23968..740f96207 100644 --- a/plugins/pip/pip.plugin.zsh +++ b/plugins/pip/pip.plugin.zsh @@ -1,4 +1,2 @@ # add brew completion function to path fpath=($ZSH/plugins/pip $fpath) -autoload -U compinit -compinit -i diff --git a/plugins/vagrant/vagrant.plugin.zsh b/plugins/vagrant/vagrant.plugin.zsh index 5e9bcf10a..98d2d705c 100644 --- a/plugins/vagrant/vagrant.plugin.zsh +++ b/plugins/vagrant/vagrant.plugin.zsh @@ -1,3 +1 @@ fpath=($ZSH/plugins/vagrant $fpath) -autoload -U compinit -compinit -i From a56e12932f9dbb923b1d935b6741243f1040665a Mon Sep 17 00:00:00 2001 From: Pat Regan Date: Fri, 8 Apr 2011 11:10:14 -0400 Subject: [PATCH 362/614] Moved the single compinit call from oh-my-zsh.sh to lib/completion.zsh --- lib/completion.zsh | 4 ++++ oh-my-zsh.sh | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/completion.zsh b/lib/completion.zsh index 3c5a41e14..21735e7e9 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -60,3 +60,7 @@ zstyle ':completion:*:*:*:users' ignored-patterns \ # ... unless we really want to. zstyle '*' single-ignored show +# Load and run compinit +autoload -U compinit +compinit -i + diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 805e92428..3970a497e 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -18,8 +18,8 @@ for plugin ($plugins) source $ZSH/plugins/$plugin/$plugin.plugin.zsh source "$ZSH/themes/$ZSH_THEME.zsh-theme" # Load and run compinit -autoload -U compinit -compinit -i +#autoload -U compinit +#compinit -i # Check for updates on initial load... if [ "$DISABLE_AUTO_UPDATE" = "true" ] From eeea6e4fb6999bc1e9e9f404162a31ec85cff20e Mon Sep 17 00:00:00 2001 From: Pat Regan Date: Fri, 8 Apr 2011 11:12:21 -0400 Subject: [PATCH 363/614] Removed commented out code. --- oh-my-zsh.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 3970a497e..291772dfe 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -17,10 +17,6 @@ for plugin ($plugins) source $ZSH/plugins/$plugin/$plugin.plugin.zsh # Load the theme source "$ZSH/themes/$ZSH_THEME.zsh-theme" -# Load and run compinit -#autoload -U compinit -#compinit -i - # Check for updates on initial load... if [ "$DISABLE_AUTO_UPDATE" = "true" ] then From af0b6ac28f6a78d8d41b0b2c56ab1f470183116f Mon Sep 17 00:00:00 2001 From: Pat Regan Date: Tue, 12 Apr 2011 09:28:15 -0400 Subject: [PATCH 364/614] Moved compinit call back to oh-my-zsh.sh, after plugins are loaded --- lib/completion.zsh | 4 ---- oh-my-zsh.sh | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/completion.zsh b/lib/completion.zsh index 21735e7e9..3c5a41e14 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -60,7 +60,3 @@ zstyle ':completion:*:*:*:users' ignored-patterns \ # ... unless we really want to. zstyle '*' single-ignored show -# Load and run compinit -autoload -U compinit -compinit -i - diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 291772dfe..84a850ca3 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -14,6 +14,10 @@ for config_file ($ZSH/custom/*.zsh) source $config_file plugin=${plugin:=()} for plugin ($plugins) source $ZSH/plugins/$plugin/$plugin.plugin.zsh +# Load and run compinit +autoload -U compinit +compinit -i + # Load the theme source "$ZSH/themes/$ZSH_THEME.zsh-theme" From 6aad987f8231960462eca900d2dc77ad10cfb9aa Mon Sep 17 00:00:00 2001 From: Pat Regan Date: Tue, 12 Apr 2011 17:41:09 -0400 Subject: [PATCH 365/614] Optimize plugin loading so that only one call to compinit is required --- oh-my-zsh.sh | 13 +++++++++++-- plugins/brew/brew.plugin.zsh | 2 -- plugins/cpanm/cpanm.plugin.zsh | 2 -- plugins/gem/gem.plugin.zsh | 2 -- plugins/github/github.plugin.zsh | 2 -- plugins/macports/macports.plugin.zsh | 2 -- plugins/pip/pip.plugin.zsh | 2 -- plugins/vagrant/vagrant.plugin.zsh | 1 - 8 files changed, 11 insertions(+), 15 deletions(-) delete mode 100644 plugins/brew/brew.plugin.zsh delete mode 100644 plugins/cpanm/cpanm.plugin.zsh delete mode 100644 plugins/gem/gem.plugin.zsh delete mode 100644 plugins/github/github.plugin.zsh delete mode 100644 plugins/pip/pip.plugin.zsh delete mode 100644 plugins/vagrant/vagrant.plugin.zsh diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 84a850ca3..0c85de714 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -10,14 +10,23 @@ for config_file ($ZSH/lib/*.zsh) source $config_file # Load all of your custom configurations from custom/ for config_file ($ZSH/custom/*.zsh) source $config_file -# Load all of the plugins that were defined in ~/.zshrc +# Add all defined plugins to fpath plugin=${plugin:=()} -for plugin ($plugins) source $ZSH/plugins/$plugin/$plugin.plugin.zsh +for plugin ($plugins) fpath=($ZSH/plugins/$plugin $fpath) # Load and run compinit autoload -U compinit compinit -i +# Load all of the plugins that were defined in ~/.zshrc +for plugin ($plugins) +do + if [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ] + then + source $ZSH/plugins/$plugin/$plugin.plugin.zsh + fi +done + # Load the theme source "$ZSH/themes/$ZSH_THEME.zsh-theme" diff --git a/plugins/brew/brew.plugin.zsh b/plugins/brew/brew.plugin.zsh deleted file mode 100644 index 079c0fba0..000000000 --- a/plugins/brew/brew.plugin.zsh +++ /dev/null @@ -1,2 +0,0 @@ -# add brew completion function to path -fpath=($ZSH/plugins/brew $fpath) diff --git a/plugins/cpanm/cpanm.plugin.zsh b/plugins/cpanm/cpanm.plugin.zsh deleted file mode 100644 index 8425b5ad8..000000000 --- a/plugins/cpanm/cpanm.plugin.zsh +++ /dev/null @@ -1,2 +0,0 @@ -# add cpanm completion function to path -fpath=($ZSH/plugins/cpanm $fpath) diff --git a/plugins/gem/gem.plugin.zsh b/plugins/gem/gem.plugin.zsh deleted file mode 100644 index cdfad7ad6..000000000 --- a/plugins/gem/gem.plugin.zsh +++ /dev/null @@ -1,2 +0,0 @@ -# add gem completion function to path -fpath=($ZSH/plugins/gem $fpath) diff --git a/plugins/github/github.plugin.zsh b/plugins/github/github.plugin.zsh deleted file mode 100644 index 0858783cc..000000000 --- a/plugins/github/github.plugin.zsh +++ /dev/null @@ -1,2 +0,0 @@ -# add github completion function to path -fpath=($ZSH/plugins/github $fpath) diff --git a/plugins/macports/macports.plugin.zsh b/plugins/macports/macports.plugin.zsh index 492a665b5..277352e32 100644 --- a/plugins/macports/macports.plugin.zsh +++ b/plugins/macports/macports.plugin.zsh @@ -6,5 +6,3 @@ alias puni="sudo port uninstall inactive" alias puo="sudo port upgrade outdated" alias pup="psu && puo" -# add macports completion function to path -fpath=($ZSH/plugins/macports $fpath) diff --git a/plugins/pip/pip.plugin.zsh b/plugins/pip/pip.plugin.zsh deleted file mode 100644 index 740f96207..000000000 --- a/plugins/pip/pip.plugin.zsh +++ /dev/null @@ -1,2 +0,0 @@ -# add brew completion function to path -fpath=($ZSH/plugins/pip $fpath) diff --git a/plugins/vagrant/vagrant.plugin.zsh b/plugins/vagrant/vagrant.plugin.zsh deleted file mode 100644 index 98d2d705c..000000000 --- a/plugins/vagrant/vagrant.plugin.zsh +++ /dev/null @@ -1 +0,0 @@ -fpath=($ZSH/plugins/vagrant $fpath) From 87030f4d83eb9cfe8883bd9a109b48a0a9e8a70e Mon Sep 17 00:00:00 2001 From: Pat Regan Date: Tue, 12 Apr 2011 17:50:15 -0400 Subject: [PATCH 366/614] Moved the plugin fpath loop and compinit so they happen before custom scripts are loaded. --- oh-my-zsh.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 0c85de714..ad4b268ae 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -7,9 +7,6 @@ fpath=($ZSH/functions $fpath) # TIP: Add files you don't want in git to .gitignore for config_file ($ZSH/lib/*.zsh) source $config_file -# Load all of your custom configurations from custom/ -for config_file ($ZSH/custom/*.zsh) source $config_file - # Add all defined plugins to fpath plugin=${plugin:=()} for plugin ($plugins) fpath=($ZSH/plugins/$plugin $fpath) @@ -18,6 +15,9 @@ for plugin ($plugins) fpath=($ZSH/plugins/$plugin $fpath) autoload -U compinit compinit -i +# Load all of your custom configurations from custom/ +for config_file ($ZSH/custom/*.zsh) source $config_file + # Load all of the plugins that were defined in ~/.zshrc for plugin ($plugins) do From 42b7e5d0beef16eebf3a4331ed940329038455d7 Mon Sep 17 00:00:00 2001 From: Pat Regan Date: Tue, 12 Apr 2011 19:53:55 -0400 Subject: [PATCH 367/614] Minor reformatting --- oh-my-zsh.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index ad4b268ae..c7a4c320a 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -19,10 +19,8 @@ compinit -i for config_file ($ZSH/custom/*.zsh) source $config_file # Load all of the plugins that were defined in ~/.zshrc -for plugin ($plugins) -do - if [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ] - then +for plugin ($plugins); do + if [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then source $ZSH/plugins/$plugin/$plugin.plugin.zsh fi done From 1e784edb04c9d936b261407e37369f9ffd4fef4b Mon Sep 17 00:00:00 2001 From: alexandru Date: Thu, 14 Apr 2011 16:22:18 -0700 Subject: [PATCH 368/614] redis-cli completion plugin --- plugins/redis-cli/_redis-cli | 142 +++++++++++++++++++++++++ plugins/redis-cli/redis-cli.plugin.zsh | 4 + 2 files changed, 146 insertions(+) create mode 100644 plugins/redis-cli/_redis-cli create mode 100644 plugins/redis-cli/redis-cli.plugin.zsh diff --git a/plugins/redis-cli/_redis-cli b/plugins/redis-cli/_redis-cli new file mode 100644 index 000000000..3789add18 --- /dev/null +++ b/plugins/redis-cli/_redis-cli @@ -0,0 +1,142 @@ +#compdef redis-cli rec +#autoload + +#redis cli completion, based off homebrew completion (ref. 2011-04-14) + +local -a _1st_arguments +_1st_arguments=( + 'append:append a value to a key' + 'auth:authenticate to the server' + 'bgrewriteeaof:asynchronously rewrite the append-only file' + 'bgsave:asynchornously save the dataset to disk' + 'blpop:remove and get the first element in a list, or block until one is available' + 'brpop:remove and get the last element in a list, or block until one is available' + 'brpoplpush:pop a value from a list, push it to another list and return it; or block until one is available' + # 'config get:get the value of a configuration parameter' + # 'config set:set a configuration parameter to the given value' + # 'config resetstat: reset the stats returned by INFO' + 'dbsize:return the number of keys in the selected database' + # 'debug object:get debugging information about a key' + # 'debug setgfault:make the server crash' + 'decr:decrement the integer value of a key by one' + 'decrby:decrement the integet value of a key by the given number' + 'del:delete a key' + 'discard:discard all commands issued after MULTI' + 'echo:echo the given string' + 'exec:execute all commands issued after a MULTI' + 'exists:determine if a key exists' + 'expire:set the time to live for a key, in seconds' + 'expireat:set the expiration for a key as a UNIX timestamp' + 'flushall:remove all keys from all databases' + 'flushdb:remove all keys from the current database' + 'get:get the value of a key' + 'getbit:returns the bit value at offset in the string value stored at key' + 'getrange:get a substring of the string stored at a key' + 'getset:set the string value of a key and return its old value' + 'hdel:delete a hash field' + 'hexists:determine if a hash field exists' + 'hget:get the value of a hash field' + 'hgetall:get all the fields and values in a hash' + 'hincrby:increment the integer value of a hash field by the given number' + 'hkeys:get all the fields in a hash' + 'hlen:get the number of fields in a hash' + 'hmget:get the values of all the given hash fields' + 'hmset:set multiple hash fields to multiple values' + 'hset:set the string value of a hash field' + 'hsetnx:set the value of a hash field, only if the field does not exist' + 'hvals:get all the values in a hash' + 'incr:increment the integer value of a key by one' + 'incrby:increment the integer value of a key by the given number' + 'info:get information and statistics about the server' + 'keys:find all keys matching the given pattern' + 'lastsave:get the UNIX timestamp of the last successful save to disk' + 'lindex:get an element from a list by its index' + 'linset:insert an element before or after another element in a list' + 'llen:get the length of a list' + 'lpop:remove and get the first element in a list' + 'lpush:prepend a value to a list' + 'lpushx:prepend a value to a list, only if the list exists' + 'lrange:get a range of elements from a list' + 'lrem:remove elements from a list' + 'lset:set the value of an element in a list by its index' + 'ltrim:trim a list to the specified range' + 'mget:get the values of all the given keys' + 'monitor:listen for all requests received by the server in real time' + 'move:move a key to another database' + 'mset:set multiple keys to muliple values' + 'msetnx:set multiple keys tom ultiple values, only if none of the keys exist' + 'multi:mark the start of a transaction block' + 'object:inspect the internals of Redis objects' + 'persist:remove the expiration from a key' + 'ping:ping the server' + 'psubscribe:listen for messages published to channels matching the given patterns' + 'publish:post a message to a channel' + 'punsubscribe:stop listening for messages posted to channels matching the given patterns' + 'quit:close the connection' + 'randomkey:return a random key from the keyspace' + 'rename:rename a key' + 'renamenx:rename a key, only if the new key does not exist' + 'rpop:remove and get the last element in a list' + 'rpoplpush:remove the last element in a list, append it to another list and return it' + 'rpush:append a value to a list' + 'rpushx:append a value to a list, only if the list exists' + 'sadd:add a member to a set' + 'save:synchronously save the dataset to disk' + 'scard:get the number of members in a set' + 'sdiff:subtract multiple sets' + 'sdiffstore:subtract multiple sets and store the resulting set in a key' + 'select:change the selected database for the current connection' + 'set:set the string value of a key' + 'setbit:sets or clears the bit at offset in the string value stored at key' + 'setex:set the value and expiration of a key' + 'setnx:set the value of a key, only if the key does not exist' + 'setrange:overwrite part of a string at key starting at the specified offset' + 'shutdown:synchronously save the dataset to disk and then shut down the server' + 'sinter:intersect multiple sets' + 'sinterstore:intersect multiple sets and store the resulting set in a key' + 'sismember:determine if a given value is a member of a set' + 'slaveof:make the server a slave of another instance, or promote it as master' + 'smembers:get all the members in a set' + 'smove:move a member from one set to another' + 'sort:sort the elements in a list, set or sorted set' + 'spop:remove and return a random member from a set' + 'srandmember:get a random member from a set' + 'srem:remove a member from a set' + 'strlen:get the length of the value stored in a key' + 'subscribe:listen for messages published to the given channels' + 'sunion:add multiple sets' + 'sunionstore:add multiple sets and store the resulting set in a key' + 'ttl:get the time to live for a key' + 'type:determine the type stored at key' + 'unsubscribe:stop listening for messages posted to the given channels' + 'unwatch:forget about all watched keys' + 'watch:watch the given keys to determine execution of the MULTI/EXEC block' + 'zadd:add a member to a sorted set, or update its score if it already exists' + 'zcard:get the number of members in a sorted set' + 'zcount:count the members in a sorted set with scores within the given values' + 'zincrby:increment the score of a member in a sorted set' + 'zinterstore:intersect multiple sorted sets and store the resulting sorted set in a new key' + 'zrange:return a range of members in a sorted set, by index' + 'zrangebyscore:return a range of members in a sorted set, by score' + 'zrank:determine the index of a member in a sorted set' + 'zrem:remove a member from a sorted set' + 'zremrangebyrank:remove all members in a sorted set within the given indexes' + 'zremrangebyscore:remove all members in a sorted set within the given scores' + 'zrevrange:return a range of membrs in a sorted set, by index, with scores ordered from high to low' + 'zrevrangebyscore:return a range of members in a sorted set, by score, with scores ordered from high to low' + 'zrevrank:determine the index of a member in a sorted set, with scores ordered from high to low' + 'zscore:get the score associated with the given member in a sorted set' + 'zunionstore:add multiple sorted sets and store te resulting sorted set in a new key' +) + +local expl + +_arguments \ + '(-v --version)'{-v,--version}'[show version]' \ + '(-h --help)'{-h,--help}'[show help]' \ + '*:: :->subcmds' && return 0 + +if (( CURRENT == 1 )); then + _describe -t commands "redis-cli subcommand" _1st_arguments + return +fi \ No newline at end of file diff --git a/plugins/redis-cli/redis-cli.plugin.zsh b/plugins/redis-cli/redis-cli.plugin.zsh new file mode 100644 index 000000000..af5a843c9 --- /dev/null +++ b/plugins/redis-cli/redis-cli.plugin.zsh @@ -0,0 +1,4 @@ +# add redis completion function to path +fpath=($ZSH/plugins/redis-cli $fpath) +autoload -U compinit +compinit -i From a57cce2122df1969dcbeeefc12aab4fb485f2540 Mon Sep 17 00:00:00 2001 From: Jonathan Tron Date: Sat, 16 Apr 2011 14:44:38 +0200 Subject: [PATCH 369/614] Add new jonathan theme --- themes/jonathan.zsh-theme | 137 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 themes/jonathan.zsh-theme diff --git a/themes/jonathan.zsh-theme b/themes/jonathan.zsh-theme new file mode 100644 index 000000000..add485279 --- /dev/null +++ b/themes/jonathan.zsh-theme @@ -0,0 +1,137 @@ +function precmd { + local TERMWIDTH + (( TERMWIDTH = ${COLUMNS} - 1 )) + + + ### + # Truncate the path if it's too long. + + PR_FILLBAR="" + PR_PWDLEN="" + + local promptsize=${#${(%):---(%n@%m:%l)---()--}} + local rubyprompt=`rvm_prompt_info` + local rubypromptsize=${#${rubyprompt}} + local pwdsize=${#${(%):-%~}} + + if [[ "$promptsize + $rubypromptsize + $pwdsize" -gt $TERMWIDTH ]]; then + ((PR_PWDLEN=$TERMWIDTH - $promptsize)) + else + PR_FILLBAR="\${(l.(($TERMWIDTH - ($promptsize + $rubypromptsize + $pwdsize)))..${PR_HBAR}.)}" + fi + +} + + +setopt extended_glob +preexec () { + if [[ "$TERM" == "screen" ]]; then + local CMD=${1[(wr)^(*=*|sudo|-*)]} + echo -n "\ek$CMD\e\\" + fi +} + + +setprompt () { + ### + # Need this so the prompt will work. + + setopt prompt_subst + + + ### + # See if we can use colors. + + autoload colors zsh/terminfo + if [[ "$terminfo[colors]" -ge 8 ]]; then + colors + fi + for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE GREY; do + eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}' + eval PR_LIGHT_$color='%{$fg[${(L)color}]%}' + (( count = $count + 1 )) + done + PR_NO_COLOUR="%{$terminfo[sgr0]%}" + + ### + # Modify Git prompt + ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[green]%}" + ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" + ZSH_THEME_GIT_PROMPT_DIRTY="" + ZSH_THEME_GIT_PROMPT_CLEAN="" + + ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} ✚" + ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} ✹" + ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖" + ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜" + ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═" + ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭" + + ### + # See if we can use extended characters to look nicer. + + typeset -A altchar + set -A altchar ${(s..)terminfo[acsc]} + PR_SET_CHARSET="%{$terminfo[enacs]%}" + PR_SHIFT_IN="%{$terminfo[smacs]%}" + PR_SHIFT_OUT="%{$terminfo[rmacs]%}" + PR_HBAR=${altchar[q]:--} + PR_ULCORNER=${altchar[l]:--} + PR_LLCORNER=${altchar[m]:--} + PR_LRCORNER=${altchar[j]:--} + PR_URCORNER=${altchar[k]:--} + + + ### + # Decide if we need to set titlebar text. + + case $TERM in + xterm*) + PR_TITLEBAR=$'%{\e]0;%(!.-=*[ROOT]*=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\a%}' + ;; + screen) + PR_TITLEBAR=$'%{\e_screen \005 (\005t) | %(!.-=[ROOT]=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\e\\%}' + ;; + *) + PR_TITLEBAR='' + ;; + esac + + + ### + # Decide whether to set a screen title + if [[ "$TERM" == "screen" ]]; then + PR_STITLE=$'%{\ekzsh\e\\%}' + else + PR_STITLE='' + fi + + + ### + # Finally, the prompt. + + PROMPT='$PR_SET_CHARSET$PR_STITLE${(e)PR_TITLEBAR}\ +$PR_CYAN$PR_SHIFT_IN$PR_ULCORNER$PR_HBAR$PR_SHIFT_OUT$PR_GREY(\ +$PR_GREEN%$PR_PWDLEN<...<%~%<<\ +$PR_GREY)`rvm_prompt_info`$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_HBAR${(e)PR_FILLBAR}$PR_HBAR$PR_SHIFT_OUT$PR_GREY(\ +$PR_CYAN%(!.%SROOT%s.%n)$PR_GREY@$PR_GREEN%m:%l\ +$PR_GREY)$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_URCORNER$PR_SHIFT_OUT\ + +$PR_CYAN$PR_SHIFT_IN$PR_LLCORNER$PR_BLUE$PR_HBAR$PR_SHIFT_OUT(\ +$PR_YELLOW%D{%H:%M:%S}\ +$PR_LIGHT_BLUE%{$reset_color%}`git_prompt_info``git_prompt_status`$PR_BLUE)$PR_CYAN$PR_SHIFT_IN$PR_HBAR\ +$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT\ +>$PR_NO_COLOUR ' + + # display exitcode on the right when >0 + return_code="%(?..%{$fg[red]%}%? ↵ %{$reset_color%})" + RPROMPT=' $return_code$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_BLUE$PR_HBAR$PR_SHIFT_OUT\ +($PR_YELLOW%D{%a,%b%d}$PR_BLUE)$PR_SHIFT_IN$PR_HBAR$PR_CYAN$PR_LRCORNER$PR_SHIFT_OUT$PR_NO_COLOUR' + + PS2='$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT\ +$PR_BLUE$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT(\ +$PR_LIGHT_GREEN%_$PR_BLUE)$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT\ +$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT$PR_NO_COLOUR ' +} + +setprompt From 15f3b09cbf23b2d8563978d8350b0073e9c68f42 Mon Sep 17 00:00:00 2001 From: Arthur Kalmenson Date: Mon, 18 Apr 2011 07:48:35 -0400 Subject: [PATCH 370/614] Make the chsh more reliable. --- tools/install.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/install.sh b/tools/install.sh index 6e3872bb9..2d5fde4c8 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -22,7 +22,12 @@ echo "Copying your current PATH and adding it to the end of ~/.zshrc for you." echo "export PATH=$PATH" >> ~/.zshrc echo "Time to change your default shell to zsh!" -chsh -s "/usr/bin/env zsh" +if [ -f /bin/zsh ] +then + chsh -s /bin/zsh +else + chsh -s "/usr/bin/env zsh" +fi echo ' __ __ ' echo ' ____ / /_ ____ ___ __ __ ____ _____/ /_ ' From cd3896b0c493c98fb0caaffd1bf16196243090a4 Mon Sep 17 00:00:00 2001 From: Arthur Kalmenson Date: Mon, 18 Apr 2011 07:50:14 -0400 Subject: [PATCH 371/614] Change URL to https since most corporate environments block git port. --- tools/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/install.sh b/tools/install.sh index 2d5fde4c8..1b8c80f21 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -5,7 +5,7 @@ then fi echo "Cloning Oh My Zsh..." -/usr/bin/env git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh +/usr/bin/env git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh echo "Looking for an existing zsh config..." if [ -f ~/.zshrc ] || [ -h ~/.zshrc ] From 0f25c6dbd9c9e8ce65745182950f0611d91dd266 Mon Sep 17 00:00:00 2001 From: Arthur Kalmenson Date: Mon, 18 Apr 2011 22:51:28 -0400 Subject: [PATCH 372/614] Changed to use which. --- tools/install.sh | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/tools/install.sh b/tools/install.sh index 1b8c80f21..8ed1403af 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -22,12 +22,7 @@ echo "Copying your current PATH and adding it to the end of ~/.zshrc for you." echo "export PATH=$PATH" >> ~/.zshrc echo "Time to change your default shell to zsh!" -if [ -f /bin/zsh ] -then - chsh -s /bin/zsh -else - chsh -s "/usr/bin/env zsh" -fi +chsh -s `which zsh` echo ' __ __ ' echo ' ____ / /_ ____ ___ __ __ ____ _____/ /_ ' From 0557b99d5b3958bc12d726cfca7101ec0016b924 Mon Sep 17 00:00:00 2001 From: Arthur Kalmenson Date: Tue, 19 Apr 2011 19:01:18 -0400 Subject: [PATCH 373/614] Make the delete key work correctly, instead of outputting a ~ --- lib/key-bindings.zsh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/key-bindings.zsh b/lib/key-bindings.zsh index 7196a88ff..e12d8010e 100644 --- a/lib/key-bindings.zsh +++ b/lib/key-bindings.zsh @@ -22,6 +22,10 @@ bindkey ' ' magic-space # also do history expansion on space bindkey '^[[Z' reverse-menu-complete +# Make the delete key (or Fn + Delete on the Mac) work instead of outputting a ~ +bindkey "^[[3~" delete-char +bindkey "^[3;5~" delete-char + # consider emacs keybindings: #bindkey -e ## emacs key bindings From 955f3ce8666c6919874e1f02ae77779b2e7bde76 Mon Sep 17 00:00:00 2001 From: Arthur Kalmenson Date: Tue, 19 Apr 2011 22:40:46 -0400 Subject: [PATCH 374/614] Added bindings for Gnome terminal. --- lib/key-bindings.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/key-bindings.zsh b/lib/key-bindings.zsh index e12d8010e..a7d5095ec 100644 --- a/lib/key-bindings.zsh +++ b/lib/key-bindings.zsh @@ -25,6 +25,7 @@ bindkey '^[[Z' reverse-menu-complete # Make the delete key (or Fn + Delete on the Mac) work instead of outputting a ~ bindkey "^[[3~" delete-char bindkey "^[3;5~" delete-char +bindkey "\e[3~" delete-char # consider emacs keybindings: From 9899c2445c3cccce21c075d10ae86496bf33b7a4 Mon Sep 17 00:00:00 2001 From: Pat Regan Date: Wed, 20 Apr 2011 01:30:52 -0400 Subject: [PATCH 375/614] Remove fpath/compinit code from github and npm plugins --- plugins/github/github.plugin.zsh | 4 ---- plugins/npm/npm.plugin.zsh | 4 ---- 2 files changed, 8 deletions(-) delete mode 100644 plugins/npm/npm.plugin.zsh diff --git a/plugins/github/github.plugin.zsh b/plugins/github/github.plugin.zsh index 8d4580654..df7053ba7 100644 --- a/plugins/github/github.plugin.zsh +++ b/plugins/github/github.plugin.zsh @@ -5,7 +5,3 @@ if [ "$commands[(I)hub]" ]; then function git(){hub "$@"} fi -# add github completion function to path -fpath=($ZSH/plugins/github $fpath) -autoload -U compinit -compinit -i diff --git a/plugins/npm/npm.plugin.zsh b/plugins/npm/npm.plugin.zsh deleted file mode 100644 index 826f0f7b0..000000000 --- a/plugins/npm/npm.plugin.zsh +++ /dev/null @@ -1,4 +0,0 @@ -# add npm completion function to path -fpath=($ZSH/plugins/npm $fpath) -autoload -U compinit -compinit -i From 5ea555b208e1a963be2d5b2a1a169705c4e21303 Mon Sep 17 00:00:00 2001 From: Alexander Rinass Date: Wed, 20 Apr 2011 15:50:55 +0200 Subject: [PATCH 376/614] Fixed folder naming for mysql-macports plugin and improved start/stop scripts. --- plugins/mysql-macports/mysql-macports.plugin.zsh | 8 ++++++++ plugins/mysql/mysql-macports.plugin.zsh | 6 ------ 2 files changed, 8 insertions(+), 6 deletions(-) create mode 100644 plugins/mysql-macports/mysql-macports.plugin.zsh delete mode 100644 plugins/mysql/mysql-macports.plugin.zsh diff --git a/plugins/mysql-macports/mysql-macports.plugin.zsh b/plugins/mysql-macports/mysql-macports.plugin.zsh new file mode 100644 index 000000000..c39563fe4 --- /dev/null +++ b/plugins/mysql-macports/mysql-macports.plugin.zsh @@ -0,0 +1,8 @@ +# commands to control local mysql-server installation +# paths are for osx installation via macports + +alias mysqlstart='sudo /opt/local/share/mysql5/mysql/mysql.server start' +alias mysqlstop='sudo /opt/local/share/mysql5/mysql/mysql.server stop' +alias mysqlrestart='sudo /opt/local/share/mysql5/mysql/mysql.server restart' + +alias mysqlstatus='mysqladmin5 -u root -p ping' diff --git a/plugins/mysql/mysql-macports.plugin.zsh b/plugins/mysql/mysql-macports.plugin.zsh deleted file mode 100644 index 63b881c9f..000000000 --- a/plugins/mysql/mysql-macports.plugin.zsh +++ /dev/null @@ -1,6 +0,0 @@ -# commands to control local mysql-server installation -# paths are for osx installtion via macports - -alias mysqlstart='sudo /opt/local/bin/mysqld_safe5' -alias mysqlstop='/opt/local/bin/mysqladmin5 -u root -p shutdown' -alias mysqlstatus='mysqladmin5 -u root -p ping' \ No newline at end of file From 95fc64739f6cf5942d123968c74f5af80c9f0b7c Mon Sep 17 00:00:00 2001 From: Alexander Rinass Date: Wed, 20 Apr 2011 15:54:51 +0200 Subject: [PATCH 377/614] Added start/stop aliases for Apache 2 installation via macports. --- plugins/apache2-macports/apache2-macports.plugin.zsh | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 plugins/apache2-macports/apache2-macports.plugin.zsh diff --git a/plugins/apache2-macports/apache2-macports.plugin.zsh b/plugins/apache2-macports/apache2-macports.plugin.zsh new file mode 100644 index 000000000..1caa4cf9d --- /dev/null +++ b/plugins/apache2-macports/apache2-macports.plugin.zsh @@ -0,0 +1,6 @@ +# commands to control local apache2 server installation +# paths are for osx installation via macports + +alias apache2start='sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper start' +alias apache2stop='sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper stop' +alias apache2restart='sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper restart' From be502b5f45acc47696ff9c4b32a5180d2994904e Mon Sep 17 00:00:00 2001 From: Christopher Chow Date: Thu, 21 Apr 2011 21:40:34 +1000 Subject: [PATCH 378/614] Made my them display the current rvm gemset and check for detached head state in git. --- themes/Soliah.zsh-theme | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/themes/Soliah.zsh-theme b/themes/Soliah.zsh-theme index 1c0ab3cc9..237e70fda 100644 --- a/themes/Soliah.zsh-theme +++ b/themes/Soliah.zsh-theme @@ -1,4 +1,4 @@ -PROMPT='%{$fg[blue]%}%n%{$reset_color%} on %{$fg[red]%}%M%{$reset_color%} in %{$fg[blue]%}%~%b%{$reset_color%}$(git_time_since_commit)$(git_prompt_info) +PROMPT='%{$fg[blue]%}%n%{$reset_color%} on %{$fg[red]%}%M%{$reset_color%} in %{$fg[blue]%}%~%b%{$reset_color%}$(git_time_since_commit)$(check_git_prompt_info) $ ' ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[white]%}" @@ -16,6 +16,29 @@ ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM="%{$fg[yellow]%}" ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG="%{$fg[red]%}" ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[cyan]%}" + +# Git sometimes goes into a detached head state. git_prompt_info doesn't +# return anything in this case. So wrap it in another function and check +# for an empty string. +function check_git_prompt_info() { + if git rev-parse --git-dir > /dev/null 2>&1; then + if [[ -z $(git_prompt_info) ]]; then + echo "%{$fg[magenta]%}detached-head%{$reset_color%})" + else + echo "$(git_prompt_info)" + fi + fi +} + +# Determine if we are using a gemset. +function rvm_gemset() { + GEMSET=`rvm gemset list | grep '=>' | cut -b4-` + if [[ -n $GEMSET ]]; then + echo "%{$fg[yellow]%}$GEMSET%{$reset_color%}|" + fi + +} + # Determine the time since last commit. If branch is clean, # use a neutral color, otherwise colors will vary according to time. function git_time_since_commit() { @@ -49,15 +72,15 @@ function git_time_since_commit() { fi if [ "$HOURS" -gt 24 ]; then - echo "($COLOR${DAYS}d${SUB_HOURS}h${SUB_MINUTES}m%{$reset_color%}|" + echo "($(rvm_gemset)$COLOR${DAYS}d${SUB_HOURS}h${SUB_MINUTES}m%{$reset_color%}|" elif [ "$MINUTES" -gt 60 ]; then - echo "($COLOR${HOURS}h${SUB_MINUTES}m%{$reset_color%}|" + echo "($(rvm_gemset)$COLOR${HOURS}h${SUB_MINUTES}m%{$reset_color%}|" else - echo "($COLOR${MINUTES}m%{$reset_color%}|" + echo "($(rvm_gemset)$COLOR${MINUTES}m%{$reset_color%}|" fi else COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL" - echo "($COLOR~|" + echo "($(rvm_gemset)$COLOR~|" fi fi } From 2d29f73f5470dc7b801e409cfd41e37f22996562 Mon Sep 17 00:00:00 2001 From: Ilmari Vacklin Date: Fri, 22 Apr 2011 00:16:29 +0300 Subject: [PATCH 379/614] Add 'upgrade' to brew completions. --- plugins/brew/_brew | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/brew/_brew b/plugins/brew/_brew index 4e590ac63..cee1e25f0 100644 --- a/plugins/brew/_brew +++ b/plugins/brew/_brew @@ -31,6 +31,7 @@ _1st_arguments=( 'search:search for a formula (/regex/ or string)' 'unlink:unlink a formula' 'update:freshen up links' + 'upgrade:upgrade outdated formulae' 'uses:show formulas which depend on a formula' ) From 2c6d9b316e88281c7cbcfe1204f058a09ab11d50 Mon Sep 17 00:00:00 2001 From: Corey Donohoe Date: Thu, 21 Apr 2011 15:53:44 -0700 Subject: [PATCH 380/614] support non-standard rvm install prefixes --- themes/bira.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/bira.zsh-theme b/themes/bira.zsh-theme index f0ee6a5bd..5642eaeb8 100644 --- a/themes/bira.zsh-theme +++ b/themes/bira.zsh-theme @@ -3,7 +3,7 @@ local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}' local current_dir='%{$terminfo[bold]$fg[blue]%} %~%{$reset_color%}' -local rvm_ruby='%{$fg[red]%}‹$(~/.rvm/bin/rvm-prompt i v g)›%{$reset_color%}' +local rvm_ruby='%{$fg[red]%}‹$(rvm-prompt i v g)›%{$reset_color%}' local git_branch='$(git_prompt_info)%{$reset_color%}' PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch} From 4b353f1a0661aaa75ac7746465de6bc4980df07d Mon Sep 17 00:00:00 2001 From: Felipe Gallois Date: Sat, 23 Apr 2011 17:31:15 -0300 Subject: [PATCH 381/614] added custom theme, based on eastwood --- themes/gallois.zsh-theme | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 themes/gallois.zsh-theme diff --git a/themes/gallois.zsh-theme b/themes/gallois.zsh-theme new file mode 100644 index 000000000..259640ba4 --- /dev/null +++ b/themes/gallois.zsh-theme @@ -0,0 +1,19 @@ +ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}[" +ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="" + +#Customized git status, oh-my-zsh currently does not allow render dirty status before branch +git_custom_status() { + local cb=$(current_branch) + if [ -n "$cb" ]; then + echo "$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_PREFIX$(current_branch)$ZSH_THEME_GIT_PROMPT_SUFFIX" + fi +} + +#RVM and git settings +if [[ -s ~/.rvm/scripts/rvm ]] ; then + RPS1='$(git_custom_status)%{$fg[red]%}[`~/.rvm/bin/rvm-prompt`]%{$reset_color%} $EPS1' +fi + +PROMPT='%{$fg[cyan]%}[%~% ]%(?.%{$fg[green]%}.%{$fg[red]%})%B$%b ' From 61f27e94b1905f91b84d52b7ed64fc6e5bef6f5c Mon Sep 17 00:00:00 2001 From: Florian Adamsky Date: Tue, 26 Apr 2011 23:22:42 +0200 Subject: [PATCH 382/614] added alias for apt-cache search --- plugins/deb/deb.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/deb/deb.plugin.zsh b/plugins/deb/deb.plugin.zsh index 732294a87..1b35a0646 100644 --- a/plugins/deb/deb.plugin.zsh +++ b/plugins/deb/deb.plugin.zsh @@ -9,4 +9,5 @@ alias ar="sudo apt-get remove --purge && \ sudo apt-get autoremove --purge" # remove package alias ap="apt-cache policy" # apt policy alias av="apt-cache show" # show package info +alias acs="apt-cache search" # search package alias ac="sudo apt-get clean && sudo apt-get autoclean" # clean apt cache From b003fc59a4c1f37699975641fc9944fd1ad43b04 Mon Sep 17 00:00:00 2001 From: Pat Regan Date: Wed, 27 Apr 2011 19:46:23 -0400 Subject: [PATCH 383/614] redis-cli.plugin.zsh removed, adding to the fpath isn't needed now --- plugins/redis-cli/redis-cli.plugin.zsh | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 plugins/redis-cli/redis-cli.plugin.zsh diff --git a/plugins/redis-cli/redis-cli.plugin.zsh b/plugins/redis-cli/redis-cli.plugin.zsh deleted file mode 100644 index af5a843c9..000000000 --- a/plugins/redis-cli/redis-cli.plugin.zsh +++ /dev/null @@ -1,4 +0,0 @@ -# add redis completion function to path -fpath=($ZSH/plugins/redis-cli $fpath) -autoload -U compinit -compinit -i From 514065b4951cb7c6726b9d5a019ceb6042c3abee Mon Sep 17 00:00:00 2001 From: Justin Riley Date: Thu, 28 Apr 2011 15:29:27 -0400 Subject: [PATCH 384/614] add my custom zsh prompt --- themes/jtriley.zsh-theme | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 themes/jtriley.zsh-theme diff --git a/themes/jtriley.zsh-theme b/themes/jtriley.zsh-theme new file mode 100644 index 000000000..ec62a2208 --- /dev/null +++ b/themes/jtriley.zsh-theme @@ -0,0 +1,8 @@ +#PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' +PROMPT="%{$fg_bold[cyan]%}%T%{$fg_bold[green]%} %{$fg_bold[white]%}%n%{$fg[magenta]%}@%{$fg_bold[white]%}%m %{$fg_bold[green]%}%d +%{$fg_bold[yellow]%}%% $(git_prompt_info)%{$reset_color%}" + +#ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" +#ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +#ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}" +#ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" From 51a7cb093b94938aec250bd3bc8177d7c01e49a5 Mon Sep 17 00:00:00 2001 From: Pat Regan Date: Thu, 28 Apr 2011 19:12:05 -0400 Subject: [PATCH 385/614] Move sourcing of custom to below plugins --- oh-my-zsh.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index c7a4c320a..bf108afce 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -15,9 +15,6 @@ for plugin ($plugins) fpath=($ZSH/plugins/$plugin $fpath) autoload -U compinit compinit -i -# Load all of your custom configurations from custom/ -for config_file ($ZSH/custom/*.zsh) source $config_file - # Load all of the plugins that were defined in ~/.zshrc for plugin ($plugins); do if [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then @@ -25,6 +22,9 @@ for plugin ($plugins); do fi done +# Load all of your custom configurations from custom/ +for config_file ($ZSH/custom/*.zsh) source $config_file + # Load the theme source "$ZSH/themes/$ZSH_THEME.zsh-theme" From f33e196bf0e2befbfdee019907200196da0c35be Mon Sep 17 00:00:00 2001 From: "Juan G. Hurtado" Date: Fri, 29 Apr 2011 09:22:56 +0200 Subject: [PATCH 386/614] Adds new prompt methods on Git lib Modifies the Git lib file (lib/git.zsh), adding three new prompt methods: - git_prompt_ahead(): Shows the content of the custom var $ZSH_THEME_GIT_PROMPT_AHEAD if the local repository has commits ahead from the remote origin repository - git_prompt_short_sha(): Shows last commit SHA hash in short mode wrapped between the content of the custom vars $ZSH_THEME_GIT_PROMPT_SHA_BEFORE and $ZSH_THEME_GIT_PROMPT_SHA_AFTER - git_prompt_long_sha(): Shows last commit SHA hash in long mode wrapped between the content of the custom vars $ZSH_THEME_GIT_PROMPT_SHA_BEFORE and $ZSH_THEME_GIT_PROMPT_SHA_AFTER --- lib/git.zsh | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/lib/git.zsh b/lib/git.zsh index 8512de8a4..e96f075be 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -4,7 +4,8 @@ function git_prompt_info() { echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX" } -parse_git_dirty () { +# Checks if working tree is dirty +parse_git_dirty() { if [[ -n $(git status -s 2> /dev/null) ]]; then echo "$ZSH_THEME_GIT_PROMPT_DIRTY" else @@ -12,7 +13,24 @@ parse_git_dirty () { fi } -# get the status of the working tree +# Checks if there are commits ahead from remote +function git_prompt_ahead() { + if $(echo "$(git log origin/master..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then + echo "$ZSH_THEME_GIT_PROMPT_AHEAD" + fi +} + +# Formats prompt string for current git commit short SHA +function git_prompt_short_sha() { + SHA=$(git rev-parse --short HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER" +} + +# Formats prompt string for current git commit long SHA +function git_prompt_long_sha() { + SHA=$(git rev-parse HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER" +} + +# Get the status of the working tree git_prompt_status() { INDEX=$(git status --porcelain 2> /dev/null) STATUS="" @@ -41,4 +59,4 @@ git_prompt_status() { STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS" fi echo $STATUS -} +} \ No newline at end of file From fb1fd8ab5a4e95a64d825570e77295dbdebc7bea Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Fri, 29 Apr 2011 11:24:29 +0200 Subject: [PATCH 387/614] Feature: Random themes now supported. Just set your theme to 'random' and it'll load a different theme each time oh-my-zsh is started. Closes #309 --- oh-my-zsh.sh | 14 +++++++++++++- templates/zshrc.zsh-template | 4 +++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 291772dfe..1e735b058 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -15,7 +15,19 @@ plugin=${plugin:=()} for plugin ($plugins) source $ZSH/plugins/$plugin/$plugin.plugin.zsh # Load the theme -source "$ZSH/themes/$ZSH_THEME.zsh-theme" +# Check for updates on initial load... +if [ "$ZSH_THEME" = "random" ] +then + themes=($ZSH/themes/*zsh-theme) + N=${#themes[@]} + ((N=RANDOM%N)) + RANDOM_THEME=${themes[$N]} + source "$RANDOM_THEME" + echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..." +else + source "$ZSH/themes/$ZSH_THEME.zsh-theme" +fi + # Check for updates on initial load... if [ "$DISABLE_AUTO_UPDATE" = "true" ] diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template index 506daa9a2..576d45eaa 100644 --- a/templates/zshrc.zsh-template +++ b/templates/zshrc.zsh-template @@ -1,8 +1,10 @@ # Path to your oh-my-zsh configuration. export ZSH=$HOME/.oh-my-zsh -# Set to the name theme to load. +# Set name of the theme to load. # Look in ~/.oh-my-zsh/themes/ +# Optionally, if you set this to "random", it'll load a random theme each +# time that oh-my-zsh is loaded. export ZSH_THEME="robbyrussell" # Set to this to use case-sensitive completion From 63d19fdb1e42f8668b0765d1b4ffd3877ba8b608 Mon Sep 17 00:00:00 2001 From: Kevin Daudt Date: Fri, 29 Apr 2011 11:54:31 +0200 Subject: [PATCH 388/614] Added git-flow plugin --- .gitignore | 3 +- plugins/git-flow/git-flow.plugin.zsh | 332 +++++++++++++++++++++++++++ 2 files changed, 334 insertions(+), 1 deletion(-) create mode 100644 plugins/git-flow/git-flow.plugin.zsh diff --git a/.gitignore b/.gitignore index 8d19d100c..4b555067e 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ locals.zsh log/.zsh_history projects.zsh custom/* -!custom/example.zsh \ No newline at end of file +!custom/example.zsh +cache diff --git a/plugins/git-flow/git-flow.plugin.zsh b/plugins/git-flow/git-flow.plugin.zsh new file mode 100644 index 000000000..270bcbe38 --- /dev/null +++ b/plugins/git-flow/git-flow.plugin.zsh @@ -0,0 +1,332 @@ +#!zsh +# +# Installation +# ------------ +# +# To achieve git-flow completion nirvana: +# +# 0. Update your zsh's git-completion module to the newest verion. +# From here. http://zsh.git.sourceforge.net/git/gitweb.cgi?p=zsh/zsh;a=blob_plain;f=Completion/Unix/Command/_git;hb=HEAD +# +# 1. Install this file. Either: +# +# a. Place it in your .zshrc: +# +# b. Or, copy it somewhere (e.g. ~/.git-flow-completion.zsh) and put the following line in +# your .zshrc: +# +# source ~/.git-flow-completion.zsh +# +# c. Or, use this file as a oh-my-zsh plugin. +# + +_git-flow () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + + local -a subcommands + subcommands=( + 'init:Initialize a new git repo with support for the branching model.' + 'feature:Manage your feature branches.' + 'release:Manage your release branches.' + 'hotfix:Manage your hotfix branches.' + 'support:Manage your support branches.' + 'version:Shows version information.' + ) + _describe -t commands 'git flow' subcommands + ;; + + (options) + case $line[1] in + + (init) + _arguments \ + -f'[Force setting of gitflow branches, even if already configured]' + ;; + + (version) + ;; + + (hotfix) + __git-flow-hotfix + ;; + + (release) + __git-flow-release + ;; + + (feature) + __git-flow-feature + ;; + esac + ;; + esac +} + +__git-flow-release () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + + local -a subcommands + subcommands=( + 'start:Start a new release branch.' + 'finish:Finish a release branch.' + 'list:List all your release branches. (Alias to `git flow release`)' + ) + _describe -t commands 'git flow release' subcommands + _arguments \ + -v'[Verbose (more) output]' + ;; + + (options) + case $line[1] in + + (start) + _arguments \ + -F'[Fetch from origin before performing finish]'\ + ':version:__git_flow_version_list' + ;; + + (finish) + _arguments \ + -F'[Fetch from origin before performing finish]' \ + -s'[Sign the release tag cryptographically]'\ + -u'[Use the given GPG-key for the digital signature (implies -s)]'\ + -m'[Use the given tag message]'\ + -p'[Push to $ORIGIN after performing finish]'\ + ':version:__git_flow_version_list' + ;; + + *) + _arguments \ + -v'[Verbose (more) output]' + ;; + esac + ;; + esac +} + +__git-flow-hotfix () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + + local -a subcommands + subcommands=( + 'start:Start a new hotfix branch.' + 'finish:Finish a hotfix branch.' + 'list:List all your hotfix branches. (Alias to `git flow hotfix`)' + ) + _describe -t commands 'git flow hotfix' subcommands + _arguments \ + -v'[Verbose (more) output]' + ;; + + (options) + case $line[1] in + + (start) + _arguments \ + -F'[Fetch from origin before performing finish]'\ + ':hotfix:__git_flow_version_list'\ + ':branch-name:__git_branch_names' + ;; + + (finish) + _arguments \ + -F'[Fetch from origin before performing finish]' \ + -s'[Sign the release tag cryptographically]'\ + -u'[Use the given GPG-key for the digital signature (implies -s)]'\ + -m'[Use the given tag message]'\ + -p'[Push to $ORIGIN after performing finish]'\ + ':hotfix:__git_flow_hotfix_list' + ;; + + *) + _arguments \ + -v'[Verbose (more) output]' + ;; + esac + ;; + esac +} + +__git-flow-feature () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + + local -a subcommands + subcommands=( + 'start:Start a new feature branch.' + 'finish:Finish a feature branch.' + 'list:List all your feature branches. (Alias to `git flow feature`)' + 'publish: public' + 'track: track' + 'diff: diff' + 'rebase: rebase' + 'checkout: checkout' + 'pull: pull' + ) + _describe -t commands 'git flow feature' subcommands + _arguments \ + -v'[Verbose (more) output]' + ;; + + (options) + case $line[1] in + + (start) + _arguments \ + -F'[Fetch from origin before performing finish]'\ + ':feature:__git_flow_feature_list'\ + ':branch-name:__git_branch_names' + ;; + + (finish) + _arguments \ + -F'[Fetch from origin before performing finish]' \ + -r'[Rebase instead of merge]'\ + ':feature:__git_flow_feature_list' + ;; + + (publish) + _arguments \ + ':feature:__git_flow_feature_list'\ + ;; + + (track) + _arguments \ + ':feature:__git_flow_feature_list'\ + ;; + + (diff) + _arguments \ + ':branch:__git_branch_names'\ + ;; + + (rebase) + _arguments \ + -i'[Do an interactive rebase]' \ + ':branch:__git_branch_names' + ;; + + (checkout) + _arguments \ + ':branch:__git_flow_feature_list'\ + ;; + + (pull) + _arguments \ + ':remote:__git_remotes'\ + ':branch:__git_branch_names' + ;; + + *) + _arguments \ + -v'[Verbose (more) output]' + ;; + esac + ;; + esac +} + +__git_flow_version_list () +{ + local expl + declare -a versions + + versions=(${${(f)"$(_call_program versions git flow release list 2> /dev/null | tr -d ' |*')"}}) + __git_command_successful || return + + _wanted versions expl 'version' compadd $versions +} + +__git_flow_feature_list () +{ + local expl + declare -a features + + features=(${${(f)"$(_call_program features git flow feature list 2> /dev/null | tr -d ' |*')"}}) + __git_command_successful || return + + _wanted features expl 'feature' compadd $features +} + +__git_remotes () { + local expl gitdir remotes + + gitdir=$(_call_program gitdir git rev-parse --git-dir 2>/dev/null) + __git_command_successful || return + + remotes=(${${(f)"$(_call_program remotes git config --get-regexp '"^remote\..*\.url$"')"}//#(#b)remote.(*).url */$match[1]}) + __git_command_successful || return + + # TODO: Should combine the two instead of either or. + if (( $#remotes > 0 )); then + _wanted remotes expl remote compadd $* - $remotes + else + _wanted remotes expl remote _files $* - -W "($gitdir/remotes)" -g "$gitdir/remotes/*" + fi +} + +__git_flow_hotfix_list () +{ + local expl + declare -a hotfixes + + hotfixes=(${${(f)"$(_call_program hotfixes git flow hotfix list 2> /dev/null | tr -d ' |*')"}}) + __git_command_successful || return + + _wanted hotfixes expl 'hotfix' compadd $hotfixes +} + +__git_branch_names () { + local expl + declare -a branch_names + + branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/}) + __git_command_successful || return + + _wanted branch-names expl branch-name compadd $* - $branch_names +} + +__git_command_successful () { + if (( ${#pipestatus:#0} > 0 )); then + _message 'not a git repository' + return 1 + fi + return 0 +} + +zstyle ':completion:*:*:git:*' user-commands flow:'description for foo' \ No newline at end of file From 8a385329b7a0aafb14a88a502802a3317b363fc4 Mon Sep 17 00:00:00 2001 From: Hakan Ensari Date: Fri, 29 Apr 2011 10:59:59 +0100 Subject: [PATCH 389/614] Rails 3 aliases now work with Rails 2 as well. --- plugins/rails3/rails3.plugin.zsh | 34 +++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/plugins/rails3/rails3.plugin.zsh b/plugins/rails3/rails3.plugin.zsh index 6bf2ba088..f669ef047 100644 --- a/plugins/rails3/rails3.plugin.zsh +++ b/plugins/rails3/rails3.plugin.zsh @@ -1,10 +1,30 @@ -alias rs='ruby script/rails server' -alias rg='ruby script/rails generate' -alias rd='ruby script/rails destroy' -alias rp='ruby script/rails plugin' +# Rails 3 aliases, backwards-compatible with Rails 2. + +function _bundle_command { + if command -v bundle && [ -e "Gemfile" ]; then + bundle exec $@ + else + $@ + fi +} + +function _rails_command () { + if [ -e "script/server" ]; then + ruby script/$@ + else + ruby script/rails $@ + fi +} + +alias rc='_rails_command console' +alias rd='_rails_command destroy' +alias rdb='_rails_command dbconsole' alias rdbm='rake db:migrate db:test:clone' -alias rdbmr='rake db:migrate && rake db:migrate:redo' -alias rc='ruby script/rails console' -alias rd='ruby script/rails server --debugger' +alias rg='_rails_command generate' +alias rp='_rails_command plugin' +alias rs='_rails_command server' +alias rsd='_rails_command server --debugger' alias devlog='tail -f log/development.log' +alias rspec='_bundle_command rspec' +alias cuke='_bundle_command cucumber' From d266e7a8b7769d6d6519217405e295929a53b934 Mon Sep 17 00:00:00 2001 From: "Juan G. Hurtado" Date: Fri, 29 Apr 2011 13:11:38 +0200 Subject: [PATCH 390/614] Custom theme with Git support This is my personal oh-my-zsh theme. It has Git support through methods found in Git lib file of oh-my-zsh. It uses: - parse_git_dirty() - git_prompt_ahead() - current_branch() - git_prompt_short_sha() - git_prompt_status() It also shows user name, machine name and current path. You can take a look at a screenshot at http://goo.gl/ZVoyk --- themes/juanghurtado.zsh-theme | 46 +++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 themes/juanghurtado.zsh-theme diff --git a/themes/juanghurtado.zsh-theme b/themes/juanghurtado.zsh-theme new file mode 100644 index 000000000..2f715cc9e --- /dev/null +++ b/themes/juanghurtado.zsh-theme @@ -0,0 +1,46 @@ +# ------------------------------------------------------------------------ +# Juan G. Hurtado oh-my-zsh theme +# (Needs Git plugin for current_branch method) +# ------------------------------------------------------------------------ + +# Color shortcuts +RED=$fg[red] +YELLOW=$fg[yellow] +GREEN=$fg[green] +WHITE=$fg[white] +BLUE=$fg[blue] +RED_BOLD=$fg_bold[red] +YELLOW_BOLD=$fg_bold[yellow] +GREEN_BOLD=$fg_bold[green] +WHITE_BOLD=$fg_bold[white] +BLUE_BOLD=$fg_bold[blue] +RESET_COLOR=$reset_color + +# Format for git_prompt_info() +ZSH_THEME_GIT_PROMPT_PREFIX="" +ZSH_THEME_GIT_PROMPT_SUFFIX="" + +# Format for parse_git_dirty() +ZSH_THEME_GIT_PROMPT_DIRTY=" %{$RED%}(*)" +ZSH_THEME_GIT_PROMPT_CLEAN="" + +# Format for git_prompt_status() +ZSH_THEME_GIT_PROMPT_UNMERGED=" %{$RED%}unmerged" +ZSH_THEME_GIT_PROMPT_DELETED=" %{$RED%}deleted" +ZSH_THEME_GIT_PROMPT_RENAMED=" %{$YELLOW%}renamed" +ZSH_THEME_GIT_PROMPT_MODIFIED=" %{$YELLOW%}modified" +ZSH_THEME_GIT_PROMPT_ADDED=" %{$GREEN%}added" +ZSH_THEME_GIT_PROMPT_UNTRACKED=" %{$WHITE%}untracked" + +# Format for git_prompt_ahead() +ZSH_THEME_GIT_PROMPT_AHEAD=" %{$RED%}(!)" + +# Format for git_prompt_long_sha() and git_prompt_short_sha() +ZSH_THEME_GIT_PROMPT_SHA_BEFORE=" %{$WHITE%}[%{$YELLOW%}" +ZSH_THEME_GIT_PROMPT_SHA_AFTER="%{$WHITE%}]" + +# Prompt format +PROMPT=' +%{$GREEN_BOLD%}%n@%m%{$WHITE%}:%{$YELLOW%}%~%u$(parse_git_dirty)$(git_prompt_ahead)%{$RESET_COLOR%} +%{$BLUE%}>%{$RESET_COLOR%} ' +RPROMPT='%{$GREEN_BOLD%}$(current_branch)$(git_prompt_short_sha)$(git_prompt_status)%{$RESET_COLOR%}' \ No newline at end of file From 7a3cb1a8e37bcdd0c462b89c65b99700d25ebea2 Mon Sep 17 00:00:00 2001 From: Matt Sacks Date: Fri, 29 Apr 2011 08:28:46 -0400 Subject: [PATCH 391/614] Add muse theme for 256 color terminals --- themes/muse.zsh-theme | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 themes/muse.zsh-theme diff --git a/themes/muse.zsh-theme b/themes/muse.zsh-theme new file mode 100644 index 000000000..4bd8fb825 --- /dev/null +++ b/themes/muse.zsh-theme @@ -0,0 +1,30 @@ +#!/usr/bin/env zsh +#local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" + +setopt promptsubst + +autoload -U add-zsh-hook + +PROMPT_SUCCESS_COLOR=$FG[117] +PROMPT_FAILURE_COLOR=$FG[124] +PROMPT_VCS_INFO_COLOR=$FG[242] +PROMPT_PROMPT=$FG[077] +GIT_DIRTY_COLOR=$FG[133] +GIT_CLEAN_COLOR=$FG[118] +GIT_PROMPT_INFO=$FG[012] + +PROMPT='%{$PROMPT_SUCCESS_COLOR%}%~%{$reset_color%} %{$GIT_PROMPT_INFO%}$(git_prompt_info)%{$GIT_DIRTY_COLOR%}$(git_prompt_status) %{$reset_color%}%{$PROMPT_PROMPT%}ᐅ%{$reset_color%} ' + +#RPS1="${return_code}" + +ZSH_THEME_GIT_PROMPT_PREFIX="(" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$GIT_PROMPT_INFO%})" +ZSH_THEME_GIT_PROMPT_DIRTY=" %{$GIT_DIRTY_COLOR%}✘" +ZSH_THEME_GIT_PROMPT_CLEAN=" %{$GIT_CLEAN_COLOR%}✔" + +ZSH_THEME_GIT_PROMPT_ADDED="%{$FG[082]%}✚%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_MODIFIED="%{$FG[166]%}✹%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DELETED="%{$FG[160]%}✖%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_RENAMED="%{$FG[220]%}➜%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_UNMERGED="%{$FG[082]%}═%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$FG[190]%}✭%{$reset_color%}" From 61c35a2174d465dc78dbeb50ecf4e2a93df2d0a3 Mon Sep 17 00:00:00 2001 From: nebirhos Date: Fri, 29 Apr 2011 17:12:40 +0200 Subject: [PATCH 392/614] fixed autoupdate --- tools/check_for_upgrade.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh index 4643739ca..e1e4eb99f 100644 --- a/tools/check_for_upgrade.sh +++ b/tools/check_for_upgrade.sh @@ -25,10 +25,11 @@ then if [ "$line" = Y ] || [ "$line" = y ] then /bin/sh $ZSH/tools/upgrade.sh + # update the zsh file + _update_zsh_update fi fi +else + # create the zsh file + _update_zsh_update fi - -# update the zsh file -_update_zsh_update - From 1ae6df763984ee528f16eb715da57baa0fb9e1c4 Mon Sep 17 00:00:00 2001 From: "Renaud (Nel) Morvan" Date: Mon, 2 May 2011 13:51:16 +0200 Subject: [PATCH 393/614] Relax pattern matching on TERM. Closes #320. --- lib/termsupport.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index 3152751e4..22e7f372f 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -4,9 +4,9 @@ #Limited support for Apple Terminal (Terminal can't set window or tab separately) function title { [ "$DISABLE_AUTO_TITLE" != "true" ] || return - if [[ $TERM =~ "^screen" ]]; then + if [[ "$TERM" == screen* ]]; then print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars - elif [[ ($TERM =~ "^xterm") ]] || [[ ($TERM == "rxvt") ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then + elif [[ "$TERM" == xterm* ]] || [[ $TERM == rxvt* ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then print -Pn "\e]2;$2:q\a" #set window name print -Pn "\e]1;$1:q\a" #set icon (=tab) name (will override window name on broken terminal) fi From c870c32837c17b3397d755a8c22b9c3762898922 Mon Sep 17 00:00:00 2001 From: Jonas Huckestein Date: Tue, 3 May 2011 14:07:35 -0700 Subject: [PATCH 394/614] added my theme --- themes/jispwoso.zsh-theme | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 themes/jispwoso.zsh-theme diff --git a/themes/jispwoso.zsh-theme b/themes/jispwoso.zsh-theme new file mode 100644 index 000000000..cdfef3871 --- /dev/null +++ b/themes/jispwoso.zsh-theme @@ -0,0 +1,4 @@ +PROMPT=$'%{$fg[green]%}%n@%m: %{$reset_color%}%{$fg[blue]%}%/%{$reset_color%} +%{$fg_bold[red]%}➜ %{$reset_color%} ' + +PROMPT2="%{$fg_blod[black]%}%_> %{$reset_color%}" From 7e378f6ef99cdc4761179ee1df1a57cccd74a70f Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 5 May 2011 18:41:05 -0400 Subject: [PATCH 395/614] Added Compleat - Completion for Human Beings plugin. --- plugins/compleat/compleat.plugin.zsh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 plugins/compleat/compleat.plugin.zsh diff --git a/plugins/compleat/compleat.plugin.zsh b/plugins/compleat/compleat.plugin.zsh new file mode 100644 index 000000000..8d16a5687 --- /dev/null +++ b/plugins/compleat/compleat.plugin.zsh @@ -0,0 +1,22 @@ +# ------------------------------------------------------------------------------ +# FILE: compleat.plugin.zsh +# DESCRIPTION: oh-my-zsh plugin file. +# AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com) +# VERSION: 1.0.0 +# ------------------------------------------------------------------------------ + + +if (( ${+commands[compleat]} )); then + local prefix="${commands[compleat]:h:h}" + local setup="${prefix}/share/compleat-1.0/compleat_setup" + + if [[ -f "$setup" ]]; then + if ! bashcompinit >/dev/null 2>&1; then + autoload -U bashcompinit + bashcompinit -i + fi + + source "$setup" + fi +fi + From 9730de8e66c115b7964137778398e8dd7f15dcdf Mon Sep 17 00:00:00 2001 From: "Juan G. Hurtado" Date: Mon, 9 May 2011 13:32:42 +0200 Subject: [PATCH 396/614] Adds support for $(current_branch) on git_parse_ahead() Changes method git_parse_ahead() on git.zsh lib file. Before this change it checked directly against origin/master branch. Now it uses $(current_branch) to check for not pushed changes against the current remote branch. --- lib/git.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/git.zsh b/lib/git.zsh index e96f075be..2ace3d0e0 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -15,7 +15,7 @@ parse_git_dirty() { # Checks if there are commits ahead from remote function git_prompt_ahead() { - if $(echo "$(git log origin/master..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then + if $(echo "$(git log origin/$(current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then echo "$ZSH_THEME_GIT_PROMPT_AHEAD" fi } From 3d26995682a502150ab80f1fc5738802b1dc16aa Mon Sep 17 00:00:00 2001 From: Justin Riley Date: Mon, 9 May 2011 10:19:10 -0400 Subject: [PATCH 397/614] remove git status from prompt --- themes/jtriley.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/jtriley.zsh-theme b/themes/jtriley.zsh-theme index ec62a2208..15d77ed23 100644 --- a/themes/jtriley.zsh-theme +++ b/themes/jtriley.zsh-theme @@ -1,6 +1,6 @@ #PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' PROMPT="%{$fg_bold[cyan]%}%T%{$fg_bold[green]%} %{$fg_bold[white]%}%n%{$fg[magenta]%}@%{$fg_bold[white]%}%m %{$fg_bold[green]%}%d -%{$fg_bold[yellow]%}%% $(git_prompt_info)%{$reset_color%}" +%{$fg_bold[yellow]%}%% %{$reset_color%}" #ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" #ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" From 0694e3b0bf872bbbba2e5714da9189d3d3f7148e Mon Sep 17 00:00:00 2001 From: Jacob Atzen Date: Thu, 19 May 2011 16:20:30 +0200 Subject: [PATCH 398/614] Add autojump plugin --- plugins/autojump/autojump.plugin.zsh | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 plugins/autojump/autojump.plugin.zsh diff --git a/plugins/autojump/autojump.plugin.zsh b/plugins/autojump/autojump.plugin.zsh new file mode 100644 index 000000000..da0a12765 --- /dev/null +++ b/plugins/autojump/autojump.plugin.zsh @@ -0,0 +1,3 @@ +if [ -f `brew --prefix`/etc/autojump ]; then + . `brew --prefix`/etc/autojump +fi From faee7964c0d4282f3bf71f597fc69cbb1919d309 Mon Sep 17 00:00:00 2001 From: Jacob Atzen Date: Thu, 19 May 2011 16:33:29 +0200 Subject: [PATCH 399/614] TextMate automatically forks into the background --- plugins/textmate/textmate.plugin.zsh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/textmate/textmate.plugin.zsh b/plugins/textmate/textmate.plugin.zsh index 7b73e2751..7c4c14a5f 100644 --- a/plugins/textmate/textmate.plugin.zsh +++ b/plugins/textmate/textmate.plugin.zsh @@ -1,9 +1,9 @@ # TextMate -alias et='mate . &' -alias ett='mate app config lib db public spec test Rakefile Capfile Todo &' -alias etp='mate app config lib db public spec test vendor/plugins vendor/gems Rakefile Capfile Todo &' -alias etts='mate app config lib db public script spec test vendor/plugins vendor/gems Rakefile Capfile Todo &' +alias et='mate .' +alias ett='mate app config lib db public spec test Rakefile Capfile Todo' +alias etp='mate app config lib db public spec test vendor/plugins vendor/gems Rakefile Capfile Todo' +alias etts='mate app config lib db public script spec test vendor/plugins vendor/gems Rakefile Capfile Todo' # Editor Ruby file in TextMate alias mr='mate CHANGELOG app config db lib public script spec test' From 0c45157caafdaa153ee5ab0e9ff981dab50391c6 Mon Sep 17 00:00:00 2001 From: Jan-Oliver Jahner Date: Fri, 20 May 2011 15:14:10 +0200 Subject: [PATCH 400/614] Added 'simple' theme. --- themes/simple.zsh-theme | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 themes/simple.zsh-theme diff --git a/themes/simple.zsh-theme b/themes/simple.zsh-theme new file mode 100644 index 000000000..a88d9d72a --- /dev/null +++ b/themes/simple.zsh-theme @@ -0,0 +1,6 @@ +PROMPT='%{$fg[green]%}%~%{$fg_bold[blue]%}$(git_prompt_info)%{$reset_color%} ' + +ZSH_THEME_GIT_PROMPT_PREFIX="(" +ZSH_THEME_GIT_PROMPT_SUFFIX=")" +ZSH_THEME_GIT_PROMPT_DIRTY=" ✗" +ZSH_THEME_GIT_PROMPT_CLEAN=" ✔" From 7b2ebce5fa54f34727515317a61a789baecf0a8f Mon Sep 17 00:00:00 2001 From: Oliver Braun Date: Fri, 20 May 2011 22:26:45 +0200 Subject: [PATCH 401/614] Added obraun theme which is a slightly modified version of an already existing theme. --- themes/obraun.zsh-theme | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 themes/obraun.zsh-theme diff --git a/themes/obraun.zsh-theme b/themes/obraun.zsh-theme new file mode 100644 index 000000000..08d137665 --- /dev/null +++ b/themes/obraun.zsh-theme @@ -0,0 +1,11 @@ +if [ "$(whoami)" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="blue"; fi + +local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" + +PROMPT='%{$fg[green]%}[%*]%{$reset_color%} %{$fg_no_bold[cyan]%}%n %{${fg_bold[blue]}%}::%{$reset_color%} %{$fg[yellow]%}%m%{$reset_color%} %{$fg_no_bold[magenta]%} ➜ %{$reset_color%} %{${fg[green]}%}%3~ $(git_prompt_info)%{${fg_bold[$CARETCOLOR]}%}»%{${reset_color}%} ' + +RPS1="${return_code}" + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[red]%}‹" +ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}" + From 293f7306bbf8534796c9cb5356f3b8cd9d2a686b Mon Sep 17 00:00:00 2001 From: Guten Date: Sun, 22 May 2011 21:27:30 +0800 Subject: [PATCH 402/614] add custom completion support --- oh-my-zsh.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 3ea88e924..a3d276df5 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -1,7 +1,7 @@ # Initializes Oh My Zsh # add a function path -fpath=($ZSH/functions $fpath) +fpath=($ZSH/functions $ZSH/completions $fpath) # Load all of the config files in ~/oh-my-zsh that end in .zsh # TIP: Add files you don't want in git to .gitignore From b5071580d64bfb792b6347e7836ef13da1a4e6b4 Mon Sep 17 00:00:00 2001 From: Casey Watson Date: Tue, 24 May 2011 12:15:58 -0600 Subject: [PATCH 403/614] Fix to random theme selection - themes array is 1-based - theme files names are located in indicies 1 through N inclusive - this resolves an issue where you would occasionally see: "no such file or directory. Random theme '' loaded..." --- oh-my-zsh.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 3ea88e924..2a206798d 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -31,7 +31,7 @@ if [ "$ZSH_THEME" = "random" ] then themes=($ZSH/themes/*zsh-theme) N=${#themes[@]} - ((N=RANDOM%N)) + ((N=(RANDOM%N)+1)) RANDOM_THEME=${themes[$N]} source "$RANDOM_THEME" echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..." From cd7b12b4acce07bd6f30c6e528f83cba03fa24e6 Mon Sep 17 00:00:00 2001 From: Jake Bell Date: Thu, 26 May 2011 12:34:37 -0500 Subject: [PATCH 404/614] Adding ability to override plugins from the custom directory. --- .gitignore | 1 + README.textile | 6 ++++-- custom/example/example.plugin.zsh | 2 ++ oh-my-zsh.sh | 4 +++- 4 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 custom/example/example.plugin.zsh diff --git a/.gitignore b/.gitignore index 4b555067e..8fdfae286 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,6 @@ locals.zsh log/.zsh_history projects.zsh custom/* +!custom/example !custom/example.zsh cache diff --git a/README.textile b/README.textile index d01c3310a..2dbfbe5a6 100644 --- a/README.textile +++ b/README.textile @@ -48,7 +48,9 @@ the "refcard":http://www.bash2zsh.com/zsh_refcard/refcard.pdf is pretty tasty fo h3. Customization If you want to override any of the default behavior, just add a new file (ending in @.zsh@) into the @custom/@ directory. -If you have many functions which go good together you can put them as a *.plugin.zsh file in the @plugin/@ directory and then enable this plugin. +If you have many functions which go good together you can put them as a *.plugin.zsh file in the @custom/plugins/@ directory and then enable this plugin. +If you would like to override the functionality of a plugin distributed with oh-my-zsh, create a plugin of the same name in the @custom/plugins/@ directory and it will be loaded instead of the one in @plugins/@. + h3. Uninstalling @@ -68,4 +70,4 @@ This project wouldn't exist without all of our awesome users and contributors. * "View our growing list of contributors":https://github.com/robbyrussell/oh-my-zsh/contributors -Thank you so much! \ No newline at end of file +Thank you so much! diff --git a/custom/example/example.plugin.zsh b/custom/example/example.plugin.zsh new file mode 100644 index 000000000..406f27445 --- /dev/null +++ b/custom/example/example.plugin.zsh @@ -0,0 +1,2 @@ +# Add your own custom plugins in the custom/plugins directory. Plugins placed +# here will override ones with the same name in the main plugins directory. diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index c8f1a33b8..dbff1ced9 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -17,7 +17,9 @@ compinit -i # Load all of the plugins that were defined in ~/.zshrc for plugin ($plugins); do - if [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then + if [ -f $ZSH/custom/plugins/$plugin/$plugin.plugin.zsh ]; then + source $ZSH/custom/plugins/$plugin/$plugin.plugin.zsh + elif [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then source $ZSH/plugins/$plugin/$plugin.plugin.zsh fi done From b9d8440caff426e3d2945c777478a4390bdad62c Mon Sep 17 00:00:00 2001 From: nebirhos Date: Thu, 26 May 2011 20:00:23 +0200 Subject: [PATCH 405/614] Added nebirhos theme --- themes/nebirhos.zsh-theme | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 themes/nebirhos.zsh-theme diff --git a/themes/nebirhos.zsh-theme b/themes/nebirhos.zsh-theme new file mode 100644 index 000000000..c49df972e --- /dev/null +++ b/themes/nebirhos.zsh-theme @@ -0,0 +1,17 @@ +# Based on robbyrussell's theme, with host and rvm indicators. Example: +# @host ➜ currentdir rvm:(rubyversion@gemset) git:(branchname) + +# Get the current ruby version in use with RVM: +if [ -e ~/.rvm/bin/rvm-prompt ]; then + RUBY_PROMPT_="%{$fg_bold[blue]%}rvm:(%{$fg[green]%}\$(~/.rvm/bin/rvm-prompt s i v g)%{$fg_bold[blue]%})%{$reset_color%} " +fi + +# Get the host name (first 4 chars) +HOST_PROMPT_="%{$fg_bold[red]%}@$HOST[0,4] ➜ %{$fg_bold[cyan]%}%c " +GIT_PROMPT="%{$fg_bold[blue]%}\$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}" +PROMPT="$HOST_PROMPT_$RUBY_PROMPT_$GIT_PROMPT" + +ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" From ec59a19cd5aef2303b620f69e78368263129db25 Mon Sep 17 00:00:00 2001 From: alanpeabody Date: Thu, 26 May 2011 23:56:45 -0400 Subject: [PATCH 406/614] Added my own theme. --- themes/alanpeabody.zsh-theme | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 themes/alanpeabody.zsh-theme diff --git a/themes/alanpeabody.zsh-theme b/themes/alanpeabody.zsh-theme new file mode 100644 index 000000000..1f66f1ec3 --- /dev/null +++ b/themes/alanpeabody.zsh-theme @@ -0,0 +1,22 @@ + +local user='%{$fg[magenta]%}%n@%{$fg[magenta]%}%m%{$reset_color%}' +local pwd='%{$fg[blue]%}%~%{$reset_color%}' +local rvm='%{$fg[green]%}‹$(rvm-prompt i v g)›%{$reset_color%}' +local return_code='%(?..%{$fg[red]%}%? ↵%{$reset_color%})' +local git_branch='$(git_prompt_status)%{$reset_color%}$(git_prompt_info)%{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="" +ZSH_THEME_GIT_PROMPT_CLEAN="" + +ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} ✚" +ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} ✹" +ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖" +ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜" +ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭" + +PROMPT="${user} ${pwd}$ " +RPROMPT="${return_code} ${git_branch} ${rvm}" + From b52668fa804bf8c11e66e81cff7f8e708df646b4 Mon Sep 17 00:00:00 2001 From: Martin Thurau Date: Fri, 27 May 2011 16:58:14 +0200 Subject: [PATCH 407/614] Added compatibility for the linux 'stat' command for the ant plugin --- plugins/ant/ant.plugin.zsh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/plugins/ant/ant.plugin.zsh b/plugins/ant/ant.plugin.zsh index 0544ac92c..23bc7756a 100644 --- a/plugins/ant/ant.plugin.zsh +++ b/plugins/ant/ant.plugin.zsh @@ -1,8 +1,15 @@ +stat -f%m . > /dev/null 2>&1 +if [ "$?" = 0 ]; then + stat_cmd=(stat -f%m) +else + stat_cmd=(stat -L --format=%y) +fi + _ant_does_target_list_need_generating () { if [ ! -f .ant_targets ]; then return 0; else - accurate=$(stat -f%m .ant_targets) - changed=$(stat -f%m build.xml) + accurate=$($stat_cmd -f%m .ant_targets) + changed=$($stat_cmd -f%m build.xml) return $(expr $accurate '>=' $changed) fi } From df5345fd8afd2581beda44359ce44a7d92b67293 Mon Sep 17 00:00:00 2001 From: Andrew Hodges Date: Sat, 28 May 2011 10:16:06 -0400 Subject: [PATCH 408/614] Ruby Switching Helpers Add helper functions to switch gemsets on ruby-1.8.7-p334 and ruby-1.9.2-p180. Add completion definitions for helper functions. --- plugins/rvm/rvm.plugin.zsh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/plugins/rvm/rvm.plugin.zsh b/plugins/rvm/rvm.plugin.zsh index ef934d547..274123836 100644 --- a/plugins/rvm/rvm.plugin.zsh +++ b/plugins/rvm/rvm.plugin.zsh @@ -1,3 +1,28 @@ fpath=($ZSH/plugins/rvm $fpath) autoload -U compinit compinit -i + +local ruby18='ruby-1.8.7-p334' +local ruby19='ruby-1.9.2-p180' + +function rb18 { + if [ -z "$1" ]; then + rvm use "$ruby18" + else + rvm use "$ruby18@$1" + fi +} + +_rb18() {compadd `ls -1 $rvm_path/gems | grep "^$ruby18@" | sed -e "s/^$ruby18@//" | awk '{print $1}'`} +compdef _rb18 rb18 + +function rb19 { + if [ -z "$1" ]; then + rvm use "$ruby19" + else + rvm use "$ruby19@$1" + fi +} + +_rb19() {compadd `ls -1 $rvm_path/gems | grep "^$ruby19@" | sed -e "s/^$ruby19@//" | awk '{print $1}'`} +compdef _rb19 rb19 From 8bc3f278e5400d83dfd7b67c26229506e6d70232 Mon Sep 17 00:00:00 2001 From: Andrew Hodges Date: Sat, 28 May 2011 10:23:06 -0400 Subject: [PATCH 409/614] Helpful Listing Aliases Add alias to list installed rubies. Add alias to list gemsets in active ruby. --- plugins/rvm/rvm.plugin.zsh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/rvm/rvm.plugin.zsh b/plugins/rvm/rvm.plugin.zsh index 274123836..ba780c97d 100644 --- a/plugins/rvm/rvm.plugin.zsh +++ b/plugins/rvm/rvm.plugin.zsh @@ -2,6 +2,9 @@ fpath=($ZSH/plugins/rvm $fpath) autoload -U compinit compinit -i +alias rubies='rvm list rubies' +alias gemsets='rvm gemset list' + local ruby18='ruby-1.8.7-p334' local ruby19='ruby-1.9.2-p180' From acac0a2a47899e988e849a89981078cbe990c1a4 Mon Sep 17 00:00:00 2001 From: Andrew Hodges Date: Sat, 28 May 2011 10:35:54 -0400 Subject: [PATCH 410/614] RVM Update Helpers Add helper function to get rvm head. Add helper function to link zsh completion that comes with rvm into om-my-zsh plugin directory, but don't overwrite the completion that comes with oh-my-zsh (oh-my-zsh's completion is better, but I want to be able to compare). --- plugins/rvm/rvm.plugin.zsh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plugins/rvm/rvm.plugin.zsh b/plugins/rvm/rvm.plugin.zsh index ba780c97d..509dcbd98 100644 --- a/plugins/rvm/rvm.plugin.zsh +++ b/plugins/rvm/rvm.plugin.zsh @@ -29,3 +29,12 @@ function rb19 { _rb19() {compadd `ls -1 $rvm_path/gems | grep "^$ruby19@" | sed -e "s/^$ruby19@//" | awk '{print $1}'`} compdef _rb19 rb19 + +function rvm-update { + rvm get head + rvm reload # TODO: Reload rvm completion? +} + +function rvm-link-completion { + ln -s "$rvm_path/scripts/zsh/Completion/_rvm" "$ZSH/plugins/rvm/_rvm.official" +} From 7b8290a4e1c9229ba66795897344114cc20d9e98 Mon Sep 17 00:00:00 2001 From: Andrew Hodges Date: Sat, 28 May 2011 10:50:06 -0400 Subject: [PATCH 411/614] Gem List Helper Add helper function to list gems in a pretty way (only with rvm, for now). Add missng EOF newline and a todo to the ruby plugin. --- plugins/ruby/ruby.plugin.zsh | 4 +++- plugins/rvm/rvm.plugin.zsh | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/plugins/ruby/ruby.plugin.zsh b/plugins/ruby/ruby.plugin.zsh index 82bf5d49d..08ca9c601 100644 --- a/plugins/ruby/ruby.plugin.zsh +++ b/plugins/ruby/ruby.plugin.zsh @@ -1,4 +1,6 @@ +# TODO: Make this compatible with rvm. +# Run sudo gem on the system ruby, not the active ruby. alias sgem='sudo gem' # Find ruby file -alias rfind='find . -name *.rb | xargs grep -n' \ No newline at end of file +alias rfind='find . -name *.rb | xargs grep -n' diff --git a/plugins/rvm/rvm.plugin.zsh b/plugins/rvm/rvm.plugin.zsh index 509dcbd98..8a3ec788a 100644 --- a/plugins/rvm/rvm.plugin.zsh +++ b/plugins/rvm/rvm.plugin.zsh @@ -38,3 +38,15 @@ function rvm-update { function rvm-link-completion { ln -s "$rvm_path/scripts/zsh/Completion/_rvm" "$ZSH/plugins/rvm/_rvm.official" } + +# TODO: Make this usable w/o rvm. +function gems { + local current_ruby=`rvm-prompt i v p` + local current_gemset=`rvm-prompt g` + + gem list $@ | sed \ + -Ee "s/\([0-9\.]+( .+)?\)/$fg[blue]&$reset_color/g" \ + -Ee "s|$(echo $rvm_path)|$fg[magenta]\$rvm_path$reset_color|g" \ + -Ee "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \ + -Ee "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g" +} From c6688047f7588a70b9fa413a971fe9414ef41bbe Mon Sep 17 00:00:00 2001 From: Andrew Hodges Date: Sat, 28 May 2011 10:57:48 -0400 Subject: [PATCH 412/614] Brew Plugin Merge completion with official brew completion. Add a helper to link official completion into oh-my-zsh plugin (without overwriting). Add an alias to list installed brews. Add brews to the path (in a somewhat strange way). --- plugins/brew/_brew | 24 +++++++++++++++++------- plugins/brew/brew.plugin.zsh | 13 +++++++++++++ 2 files changed, 30 insertions(+), 7 deletions(-) create mode 100644 plugins/brew/brew.plugin.zsh diff --git a/plugins/brew/_brew b/plugins/brew/_brew index cee1e25f0..1dcf0a4bf 100644 --- a/plugins/brew/_brew +++ b/plugins/brew/_brew @@ -25,10 +25,12 @@ _1st_arguments=( 'link:link a formula' 'list:list files in a formula or not-installed formulae' 'log:git commit log for a formula' + 'missing:check all installed formuale for missing dependencies.' 'outdated:list formulas for which a newer version is available' 'prune:remove dead links' 'remove:remove a formula' 'search:search for a formula (/regex/ or string)' + 'server:start a local web app that lets you browse formulae (requires Sinatra)' 'unlink:unlink a formula' 'update:freshen up links' 'upgrade:upgrade outdated formulae' @@ -36,10 +38,14 @@ _1st_arguments=( ) local expl -local -a formula installed_formulae +local -a formulae installed_formulae _arguments \ - '(-v --verbose)'{-v,--verbose}'[verbose]' \ + '(-v)-v[verbose]' \ + '(--cellar)--cellar[brew cellar]' \ + '(--config)--config[brew configuration]' \ + '(--env)--env[brew environment]' \ + '(--repository)--repository[brew repository]' \ '(--version)--version[version information]' \ '(--prefix)--prefix[where brew lives on this system]' \ '(--cache)--cache[brew cache]' \ @@ -51,20 +57,24 @@ if (( CURRENT == 1 )); then fi case "$words[1]" in - list) + search|-S) + _arguments \ + '(--macports)--macports[search the macports repository]' \ + '(--fink)--fink[search the fink repository]' ;; + list|ls) _arguments \ '(--unbrewed)--unbrewed[files in brew --prefix not controlled by brew]' \ + '(--versions)--versions[list all installed versions of a formula]' \ '1: :->forms' && return 0 if [[ "$state" == forms ]]; then _brew_installed_formulae - _requested installed_formulae expl 'installed formulae' compadd -a installed_formulae + _wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae fi ;; - install|home|log|info|uses|cat|deps) + install|home|homepage|log|info|abv|uses|cat|deps|edit|options) _brew_all_formulae _wanted formulae expl 'all formulae' compadd -a formulae ;; - remove|edit|xo) + remove|rm|uninstall|unlink|cleanup|link|ln) _brew_installed_formulae _wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae ;; esac - diff --git a/plugins/brew/brew.plugin.zsh b/plugins/brew/brew.plugin.zsh new file mode 100644 index 000000000..f584a4684 --- /dev/null +++ b/plugins/brew/brew.plugin.zsh @@ -0,0 +1,13 @@ +# Move /usr/local/bin (path where brews are linked) to the front of the path +# This will allow us to override system binaries like ruby with our brews +# TODO: Do this in a more compatible way. +# What if someone doesn't have /usr/bin in their path? +export PATH=`echo $PATH | sed -e 's|/usr/local/bin||' -e 's|::|:|g'` # Remove /usr/local/bin +export PATH=`echo $PATH | sed -e 's|/usr/bin|/usr/local/bin:&|'` # Add it in front of /usr/bin +export PATH=`echo $PATH | sed -e 's|/usr/bin|/usr/local/sbin:&|'` # Add /usr/local/sbin + +alias brews='brew list -1' + +function brew-link-completion { + ln -s "$(brew --prefix)/Library/Contributions/brew_zsh_completion.zsh" "$ZSH/plugins/brew/_brew.official" +} From 513938e5c358a37f960cf7206938335d5c7d29fc Mon Sep 17 00:00:00 2001 From: Andrew Hodges Date: Sat, 28 May 2011 11:09:37 -0400 Subject: [PATCH 413/614] Pow! Restart Helper Add helper function to restart an app running on Pow! --- plugins/pow/pow.plugin.zsh | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 plugins/pow/pow.plugin.zsh diff --git a/plugins/pow/pow.plugin.zsh b/plugins/pow/pow.plugin.zsh new file mode 100644 index 000000000..6b2a6f2be --- /dev/null +++ b/plugins/pow/pow.plugin.zsh @@ -0,0 +1,10 @@ +# Thanks to Christopher Sexton +# https://gist.github.com/965032 +function kapow { + touch ~/.pow/$1/tmp/restart.txt + if [ $? -eq 0 ]; then + echo "$fg[yellow]Pow restarting $1...$reset_color" + fi +} + +compctl -W ~/.pow -/ kapow From f14b00808d531bc1195e9ad23e12182834156a36 Mon Sep 17 00:00:00 2001 From: Andrew Hodges Date: Sat, 28 May 2011 11:20:48 -0400 Subject: [PATCH 414/614] Node.js Helpers Add helper function to open node api in browser. Add binaries installed via npm to path. Tell node where to find things (what things?). --- plugins/node/node.plugin.zsh | 8 ++++++++ plugins/npm/npm.plugin.zsh | 2 ++ 2 files changed, 10 insertions(+) create mode 100644 plugins/node/node.plugin.zsh create mode 100644 plugins/npm/npm.plugin.zsh diff --git a/plugins/node/node.plugin.zsh b/plugins/node/node.plugin.zsh new file mode 100644 index 000000000..18f35333c --- /dev/null +++ b/plugins/node/node.plugin.zsh @@ -0,0 +1,8 @@ +# This works if you installed node via homebrew. +export NODE_PATH="/usr/local/lib/node" + +# Open the node api for your current version to the optional section. +# TODO: Make the section part easier to use. +function node-api { + open "http://nodejs.org/docs/$(node --version)/api/all.html#$1" +} diff --git a/plugins/npm/npm.plugin.zsh b/plugins/npm/npm.plugin.zsh new file mode 100644 index 000000000..0b0a30e11 --- /dev/null +++ b/plugins/npm/npm.plugin.zsh @@ -0,0 +1,2 @@ +# TODO: Don't do this in such a weird way. +export PATH=`echo $PATH | sed -e 's|/usr/bin|/usr/local/share/npm/bin:&|'` From 8e7fa7cefcff63f78df434fa96b636281e629cba Mon Sep 17 00:00:00 2001 From: Andrew Hodges Date: Sat, 28 May 2011 11:27:50 -0400 Subject: [PATCH 415/614] OS X Helpers Add helper aliases for show/hide files. Add helper alias to recursively delete .DS_Store files. --- plugins/osx/osx.plugin.zsh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh index 81eed5e92..a65ca642a 100644 --- a/plugins/osx/osx.plugin.zsh +++ b/plugins/osx/osx.plugin.zsh @@ -1,3 +1,9 @@ +alias showfiles='defaults write com.apple.finder AppleShowAllFiles TRUE; killall Finder' +alias hidefiles='defaults write com.apple.finder AppleShowAllFiles FALSE; killall Finder' + +# Recursively delete .DS_Store files +alias rm-dsstore="find . -name '*.DS_Store' -type f -delete" + function savepath() { pwd > ~/.current_path~ } From 2bab02829c4c60a1e123e5eb96bddc8cecc45dc8 Mon Sep 17 00:00:00 2001 From: brian tse Date: Sat, 28 May 2011 23:57:32 +0800 Subject: [PATCH 416/614] Add new 'minimal' theme --- themes/minimal.zsh-theme | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 themes/minimal.zsh-theme diff --git a/themes/minimal.zsh-theme b/themes/minimal.zsh-theme new file mode 100644 index 000000000..ee3ab6b22 --- /dev/null +++ b/themes/minimal.zsh-theme @@ -0,0 +1,15 @@ +ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[white]%}[" +ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}●%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="" + +#Customized git status, oh-my-zsh currently does not allow render dirty status before branch +git_custom_status() { + local cb=$(current_branch) + if [ -n "$cb" ]; then + echo "- $ZSH_THEME_GIT_PROMPT_PREFIX$(current_branch)$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX" + fi +} + + +PROMPT='%2~ $(git_custom_status) »%b ' \ No newline at end of file From bcfa9b192098db3fc56b6fdd6b904e35db33ef68 Mon Sep 17 00:00:00 2001 From: Andrew Hodges Date: Sat, 28 May 2011 13:06:03 -0400 Subject: [PATCH 417/614] Cleanup Add missing newlines at EOF. Remove redundant comment. Fix grammar in comment. --- plugins/cap/cap.plugin.zsh | 2 +- plugins/compleat/compleat.plugin.zsh | 2 -- plugins/github/github.plugin.zsh | 1 - plugins/textmate/textmate.plugin.zsh | 4 +--- 4 files changed, 2 insertions(+), 7 deletions(-) diff --git a/plugins/cap/cap.plugin.zsh b/plugins/cap/cap.plugin.zsh index a0fa21d00..8336182d5 100644 --- a/plugins/cap/cap.plugin.zsh +++ b/plugins/cap/cap.plugin.zsh @@ -18,4 +18,4 @@ function _cap () { fi } -compctl -K _cap cap \ No newline at end of file +compctl -K _cap cap diff --git a/plugins/compleat/compleat.plugin.zsh b/plugins/compleat/compleat.plugin.zsh index 8d16a5687..38f1b396a 100644 --- a/plugins/compleat/compleat.plugin.zsh +++ b/plugins/compleat/compleat.plugin.zsh @@ -5,7 +5,6 @@ # VERSION: 1.0.0 # ------------------------------------------------------------------------------ - if (( ${+commands[compleat]} )); then local prefix="${commands[compleat]:h:h}" local setup="${prefix}/share/compleat-1.0/compleat_setup" @@ -19,4 +18,3 @@ if (( ${+commands[compleat]} )); then source "$setup" fi fi - diff --git a/plugins/github/github.plugin.zsh b/plugins/github/github.plugin.zsh index df7053ba7..1eb338113 100644 --- a/plugins/github/github.plugin.zsh +++ b/plugins/github/github.plugin.zsh @@ -4,4 +4,3 @@ if [ "$commands[(I)hub]" ]; then # eval `hub alias -s zsh` function git(){hub "$@"} fi - diff --git a/plugins/textmate/textmate.plugin.zsh b/plugins/textmate/textmate.plugin.zsh index 7c4c14a5f..aa2f75f4f 100644 --- a/plugins/textmate/textmate.plugin.zsh +++ b/plugins/textmate/textmate.plugin.zsh @@ -1,11 +1,9 @@ - -# TextMate alias et='mate .' alias ett='mate app config lib db public spec test Rakefile Capfile Todo' alias etp='mate app config lib db public spec test vendor/plugins vendor/gems Rakefile Capfile Todo' alias etts='mate app config lib db public script spec test vendor/plugins vendor/gems Rakefile Capfile Todo' -# Editor Ruby file in TextMate +# Edit Ruby app in TextMate alias mr='mate CHANGELOG app config db lib public script spec test' function tm() { From 92ba1f5737aea661e336e035e7a41e44f4d74a59 Mon Sep 17 00:00:00 2001 From: Andrew Hodges Date: Sat, 28 May 2011 13:12:03 -0400 Subject: [PATCH 418/614] Thor Add plugin with completion for thor. --- plugins/thor/_thor | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 plugins/thor/_thor diff --git a/plugins/thor/_thor b/plugins/thor/_thor new file mode 100644 index 000000000..9f7ed5aef --- /dev/null +++ b/plugins/thor/_thor @@ -0,0 +1,4 @@ +#compdef thor +#autoload + +compadd `thor list | grep thor | cut -d " " -f 2` From edfa673b6fd5f07a0595a4fafa43d7602db5677c Mon Sep 17 00:00:00 2001 From: Magnus Woldrich Date: Sun, 29 May 2011 11:55:24 +0200 Subject: [PATCH 419/614] add trapd00r theme --- themes/trapd00r.zsh-theme | 95 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 themes/trapd00r.zsh-theme diff --git a/themes/trapd00r.zsh-theme b/themes/trapd00r.zsh-theme new file mode 100644 index 000000000..cba14c42c --- /dev/null +++ b/themes/trapd00r.zsh-theme @@ -0,0 +1,95 @@ +# Name: trapd00r zsh theme +# Author: Magnus Woldrich +# +# This theme needs a terminal supporting 256 colors as well as unicode. It also +# needs the script that splits up the current path and makes it fancy as located +# here: https://github.com/trapd00r/utils/blob/master/zsh_path +# +# By default it spans over two lines like so: +# +# scp1@shiva:pts/9-> /home » scp1 (0) +# > +# +# that's user@host:pts/-> splitted path (return status) +# +# If the current directory is a git repository, we span 3 lines; +# +# git❨ master ❩ DIRTY +# scp1@shiva:pts/4-> /home » scp1 » dev » utils (0) +# > + +autoload -U add-zsh-hook +autoload -Uz vcs_info + +local c0=$( printf "\e[m") +local c1=$( printf "\e[38;5;245m") +local c2=$( printf "\e[38;5;250m") +local c3=$( printf "\e[38;5;242m") +local c4=$( printf "\e[38;5;197m") +local c5=$( printf "\e[38;5;225m") +local c6=$( printf "\e[38;5;240m") +local c7=$( printf "\e[38;5;242m") +local c8=$( printf "\e[38;5;244m") +local c9=$( printf "\e[38;5;162m") +local c10=$(printf "\e[1m") +local c11=$(printf "\e[38;5;208m\e[1m") +local c12=$(printf "\e[38;5;142m\e[1m") +local c13=$(printf "\e[38;5;196m\e[1m") + + +# We dont want to use the extended colorset in the TTY / VC. +if [ "$TERM" = "linux" ]; then + c1=$( printf "\e[34;1m") + c2=$( printf "\e[35m") + c3=$( printf "\e[31m") + c4=$( printf "\e[31;1m") + c5=$( printf "\e[32m") + c6=$( printf "\e[32;1m") + c7=$( printf "\e[33m") + c8=$( printf "\e[33;1m") + c9=$( printf "\e[34m") + + c11=$(printf "\e[35;1m") + c12=$(printf "\e[36m") + c13=$(printf "\e[31;1m") +fi + +zstyle ':vcs_info:*' actionformats \ + '%{$c8%}(%f%s)%{$c7%}-%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f ' + +zstyle ':vcs_info:*' formats \ + "%{$c8%}%s%%{$c7%}❨ %{$c9%}%{$c11%}%b%{$c7%} ❩%{$reset_color%}%f " + +zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r' +zstyle ':vcs_info:*' enable git + +add-zsh-hook precmd prompt_jnrowe_precmd + +prompt_jnrowe_precmd () { + vcs_info + if [ "${vcs_info_msg_0_}" = "" ]; then + dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})" + PROMPT='%{$fg_bold[green]%}%p%{$reset_color%}${vcs_info_msg_0_}${dir_status} ${ret_status}%{$reset_color%} +> ' + +# modified, to be commited + elif [[ $(git diff --cached --name-status 2>/dev/null ) != "" ]]; then + dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})" + PROMPT='${vcs_info_msg_0_}%{$30%} %{$bg_bold[red]%}%{$fg_bold[cyan]%}C%{$fg_bold[black]%}OMMIT%{$reset_color%} +%{$fg_bold[green]%}%p%{$reset_color%}${dir_status}%{$reset_color%} +> ' + + elif [[ $(git diff --name-status 2>/dev/null ) != "" ]]; then + dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})" + PROMPT='${vcs_info_msg_0_}%{$bg_bold[red]%}%{$fg_bold[blue]%}D%{$fg_bold[black]%}IRTY%{$reset_color%} +%{$fg_bold[green]%}%p%{$reset_color%}${dir_status}%{$reset_color%} +%{$c13%}>%{$c0%} ' + else + dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})" + PROMPT='${vcs_info_msg_0_} +%{$fg_bold[green]%}%p%{$reset_color%}${dir_status} ${vcs_info_msg_0_}%{$reset_color%} +> ' +fi +} + +# vim: set ft=zsh sw=2 et tw=0: From 80ed1cbc5dd9a82dfa54e5381d75210280246f6f Mon Sep 17 00:00:00 2001 From: Andrew Hodges Date: Mon, 30 May 2011 10:07:15 -0400 Subject: [PATCH 420/614] Rollback of Pull #366 sorin-ionescu had some good points. --- plugins/brew/brew.plugin.zsh | 12 ------------ plugins/node/node.plugin.zsh | 5 +---- plugins/npm/npm.plugin.zsh | 2 -- plugins/rvm/rvm.plugin.zsh | 9 ++------- 4 files changed, 3 insertions(+), 25 deletions(-) delete mode 100644 plugins/npm/npm.plugin.zsh diff --git a/plugins/brew/brew.plugin.zsh b/plugins/brew/brew.plugin.zsh index f584a4684..c2e95884e 100644 --- a/plugins/brew/brew.plugin.zsh +++ b/plugins/brew/brew.plugin.zsh @@ -1,13 +1 @@ -# Move /usr/local/bin (path where brews are linked) to the front of the path -# This will allow us to override system binaries like ruby with our brews -# TODO: Do this in a more compatible way. -# What if someone doesn't have /usr/bin in their path? -export PATH=`echo $PATH | sed -e 's|/usr/local/bin||' -e 's|::|:|g'` # Remove /usr/local/bin -export PATH=`echo $PATH | sed -e 's|/usr/bin|/usr/local/bin:&|'` # Add it in front of /usr/bin -export PATH=`echo $PATH | sed -e 's|/usr/bin|/usr/local/sbin:&|'` # Add /usr/local/sbin - alias brews='brew list -1' - -function brew-link-completion { - ln -s "$(brew --prefix)/Library/Contributions/brew_zsh_completion.zsh" "$ZSH/plugins/brew/_brew.official" -} diff --git a/plugins/node/node.plugin.zsh b/plugins/node/node.plugin.zsh index 18f35333c..519bc18da 100644 --- a/plugins/node/node.plugin.zsh +++ b/plugins/node/node.plugin.zsh @@ -1,8 +1,5 @@ -# This works if you installed node via homebrew. -export NODE_PATH="/usr/local/lib/node" - # Open the node api for your current version to the optional section. # TODO: Make the section part easier to use. -function node-api { +function node-docs { open "http://nodejs.org/docs/$(node --version)/api/all.html#$1" } diff --git a/plugins/npm/npm.plugin.zsh b/plugins/npm/npm.plugin.zsh deleted file mode 100644 index 0b0a30e11..000000000 --- a/plugins/npm/npm.plugin.zsh +++ /dev/null @@ -1,2 +0,0 @@ -# TODO: Don't do this in such a weird way. -export PATH=`echo $PATH | sed -e 's|/usr/bin|/usr/local/share/npm/bin:&|'` diff --git a/plugins/rvm/rvm.plugin.zsh b/plugins/rvm/rvm.plugin.zsh index 8a3ec788a..40fd88c1a 100644 --- a/plugins/rvm/rvm.plugin.zsh +++ b/plugins/rvm/rvm.plugin.zsh @@ -1,6 +1,5 @@ -fpath=($ZSH/plugins/rvm $fpath) -autoload -U compinit -compinit -i +# What does this really do? +# fpath=($ZSH/plugins/rvm $fpath) alias rubies='rvm list rubies' alias gemsets='rvm gemset list' @@ -35,10 +34,6 @@ function rvm-update { rvm reload # TODO: Reload rvm completion? } -function rvm-link-completion { - ln -s "$rvm_path/scripts/zsh/Completion/_rvm" "$ZSH/plugins/rvm/_rvm.official" -} - # TODO: Make this usable w/o rvm. function gems { local current_ruby=`rvm-prompt i v p` From 932d3fc90269443852d14650c7815218a2c64f2f Mon Sep 17 00:00:00 2001 From: Andrew Hodges Date: Mon, 30 May 2011 11:10:08 -0400 Subject: [PATCH 421/614] Remove Uneeded Lines --- plugins/rvm/rvm.plugin.zsh | 3 --- 1 file changed, 3 deletions(-) diff --git a/plugins/rvm/rvm.plugin.zsh b/plugins/rvm/rvm.plugin.zsh index 40fd88c1a..24621fe0b 100644 --- a/plugins/rvm/rvm.plugin.zsh +++ b/plugins/rvm/rvm.plugin.zsh @@ -1,6 +1,3 @@ -# What does this really do? -# fpath=($ZSH/plugins/rvm $fpath) - alias rubies='rvm list rubies' alias gemsets='rvm gemset list' From d134a526def92372e9e5b82ddd55b0d7079d6c20 Mon Sep 17 00:00:00 2001 From: Second Planet Date: Mon, 30 May 2011 19:10:26 -0400 Subject: [PATCH 422/614] added humza.zsh-theme --- themes/humza.zsh-theme | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 themes/humza.zsh-theme diff --git a/themes/humza.zsh-theme b/themes/humza.zsh-theme new file mode 100644 index 000000000..107886295 --- /dev/null +++ b/themes/humza.zsh-theme @@ -0,0 +1,26 @@ +# ZSH THEME Preview: https://skitch.com/huyy/rk979/humza.zshtheme + +let TotalBytes=0 +for Bytes in $(ls -l | grep "^-" | awk '{ print $5 }') +do + let TotalBytes=$TotalBytes+$Bytes +done + # should it say b, kb, Mb, or Gb +if [ $TotalBytes -lt 1024 ]; then + TotalSize=$(echo -e "scale=3 \n$TotalBytes \nquit" | bc) + suffix="b" +elif [ $TotalBytes -lt 1048576 ]; then + TotalSize=$(echo -e "scale=3 \n$TotalBytes/1024 \nquit" | bc) + suffix="kb" +elif [ $TotalBytes -lt 1073741824 ]; then + TotalSize=$(echo -e "scale=3 \n$TotalBytes/1048576 \nquit" | bc) + suffix="Mb" +else + TotalSize=$(echo -e "scale=3 \n$TotalBytes/1073741824 \nquit" | bc) + suffix="Gb" +fi + +PROMPT='%{$reset_color%}%n %{$fg[green]%}{%{$reset_color%}%~%{$fg[green]%}}%{$reset_color%}$(git_prompt_info) greetings, earthling %{$fg[green]%}[%{$reset_color%}%{$TotalSize%}%{$suffix%}%{$fg[green]%}]%{$fg[red]%}$%{$reset_color%} ☞ ' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[red]%}±(" +ZSH_THEME_GIT_PROMPT_SUFFIX=");%{$reset_color%}" From 74fea2aa2f5ce927af8acadf83b6e3328f03892e Mon Sep 17 00:00:00 2001 From: Brian Riddle Date: Tue, 31 May 2011 14:16:43 +0200 Subject: [PATCH 423/614] fix double -f and corrected format. -f%m was getting called twice in the stat_cmd corrected format of stat command from y to Y. --- plugins/ant/ant.plugin.zsh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/ant/ant.plugin.zsh b/plugins/ant/ant.plugin.zsh index 23bc7756a..691d4d2db 100644 --- a/plugins/ant/ant.plugin.zsh +++ b/plugins/ant/ant.plugin.zsh @@ -2,14 +2,14 @@ stat -f%m . > /dev/null 2>&1 if [ "$?" = 0 ]; then stat_cmd=(stat -f%m) else - stat_cmd=(stat -L --format=%y) + stat_cmd=(stat -L --format=%Y) fi _ant_does_target_list_need_generating () { if [ ! -f .ant_targets ]; then return 0; else - accurate=$($stat_cmd -f%m .ant_targets) - changed=$($stat_cmd -f%m build.xml) + accurate=$($stat_cmd .ant_targets) + changed=$($stat_cmd build.xml) return $(expr $accurate '>=' $changed) fi } From a3505c448f43a38d5483d048cb520ee557db3a35 Mon Sep 17 00:00:00 2001 From: Michael Hanson Date: Tue, 31 May 2011 15:13:23 -0700 Subject: [PATCH 424/614] Fix deleted in git.zsh --- lib/git.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/git.zsh b/lib/git.zsh index 2ace3d0e0..ce4de5598 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -52,11 +52,11 @@ git_prompt_status() { if $(echo "$INDEX" | grep '^R ' &> /dev/null); then STATUS="$ZSH_THEME_GIT_PROMPT_RENAMED$STATUS" fi - if $(echo "$INDEX" | grep '^ D ' &> /dev/null); then + if $(echo "$INDEX" | grep '^D ' &> /dev/null); then STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS" fi if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS" fi echo $STATUS -} \ No newline at end of file +} From 5298cbbabf8bd6ff754b7131416a20a76128d804 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Wed, 1 Jun 2011 09:33:12 +0200 Subject: [PATCH 425/614] Revert "Added my zsh theme file, heavily based on sjl's" as it relies on a dotfile to be in ~/bin. This reverts commit f2f34f5404e8ab674a0e345a709783b6c56a3b72. --- themes/thomasjbradley.zsh-theme | 29 ----------------------------- 1 file changed, 29 deletions(-) delete mode 100644 themes/thomasjbradley.zsh-theme diff --git a/themes/thomasjbradley.zsh-theme b/themes/thomasjbradley.zsh-theme deleted file mode 100644 index 857301d19..000000000 --- a/themes/thomasjbradley.zsh-theme +++ /dev/null @@ -1,29 +0,0 @@ -function prompt_char { - git branch >/dev/null 2>/dev/null && echo '±' && return - hg root >/dev/null 2>/dev/null && echo '☿' && return - echo '○' -} - -function virtualenv_info { - [ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') ' -} - -function hg_prompt_info { - hg prompt --angle-brackets "\ -< on %{$fg[magenta]%}%{$reset_color%}>\ -< at %{$fg[yellow]%}%{$reset_color%}>\ -%{$fg[green]%}%{$reset_color%}< -patches: >" 2>/dev/null -} - -PROMPT=' -%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$(hg_prompt_info)$(git_prompt_info) -$(virtualenv_info)$(prompt_char) ' - -ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}!" -ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[green]%}?" -ZSH_THEME_GIT_PROMPT_CLEAN="" - -. ~/bin/dotfiles/zsh/aliases From 124a89342885a43f0a1a95f35681812802133c7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milo=C5=A1=20Had=C5=BEi=C4=87?= Date: Wed, 1 Jun 2011 12:45:15 +0200 Subject: [PATCH 426/614] Adds my theme --- themes/miloshadzic.zsh-theme | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 themes/miloshadzic.zsh-theme diff --git a/themes/miloshadzic.zsh-theme b/themes/miloshadzic.zsh-theme new file mode 100644 index 000000000..ad5394423 --- /dev/null +++ b/themes/miloshadzic.zsh-theme @@ -0,0 +1,8 @@ +# Yay! High voltage and arrows! + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}⚡%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="" + +PROMPT='%{$fg[cyan]%}%1~%{$reset_color%}%{$fg[red]%}|%{$reset_color%}$(git_prompt_info)%{$fg[cyan]%}⇒%{$reset_color%} ' From 6fd1c487fbaa89ade11af16240bbacde89e7893c Mon Sep 17 00:00:00 2001 From: "Suraj N. Kurapati" Date: Wed, 1 Jun 2011 20:38:25 -0700 Subject: [PATCH 427/614] add "sunaku" theme, see http://ompldr.org/vOHcwZg --- themes/sunaku.zsh-theme | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 themes/sunaku.zsh-theme diff --git a/themes/sunaku.zsh-theme b/themes/sunaku.zsh-theme new file mode 100644 index 000000000..440fa90b4 --- /dev/null +++ b/themes/sunaku.zsh-theme @@ -0,0 +1,26 @@ +# Git-centric variation of the "fishy" theme. +# See screenshot at http://ompldr.org/vOHcwZg + +ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%}+" +ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[magenta]%}!" +ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%}-" +ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%}>" +ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[cyan]%}#" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[yellow]%}?" + +ZSH_THEME_GIT_PROMPT_PREFIX="" +ZSH_THEME_GIT_PROMPT_SUFFIX=" " +ZSH_THEME_GIT_PROMPT_DIRTY="" +ZSH_THEME_GIT_PROMPT_CLEAN="" + +local user_color='green' +test $UID -eq 0 && user_color='red' + +PROMPT='%(?..%{$fg_bold[red]%}exit %? +%{$reset_color%})'\ +'%{$bold_color%}$(git_prompt_status)%{$reset_color%}'\ +'$(git_prompt_info)'\ +'%{$fg[$user_color]%}%~%{$reset_color%}'\ +'%(!.#.>) ' + +PROMPT2='%{$fg[red]%}\ %{$reset_color%}' From 5af19be02fcea58ba7cedf1c6770a54b12d5a8d3 Mon Sep 17 00:00:00 2001 From: Matt Doran Date: Sat, 4 Jun 2011 00:32:05 +1000 Subject: [PATCH 428/614] Fix typos in the svn plugin that would cause calls to 'svn' when not in an svn working copy. --- plugins/svn/svn.plugin.zsh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/svn/svn.plugin.zsh b/plugins/svn/svn.plugin.zsh index 45d461306..86050227d 100644 --- a/plugins/svn/svn.plugin.zsh +++ b/plugins/svn/svn.plugin.zsh @@ -13,7 +13,7 @@ function in_svn() { } function svn_get_repo_name { - if [ is_svn ]; then + if [ in_svn ]; then svn info | sed -n 's/Repository\ Root:\ .*\///p' | read SVN_ROOT svn info | sed -n "s/URL:\ .*$SVN_ROOT\///p" | sed "s/\/.*$//" @@ -21,13 +21,13 @@ function svn_get_repo_name { } function svn_get_rev_nr { - if [ is_svn ]; then + if [ in_svn ]; then svn info 2> /dev/null | sed -n s/Revision:\ //p fi } function svn_dirty_choose { - if [ is_svn ]; then + if [ in_svn ]; then s=$(svn status 2>/dev/null) if [ $s ]; then echo $1 @@ -39,4 +39,4 @@ function svn_dirty_choose { function svn_dirty { svn_dirty_choose $ZSH_THEME_SVN_PROMPT_DIRTY $ZSH_THEME_SVN_PROMPT_CLEAN -} \ No newline at end of file +} From 532375a1685c45037a2fbb8115be75be22fade6b Mon Sep 17 00:00:00 2001 From: Andrew Hodges Date: Fri, 3 Jun 2011 14:05:25 -0400 Subject: [PATCH 429/614] Colorize Install & Upgrade Scripts Make tools/install.sh and tools/upgrade.sh pretty. --- tools/install.sh | 28 ++++++++++++++-------------- tools/upgrade.sh | 21 +++++++++++---------- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/tools/install.sh b/tools/install.sh index 8ed1403af..aedb706da 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -1,36 +1,36 @@ if [ -d ~/.oh-my-zsh ] then - echo "You already have Oh My Zsh installed. You'll need to remove ~/.oh-my-zsh if you want to install" + echo "\033[0;33mYou already have Oh My Zsh installed.\033[0m You'll need to remove ~/.oh-my-zsh if you want to install" exit fi -echo "Cloning Oh My Zsh..." +echo "\033[0;34mCloning Oh My Zsh...\033[0m" /usr/bin/env git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh -echo "Looking for an existing zsh config..." +echo "\033[0;34mLooking for an existing zsh config...\033[0m" if [ -f ~/.zshrc ] || [ -h ~/.zshrc ] then - echo "Found ~/.zshrc. Backing up to ~/.zshrc.pre-oh-my-zsh"; + echo "\033[0;33mFound ~/.zshrc.\033[0m \033[0;32]Backing up to ~/.zshrc.pre-oh-my-zsh\033[0m"; cp ~/.zshrc ~/.zshrc.pre-oh-my-zsh; rm ~/.zshrc; fi -echo "Using the Oh My Zsh template file and adding it to ~/.zshrc" +echo "\033[0;34mUsing the Oh My Zsh template file and adding it to ~/.zshrc\033[0m" cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc -echo "Copying your current PATH and adding it to the end of ~/.zshrc for you." +echo "\033[0;34mCopying your current PATH and adding it to the end of ~/.zshrc for you.\033[0m" echo "export PATH=$PATH" >> ~/.zshrc -echo "Time to change your default shell to zsh!" +echo "\033[0;34mTime to change your default shell to zsh!\033[0m" chsh -s `which zsh` -echo ' __ __ ' -echo ' ____ / /_ ____ ___ __ __ ____ _____/ /_ ' -echo ' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ ' -echo '/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / ' -echo '\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ ' -echo ' /____/' +echo "\033[0;32m"' __ __ '"\033[0m" +echo "\033[0;32m"' ____ / /_ ____ ___ __ __ ____ _____/ /_ '"\033[0m" +echo "\033[0;32m"' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '"\033[0m" +echo "\033[0;32m"'/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '"\033[0m" +echo "\033[0;32m"'\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '"\033[0m" +echo "\033[0;32m"' /____/ '"\033[0m" -echo "\n\n ....is now installed." +echo "\n\n \033[0;32m....is now installed.\033[0m" /usr/bin/env zsh source ~/.zshrc diff --git a/tools/upgrade.sh b/tools/upgrade.sh index 6bdd02e38..7e5cc7655 100644 --- a/tools/upgrade.sh +++ b/tools/upgrade.sh @@ -1,12 +1,13 @@ current_path=`pwd` -echo "Upgrading Oh My Zsh" +echo "\033[0;34mUpgrading Oh My Zsh\033[0m" ( cd $ZSH && git pull origin master ) -echo ' __ __ ' -echo ' ____ / /_ ____ ___ __ __ ____ _____/ /_ ' -echo ' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ ' -echo '/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / ' -echo '\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ ' -echo ' /____/' -echo "Hooray! Oh My Zsh has been updated and/or is at the current version. \nAny new updates will be reflected when you start your next terminal session." -echo "To keep up on the latest, be sure to follow Oh My Zsh on twitter: http://twitter.com/ohmyzsh" -cd $current_path \ No newline at end of file +echo "\033[0;32m"' __ __ '"\033[0m" +echo "\033[0;32m"' ____ / /_ ____ ___ __ __ ____ _____/ /_ '"\033[0m" +echo "\033[0;32m"' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '"\033[0m" +echo "\033[0;32m"'/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '"\033[0m" +echo "\033[0;32m"'\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '"\033[0m" +echo "\033[0;32m"' /____/ '"\033[0m" +echo "\033[0;34mHooray! Oh My Zsh has been updated and/or is at the current version.\033[0m" +echo "\033[0;34mAny new updates will be reflected when you start your next terminal session.\033[0m" +echo "\033[0;34mTo keep up on the latest, be sure to follow Oh My Zsh on twitter: \033[1mhttp://twitter.com/ohmyzsh\033[0m" +cd $current_path From 80c9a31b445f0c40b9029388b008c6f46a9b94e1 Mon Sep 17 00:00:00 2001 From: vguerci Date: Sat, 4 Jun 2011 11:02:25 +0200 Subject: [PATCH 430/614] [upgrade] before init (no reload needed unless oh-my-zsh.sh has been modified) --- oh-my-zsh.sh | 17 ++++++++--------- tools/upgrade.sh | 1 - 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index dbff1ced9..2157c38a0 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -1,3 +1,11 @@ +# Check for updates on initial load... +if [ "$DISABLE_AUTO_UPDATE" = "true" ] +then + return +else + /usr/bin/env zsh $ZSH/tools/check_for_upgrade.sh +fi + # Initializes Oh My Zsh # add a function path @@ -28,7 +36,6 @@ done for config_file ($ZSH/custom/*.zsh) source $config_file # Load the theme -# Check for updates on initial load... if [ "$ZSH_THEME" = "random" ] then themes=($ZSH/themes/*zsh-theme) @@ -41,11 +48,3 @@ else source "$ZSH/themes/$ZSH_THEME.zsh-theme" fi - -# Check for updates on initial load... -if [ "$DISABLE_AUTO_UPDATE" = "true" ] -then - return -else - /usr/bin/env zsh $ZSH/tools/check_for_upgrade.sh -fi diff --git a/tools/upgrade.sh b/tools/upgrade.sh index 7e5cc7655..e30488822 100644 --- a/tools/upgrade.sh +++ b/tools/upgrade.sh @@ -8,6 +8,5 @@ echo "\033[0;32m"'/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '"\033[0m echo "\033[0;32m"'\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '"\033[0m" echo "\033[0;32m"' /____/ '"\033[0m" echo "\033[0;34mHooray! Oh My Zsh has been updated and/or is at the current version.\033[0m" -echo "\033[0;34mAny new updates will be reflected when you start your next terminal session.\033[0m" echo "\033[0;34mTo keep up on the latest, be sure to follow Oh My Zsh on twitter: \033[1mhttp://twitter.com/ohmyzsh\033[0m" cd $current_path From c2648a7ebf40e0689406eda1dd8e46d90620f5e8 Mon Sep 17 00:00:00 2001 From: Michael Komitee Date: Sat, 4 Jun 2011 14:03:10 -0400 Subject: [PATCH 431/614] Fix bug from Pull request #395 #395 broke oh-my-zsh for users who disable check-for-updates --- oh-my-zsh.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 2157c38a0..d72d90cf9 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -1,8 +1,6 @@ # Check for updates on initial load... -if [ "$DISABLE_AUTO_UPDATE" = "true" ] +if [ "$DISABLE_AUTO_UPDATE" != "true" ] then - return -else /usr/bin/env zsh $ZSH/tools/check_for_upgrade.sh fi From a876f3e9203a120c4ee19956634a33a170019ceb Mon Sep 17 00:00:00 2001 From: Marius Ghita Date: Wed, 15 Jun 2011 01:17:22 +0300 Subject: [PATCH 432/614] When the theme choice is left out, oh-my-zsh will not try to load it --- oh-my-zsh.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index d72d90cf9..c4522491b 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -43,6 +43,9 @@ then source "$RANDOM_THEME" echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..." else - source "$ZSH/themes/$ZSH_THEME.zsh-theme" + if [ ! "$ZSH_THEME" = "" ] + then + source "$ZSH/themes/$ZSH_THEME.zsh-theme" + fi fi From ace5ecd7d8518b43c787c0226b0e7bfe98a9beee Mon Sep 17 00:00:00 2001 From: Stephen Tudor Date: Sat, 18 Jun 2011 19:24:55 -0400 Subject: [PATCH 433/614] Add ohmyzsh theme, my version of dogenpunk --- themes/smt.zsh-theme | 91 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 themes/smt.zsh-theme diff --git a/themes/smt.zsh-theme b/themes/smt.zsh-theme new file mode 100644 index 000000000..fcb4858de --- /dev/null +++ b/themes/smt.zsh-theme @@ -0,0 +1,91 @@ +# ----------------------------------------------------------------------------- +# FILE: smt.zsh-theme +# DESCRIPTION: oh-my-zsh theme file, based on dogenpunk by Matthew Nelson. +# AUTHOR: Stephen Tudor (stephen@tudorstudio.com +# VERSION: 0.1 +# SCREENSHOT: coming soon +# ----------------------------------------------------------------------------- + +MODE_INDICATOR="%{$fg_bold[red]%}❮%{$reset_color%}%{$fg[red]%}❮❮%{$reset_color%}" +local return_status="%{$fg[red]%}%(?..⏎)%{$reset_color%} " + +ZSH_THEME_GIT_PROMPT_PREFIX="|" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%}⚡%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_AHEAD="%{$fg_bold[red]%}!%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%}✓%{$reset_color%}" + +ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} ✚" +ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} ✹" +ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖" +ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜" +ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭" + +# Format for git_prompt_long_sha() and git_prompt_short_sha() +ZSH_THEME_GIT_PROMPT_SHA_BEFORE="➤ %{$fg_bold[yellow]%}" +ZSH_THEME_GIT_PROMPT_SHA_AFTER="%{$reset_color%}" + +function prompt_char() { + git branch >/dev/null 2>/dev/null && echo "%{$fg[green]%}±%{$reset_color%}" && return + hg root >/dev/null 2>/dev/null && echo "%{$fg_bold[red]%}☿%{$reset_color%}" && return + echo "%{$fg[cyan]%}◯%{$reset_color%}" +} + +# Colors vary depending on time lapsed. +ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT="%{$fg[green]%}" +ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM="%{$fg[yellow]%}" +ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG="%{$fg[red]%}" +ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[cyan]%}" + +# Determine the time since last commit. If branch is clean, +# use a neutral color, otherwise colors will vary according to time. +function git_time_since_commit() { + if git rev-parse --git-dir > /dev/null 2>&1; then + # Only proceed if there is actually a commit. + if [[ $(git log 2>&1 > /dev/null | grep -c "^fatal: bad default revision") == 0 ]]; then + # Get the last commit. + last_commit=`git log --pretty=format:'%at' -1 2> /dev/null` + now=`date +%s` + seconds_since_last_commit=$((now-last_commit)) + + # Totals + MINUTES=$((seconds_since_last_commit / 60)) + HOURS=$((seconds_since_last_commit/3600)) + + # Sub-hours and sub-minutes + DAYS=$((seconds_since_last_commit / 86400)) + SUB_HOURS=$((HOURS % 24)) + SUB_MINUTES=$((MINUTES % 60)) + + if [[ -n $(git status -s 2> /dev/null) ]]; then + if [ "$MINUTES" -gt 30 ]; then + COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG" + elif [ "$MINUTES" -gt 10 ]; then + COLOR="$ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM" + else + COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT" + fi + else + COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL" + fi + + if [ "$HOURS" -gt 24 ]; then + echo "[$COLOR${DAYS}d${SUB_HOURS}h${SUB_MINUTES}m%{$reset_color%}]" + elif [ "$MINUTES" -gt 60 ]; then + echo "[$COLOR${HOURS}h${SUB_MINUTES}m%{$reset_color%}]" + else + echo "[$COLOR${MINUTES}m%{$reset_color%}]" + fi + else + COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL" + echo "[$COLOR~]" + fi + fi +} + +PROMPT=' +%{$fg[blue]%}%m%{$reset_color%} 寿帝文 %{$fg[cyan]%}%~ %{$reset_color%}$(git_prompt_short_sha)$(git_prompt_info) +%{$fg[red]%}%!%{$reset_color%} $(prompt_char) : ' + +RPROMPT='${return_status}$(git_time_since_commit)$(git_prompt_status)%{$reset_color%}' From 1a70c9b4b411b156933ff56dee8abe575e8d6f95 Mon Sep 17 00:00:00 2001 From: Stephen Tudor Date: Sun, 19 Jun 2011 12:22:23 -0400 Subject: [PATCH 434/614] Changed kanji to fuku (good luck) --- themes/smt.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/smt.zsh-theme b/themes/smt.zsh-theme index fcb4858de..7a287523e 100644 --- a/themes/smt.zsh-theme +++ b/themes/smt.zsh-theme @@ -85,7 +85,7 @@ function git_time_since_commit() { } PROMPT=' -%{$fg[blue]%}%m%{$reset_color%} 寿帝文 %{$fg[cyan]%}%~ %{$reset_color%}$(git_prompt_short_sha)$(git_prompt_info) +%{$fg[blue]%}%m%{$reset_color%} 福 %{$fg[cyan]%}%~ %{$reset_color%}$(git_prompt_short_sha)$(git_prompt_info) %{$fg[red]%}%!%{$reset_color%} $(prompt_char) : ' RPROMPT='${return_status}$(git_time_since_commit)$(git_prompt_status)%{$reset_color%}' From 8d935eede9aa92692e05a89c0c1a459fa7a70762 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Tue, 19 Apr 2011 21:58:02 -0400 Subject: [PATCH 435/614] Populated custom. --- .gitignore | 3 -- custom/aliases.zsh | 73 +++++++++++++++++++++++++++ custom/directories.zsh | 1 + custom/example/example.plugin.zsh | 2 - custom/functions.zsh | 46 +++++++++++++++++ custom/grep.zsh | 7 +++ custom/{example.zsh => shortcuts.zsh} | 0 7 files changed, 127 insertions(+), 5 deletions(-) create mode 100644 custom/aliases.zsh create mode 100644 custom/directories.zsh delete mode 100644 custom/example/example.plugin.zsh create mode 100644 custom/functions.zsh create mode 100644 custom/grep.zsh rename custom/{example.zsh => shortcuts.zsh} (100%) diff --git a/.gitignore b/.gitignore index 8fdfae286..31cc75cb9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,4 @@ locals.zsh log/.zsh_history projects.zsh -custom/* -!custom/example -!custom/example.zsh cache diff --git a/custom/aliases.zsh b/custom/aliases.zsh new file mode 100644 index 000000000..5c2c92895 --- /dev/null +++ b/custom/aliases.zsh @@ -0,0 +1,73 @@ +# The 'ls' family +# ------------------------------------------------------------------------------ +[[ "$DISABLE_COLOR" != 'true' ]] && { + [[ -x "${commands[gdircolors]}" ]] && use_color_gnu='true' || use_color_bsd='true' +} + +[[ "$use_color_gnu" == 'true' ]] && eval $(gdircolors $HOME/.dir_colors) +[[ "$use_color_bsd" == 'true' ]] && export CLICOLOR=1 +[[ "$use_color_bsd" == 'true' ]] && export LSCOLORS="exfxcxdxbxegedabagacad" + +# add colors for filetype recognition +[[ "$use_color_gnu" == 'true' ]] && alias ls='ls -hF --group-directories-first --color=auto' +[[ "$use_color_bsd" == 'true' ]] && alias ls='ls -G -F' + +alias la='ls -Ahl' # show hidden files +alias lx='ls -lhXB' # sort by extension +alias lk='ls -lhSr' # sort by size, biggest last +alias lc='ls -lhtcr' # sort by and show change time, most recent last +alias lu='ls -lhtur' # sort by and show access time, most recent last +alias lt='ls -lhtr' # sort by date, most recent last +alias lm='ls -ahl | more' # pipe through 'more' +alias lr='ls -lhR' # recursive ls +alias l='ls -lha' +alias ll='ls -lh' + +# General +# ------------------------------------------------------------------------------ +alias rm='nocorrect rm -i' +alias cp='nocorrect cp -i' +alias mv='nocorrect mv -i' +alias ln='nocorrect ln -i' +alias du='du -kh' +alias df='df -kh' +alias e="$EDITOR" +alias get='curl -C - -O' +alias mkdir='nocorrect mkdir -p' +alias q='exit' +alias ssh='ssh -X' +alias h='history' +alias j='jobs -l' +alias type='type -a' +alias print-path='echo -e ${PATH//:/\\n}' +alias print-libpath='echo -e ${LD_LIBRARY_PATH//:/\\n}' +alias lsbom='lsbom -f -l -s -pf' +alias t="$HOME/.local/bin/t --task-dir ~/.tasks --list todo.txt --delete-if-empty" + +if [[ -x "${commands[htop]}" ]]; then + alias top=htop +else + alias topm='top -o vsize' + alias topc='top -o cpu' +fi + +[[ "$DISABLE_COLOR" != 'true' ]] && { + [[ -x "${commands[colordiff]}" ]] && alias diff='colordiff' + [[ -x "${commands[colormake]}" ]] && alias make='colormake' +} + +# Screen +# ------------------------------------------------------------------------------ +[[ "$TERM" == 'xterm-color' ]] && screenrc="$HOME/.screenrc" +[[ "$TERM" == 'xterm-256color' ]] && screenrc="$HOME/.screenrc256" +alias screen="screen -c '$screenrc'" +alias sls="screen -c '$screenrc' -list" +alias surd="screen -c '$screenrc' -aAURD" +alias sus="screen -c '$screenrc' -US" + +# TMUX +# ------------------------------------------------------------------------------ +[[ "$TERM" == 'xterm-color' ]] && tmuxconf="$HOME/.tmux.conf" +[[ "$TERM" == 'xterm-256color' ]] && tmuxconf="$HOME/.tmux256.conf" +alias tmux="tmux -f '$tmuxconf'" +alias tls="tmux list-sessions" diff --git a/custom/directories.zsh b/custom/directories.zsh new file mode 100644 index 000000000..1237335b4 --- /dev/null +++ b/custom/directories.zsh @@ -0,0 +1 @@ +unsetopt auto_pushd \ No newline at end of file diff --git a/custom/example/example.plugin.zsh b/custom/example/example.plugin.zsh deleted file mode 100644 index 406f27445..000000000 --- a/custom/example/example.plugin.zsh +++ /dev/null @@ -1,2 +0,0 @@ -# Add your own custom plugins in the custom/plugins directory. Plugins placed -# here will override ones with the same name in the main plugins directory. diff --git a/custom/functions.zsh b/custom/functions.zsh new file mode 100644 index 000000000..01165deab --- /dev/null +++ b/custom/functions.zsh @@ -0,0 +1,46 @@ +function cdll() { + if [[ -n "$1" ]]; then + builtin cd "$1" + ls -lFhA + else + ls -lFhA + fi +} + +function pushdll() { + if [[ -n "$1" ]]; then + builtin pushd "$1" + ls -lFhA + else + ls -lFhA + fi +} + +function popdll() { + builtin popd + ls -lFhA +} + +function grab() { + sudo chown -R ${USER} ${1:-.} +} + +function reload() { + source "$HOME/.zshrc" +} + +function calc() { + echo "scale=4; $@" | bc -l +} + +function pmine() { + ps $@ -u $USER -o pid,%cpu,%mem,command +} + +function findexec() { + find . -type f -iname '*'${1:-}'*' -exec ${2:-file} {} \; +} + +function httpserve() { + python -m SimpleHTTPServer +} diff --git a/custom/grep.zsh b/custom/grep.zsh new file mode 100644 index 000000000..4dc7adc31 --- /dev/null +++ b/custom/grep.zsh @@ -0,0 +1,7 @@ +if [[ "$DISABLE_COLOR" != "true" ]]; then + export GREP_OPTIONS='--color=auto' + export GREP_COLOR='37;45' +else + export GREP_OPTIONS='--color=none' + export GREP_COLOR='' +fi diff --git a/custom/example.zsh b/custom/shortcuts.zsh similarity index 100% rename from custom/example.zsh rename to custom/shortcuts.zsh From 9ded21d21bc3e5c58d22ab7f0dacfb06f7f04f2f Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 3 Feb 2011 22:46:52 -0500 Subject: [PATCH 436/614] Added extract plugin. --- lib/aliases.zsh | 1 - lib/functions.zsh | 35 -------------- plugins/extract/_extract | 6 +++ plugins/extract/extract.plugin.zsh | 78 ++++++++++++++++++++++++++++++ 4 files changed, 84 insertions(+), 36 deletions(-) create mode 100644 plugins/extract/_extract create mode 100644 plugins/extract/extract.plugin.zsh diff --git a/lib/aliases.zsh b/lib/aliases.zsh index b47de5bde..0555be264 100644 --- a/lib/aliases.zsh +++ b/lib/aliases.zsh @@ -22,4 +22,3 @@ alias sl=ls # often screw this up alias afind='ack-grep -il' -alias x=extract diff --git a/lib/functions.zsh b/lib/functions.zsh index b29d3e482..ef7cc6383 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -15,38 +15,3 @@ function take() { cd $1 } -function extract() { - unset REMOVE_ARCHIVE - - if test "$1" = "-r"; then - REMOVE=1 - shift - fi - if [[ -f $1 ]]; then - case $1 in - *.tar.bz2) tar xvjf $1;; - *.tar.gz) tar xvzf $1;; - *.tar.xz) tar xvJf $1;; - *.tar.lzma) tar --lzma -xvf $1;; - *.bz2) bunzip $1;; - *.rar) unrar x $1;; - *.gz) gunzip $1;; - *.tar) tar xvf $1;; - *.tbz2) tar xvjf $1;; - *.tgz) tar xvzf $1;; - *.zip) unzip $1;; - *.Z) uncompress $1;; - *.7z) 7z x $1;; - *) echo "'$1' cannot be extracted via >extract<";; - esac - - if [[ $REMOVE_ARCHIVE -eq 1 ]]; then - echo removing "$1"; - /bin/rm "$1"; - fi - - else - echo "'$1' is not a valid file" - fi -} - diff --git a/plugins/extract/_extract b/plugins/extract/_extract new file mode 100644 index 000000000..30ca9292a --- /dev/null +++ b/plugins/extract/_extract @@ -0,0 +1,6 @@ +#compdef extract +#autoload + +_arguments \ + '(-r --remove)'{-r,--remove}'[Remove archive.]' \ + "*::archive file:_files -g '(#i)*.(tar|tgz|tbz|tbz2|txz|tlz|gz|bz2|xz|lzma|Z|zip|rar|7z|deb)(-.)'" && return 0 diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh new file mode 100644 index 000000000..371f4a1fc --- /dev/null +++ b/plugins/extract/extract.plugin.zsh @@ -0,0 +1,78 @@ +# ------------------------------------------------------------------------------ +# FILE: extract.plugin.zsh +# DESCRIPTION: oh-my-zsh plugin file. +# AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com) +# VERSION: 1.0.0 +# ------------------------------------------------------------------------------ + + +function extract() { + local remove_archive + local success + local file_name + local extract_dir + + if (( $# == 0 )); then + echo "Usage: extract [-option] [file ...]" + echo + echo Options: + echo " -r, --remove Remove archive." + echo + echo "Report bugs to ." + fi + + remove_archive=1 + if [[ "$1" == "-r" ]] || [[ "$1" == "--remove" ]]; then + remove_archive=0 + shift + fi + + while (( $# > 0 )); do + if [[ ! -f "$1" ]]; then + echo "extract: '$1' is not a valid file" 1>&2 + shift + continue + fi + + success=0 + file_name="$( basename "$1" )" + extract_dir="$( echo "$file_name" | sed "s/\.${1##*.}//g" )" + case "$1" in + (*.tar.gz|*.tgz) tar xvzf "$1" ;; + (*.tar.bz2|*.tbz|*.tbz2) tar xvjf "$1" ;; + (*.tar.xz|*.txz) tar xvJf "$1" ;; + # (*.tar.xz|*.txz) xzcat "$1" | tar xvf - ;; + (*.tar.lzma|*.tlz) tar --lzma -xvf "$1" ;; + # (*.tar.lzma|*.tlz) lzcat "$1" | tar xvf - ;; + (*.tar) tar xvf "$1" ;; + (*.gz) gunzip "$1" ;; + (*.bz2) bunzip2 "$1" ;; + (*.xz) unxz "$1" ;; + (*.lzma) unlzma "$1" ;; + (*.Z) uncompress "$1" ;; + (*.zip) unzip "$1" -d $extract_dir ;; + (*.rar) unrar e -ad "$1" ;; + (*.7z) 7za x "$1" ;; + (*.deb) + mkdir -p "$extract_dir/control" + mkdir -p "$extract_dir/data" + cd "$extract_dir"; ar vx "../${1}" > /dev/null + cd control; tar xzvf ../control.tar.gz + cd ../data; tar xzvf ../data.tar.gz + cd ..; rm *.tar.gz debian-binary + cd .. + ;; + (*) + echo "extract: '$1' cannot be extracted" 1>&2 + success=1 + ;; + esac + + (( success = $success > 0 ? $success : $? )) + (( $success == 0 )) && (( $remove_archive == 0 )) && rm "$1" + shift + done +} + +alias x=extract + From 922fec1d4b76a140260a60140112b16aeec8ddd4 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sun, 17 Apr 2011 23:17:48 -0400 Subject: [PATCH 437/614] Handle tar.xz and tar.lzma better (credit: @gwjo). --- plugins/extract/extract.plugin.zsh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh index 371f4a1fc..02b05eb4b 100644 --- a/plugins/extract/extract.plugin.zsh +++ b/plugins/extract/extract.plugin.zsh @@ -2,7 +2,7 @@ # FILE: extract.plugin.zsh # DESCRIPTION: oh-my-zsh plugin file. # AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com) -# VERSION: 1.0.0 +# VERSION: 1.0.1 # ------------------------------------------------------------------------------ @@ -40,10 +40,12 @@ function extract() { case "$1" in (*.tar.gz|*.tgz) tar xvzf "$1" ;; (*.tar.bz2|*.tbz|*.tbz2) tar xvjf "$1" ;; - (*.tar.xz|*.txz) tar xvJf "$1" ;; - # (*.tar.xz|*.txz) xzcat "$1" | tar xvf - ;; - (*.tar.lzma|*.tlz) tar --lzma -xvf "$1" ;; - # (*.tar.lzma|*.tlz) lzcat "$1" | tar xvf - ;; + (*.tar.xz|*.txz) tar --xz --help &> /dev/null \ + && tar --xz -xvf "$1" \ + || xzcat "$1" | tar xvf - ;; + (*.tar.zma|*.tlz) tar --lzma --help &> /dev/null \ + && tar --lzma -xvf "$1" \ + || lzcat "$1" | tar xvf - ;; (*.tar) tar xvf "$1" ;; (*.gz) gunzip "$1" ;; (*.bz2) bunzip2 "$1" ;; From 99f5b5e4922b8f4fc64beebcd9b6f2ec16d238f9 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 3 Feb 2011 17:25:45 -0500 Subject: [PATCH 438/614] Added gnu-utils plugin. --- plugins/gnu-utils/gnu-utils.plugin.zsh | 79 ++++++++++++++++++++++++++ 1 file changed, 79 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..ab118e868 --- /dev/null +++ b/plugins/gnu-utils/gnu-utils.plugin.zsh @@ -0,0 +1,79 @@ +# ------------------------------------------------------------------------------ +# 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 3ce00cf49a1803a1bbb46ccbca73efc0b0c2c643 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Tue, 22 Feb 2011 23:32:50 -0500 Subject: [PATCH 439/614] Vastly improved osx plugin. --- plugins/osx/osx.plugin.zsh | 137 +++++++++++++++++++++++-------------- 1 file changed, 86 insertions(+), 51 deletions(-) diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh index a65ca642a..0e436aa7b 100644 --- a/plugins/osx/osx.plugin.zsh +++ b/plugins/osx/osx.plugin.zsh @@ -1,63 +1,98 @@ -alias showfiles='defaults write com.apple.finder AppleShowAllFiles TRUE; killall Finder' -alias hidefiles='defaults write com.apple.finder AppleShowAllFiles FALSE; killall Finder' +# ------------------------------------------------------------------------------ +# FILE: osx.plugin.zsh +# DESCRIPTION: oh-my-zsh plugin file. +# AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com) +# VERSION: 1.0.1 +# ------------------------------------------------------------------------------ -# Recursively delete .DS_Store files -alias rm-dsstore="find . -name '*.DS_Store' -type f -delete" - -function savepath() { - pwd > ~/.current_path~ -} function tab() { -savepath -osascript >/dev/null < 0 )) && command="${command}; $*" + + the_app=$( + osascript 2>/dev/null </dev/null </dev/null </dev/null </dev/null </dev/null < 0 )) && qlmanage -p $* &>/dev/null & +} + +function man-preview() { + man -t "$@" | open -f -a Preview +} + +function trash() { + local trash_dir="${HOME}/.Trash" + local temp_ifs=$IFS + IFS=$'\n' + for item in "$@"; do + if [[ -e "$item" ]]; then + item_name="$(basename $item)" + if [[ -e "${trash_dir}/${item_name}" ]]; then + mv -f "$item" "${trash_dir}/${item_name} $(date "+%H-%M-%S")" + else + mv -f "$item" "${trash_dir}/" + fi + fi + done + IFS=$temp_ifs +} From 29b055466608edd981732f1820d3c97a35d9ff67 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Fri, 4 Feb 2011 23:23:14 -0500 Subject: [PATCH 440/614] Vastly improved vi-mode plugin. --- plugins/vi-mode/vi-mode.plugin.zsh | 77 +++++++++++++++++++++++------- 1 file changed, 61 insertions(+), 16 deletions(-) diff --git a/plugins/vi-mode/vi-mode.plugin.zsh b/plugins/vi-mode/vi-mode.plugin.zsh index c47ab7211..08480475d 100644 --- a/plugins/vi-mode/vi-mode.plugin.zsh +++ b/plugins/vi-mode/vi-mode.plugin.zsh @@ -1,22 +1,67 @@ +# ------------------------------------------------------------------------------ +# FILE: vi-mode.plugin.zsh +# DESCRIPTION: oh-my-zsh plugin file. +# AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com) +# VERSION: 1.0.2 +# ------------------------------------------------------------------------------ + + +# Allow command line editing in an external editor. +autoload -Uz edit-command-line + +# If mode indicator wasn't setup by theme, define a default. +if [[ "$MODE_INDICATOR" == "" ]]; then + MODE_INDICATOR="%{$fg_bold[red]%}<%{$reset_color%}%{$fg[red]%}<<%{$reset_color%}" +fi + function zle-line-init zle-keymap-select { zle reset-prompt } -zle -N zle-line-init -zle -N zle-keymap-select - -bindkey -v - -# if mode indicator wasn't setup by theme, define default -if [[ "$MODE_INDICATOR" == "" ]]; then - MODE_INDICATOR="%{$fg_bold[red]%}<%{$fg[red]%}<<%{$reset_color%}" -fi - -function vi_mode_prompt_info() { - echo "${${KEYMAP/vicmd/$MODE_INDICATOR}/(main|viins)/}" +# If I am using vi keys, I want to know what mode I'm currently using. +# zle-keymap-select is executed every time KEYMAP changes. +# From http://zshwiki.org/home/examples/zlewidgets +function zle-line-init zle-keymap-select { + if [[ "$KEYMAP" == 'vicmd' ]]; then + rprompt_cached="$RPROMPT" + RPROMPT="$MODE_INDICATOR" + elif [[ -n "$rprompt_cached" ]]; then + RPROMPT="$rprompt_cached" + rprompt_cached="" + fi + zle reset-prompt } -# define right prompt, if it wasn't defined by a theme -if [[ "$RPS1" == "" && "$RPROMPT" == "" ]]; then - RPS1='$(vi_mode_prompt_info)' -fi +# Accept RETURN in vi command mode. +function accept_line { + if [[ -n "$rprompt_cached" ]]; then + RPROMPT="$rprompt_cached" + rprompt_cached="" + fi + builtin zle .accept-line +} + +zle -N zle-line-init +zle -N zle-keymap-select +zle -N accept_line +zle -N edit-command-line + +# Avoid binding ^J, ^M, ^C, ^?, ^S, ^Q, etc. +bindkey -d # Reset to default. +bindkey -v # Use vi key bindings. +bindkey -M vicmd "^M" accept_line # Alow RETURN in vi command. +bindkey -M vicmd v edit-command-line # ESC-v to edit in an external editor. + +bindkey ' ' magic-space +bindkey -M vicmd "gg" beginning-of-history +bindkey -M vicmd "G" end-of-history +bindkey -M vicmd "k" history-search-backward +bindkey -M vicmd "j" history-search-forward +bindkey -M vicmd "?" history-incremental-search-backward +bindkey -M vicmd "/" history-incremental-search-forward + +bindkey -M viins "^L" clear-screen +bindkey -M viins "^W" backward-kill-word +bindkey -M viins "^A" beginning-of-line +bindkey -M viins "^E" end-of-line + From 19a85909ca9b7eb93aa357fe74d4c353437b0bb0 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 3 Feb 2011 23:11:17 -0500 Subject: [PATCH 441/614] Fixed confusing, inconsistent casing. --- lib/history.zsh | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/history.zsh b/lib/history.zsh index ca6f57079..604658a5f 100644 --- a/lib/history.zsh +++ b/lib/history.zsh @@ -3,14 +3,11 @@ HISTFILE=$HOME/.zsh_history HISTSIZE=10000 SAVEHIST=10000 -setopt hist_ignore_dups # ignore duplication command history list -setopt share_history # share command history data - -setopt hist_verify -setopt inc_append_history -setopt extended_history -setopt hist_expire_dups_first -setopt hist_ignore_space - +setopt HIST_VERIFY +setopt HIST_EXPIRE_DUPS_FIRST +setopt HIST_IGNORE_SPACE +setopt HIST_IGNORE_DUPS setopt SHARE_HISTORY setopt APPEND_HISTORY +setopt EXTENDED_HISTORY +setopt INC_APPEND_HISTORY From 3a444ea70a12981cfd188ad3d86f16754a992b63 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Tue, 22 Feb 2011 19:30:42 -0500 Subject: [PATCH 442/614] ZSH has built-in regex support; use it! --- lib/git.zsh | 55 +++++++++++++++++++++++++++-------------------------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/lib/git.zsh b/lib/git.zsh index ce4de5598..235f9de12 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -32,31 +32,32 @@ function git_prompt_long_sha() { # Get the status of the working tree git_prompt_status() { - INDEX=$(git status --porcelain 2> /dev/null) - STATUS="" - if $(echo "$INDEX" | grep '^?? ' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_UNTRACKED$STATUS" - fi - if $(echo "$INDEX" | grep '^A ' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS" - elif $(echo "$INDEX" | grep '^M ' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS" - fi - if $(echo "$INDEX" | grep '^ M ' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS" - elif $(echo "$INDEX" | grep '^AM ' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS" - elif $(echo "$INDEX" | grep '^ T ' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS" - fi - if $(echo "$INDEX" | grep '^R ' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_RENAMED$STATUS" - fi - if $(echo "$INDEX" | grep '^D ' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS" - fi - if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then - STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS" - fi - echo $STATUS + local indicators line untracked added modified renamed deleted + while IFS=$'\n' read line; do + if [[ "$line" =~ '^\?\? ' ]]; then + [[ -n $untracked ]] && continue || untracked='yes' + indicators="${ZSH_THEME_GIT_PROMPT_UNTRACKED}${indicators}" + fi + if [[ "$line" =~ '^(((A|M|D|T) )|(AD|AM|AT|MM)) ' ]]; then + [[ -n $added ]] && continue || added='yes' + indicators="${ZSH_THEME_GIT_PROMPT_ADDED}${indicators}" + fi + if [[ "$line" =~ '^(( (M|T))|(AM|AT|MM)) ' ]]; then + [[ -n $modified ]] && continue || modified='yes' + indicators="${ZSH_THEME_GIT_PROMPT_MODIFIED}${indicators}" + fi + if [[ "$line" =~ '^R ' ]]; then + [[ -n $renamed ]] && continue || renamed='yes' + indicators="${ZSH_THEME_GIT_PROMPT_RENAMED}${indicators}" + fi + if [[ "$line" =~ '^( D|AD) ' ]]; then + [[ -n $deleted ]] && continue || deleted='yes' + indicators="${ZSH_THEME_GIT_PROMPT_DELETED}${indicators}" + fi + if [[ "$line" =~ '^UU ' ]]; then + [[ -n $unmerged ]] && continue || unmerged='yes' + indicators="${ZSH_THEME_GIT_PROMPT_UNMERGED}${indicators}" + fi + done < <(git status --porcelain 2> /dev/null) + echo $indicators } From deab2ed37611056128cceb61daffaefc82c01331 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sun, 27 Feb 2011 10:13:57 -0500 Subject: [PATCH 443/614] Fix for dumb terminals like Vim's. --- lib/completion.zsh | 1 + lib/grep.zsh | 10 ++++------ lib/misc.zsh | 4 ++-- lib/termsupport.zsh | 2 ++ lib/theme-and-appearance.zsh | 5 ++--- oh-my-zsh.sh | 5 +++++ templates/zshrc.zsh-template | 2 +- themes/sorin.zsh-theme | 6 +++--- 8 files changed, 20 insertions(+), 15 deletions(-) diff --git a/lib/completion.zsh b/lib/completion.zsh index fdd0a8536..9e770f181 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -1,4 +1,5 @@ # fixme - the load process here seems a bit bizarre +[[ "$TERM" == "dumb" ]] && return unsetopt menu_complete # do not autoselect the first completion entry unsetopt flowcontrol diff --git a/lib/grep.zsh b/lib/grep.zsh index 93c4270b6..714ac9ccb 100644 --- a/lib/grep.zsh +++ b/lib/grep.zsh @@ -1,6 +1,4 @@ -# -# Color grep results -# Examples: http://rubyurl.com/ZXv -# -export GREP_OPTIONS='--color=auto' -export GREP_COLOR='1;32' \ No newline at end of file +if [[ "$DISABLE_COLOR" != "true" ]]; then + [[ -z "$GREP_OPTIONS" ]] && export GREP_OPTIONS='--color=auto' + [[ -z "$GREP_COLOR" ]] && export GREP_COLOR='1;32' +fi diff --git a/lib/misc.zsh b/lib/misc.zsh index 4c1743657..364ad8792 100644 --- a/lib/misc.zsh +++ b/lib/misc.zsh @@ -9,5 +9,5 @@ bindkey "^[m" copy-prev-shell-word setopt long_list_jobs ## pager -export PAGER=less -export LC_CTYPE=en_US.UTF-8 +[[ -z "$PAGER" ]] && export PAGER=less +[[ -z "$LC_CTYPE" ]] && export LC_CTYPE=en_US.UTF-8 diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index 22e7f372f..9a5765709 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -1,3 +1,5 @@ +[[ "$TERM" == "dumb" ]] && return + #usage: title short_tab_title looooooooooooooooooooooggggggg_windows_title #http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#ss3.1 #Fully support screen, iterm, and probably most modern xterm and rxvt diff --git a/lib/theme-and-appearance.zsh b/lib/theme-and-appearance.zsh index aec67721a..ab5aba4da 100644 --- a/lib/theme-and-appearance.zsh +++ b/lib/theme-and-appearance.zsh @@ -1,10 +1,9 @@ # ls colors autoload colors; colors; -export LSCOLORS="Gxfxcxdxbxegedabagacad" -#export LS_COLORS +[[ -z "$LSCOLORS" ]] && export LSCOLORS="Gxfxcxdxbxegedabagacad" # Enable ls colors -if [ "$DISABLE_LS_COLORS" != "true" ] +if [ "$DISABLE_COLOR" != "true" ] then # Find the option for using colors in ls, depending on the version: Linux or BSD ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty' || alias ls='ls -G' diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index c4522491b..ddd1f0439 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -6,6 +6,11 @@ fi # Initializes Oh My Zsh +# Disable colors on dumb terminals +if [ "$TERM" = "dumb" ]; then + DISABLE_COLOR="true" +fi + # add a function path fpath=($ZSH/functions $ZSH/completions $fpath) diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template index 576d45eaa..65299df3e 100644 --- a/templates/zshrc.zsh-template +++ b/templates/zshrc.zsh-template @@ -14,7 +14,7 @@ export ZSH_THEME="robbyrussell" # export DISABLE_AUTO_UPDATE="true" # Uncomment following line if you want to disable colors in ls -# export DISABLE_LS_COLORS="true" +# export DISABLE_COLOR="true" # Uncomment following line if you want to disable autosetting terminal title. # export DISABLE_AUTO_TITLE="true" diff --git a/themes/sorin.zsh-theme b/themes/sorin.zsh-theme index 601dbe5d7..ecd092b84 100644 --- a/themes/sorin.zsh-theme +++ b/themes/sorin.zsh-theme @@ -2,15 +2,15 @@ # FILE: sorin.zsh-theme # DESCRIPTION: oh-my-zsh theme file. # AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com) -# VERSION: 1.0.2 +# VERSION: 1.0.3 # SCREENSHOT: http://i.imgur.com/aipDQ.png # ------------------------------------------------------------------------------ -if [[ "$TERM" != "dumb" ]] && [[ "$DISABLE_LS_COLORS" != "true" ]]; then +if [[ "$DISABLE_COLOR" != "true" ]]; then MODE_INDICATOR="%{$fg_bold[red]%}❮%{$reset_color%}%{$fg[red]%}❮❮%{$reset_color%}" local return_status="%{$fg[red]%}%(?..⏎)%{$reset_color%}" - + PROMPT='%{$fg[cyan]%}%c$(git_prompt_info) %(!.%{$fg_bold[red]%}#.%{$fg_bold[green]%}❯)%{$reset_color%} ' ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[blue]%}git%{$reset_color%}:%{$fg[red]%}" From d10192c6d0f0ba2038b06f97f30ed83f80139577 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Fri, 22 Apr 2011 19:13:37 -0400 Subject: [PATCH 444/614] Added man-preview completion suggested by @webflo. --- plugins/osx/_man-preview | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 plugins/osx/_man-preview diff --git a/plugins/osx/_man-preview b/plugins/osx/_man-preview new file mode 100644 index 000000000..698ae2656 --- /dev/null +++ b/plugins/osx/_man-preview @@ -0,0 +1,4 @@ +#compdef man-preview +#autoload + +_man From f26a86795ef1f4b7fe9bf5c1e7181ee522106862 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Fri, 22 Apr 2011 22:23:08 -0400 Subject: [PATCH 445/614] Disabled complist since it's crashing ZSH on menu completion. --- lib/completion.zsh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/completion.zsh b/lib/completion.zsh index 9e770f181..7c81f77bd 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -9,7 +9,8 @@ setopt always_to_end WORDCHARS='' -zmodload -i zsh/complist +# fixme - complist is crashing ZSH on menu completion +# zmodload -i zsh/complist ## case-insensitive (all),partial-word and then substring completion if [ "x$CASE_SENSITIVE" = "xtrue" ]; then @@ -22,7 +23,7 @@ fi zstyle ':completion:*' list-colors '' # should this be in keybindings? -bindkey -M menuselect '^o' accept-and-infer-next-history +# bindkey -M menuselect '^o' accept-and-infer-next-history zstyle ':completion:*:*:*:*:*' menu select zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01' From c7b8ce0f0b0e035db5b58bdf1283b008cefbba9f Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sun, 1 May 2011 12:33:28 -0400 Subject: [PATCH 446/614] Compile zcompdump, if modified, to increase startup speed. --- oh-my-zsh.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index ddd1f0439..a3ac5b766 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -54,3 +54,7 @@ else fi fi +# Compile zcompdump, if modified, to increase startup speed. +if [ "$HOME/.zcompdump" -nt "$HOME/.zcompdump.zwc" -o ! -e "$HOME/.zcompdump.zwc" ]; then + zcompile "$HOME/.zcompdump" +fi From 56e2f17d7a02e1ede70ad53c3f19dcfa31bb6df6 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sun, 1 May 2011 11:46:11 -0400 Subject: [PATCH 447/614] 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 9a3b68d65531474ec15e57f5fc47f4b97e463fe7 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sun, 29 May 2011 21:24:53 -0400 Subject: [PATCH 448/614] Added new aliases, changed and fixed bugs in old aliases. --- custom/aliases.zsh | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/custom/aliases.zsh b/custom/aliases.zsh index 5c2c92895..57c9314f1 100644 --- a/custom/aliases.zsh +++ b/custom/aliases.zsh @@ -4,7 +4,7 @@ [[ -x "${commands[gdircolors]}" ]] && use_color_gnu='true' || use_color_bsd='true' } -[[ "$use_color_gnu" == 'true' ]] && eval $(gdircolors $HOME/.dir_colors) +[[ "$use_color_gnu" == 'true' && -e "$HOME/.dir_colors" ]] && eval $(gdircolors $HOME/.dir_colors) [[ "$use_color_bsd" == 'true' ]] && export CLICOLOR=1 [[ "$use_color_bsd" == 'true' ]] && export LSCOLORS="exfxcxdxbxegedabagacad" @@ -29,15 +29,17 @@ alias rm='nocorrect rm -i' alias cp='nocorrect cp -i' alias mv='nocorrect mv -i' alias ln='nocorrect ln -i' +alias mkdir='nocorrect mkdir -p' alias du='du -kh' alias df='df -kh' alias e="$EDITOR" alias get='curl -C - -O' -alias mkdir='nocorrect mkdir -p' alias q='exit' alias ssh='ssh -X' alias h='history' alias j='jobs -l' +alias f='fg' +alias gr='grep -r' alias type='type -a' alias print-path='echo -e ${PATH//:/\\n}' alias print-libpath='echo -e ${LD_LIBRARY_PATH//:/\\n}' @@ -58,16 +60,16 @@ fi # Screen # ------------------------------------------------------------------------------ -[[ "$TERM" == 'xterm-color' ]] && screenrc="$HOME/.screenrc" -[[ "$TERM" == 'xterm-256color' ]] && screenrc="$HOME/.screenrc256" -alias screen="screen -c '$screenrc'" -alias sls="screen -c '$screenrc' -list" -alias surd="screen -c '$screenrc' -aAURD" -alias sus="screen -c '$screenrc' -US" +[[ "$TERM" == 'xterm-color' && -e "$HOME/.screenrc" ]] && screenrc="-c '$HOME/.screenrc'" +[[ "$TERM" == 'xterm-256color' && -e "$HOME/.screenrc256" ]] && screenrc="-c '$HOME/.screenrc256'" +alias screen="screen $screenrc" +alias sl="screen $screenrc -list" +alias sr="screen $screenrc -a -A -U -D -R" +alias S="screen $screenrc -U -S" # TMUX # ------------------------------------------------------------------------------ -[[ "$TERM" == 'xterm-color' ]] && tmuxconf="$HOME/.tmux.conf" -[[ "$TERM" == 'xterm-256color' ]] && tmuxconf="$HOME/.tmux256.conf" -alias tmux="tmux -f '$tmuxconf'" +[[ "$TERM" == 'xterm-color' && -e "$HOME/.tmux.conf" ]] && tmuxconf="-f '$HOME/.tmux.conf'" +[[ "$TERM" == 'xterm-256color' && -e "$HOME/.tmux256.conf" ]] && tmuxconf="-f '$HOME/.tmux256.conf'" +alias tmux="tmux $tmuxconf" alias tls="tmux list-sessions" From ec4f2794455e7b84ef289310ca9fe54411ea14cf Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Mon, 30 May 2011 18:39:04 -0400 Subject: [PATCH 449/614] Merged custom/ and lib/. Conflicts: custom/aliases.zsh custom/functions.zsh custom/grep.zsh --- custom/aliases.zsh | 75 ---------------------------------- custom/directories.zsh | 1 - custom/functions.zsh | 46 --------------------- custom/grep.zsh | 7 ---- custom/shortcuts.zsh | 5 --- lib/aliases.zsh | 93 ++++++++++++++++++++++++++++++++++-------- lib/functions.zsh | 47 +++++++++++++++++++++ lib/grep.zsh | 8 +++- oh-my-zsh.sh | 10 +---- 9 files changed, 130 insertions(+), 162 deletions(-) delete mode 100644 custom/aliases.zsh delete mode 100644 custom/directories.zsh delete mode 100644 custom/functions.zsh delete mode 100644 custom/grep.zsh delete mode 100644 custom/shortcuts.zsh diff --git a/custom/aliases.zsh b/custom/aliases.zsh deleted file mode 100644 index 57c9314f1..000000000 --- a/custom/aliases.zsh +++ /dev/null @@ -1,75 +0,0 @@ -# The 'ls' family -# ------------------------------------------------------------------------------ -[[ "$DISABLE_COLOR" != 'true' ]] && { - [[ -x "${commands[gdircolors]}" ]] && use_color_gnu='true' || use_color_bsd='true' -} - -[[ "$use_color_gnu" == 'true' && -e "$HOME/.dir_colors" ]] && eval $(gdircolors $HOME/.dir_colors) -[[ "$use_color_bsd" == 'true' ]] && export CLICOLOR=1 -[[ "$use_color_bsd" == 'true' ]] && export LSCOLORS="exfxcxdxbxegedabagacad" - -# add colors for filetype recognition -[[ "$use_color_gnu" == 'true' ]] && alias ls='ls -hF --group-directories-first --color=auto' -[[ "$use_color_bsd" == 'true' ]] && alias ls='ls -G -F' - -alias la='ls -Ahl' # show hidden files -alias lx='ls -lhXB' # sort by extension -alias lk='ls -lhSr' # sort by size, biggest last -alias lc='ls -lhtcr' # sort by and show change time, most recent last -alias lu='ls -lhtur' # sort by and show access time, most recent last -alias lt='ls -lhtr' # sort by date, most recent last -alias lm='ls -ahl | more' # pipe through 'more' -alias lr='ls -lhR' # recursive ls -alias l='ls -lha' -alias ll='ls -lh' - -# General -# ------------------------------------------------------------------------------ -alias rm='nocorrect rm -i' -alias cp='nocorrect cp -i' -alias mv='nocorrect mv -i' -alias ln='nocorrect ln -i' -alias mkdir='nocorrect mkdir -p' -alias du='du -kh' -alias df='df -kh' -alias e="$EDITOR" -alias get='curl -C - -O' -alias q='exit' -alias ssh='ssh -X' -alias h='history' -alias j='jobs -l' -alias f='fg' -alias gr='grep -r' -alias type='type -a' -alias print-path='echo -e ${PATH//:/\\n}' -alias print-libpath='echo -e ${LD_LIBRARY_PATH//:/\\n}' -alias lsbom='lsbom -f -l -s -pf' -alias t="$HOME/.local/bin/t --task-dir ~/.tasks --list todo.txt --delete-if-empty" - -if [[ -x "${commands[htop]}" ]]; then - alias top=htop -else - alias topm='top -o vsize' - alias topc='top -o cpu' -fi - -[[ "$DISABLE_COLOR" != 'true' ]] && { - [[ -x "${commands[colordiff]}" ]] && alias diff='colordiff' - [[ -x "${commands[colormake]}" ]] && alias make='colormake' -} - -# Screen -# ------------------------------------------------------------------------------ -[[ "$TERM" == 'xterm-color' && -e "$HOME/.screenrc" ]] && screenrc="-c '$HOME/.screenrc'" -[[ "$TERM" == 'xterm-256color' && -e "$HOME/.screenrc256" ]] && screenrc="-c '$HOME/.screenrc256'" -alias screen="screen $screenrc" -alias sl="screen $screenrc -list" -alias sr="screen $screenrc -a -A -U -D -R" -alias S="screen $screenrc -U -S" - -# TMUX -# ------------------------------------------------------------------------------ -[[ "$TERM" == 'xterm-color' && -e "$HOME/.tmux.conf" ]] && tmuxconf="-f '$HOME/.tmux.conf'" -[[ "$TERM" == 'xterm-256color' && -e "$HOME/.tmux256.conf" ]] && tmuxconf="-f '$HOME/.tmux256.conf'" -alias tmux="tmux $tmuxconf" -alias tls="tmux list-sessions" diff --git a/custom/directories.zsh b/custom/directories.zsh deleted file mode 100644 index 1237335b4..000000000 --- a/custom/directories.zsh +++ /dev/null @@ -1 +0,0 @@ -unsetopt auto_pushd \ No newline at end of file diff --git a/custom/functions.zsh b/custom/functions.zsh deleted file mode 100644 index 01165deab..000000000 --- a/custom/functions.zsh +++ /dev/null @@ -1,46 +0,0 @@ -function cdll() { - if [[ -n "$1" ]]; then - builtin cd "$1" - ls -lFhA - else - ls -lFhA - fi -} - -function pushdll() { - if [[ -n "$1" ]]; then - builtin pushd "$1" - ls -lFhA - else - ls -lFhA - fi -} - -function popdll() { - builtin popd - ls -lFhA -} - -function grab() { - sudo chown -R ${USER} ${1:-.} -} - -function reload() { - source "$HOME/.zshrc" -} - -function calc() { - echo "scale=4; $@" | bc -l -} - -function pmine() { - ps $@ -u $USER -o pid,%cpu,%mem,command -} - -function findexec() { - find . -type f -iname '*'${1:-}'*' -exec ${2:-file} {} \; -} - -function httpserve() { - python -m SimpleHTTPServer -} diff --git a/custom/grep.zsh b/custom/grep.zsh deleted file mode 100644 index 4dc7adc31..000000000 --- a/custom/grep.zsh +++ /dev/null @@ -1,7 +0,0 @@ -if [[ "$DISABLE_COLOR" != "true" ]]; then - export GREP_OPTIONS='--color=auto' - export GREP_COLOR='37;45' -else - export GREP_OPTIONS='--color=none' - export GREP_COLOR='' -fi diff --git a/custom/shortcuts.zsh b/custom/shortcuts.zsh deleted file mode 100644 index 28ffcae25..000000000 --- a/custom/shortcuts.zsh +++ /dev/null @@ -1,5 +0,0 @@ -# Add yourself some shortcuts to projects you often work on -# Example: -# -# brainstormr=/Users/robbyrussell/Projects/development/planetargon/brainstormr -# \ No newline at end of file diff --git a/lib/aliases.zsh b/lib/aliases.zsh index 0555be264..a529f816f 100644 --- a/lib/aliases.zsh +++ b/lib/aliases.zsh @@ -1,24 +1,83 @@ -# Push and pop directories on directory stack -alias pu='pushd' -alias po='popd' +# The 'ls' family +# ------------------------------------------------------------------------------ +[[ "$DISABLE_COLOR" != 'true' ]] && { + [[ -x "${commands[gdircolors]}" ]] && use_color_gnu='true' || use_color_bsd='true' +} -# Basic directory operations +[[ "$use_color_gnu" == 'true' && -e "$HOME/.dir_colors" ]] && eval $(gdircolors $HOME/.dir_colors) +[[ "$use_color_bsd" == 'true' ]] && export CLICOLOR=1 +[[ "$use_color_bsd" == 'true' ]] && export LSCOLORS="exfxcxdxbxegedabagacad" + +# add colors for filetype recognition +[[ "$use_color_gnu" == 'true' ]] && alias ls='ls -hF --group-directories-first --color=auto' +[[ "$use_color_bsd" == 'true' ]] && alias ls='ls -G -F' + +alias ll='ls -lh' # show human readable +alias la='ls -lhA' # show hidden files +alias lx='ls -lhXB' # sort by extension +alias lk='ls -lhSr' # sort by size, biggest last +alias lc='ls -lhtcr' # sort by and show change time, most recent last +alias lu='ls -lhtur' # sort by and show access time, most recent last +alias lt='ls -lhtr' # sort by date, most recent last +alias lm='ls -lha | more' # pipe through 'more' +alias lr='ls -lhR' # recursive ls +alias sl='ls' # often screw this up + +# General +# ------------------------------------------------------------------------------ alias ...='cd ../..' alias -- -='cd -' - -# Super user +alias rm='nocorrect rm -i' +alias cp='nocorrect cp -i' +alias mv='nocorrect mv -i' +alias ln='nocorrect ln -i' +alias mkdir='nocorrect mkdir -p' +alias du='du -kh' +alias df='df -kh' +alias pu='pushd' +alias po='popd' alias _='sudo' - -#alias g='grep -in' - -# Show history +alias e="$EDITOR" +alias q='exit' alias history='fc -l 1' - -# List direcory contents -alias lsa='ls -lah' -alias l='ls -la' -alias ll='ls -l' -alias sl=ls # often screw this up - +alias h='history' +alias j='jobs -l' +alias f='fg' +alias gr='grep -r' +alias get='curl -C - -O' alias afind='ack-grep -il' +alias type='type -a' +alias ssh='ssh -X' +alias print-path='echo -e ${PATH//:/\\n}' +alias print-libpath='echo -e ${LD_LIBRARY_PATH//:/\\n}' +alias lsbom='lsbom -f -l -s -pf' +alias t="$HOME/.local/bin/t --task-dir ~/.tasks --list todo.txt --delete-if-empty" + +if [[ -x "${commands[htop]}" ]]; then + alias top=htop +else + alias topm='top -o vsize' + alias topc='top -o cpu' +fi + +[[ "$DISABLE_COLOR" != 'true' ]] && { + [[ -x "${commands[colordiff]}" ]] && alias diff='colordiff' + [[ -x "${commands[colormake]}" ]] && alias make='colormake' +} + +# Screen +# ------------------------------------------------------------------------------ +[[ "$TERM" == 'xterm-color' && -e "$HOME/.screenrc" ]] && screenrc="-c '$HOME/.screenrc'" +[[ "$TERM" == 'xterm-256color' && -e "$HOME/.screenrc256" ]] && screenrc="-c '$HOME/.screenrc256'" +alias screen="screen $screenrc" +alias sl="screen $screenrc -list" +alias sr="screen $screenrc -a -A -U -D -R" +alias S="screen $screenrc -U -S" + +# TMUX +# ------------------------------------------------------------------------------ +[[ "$TERM" == 'xterm-color' && -e "$HOME/.tmux.conf" ]] && tmuxconf="-f '$HOME/.tmux.conf'" +[[ "$TERM" == 'xterm-256color' && -e "$HOME/.tmux256.conf" ]] && tmuxconf="-f '$HOME/.tmux256.conf'" +alias tmux="tmux $tmuxconf" +alias tls="tmux list-sessions" diff --git a/lib/functions.zsh b/lib/functions.zsh index ef7cc6383..f26659ec3 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -15,3 +15,50 @@ function take() { cd $1 } +function cdll() { + if [[ -n "$1" ]]; then + builtin cd "$1" + ls -lFhA + else + ls -lFhA + fi +} + +function pushdll() { + if [[ -n "$1" ]]; then + builtin pushd "$1" + ls -lFhA + else + ls -lFhA + fi +} + +function popdll() { + builtin popd + ls -lFhA +} + +function grab() { + sudo chown -R ${USER} ${1:-.} +} + +function reload() { + source "$HOME/.zshrc" +} + +function calc() { + echo "scale=4; $@" | bc -l +} + +function pmine() { + ps $@ -u $USER -o pid,%cpu,%mem,command +} + +function findexec() { + find . -type f -iname '*'${1:-}'*' -exec ${2:-file} {} \; +} + +function httpserve() { + python -m SimpleHTTPServer +} + diff --git a/lib/grep.zsh b/lib/grep.zsh index 714ac9ccb..3e1f213e7 100644 --- a/lib/grep.zsh +++ b/lib/grep.zsh @@ -1,4 +1,8 @@ if [[ "$DISABLE_COLOR" != "true" ]]; then - [[ -z "$GREP_OPTIONS" ]] && export GREP_OPTIONS='--color=auto' - [[ -z "$GREP_COLOR" ]] && export GREP_COLOR='1;32' + export GREP_OPTIONS='--color=auto' + export GREP_COLOR='37;45' +else + export GREP_OPTIONS='--color=none' + export GREP_COLOR='' fi + diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index a3ac5b766..44361addd 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -11,9 +11,6 @@ if [ "$TERM" = "dumb" ]; then DISABLE_COLOR="true" fi -# add a function path -fpath=($ZSH/functions $ZSH/completions $fpath) - # Load all of the config files in ~/oh-my-zsh that end in .zsh # TIP: Add files you don't want in git to .gitignore for config_file ($ZSH/lib/*.zsh) source $config_file @@ -28,16 +25,11 @@ compinit -i # 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 - elif [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then + if [ -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 - # Load the theme if [ "$ZSH_THEME" = "random" ] then From ad9db8d342f79d2e7e700339ec6be8115b823a13 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Mon, 30 May 2011 19:46:27 -0400 Subject: [PATCH 450/614] Removed tools I have never used nor will I ever use. Conflicts: oh-my-zsh.sh tools/install.sh tools/upgrade.sh --- README.textile | 18 ------------------ lib/functions.zsh | 8 -------- oh-my-zsh.sh | 7 +------ templates/zshrc.zsh-template | 3 --- tools/check_for_upgrade.sh | 35 ----------------------------------- tools/install.sh | 36 ------------------------------------ tools/uninstall.sh | 20 -------------------- tools/upgrade.sh | 12 ------------ 8 files changed, 1 insertion(+), 138 deletions(-) delete mode 100644 tools/check_for_upgrade.sh delete mode 100755 tools/install.sh delete mode 100644 tools/uninstall.sh delete mode 100644 tools/upgrade.sh diff --git a/README.textile b/README.textile index 2dbfbe5a6..c176540fd 100644 --- a/README.textile +++ b/README.textile @@ -6,13 +6,6 @@ h2. Setup @oh-my-zsh@ should work with any recent release of "zsh":http://www.zsh.org/, the minimum recommended version is 4.3.9. -h3. The automatic installer... (do you trust me?) - -@wget --no-check-certificate https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh@ - -h3. The manual way - - 1. Clone the repository @git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh@ @@ -47,23 +40,12 @@ the "refcard":http://www.bash2zsh.com/zsh_refcard/refcard.pdf is pretty tasty fo h3. Customization -If you want to override any of the default behavior, just add a new file (ending in @.zsh@) into the @custom/@ directory. If you have many functions which go good together you can put them as a *.plugin.zsh file in the @custom/plugins/@ directory and then enable this plugin. -If you would like to override the functionality of a plugin distributed with oh-my-zsh, create a plugin of the same name in the @custom/plugins/@ directory and it will be loaded instead of the one in @plugins/@. - - -h3. Uninstalling - -If you want to uninstall it, just run @uninstall_oh_my_zsh@ from the command line and it'll remove itself and revert you to bash (or your previous zsh config). h2. Help out! I'm far from being a zsh-expert and suspect there are many ways to improve. If you have ideas on how to make the configuration easier to maintain (and faster), don't hesitate to fork and send pull requests! -h3. Send us your theme! - -I'm hoping to collect a bunch of themes for our command prompts. You can see existing ones in the @themes/@ directory. - h2. Contributors This project wouldn't exist without all of our awesome users and contributors. diff --git a/lib/functions.zsh b/lib/functions.zsh index f26659ec3..892f0537c 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -2,14 +2,6 @@ function zsh_stats() { history | awk '{print $2}' | sort | uniq -c | sort -rn | head } -function uninstall_oh_my_zsh() { - /bin/sh $ZSH/tools/uninstall.sh -} - -function upgrade_oh_my_zsh() { - /bin/sh $ZSH/tools/upgrade.sh -} - function take() { mkdir -p $1 cd $1 diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 44361addd..2d3fe50f2 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -1,9 +1,3 @@ -# Check for updates on initial load... -if [ "$DISABLE_AUTO_UPDATE" != "true" ] -then - /usr/bin/env zsh $ZSH/tools/check_for_upgrade.sh -fi - # Initializes Oh My Zsh # Disable colors on dumb terminals @@ -50,3 +44,4 @@ fi if [ "$HOME/.zcompdump" -nt "$HOME/.zcompdump.zwc" -o ! -e "$HOME/.zcompdump.zwc" ]; then zcompile "$HOME/.zcompdump" fi + diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template index 65299df3e..c2accfc87 100644 --- a/templates/zshrc.zsh-template +++ b/templates/zshrc.zsh-template @@ -10,9 +10,6 @@ export ZSH_THEME="robbyrussell" # Set to this to use case-sensitive completion # export CASE_SENSITIVE="true" -# Comment this out to disable weekly auto-update checks -# export DISABLE_AUTO_UPDATE="true" - # Uncomment following line if you want to disable colors in ls # export DISABLE_COLOR="true" diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh deleted file mode 100644 index e1e4eb99f..000000000 --- a/tools/check_for_upgrade.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh - -function _current_epoch() { - echo $(($(date +%s) / 60 / 60 / 24)) -} - -function _update_zsh_update() { - echo "LAST_EPOCH=$(_current_epoch)" > ~/.zsh-update -} - -if [ -f ~/.zsh-update ] -then - . ~/.zsh-update - - if [[ -z "$LAST_EPOCH" ]]; then - _update_zsh_update && return 0; - fi - - epoch_diff=$(($(_current_epoch) - $LAST_EPOCH)) - if [ $epoch_diff -gt 6 ] - then - echo "[Oh My Zsh] Would you like to check for updates?" - echo "Type Y to update oh-my-zsh: \c" - read line - if [ "$line" = Y ] || [ "$line" = y ] - then - /bin/sh $ZSH/tools/upgrade.sh - # update the zsh file - _update_zsh_update - fi - fi -else - # create the zsh file - _update_zsh_update -fi diff --git a/tools/install.sh b/tools/install.sh deleted file mode 100755 index aedb706da..000000000 --- a/tools/install.sh +++ /dev/null @@ -1,36 +0,0 @@ -if [ -d ~/.oh-my-zsh ] -then - echo "\033[0;33mYou already have Oh My Zsh installed.\033[0m You'll need to remove ~/.oh-my-zsh if you want to install" - exit -fi - -echo "\033[0;34mCloning Oh My Zsh...\033[0m" -/usr/bin/env git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh - -echo "\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"; - cp ~/.zshrc ~/.zshrc.pre-oh-my-zsh; - rm ~/.zshrc; -fi - -echo "\033[0;34mUsing the Oh My Zsh template file and adding it to ~/.zshrc\033[0m" -cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc - -echo "\033[0;34mCopying your current PATH and adding it to the end of ~/.zshrc for you.\033[0m" -echo "export PATH=$PATH" >> ~/.zshrc - -echo "\033[0;34mTime to change your default shell to zsh!\033[0m" -chsh -s `which zsh` - -echo "\033[0;32m"' __ __ '"\033[0m" -echo "\033[0;32m"' ____ / /_ ____ ___ __ __ ____ _____/ /_ '"\033[0m" -echo "\033[0;32m"' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '"\033[0m" -echo "\033[0;32m"'/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '"\033[0m" -echo "\033[0;32m"'\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '"\033[0m" -echo "\033[0;32m"' /____/ '"\033[0m" - -echo "\n\n \033[0;32m....is now installed.\033[0m" -/usr/bin/env zsh -source ~/.zshrc diff --git a/tools/uninstall.sh b/tools/uninstall.sh deleted file mode 100644 index 8ff583322..000000000 --- a/tools/uninstall.sh +++ /dev/null @@ -1,20 +0,0 @@ -echo "Removing ~/.oh-my-zsh" -if [[ -d ~/.oh-my-zsh ]] -then - rm -rf ~/.oh-my-zsh -fi - -echo "Looking for an existing zsh config..." -if [ -f ~/.zshrc.pre-oh-my-zsh ] || [ -h ~/.zshrc.pre-oh-my-zsh ] -then - echo "Found ~/.zshrc. Backing up to ~/.zshrc.pre-oh-my-zsh"; - rm ~/.zshrc; - cp ~/.zshrc.pre-oh-my-zsh ~/.zshrc; - source ~/.zshrc; -else - echo "Switching back to bash" - chsh -s /bin/bash - source /etc/profile -fi - -echo "Thanks for trying out Oh My Zsh. It's been uninstalled." \ No newline at end of file diff --git a/tools/upgrade.sh b/tools/upgrade.sh deleted file mode 100644 index e30488822..000000000 --- a/tools/upgrade.sh +++ /dev/null @@ -1,12 +0,0 @@ -current_path=`pwd` -echo "\033[0;34mUpgrading Oh My Zsh\033[0m" -( cd $ZSH && git pull origin master ) -echo "\033[0;32m"' __ __ '"\033[0m" -echo "\033[0;32m"' ____ / /_ ____ ___ __ __ ____ _____/ /_ '"\033[0m" -echo "\033[0;32m"' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ '"\033[0m" -echo "\033[0;32m"'/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / '"\033[0m" -echo "\033[0;32m"'\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '"\033[0m" -echo "\033[0;32m"' /____/ '"\033[0m" -echo "\033[0;34mHooray! Oh My Zsh has been updated and/or is at the current version.\033[0m" -echo "\033[0;34mTo keep up on the latest, be sure to follow Oh My Zsh on twitter: \033[1mhttp://twitter.com/ohmyzsh\033[0m" -cd $current_path From 99e1fd3a7cc8264209239064b456179ba0e2c109 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Mon, 30 May 2011 19:47:55 -0400 Subject: [PATCH 451/614] Removed mcd function and aliases from directories. --- lib/directories.zsh | 8 -------- 1 file changed, 8 deletions(-) diff --git a/lib/directories.zsh b/lib/directories.zsh index bb114f615..539e30d22 100644 --- a/lib/directories.zsh +++ b/lib/directories.zsh @@ -34,11 +34,3 @@ cd () { fi } -alias md='mkdir -p' -alias rd=rmdir -alias d='dirs -v' - -# mkdir & cd to it -function mcd() { - mkdir -p "$1" && cd "$1"; -} \ No newline at end of file From 3436a9247c76fe5b280fa71a4051a4add61d6265 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Mon, 30 May 2011 21:38:07 -0400 Subject: [PATCH 452/614] Removed unused log directory. --- log/.easter-egg | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 log/.easter-egg diff --git a/log/.easter-egg b/log/.easter-egg deleted file mode 100644 index 2533149e2..000000000 --- a/log/.easter-egg +++ /dev/null @@ -1,4 +0,0 @@ -This file is only here so that Git will keep a log directory as .gitignore is ignoring all the log files within it. - -feel free to add love notes for people here. - From 94ab5e0ec8b2e386df64dd6a28b240e9f1ee3bef Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Wed, 1 Jun 2011 02:48:26 -0400 Subject: [PATCH 453/614] Cleaned up lib/ and removed trailing white space everywhere. Conflicts: oh-my-zsh.sh --- lib/aliases.zsh | 96 +++++++++++++----------- lib/completion.zsh | 33 ++++---- lib/correction.zsh | 1 + lib/directories.zsh | 10 ++- lib/functions.zsh | 24 +++--- lib/git.zsh | 43 +++++++---- lib/grep.zsh | 10 ++- lib/history.zsh | 19 ++--- lib/key-bindings.zsh | 20 +++-- lib/misc.zsh | 20 +++-- lib/rvm.zsh | 9 ++- lib/spectrum.zsh | 20 ++--- lib/termsupport.zsh | 41 ++++++---- lib/theme-and-appearance.zsh | 40 ++++------ oh-my-zsh.sh | 49 ++++++------ plugins/compleat/compleat.plugin.zsh | 4 +- plugins/dirpersist/dirpersist.plugin.zsh | 6 +- plugins/git-flow/git-flow.plugin.zsh | 2 +- plugins/git/git.plugin.zsh | 21 +----- plugins/macports/_port | 8 +- plugins/perl/perl.plugin.zsh | 2 +- plugins/redis-cli/_redis-cli | 2 +- plugins/rvm/_rvm | 4 +- plugins/svn/svn.plugin.zsh | 6 +- plugins/vagrant/_vagrant | 6 +- templates/zshrc.zsh-template | 29 ++++--- themes/Soliah.zsh-theme | 10 +-- themes/awesomepanda.zsh-theme | 2 +- themes/cloud.zsh-theme | 2 +- themes/eastwood.zsh-theme | 2 +- themes/evan.zsh-theme | 2 +- themes/example.zsh-theme | 2 +- themes/funky.zsh-theme | 2 +- themes/gallois.zsh-theme | 2 +- themes/imajes.zsh-theme | 2 +- themes/jonathan.zsh-theme | 20 ++--- themes/josh.zsh-theme | 8 +- themes/juanghurtado.zsh-theme | 2 +- themes/kardan.zsh-theme | 2 +- themes/linuxonly | 6 +- themes/mikeh.zsh-theme | 2 +- themes/minimal.zsh-theme | 2 +- themes/rixius.zsh-theme | 2 +- themes/sorin.zsh-theme | 4 +- themes/theunraveler.zsh-theme | 2 +- themes/tonotdo.zsh-theme | 2 +- 46 files changed, 319 insertions(+), 284 deletions(-) diff --git a/lib/aliases.zsh b/lib/aliases.zsh index a529f816f..0cfafc6e0 100644 --- a/lib/aliases.zsh +++ b/lib/aliases.zsh @@ -1,32 +1,35 @@ # The 'ls' family # ------------------------------------------------------------------------------ -[[ "$DISABLE_COLOR" != 'true' ]] && { - [[ -x "${commands[gdircolors]}" ]] && use_color_gnu='true' || use_color_bsd='true' -} +if [[ "$DISABLE_COLOR" != 'true' ]]; then + if (( ${+commands[dircolors]} )); then + dircolors="${commands[dircolors]}" + fi + if (( ${+commands[gdircolors]} )); then + dircolors="${commands[gdircolors]}" + fi + if [[ -x "$dircolors" ]] && [[ -e "$HOME/.dir_colors" ]]; then + eval $("$dircolors" "$HOME/.dir_colors") + alias ls='ls -hF --group-directories-first --color=auto' + else + export CLICOLOR=1 + export LSCOLORS="exfxcxdxbxegedabagacad" + alias ls='ls -G -F' + fi +fi -[[ "$use_color_gnu" == 'true' && -e "$HOME/.dir_colors" ]] && eval $(gdircolors $HOME/.dir_colors) -[[ "$use_color_bsd" == 'true' ]] && export CLICOLOR=1 -[[ "$use_color_bsd" == 'true' ]] && export LSCOLORS="exfxcxdxbxegedabagacad" - -# add colors for filetype recognition -[[ "$use_color_gnu" == 'true' ]] && alias ls='ls -hF --group-directories-first --color=auto' -[[ "$use_color_bsd" == 'true' ]] && alias ls='ls -G -F' - -alias ll='ls -lh' # show human readable -alias la='ls -lhA' # show hidden files -alias lx='ls -lhXB' # sort by extension -alias lk='ls -lhSr' # sort by size, biggest last -alias lc='ls -lhtcr' # sort by and show change time, most recent last -alias lu='ls -lhtur' # sort by and show access time, most recent last -alias lt='ls -lhtr' # sort by date, most recent last -alias lm='ls -lha | more' # pipe through 'more' -alias lr='ls -lhR' # recursive ls -alias sl='ls' # often screw this up +alias ll='ls -lh' # Show human readable. +alias la='ls -lhA' # Show hidden files. +alias lx='ls -lhXB' # Sort by extension. +alias lk='ls -lhSr' # Sort by size, biggest last. +alias lc='ls -lhtcr' # Sort by and show change time, most recent lasa. +alias lu='ls -lhtur' # Sort by and show access time, most recent last. +alias lt='ls -lhtr' # Sort by date, most recent last. +alias lm='ls -lha | more' # Pipe through 'more'. +alias lr='ls -lhR' # Recursive ls. +alias sl='ls' # I often screw this up. # General # ------------------------------------------------------------------------------ -alias ...='cd ../..' -alias -- -='cd -' alias rm='nocorrect rm -i' alias cp='nocorrect cp -i' alias mv='nocorrect mv -i' @@ -38,20 +41,13 @@ alias pu='pushd' alias po='popd' alias _='sudo' alias e="$EDITOR" -alias q='exit' alias history='fc -l 1' -alias h='history' -alias j='jobs -l' -alias f='fg' -alias gr='grep -r' alias get='curl -C - -O' -alias afind='ack-grep -il' +alias afind='ack -il' alias type='type -a' alias ssh='ssh -X' alias print-path='echo -e ${PATH//:/\\n}' -alias print-libpath='echo -e ${LD_LIBRARY_PATH//:/\\n}' -alias lsbom='lsbom -f -l -s -pf' -alias t="$HOME/.local/bin/t --task-dir ~/.tasks --list todo.txt --delete-if-empty" +alias t="t --task-dir ~/.tasks --list todo.txt --delete-if-empty" if [[ -x "${commands[htop]}" ]]; then alias top=htop @@ -60,24 +56,38 @@ else alias topc='top -o cpu' fi -[[ "$DISABLE_COLOR" != 'true' ]] && { - [[ -x "${commands[colordiff]}" ]] && alias diff='colordiff' - [[ -x "${commands[colormake]}" ]] && alias make='colormake' -} +if [[ "$DISABLE_COLOR" != 'true' ]]; then + if [[ -x "${commands[colordiff]}" ]]; then + alias diff='colordiff' + fi -# Screen + if [[ -x "${commands[colormake]}" ]]; then + alias make='colormake' + fi +fi + +# Terminal Multiplexer # ------------------------------------------------------------------------------ -[[ "$TERM" == 'xterm-color' && -e "$HOME/.screenrc" ]] && screenrc="-c '$HOME/.screenrc'" -[[ "$TERM" == 'xterm-256color' && -e "$HOME/.screenrc256" ]] && screenrc="-c '$HOME/.screenrc256'" +local screenrc tmuxconf +if [[ "$TERM" == 'xterm-color' ]]; then + if [[ -e "$HOME/.screenrc" ]]; then + screenrc="-c '$HOME/.screenrc'" + tmuxconf="-f '$HOME/.tmux.conf'" + fi +fi + +if [[ "$TERM" == 'xterm-256color' ]]; then + if [[ -e "$HOME/.screenrc256" ]]; then + screenrc="-c '$HOME/.screenrc256'" + tmuxconf="-f '$HOME/.tmux256.conf'" + fi +fi + alias screen="screen $screenrc" alias sl="screen $screenrc -list" alias sr="screen $screenrc -a -A -U -D -R" alias S="screen $screenrc -U -S" -# TMUX -# ------------------------------------------------------------------------------ -[[ "$TERM" == 'xterm-color' && -e "$HOME/.tmux.conf" ]] && tmuxconf="-f '$HOME/.tmux.conf'" -[[ "$TERM" == 'xterm-256color' && -e "$HOME/.tmux256.conf" ]] && tmuxconf="-f '$HOME/.tmux256.conf'" alias tmux="tmux $tmuxconf" alias tls="tmux list-sessions" diff --git a/lib/completion.zsh b/lib/completion.zsh index 7c81f77bd..c60faf636 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -1,19 +1,21 @@ -# fixme - the load process here seems a bit bizarre -[[ "$TERM" == "dumb" ]] && return +# Dumb terminals lack support. +if [[ "$TERM" == 'dumb' ]]; then + return +fi -unsetopt menu_complete # do not autoselect the first completion entry -unsetopt flowcontrol -setopt auto_menu # show completion menu on succesive tab press -setopt complete_in_word -setopt always_to_end +unsetopt menu_complete # Do not autoselect the first completion entry. +unsetopt flow_control # Disable start/stop characters in shell editor. +setopt auto_menu # Show completion menu on a succesive tab press. +setopt complete_in_word # Complete from both ends of a word. +setopt always_to_end # Move cursor to the end of a completed word. WORDCHARS='' -# fixme - complist is crashing ZSH on menu completion +# FIXME: complist is crashing ZSH on menu completion. # zmodload -i zsh/complist -## case-insensitive (all),partial-word and then substring completion -if [ "x$CASE_SENSITIVE" = "xtrue" ]; then +## Case-insensitive (all), partial-word, and then substring completion. +if [[ "$CASE_SENSITIVE" == "true" ]]; then zstyle ':completion:*' matcher-list 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' unset CASE_SENSITIVE else @@ -22,18 +24,19 @@ fi zstyle ':completion:*' list-colors '' -# should this be in keybindings? +# FIXME: It depends on complist which crashes ZSH on menu completion. +# Should this be in key-bindings.zsh? # bindkey -M menuselect '^o' accept-and-infer-next-history zstyle ':completion:*:*:*:*:*' menu select zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01' zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm -w -w" -# disable named-directories autocompletion +# Disable named-directories autocompletion. zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories cdpath=(.) -# use /etc/hosts and known_hosts for hostname completion +# Use /etc/hosts and known_hosts for hostname completion. [ -r ~/.ssh/known_hosts ] && _ssh_hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=() [ -r /etc/hosts ] && : ${(A)_etc_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$( /dev/null) || return - echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX" + local branch=$(git_current_branch) + if [[ -n "$branch" ]]; then + echo "${ZSH_THEME_GIT_PROMPT_PREFIX}${branch}$(parse_git_dirty)${ZSH_THEME_GIT_PROMPT_SUFFIX}" + fi } -# Checks if working tree is dirty -parse_git_dirty() { +# Gets the current branch. +function git_current_branch() { + local ref=$(git symbolic-ref HEAD 2> /dev/null) + if [[ -n "$ref" ]]; then + echo "${ref#refs/heads/}" + fi +} + +# Checks if the working tree is dirty. +function parse_git_dirty() { if [[ -n $(git status -s 2> /dev/null) ]]; then echo "$ZSH_THEME_GIT_PROMPT_DIRTY" else @@ -13,25 +23,31 @@ parse_git_dirty() { fi } -# Checks if there are commits ahead from remote +# Checks if there are commits ahead from remote. function git_prompt_ahead() { - if $(echo "$(git log origin/$(current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then + if $(echo "$(git log origin/$(git_current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then echo "$ZSH_THEME_GIT_PROMPT_AHEAD" fi } -# Formats prompt string for current git commit short SHA +# Formats the prompt string for current git commit short SHA. function git_prompt_short_sha() { - SHA=$(git rev-parse --short HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER" + local sha=$(git rev-parse --short HEAD 2> /dev/null) + if [[ -n "$sha" ]]; then + echo "${ZSH_THEME_GIT_PROMPT_SHA_BEFORE}${sha}${ZSH_THEME_GIT_PROMPT_SHA_AFTER}" + fi } -# Formats prompt string for current git commit long SHA +# Formats the prompt string for current git commit long SHA. function git_prompt_long_sha() { - SHA=$(git rev-parse HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER" + local sha=$(git rev-parse HEAD 2> /dev/null) + if [[ -n "$sha" ]]; then + echo "${ZSH_THEME_GIT_PROMPT_SHA_BEFORE}${sha}${ZSH_THEME_GIT_PROMPT_SHA_AFTER}" + fi } -# Get the status of the working tree -git_prompt_status() { +# Gets the status of the working tree. +function git_prompt_status() { local indicators line untracked added modified renamed deleted while IFS=$'\n' read line; do if [[ "$line" =~ '^\?\? ' ]]; then @@ -61,3 +77,4 @@ git_prompt_status() { done < <(git status --porcelain 2> /dev/null) echo $indicators } + diff --git a/lib/grep.zsh b/lib/grep.zsh index 3e1f213e7..75cfc2925 100644 --- a/lib/grep.zsh +++ b/lib/grep.zsh @@ -1,6 +1,10 @@ -if [[ "$DISABLE_COLOR" != "true" ]]; then - export GREP_OPTIONS='--color=auto' - export GREP_COLOR='37;45' +if [[ "$DISABLE_COLOR" != 'true' ]]; then + if [[ -z "$GREP_OPTIONS" ]]; then + export GREP_OPTIONS='--color=auto' + fi + if [[ -z "$GREP_COLOR" ]]; then + export GREP_COLOR='37;45' + fi else export GREP_OPTIONS='--color=none' export GREP_COLOR='' diff --git a/lib/history.zsh b/lib/history.zsh index 604658a5f..8a32e339a 100644 --- a/lib/history.zsh +++ b/lib/history.zsh @@ -1,13 +1,14 @@ ## Command history configuration -HISTFILE=$HOME/.zsh_history +HISTFILE="$HOME/.zsh_history" HISTSIZE=10000 SAVEHIST=10000 -setopt HIST_VERIFY -setopt HIST_EXPIRE_DUPS_FIRST -setopt HIST_IGNORE_SPACE -setopt HIST_IGNORE_DUPS -setopt SHARE_HISTORY -setopt APPEND_HISTORY -setopt EXTENDED_HISTORY -setopt INC_APPEND_HISTORY +setopt hist_verify +setopt hist_expire_dups_first +setopt hist_ignore_space +setopt hist_ignore_dups +setopt share_history +setopt append_history +setopt extended_history +setopt inc_append_history + diff --git a/lib/key-bindings.zsh b/lib/key-bindings.zsh index 9f28d5761..fd795ed78 100644 --- a/lib/key-bindings.zsh +++ b/lib/key-bindings.zsh @@ -1,4 +1,4 @@ -# TODO: Explain what some of this does.. +# TODO: Write a GNU Emacs key bindings file akin to the vi-mode plugin. bindkey -e bindkey '\ew' kill-region @@ -8,7 +8,7 @@ bindkey '^r' history-incremental-search-backward bindkey "^[[5~" up-line-or-history bindkey "^[[6~" down-line-or-history -# make search up and down work, so partially type and hit up/down to find relevant stuff +# Make key up/down move up/down or search history. bindkey '^[[A' up-line-or-search bindkey '^[[B' down-line-or-search @@ -16,18 +16,22 @@ bindkey "^[[H" beginning-of-line bindkey "^[[1~" beginning-of-line bindkey "^[[F" end-of-line bindkey "^[[4~" end-of-line -bindkey ' ' magic-space # also do history expansion on space +# Do history expansion on space. +bindkey ' ' magic-space + +# File rename magick. +bindkey "^[m" copy-prev-shell-word bindkey '^[[Z' reverse-menu-complete -# Make the delete key (or Fn + Delete on the Mac) work instead of outputting a ~ +# Make the delete key (or Fn + Delete on the Mac) work instead of outputting a ~. bindkey "^[[3~" delete-char bindkey "^[3;5~" delete-char bindkey "\e[3~" delete-char -# consider emacs keybindings: +# Consider GNU Emacs keybindings: -#bindkey -e ## emacs key bindings +#bindkey -e # Emacs key bindings. # #bindkey '^[[A' up-line-or-search #bindkey '^[[B' down-line-or-search @@ -40,6 +44,6 @@ bindkey "\e[3~" delete-char #bindkey '^X^N' accept-and-infer-next-history #bindkey '^W' kill-region #bindkey '^I' complete-word -## Fix weird sequence that rxvt produces +## FIXME: A weird sequence that rxvt produces #bindkey -s '^[[Z' '\t' -# + diff --git a/lib/misc.zsh b/lib/misc.zsh index 364ad8792..efc38400b 100644 --- a/lib/misc.zsh +++ b/lib/misc.zsh @@ -1,13 +1,17 @@ -## smart urls +# Smart URLs autoload -U url-quote-magic zle -N self-insert url-quote-magic -## file rename magick -bindkey "^[m" copy-prev-shell-word - -## jobs +# Jobs setopt long_list_jobs -## pager -[[ -z "$PAGER" ]] && export PAGER=less -[[ -z "$LC_CTYPE" ]] && export LC_CTYPE=en_US.UTF-8 +# Pager +if [[ -z "$PAGER" ]]; then + export PAGER=less +fi + +# Localization +if [[ -z "$LC_CTYPE" ]]; then + export LC_CTYPE=en_US.UTF-8 +fi + diff --git a/lib/rvm.zsh b/lib/rvm.zsh index 597be1b33..25ba36b7d 100644 --- a/lib/rvm.zsh +++ b/lib/rvm.zsh @@ -1,7 +1,8 @@ -# get the name of the branch we are on +# Get the name of the current branch. function rvm_prompt_info() { - ruby_version=$(~/.rvm/bin/rvm-prompt 2> /dev/null) || return - echo "($ruby_version)" + local ruby_version=$(~/.rvm/bin/rvm-prompt 2> /dev/null) + if [[ -n "$ruby_version" ]]; then + echo "($ruby_version)" + fi } - diff --git a/lib/spectrum.zsh b/lib/spectrum.zsh index 4006a7fe1..43a013d78 100644 --- a/lib/spectrum.zsh +++ b/lib/spectrum.zsh @@ -1,20 +1,20 @@ -#! /bin/zsh -# A script to make using 256 colors in zsh less painful. +# A script to make using 256 colors in ZSH less painful. # P.C. Shyamshankar # Copied from http://github.com/sykora/etc/blob/master/zsh/functions/spectrum/ typeset -Ag FX FG BG FX=( - reset "%{%}" - bold "%{%}" no-bold "%{%}" - italic "%{%}" no-italic "%{%}" - underline "%{%}" no-underline "%{%}" - blink "%{%}" no-blink "%{%}" - reverse "%{%}" no-reverse "%{%}" + reset "%{%}" + bold "%{%}" no-bold "%{%}" + italic "%{%}" no-italic "%{%}" + underline "%{%}" no-underline "%{%}" + blink "%{%}" no-blink "%{%}" + reverse "%{%}" no-reverse "%{%}" ) for color in {000..255}; do - FG[$color]="%{[38;5;${color}m%}" - BG[$color]="%{[48;5;${color}m%}" + FG[$color]="%{[38;5;${color}m%}" + BG[$color]="%{[48;5;${color}m%}" done + diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index 9a5765709..5c1c812d1 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -1,31 +1,40 @@ -[[ "$TERM" == "dumb" ]] && return +# Dumb terminals lack support. +if [[ "$TERM" == 'dumb' ]]; then + return +fi -#usage: title short_tab_title looooooooooooooooooooooggggggg_windows_title -#http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#ss3.1 -#Fully support screen, iterm, and probably most modern xterm and rxvt -#Limited support for Apple Terminal (Terminal can't set window or tab separately) +# Fully supports GNU Screen, iTerm, and most modern xterm and rxvt terminals. +# Partially supports Mac OS X Terminal since it can't set window and tab separately. +# Usage: title "tab title" "window title" function title { - [ "$DISABLE_AUTO_TITLE" != "true" ] || return - if [[ "$TERM" == screen* ]]; then - print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars - elif [[ "$TERM" == xterm* ]] || [[ $TERM == rxvt* ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then - print -Pn "\e]2;$2:q\a" #set window name - print -Pn "\e]1;$1:q\a" #set icon (=tab) name (will override window name on broken terminal) + if [[ "$DISABLE_AUTO_TITLE" != 'true' ]]; then + if [[ "$TERM" == screen* ]]; then + # Set GNU Screen's hardstatus (usually truncated at 20 characters). + print -Pn "\ek$1:q\e\\" + elif [[ "$TERM" == xterm* ]] || [[ "$TERM" == rxvt* ]]; then + # Set the window title. + print -Pn "\e]2;$2:q\a" + # Set the tab title (will override window title on a broken terminal). + print -Pn "\e]1;$1:q\a" + fi fi } -ZSH_THEME_TERM_TAB_TITLE_IDLE="%15<..<%~%<<" #15 char left truncated PWD +# 15 character, left-truncated current working directory. +ZSH_THEME_TERM_TAB_TITLE_IDLE="%15<..<%~%<<" ZSH_THEME_TERM_TITLE_IDLE="%n@%m: %~" -#Appears when you have the prompt +# Set the tab and window titles before the prompt is displayed. function precmd { - title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE + title "$ZSH_THEME_TERM_TAB_TITLE_IDLE" "$ZSH_THEME_TERM_TITLE_IDLE" } -#Appears at the beginning of (and during) of command execution +# Set the tab and window titles before command execution. function preexec { emulate -L zsh setopt extended_glob - local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd + # Command name only, or if this is sudo or ssh, the next command. + local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]} title "$CMD" "%100>...>$2%<<" } + diff --git a/lib/theme-and-appearance.zsh b/lib/theme-and-appearance.zsh index ab5aba4da..2596013b6 100644 --- a/lib/theme-and-appearance.zsh +++ b/lib/theme-and-appearance.zsh @@ -1,35 +1,23 @@ -# ls colors -autoload colors; colors; -[[ -z "$LSCOLORS" ]] && export LSCOLORS="Gxfxcxdxbxegedabagacad" +# Load and run colors. +autoload -U colors +colors -i -# Enable ls colors -if [ "$DISABLE_COLOR" != "true" ] -then - # Find the option for using colors in ls, depending on the version: Linux or BSD - ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty' || alias ls='ls -G' -fi - -#setopt no_beep -setopt auto_cd -setopt multios -setopt cdablevarS - -if [[ x$WINDOW != x ]] -then - SCREEN_NO="%B$WINDOW%b " +# Set the GNU Screen window number. +if [[ -n "$WINDOW" ]]; then + SCREEN_NO="%B$WINDOW%b " else - SCREEN_NO="" + SCREEN_NO="" fi -# Apply theming defaults +# Set the default prompt theme. PS1="%n@%m:%~%# " -# git theming default: Variables for theming the git info prompt -ZSH_THEME_GIT_PROMPT_PREFIX="git:(" # Prefix at the very beginning of the prompt, before the branch name -ZSH_THEME_GIT_PROMPT_SUFFIX=")" # At the very end of the prompt -ZSH_THEME_GIT_PROMPT_DIRTY="*" # Text to display if the branch is dirty -ZSH_THEME_GIT_PROMPT_CLEAN="" # Text to display if the branch is clean +# Set the default Git prompt theme. +ZSH_THEME_GIT_PROMPT_PREFIX="git:(" # Prefix before the branch name. +ZSH_THEME_GIT_PROMPT_SUFFIX=")" # Suffix after the branch name. +ZSH_THEME_GIT_PROMPT_DIRTY="*" # Indicator to display if the branch is dirty. +ZSH_THEME_GIT_PROMPT_CLEAN="" # Indicator to display if the branch is clean. -# Setup the prompt with pretty colors +# Enable parameter, arithmentic expansion and command substitution in prompt. setopt prompt_subst diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 2d3fe50f2..4dc081405 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -1,38 +1,39 @@ -# Initializes Oh My Zsh +# Initializes OH MY ZSH. -# Disable colors on dumb terminals -if [ "$TERM" = "dumb" ]; then - DISABLE_COLOR="true" +# Disable color in dumb terminals. +if [[ "$TERM" == 'dumb' ]]; then + DISABLE_COLOR='true' fi -# Load all of the config files in ~/oh-my-zsh that end in .zsh -# TIP: Add files you don't want in git to .gitignore -for config_file ($ZSH/lib/*.zsh) source $config_file +# Load all files in $ZSH/oh-my-zsh/lib/ that end in .zsh. +for config_file in $ZSH/lib/*.zsh; do + source "$config_file" +done -# Add all defined plugins to fpath +# Add all defined plugins to fpath. plugin=${plugin:=()} -for plugin ($plugins) fpath=($ZSH/plugins/$plugin $fpath) +for plugin in $plugins; do + fpath=($ZSH/plugins/$plugin $fpath) +done -# Load and run compinit +# Load and run compinit. autoload -U compinit compinit -i -# Load all of the plugins that were defined in ~/.zshrc -for plugin ($plugins); do - if [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then - source $ZSH/plugins/$plugin/$plugin.plugin.zsh +# Load all plugins defined in ~/.zshrc. +for plugin in $plugins; do + if [[ -f "$ZSH/plugins/$plugin/$plugin.plugin.zsh" ]]; then + source "$ZSH/plugins/$plugin/$plugin.plugin.zsh" fi done -# Load the theme -if [ "$ZSH_THEME" = "random" ] -then - themes=($ZSH/themes/*zsh-theme) - N=${#themes[@]} - ((N=(RANDOM%N)+1)) - RANDOM_THEME=${themes[$N]} - source "$RANDOM_THEME" - echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..." +# Load the theme. +if [[ "$ZSH_THEME" == "random" ]]; then + themes=($ZSH/themes/*.zsh-theme) + theme_index=${#themes[@]} + (( theme_index=((RANDOM % theme_index) + 1) )) + random_theme="${themes[$theme_index]}" + source "$random_theme" else if [ ! "$ZSH_THEME" = "" ] then @@ -41,7 +42,7 @@ else fi # Compile zcompdump, if modified, to increase startup speed. -if [ "$HOME/.zcompdump" -nt "$HOME/.zcompdump.zwc" -o ! -e "$HOME/.zcompdump.zwc" ]; then +if [[ "$HOME/.zcompdump" -nt "$HOME/.zcompdump.zwc" ]] || [[ ! -e "$HOME/.zcompdump.zwc" ]]; then zcompile "$HOME/.zcompdump" fi diff --git a/plugins/compleat/compleat.plugin.zsh b/plugins/compleat/compleat.plugin.zsh index 38f1b396a..7fbd2b953 100644 --- a/plugins/compleat/compleat.plugin.zsh +++ b/plugins/compleat/compleat.plugin.zsh @@ -7,7 +7,7 @@ if (( ${+commands[compleat]} )); then local prefix="${commands[compleat]:h:h}" - local setup="${prefix}/share/compleat-1.0/compleat_setup" + local setup="${prefix}/share/compleat-1.0/compleat_setup" if [[ -f "$setup" ]]; then if ! bashcompinit >/dev/null 2>&1; then @@ -15,6 +15,6 @@ if (( ${+commands[compleat]} )); then bashcompinit -i fi - source "$setup" + source "$setup" fi fi diff --git a/plugins/dirpersist/dirpersist.plugin.zsh b/plugins/dirpersist/dirpersist.plugin.zsh index 6a2b289a2..baf21b1da 100644 --- a/plugins/dirpersist/dirpersist.plugin.zsh +++ b/plugins/dirpersist/dirpersist.plugin.zsh @@ -1,9 +1,9 @@ #!/bin/zsh -# +# # Make the dirstack more persistant -# +# # Add dirpersist to $plugins in ~/.zshrc to load -# +# # $zdirstore is the file used to persist the stack zdirstore=~/.zdirstore diff --git a/plugins/git-flow/git-flow.plugin.zsh b/plugins/git-flow/git-flow.plugin.zsh index 270bcbe38..a889473e8 100644 --- a/plugins/git-flow/git-flow.plugin.zsh +++ b/plugins/git-flow/git-flow.plugin.zsh @@ -329,4 +329,4 @@ __git_command_successful () { return 0 } -zstyle ':completion:*:*:git:*' user-commands flow:'description for foo' \ No newline at end of file +zstyle ':completion:*:*:git:*' user-commands flow:'description for foo' diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index bc340e86b..6f0ce28c0 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -1,4 +1,3 @@ -# Aliases alias g='git' compdef g=git alias gst='git status' @@ -27,24 +26,12 @@ alias gcp='git cherry-pick' compdef _git gcp=git-cherry-pick alias glg='git log --stat --max-count=5' compdef _git glg=git-log - -# Git and svn mix alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk' compdef git-svn-dcommit-push=git - -# -# Will return the current branch name -# Usage example: git pull origin $(current_branch) -# -function current_branch() { - ref=$(git symbolic-ref HEAD 2> /dev/null) || return - echo ${ref#refs/heads/} -} - -# these aliases take advantage of the previous function -alias ggpull='git pull origin $(current_branch)' +alias ggpull='git pull origin $(git_current_branch)' compdef ggpull=git -alias ggpush='git push origin $(current_branch)' +alias ggpush='git push origin $(git_current_branch)' compdef ggpush=git -alias ggpnp='git pull origin $(current_branch) && git push origin $(current_branch)' +alias ggpnp='git pull origin $(git_current_branch) && git push origin $(git_current_branch)' compdef ggpnp=git + diff --git a/plugins/macports/_port b/plugins/macports/_port index 06d7fb426..c4de6eabb 100644 --- a/plugins/macports/_port +++ b/plugins/macports/_port @@ -1,6 +1,6 @@ #compdef port -local subcmds +local subcmds # we cache the list of ports # we shall use some cache policy to avoid problems with new ports @@ -31,8 +31,8 @@ subcmds=( 'file' 'help' 'info' -'install' -'installed' +'install' +'installed' 'list' 'livecheck' 'location' @@ -48,7 +48,7 @@ subcmds=( 'test' 'unarchive' 'uninstall' -'upgrade' +'upgrade' 'variants' 'version' ) diff --git a/plugins/perl/perl.plugin.zsh b/plugins/perl/perl.plugin.zsh index f94c4195d..c5590e531 100644 --- a/plugins/perl/perl.plugin.zsh +++ b/plugins/perl/perl.plugin.zsh @@ -27,7 +27,7 @@ alias latest-perl='curl -s http://www.perl.org/get.html | perl -wlne '\''if (/pe # Functions ################################################################# -# newpl - creates a basic Perl script file and opens it with $EDITOR +# newpl - creates a basic Perl script file and opens it with $EDITOR newpl () { # set $EDITOR to 'vim' if it is undefined [[ -z $EDITOR ]] && EDITOR=vim diff --git a/plugins/redis-cli/_redis-cli b/plugins/redis-cli/_redis-cli index 3789add18..ae82dcd58 100644 --- a/plugins/redis-cli/_redis-cli +++ b/plugins/redis-cli/_redis-cli @@ -139,4 +139,4 @@ _arguments \ if (( CURRENT == 1 )); then _describe -t commands "redis-cli subcommand" _1st_arguments return -fi \ No newline at end of file +fi diff --git a/plugins/rvm/_rvm b/plugins/rvm/_rvm index bba5304a0..977e14a78 100644 --- a/plugins/rvm/_rvm +++ b/plugins/rvm/_rvm @@ -34,7 +34,7 @@ _arguments -C \ case $state in cmds) - 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)" @@ -116,7 +116,7 @@ case $state in if (( CURRENT == 3 )); then _values 'package_commands' \ 'install' \ - 'uninstall' + 'uninstall' else _values 'packages' \ 'readline' \ diff --git a/plugins/svn/svn.plugin.zsh b/plugins/svn/svn.plugin.zsh index 86050227d..9b9f1b6b0 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" | sed "s/\/.*$//" fi } @@ -29,9 +29,9 @@ function svn_get_rev_nr { function svn_dirty_choose { if [ in_svn ]; then s=$(svn status 2>/dev/null) - if [ $s ]; then + if [ $s ]; then echo $1 - else + else echo $2 fi fi diff --git a/plugins/vagrant/_vagrant b/plugins/vagrant/_vagrant index 483b29c53..2e76d2ec2 100644 --- a/plugins/vagrant/_vagrant +++ b/plugins/vagrant/_vagrant @@ -1,4 +1,4 @@ -#compdef vagrant +#compdef vagrant #autoload # vagrant zsh completion @@ -64,7 +64,7 @@ __vagrant-box () (options) case $line[1] in (repackage|remove) - _arguments ':feature:__box_list' + _arguments ':feature:__box_list' ;; esac ;; @@ -93,7 +93,7 @@ case $state in (options) case $line[1] in (help) - _arguments ':feature:__task_list' + _arguments ':feature:__task_list' ;; (box) diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template index c2accfc87..6746feb28 100644 --- a/templates/zshrc.zsh-template +++ b/templates/zshrc.zsh-template @@ -1,25 +1,24 @@ -# Path to your oh-my-zsh configuration. -export ZSH=$HOME/.oh-my-zsh +# Path to oh-my-zsh. +export ZSH="$HOME/.oh-my-zsh" -# Set name of the theme to load. -# Look in ~/.oh-my-zsh/themes/ -# Optionally, if you set this to "random", it'll load a random theme each -# time that oh-my-zsh is loaded. +# Set the name of the theme to load (see $ZSH/themes/). +# Setting it to 'random' loads a random theme. export ZSH_THEME="robbyrussell" -# Set to this to use case-sensitive completion -# export CASE_SENSITIVE="true" +# Set to 'true' to enable case-sensitivity. +export CASE_SENSITIVE='false' -# Uncomment following line if you want to disable colors in ls -# export DISABLE_COLOR="true" +# Set to 'true' to disable color (auto set on dumb terminals). +export DISABLE_COLOR='false' -# Uncomment following line if you want to disable autosetting terminal title. -# export DISABLE_AUTO_TITLE="true" +# Set to 'true' to disable auto setting the tab and window titles. +export DISABLE_AUTO_TITLE='false' -# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) -# Example format: plugins=(rails git textmate ruby lighthouse) +# Set the plugins to load (see $ZSH/plugins/). +# Example: plugins=(rails git textmate ruby lighthouse) plugins=(git) -source $ZSH/oh-my-zsh.sh +source "$ZSH/oh-my-zsh.sh" # Customize to your needs... + diff --git a/themes/Soliah.zsh-theme b/themes/Soliah.zsh-theme index 237e70fda..e0932c4b5 100644 --- a/themes/Soliah.zsh-theme +++ b/themes/Soliah.zsh-theme @@ -5,10 +5,10 @@ ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[white]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%})" # Text to display if the branch is dirty -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*%{$reset_color%}" # Text to display if the branch is clean -ZSH_THEME_GIT_PROMPT_CLEAN="" +ZSH_THEME_GIT_PROMPT_CLEAN="" # Colors vary depending on time lapsed. ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT="%{$fg[green]%}" @@ -35,7 +35,7 @@ function rvm_gemset() { GEMSET=`rvm gemset list | grep '=>' | cut -b4-` if [[ -n $GEMSET ]]; then echo "%{$fg[yellow]%}$GEMSET%{$reset_color%}|" - fi + fi } @@ -53,12 +53,12 @@ function git_time_since_commit() { # Totals MINUTES=$((seconds_since_last_commit / 60)) HOURS=$((seconds_since_last_commit/3600)) - + # Sub-hours and sub-minutes DAYS=$((seconds_since_last_commit / 86400)) SUB_HOURS=$((HOURS % 24)) SUB_MINUTES=$((MINUTES % 60)) - + if [[ -n $(git status -s 2> /dev/null) ]]; then if [ "$MINUTES" -gt 30 ]; then COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG" diff --git a/themes/awesomepanda.zsh-theme b/themes/awesomepanda.zsh-theme index 411b89837..1915bd13c 100644 --- a/themes/awesomepanda.zsh-theme +++ b/themes/awesomepanda.zsh-theme @@ -15,4 +15,4 @@ ZSH_THEME_REPO_NAME_COLOR="%{$fg_bold[red]%}" ZSH_THEME_SVN_PROMPT_PREFIX="svn:(" ZSH_THEME_SVN_PROMPT_SUFFIX=")" ZSH_THEME_SVN_PROMPT_DIRTY="%{$fg[red]%} ✘ %{$reset_color%}" -ZSH_THEME_SVN_PROMPT_CLEAN=" " \ No newline at end of file +ZSH_THEME_SVN_PROMPT_CLEAN=" " diff --git a/themes/cloud.zsh-theme b/themes/cloud.zsh-theme index ad5e2834b..4e94f61a7 100644 --- a/themes/cloud.zsh-theme +++ b/themes/cloud.zsh-theme @@ -3,4 +3,4 @@ PROMPT='%{$fg_bold[cyan]%}☁ %{$fg_bold[green]%}%p %{$fg[green]%}%c %{$fg_bold[ ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}[%{$fg[cyan]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}] %{$fg[yellow]%}⚡%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%}]" \ No newline at end of file +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%}]" diff --git a/themes/eastwood.zsh-theme b/themes/eastwood.zsh-theme index 83664515a..8f15f367f 100644 --- a/themes/eastwood.zsh-theme +++ b/themes/eastwood.zsh-theme @@ -1,5 +1,5 @@ #RVM settings -if [[ -s ~/.rvm/scripts/rvm ]] ; then +if [[ -s ~/.rvm/scripts/rvm ]] ; then RPS1="%{$fg[yellow]%}rvm:%{$reset_color%}%{$fg[red]%}\$(~/.rvm/bin/rvm-prompt)%{$reset_color%} $EPS1" fi diff --git a/themes/evan.zsh-theme b/themes/evan.zsh-theme index 5ef1f40dd..2ebb27159 100644 --- a/themes/evan.zsh-theme +++ b/themes/evan.zsh-theme @@ -1,2 +1,2 @@ # Evan describes this sexy prompt as: "a skinny, topless prompt" -PROMPT='%m :: %2~ %B»%b ' \ No newline at end of file +PROMPT='%m :: %2~ %B»%b ' diff --git a/themes/example.zsh-theme b/themes/example.zsh-theme index dbd9dc9c9..4ad3b7cae 100644 --- a/themes/example.zsh-theme +++ b/themes/example.zsh-theme @@ -2,4 +2,4 @@ # http://zshwiki.org/home/config/prompt # -PROMPT="%{$fg[red]%}%n%{$reset_color%}@%{$fg[blue]%}%m %{$fg[yellow]%}%~ %{$reset_color%}%% " \ No newline at end of file +PROMPT="%{$fg[red]%}%n%{$reset_color%}@%{$fg[blue]%}%m %{$fg[yellow]%}%~ %{$reset_color%}%% " diff --git a/themes/funky.zsh-theme b/themes/funky.zsh-theme index 2451296d9..503455485 100644 --- a/themes/funky.zsh-theme +++ b/themes/funky.zsh-theme @@ -11,4 +11,4 @@ local smiley="%(?,%{$fg[green]%}:%)%{$reset_color%},%{$fg[red]%}:(%{$reset_color PROMPT="╭─${path_p}─${user_host}─${ret_status}─${hist_no} ╰─${blue_op}${smiley}${blue_cp} %# " local cur_cmd="${blue_op}%_${blue_cp}" -PROMPT2="${cur_cmd}> " \ No newline at end of file +PROMPT2="${cur_cmd}> " diff --git a/themes/gallois.zsh-theme b/themes/gallois.zsh-theme index 259640ba4..be8fe0999 100644 --- a/themes/gallois.zsh-theme +++ b/themes/gallois.zsh-theme @@ -12,7 +12,7 @@ git_custom_status() { } #RVM and git settings -if [[ -s ~/.rvm/scripts/rvm ]] ; then +if [[ -s ~/.rvm/scripts/rvm ]] ; then RPS1='$(git_custom_status)%{$fg[red]%}[`~/.rvm/bin/rvm-prompt`]%{$reset_color%} $EPS1' fi diff --git a/themes/imajes.zsh-theme b/themes/imajes.zsh-theme index 88c35b6d9..918cd8081 100644 --- a/themes/imajes.zsh-theme +++ b/themes/imajes.zsh-theme @@ -2,4 +2,4 @@ # http://zshwiki.org/home/config/prompt # -PROMPT="%{$fg[red]%}%%%{$reset_color%} " \ No newline at end of file +PROMPT="%{$fg[red]%}%%%{$reset_color%} " diff --git a/themes/jonathan.zsh-theme b/themes/jonathan.zsh-theme index add485279..79d0d21ff 100644 --- a/themes/jonathan.zsh-theme +++ b/themes/jonathan.zsh-theme @@ -5,15 +5,15 @@ function precmd { ### # Truncate the path if it's too long. - + PR_FILLBAR="" PR_PWDLEN="" - + local promptsize=${#${(%):---(%n@%m:%l)---()--}} local rubyprompt=`rvm_prompt_info` local rubypromptsize=${#${rubyprompt}} local pwdsize=${#${(%):-%~}} - + if [[ "$promptsize + $rubypromptsize + $pwdsize" -gt $TERMWIDTH ]]; then ((PR_PWDLEN=$TERMWIDTH - $promptsize)) else @@ -69,7 +69,7 @@ setprompt () { ### # See if we can use extended characters to look nicer. - + typeset -A altchar set -A altchar ${(s..)terminfo[acsc]} PR_SET_CHARSET="%{$terminfo[enacs]%}" @@ -81,10 +81,10 @@ setprompt () { PR_LRCORNER=${altchar[j]:--} PR_URCORNER=${altchar[k]:--} - + ### # Decide if we need to set titlebar text. - + case $TERM in xterm*) PR_TITLEBAR=$'%{\e]0;%(!.-=*[ROOT]*=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\a%}' @@ -96,8 +96,8 @@ setprompt () { PR_TITLEBAR='' ;; esac - - + + ### # Decide whether to set a screen title if [[ "$TERM" == "screen" ]]; then @@ -105,8 +105,8 @@ setprompt () { else PR_STITLE='' fi - - + + ### # Finally, the prompt. diff --git a/themes/josh.zsh-theme b/themes/josh.zsh-theme index 6bed1a70e..d6c64da8e 100644 --- a/themes/josh.zsh-theme +++ b/themes/josh.zsh-theme @@ -15,7 +15,7 @@ function josh_prompt { branch_size=${#branch} ruby_size=${#ruby_version} user_machine_size=${#${(%):-%n@%m-}} - + if [[ ${#branch} -eq 0 ]] then (( ruby_size = ruby_size + 1 )) else @@ -24,15 +24,15 @@ function josh_prompt { (( branch_size = branch_size + 2 )) fi fi - + (( spare_width = ${spare_width} - (${user_machine_size} + ${path_size} + ${branch_size} + ${ruby_size}) )) while [ ${#prompt} -lt $spare_width ]; do prompt=" $prompt" done - + prompt="%{%F{green}%}$PWD$prompt%{%F{red}%}$(rvm_prompt_info)%{$reset_color%} $(git_prompt_info)" - + echo $prompt } diff --git a/themes/juanghurtado.zsh-theme b/themes/juanghurtado.zsh-theme index 2f715cc9e..3ca50cee8 100644 --- a/themes/juanghurtado.zsh-theme +++ b/themes/juanghurtado.zsh-theme @@ -43,4 +43,4 @@ ZSH_THEME_GIT_PROMPT_SHA_AFTER="%{$WHITE%}]" PROMPT=' %{$GREEN_BOLD%}%n@%m%{$WHITE%}:%{$YELLOW%}%~%u$(parse_git_dirty)$(git_prompt_ahead)%{$RESET_COLOR%} %{$BLUE%}>%{$RESET_COLOR%} ' -RPROMPT='%{$GREEN_BOLD%}$(current_branch)$(git_prompt_short_sha)$(git_prompt_status)%{$RESET_COLOR%}' \ No newline at end of file +RPROMPT='%{$GREEN_BOLD%}$(current_branch)$(git_prompt_short_sha)$(git_prompt_status)%{$RESET_COLOR%}' diff --git a/themes/kardan.zsh-theme b/themes/kardan.zsh-theme index fd6586a9d..59c938037 100644 --- a/themes/kardan.zsh-theme +++ b/themes/kardan.zsh-theme @@ -9,4 +9,4 @@ RPROMPT='%~$(git_prompt_info)$(get_host)' ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}✗%{$reset_color%}" ZSH_THEME_GIT_PROMPT_PREFIX="(" -ZSH_THEME_GIT_PROMPT_SUFFIX=")" \ No newline at end of file +ZSH_THEME_GIT_PROMPT_SUFFIX=")" diff --git a/themes/linuxonly b/themes/linuxonly index a11b80d7f..335b2c4a7 100644 --- a/themes/linuxonly +++ b/themes/linuxonly @@ -47,7 +47,7 @@ prompt_jnrowe_precmd () { #dir_status="$c1%n%F{7}@%F{9}%m%F{7}:%F{12}%/" dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$c4%}%/ %{$c0%}(%{$c5%}%?%{$c0%})" #dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$foopath%} %{$c0%}(%{$c5%}%?%{$c0%})" - + PROMPT='%{$fg_bold[green]%}%p%{$reset_color%}${vcs_info_msg_0_}${dir_status} ${ret_status}%{$reset_color%} > ' elif [[ $(git diff --cached --name-status 2>/dev/null ) != "" ]]; then @@ -55,7 +55,7 @@ prompt_jnrowe_precmd () { PROMPT='${vcs_info_msg_0_} %{$fg_bold[green]%}%p%{$reset_color%}${dir_status} ${vcs_info_msg_0_}%{$reset_color%} > ' - + elif [[ $(git diff --name-status 2>/dev/null ) != "" ]]; then dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$c4%}%/ %{$c0%}(%{$c5%}%?%{$c0%})" @@ -67,7 +67,7 @@ prompt_jnrowe_precmd () { PROMPT='${vcs_info_msg_0_} %{$fg_bold[green]%}%p%{$reset_color%}${dir_status} ${vcs_info_msg_0_}%{$reset_color%} > ' - + fi } diff --git a/themes/mikeh.zsh-theme b/themes/mikeh.zsh-theme index 943f04d38..e611b6832 100644 --- a/themes/mikeh.zsh-theme +++ b/themes/mikeh.zsh-theme @@ -20,4 +20,4 @@ mikeh_precmd() { # entry in a nice long thread on the Arch Linux forums: http://bbs.archlinux.org/viewtopic.php?pid=521888#p521888 PROMPT=$'%{\e[0;34m%}%B..[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%a %b %d, %I:%M"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} %{\e[0;34m%}%B..%B[%{\e[1;35m%}$%{\e[0;34m%}%B] <($vcs_info_msg_0_)>%{\e[0m%}%b ' -PS2=$' \e[0;34m%}%B>%{\e[0m%}%b ' \ No newline at end of file +PS2=$' \e[0;34m%}%B>%{\e[0m%}%b ' diff --git a/themes/minimal.zsh-theme b/themes/minimal.zsh-theme index ee3ab6b22..d3c9e3663 100644 --- a/themes/minimal.zsh-theme +++ b/themes/minimal.zsh-theme @@ -12,4 +12,4 @@ git_custom_status() { } -PROMPT='%2~ $(git_custom_status) »%b ' \ No newline at end of file +PROMPT='%2~ $(git_custom_status) »%b ' diff --git a/themes/rixius.zsh-theme b/themes/rixius.zsh-theme index c0c5c9c71..7e7c9c633 100644 --- a/themes/rixius.zsh-theme +++ b/themes/rixius.zsh-theme @@ -1,6 +1,6 @@ # /|/ Code by Stephen # /|/ "Rixius" Middleton -# +# # name in folder (github) # ± if in github repo, or ≥ if otherwise Time in 24-hour format is on right. function collapse_pwd { diff --git a/themes/sorin.zsh-theme b/themes/sorin.zsh-theme index ecd092b84..a63a98441 100644 --- a/themes/sorin.zsh-theme +++ b/themes/sorin.zsh-theme @@ -26,10 +26,10 @@ if [[ "$DISABLE_COLOR" != "true" ]]; then ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜" ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═" ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭" -else +else MODE_INDICATOR="❮❮❮" local return_status="%(?::⏎)" - + PROMPT='%c$(git_prompt_info) %(!.#.❯) ' ZSH_THEME_GIT_PROMPT_PREFIX=" git:" diff --git a/themes/theunraveler.zsh-theme b/themes/theunraveler.zsh-theme index e4bfb79c5..a896970df 100644 --- a/themes/theunraveler.zsh-theme +++ b/themes/theunraveler.zsh-theme @@ -13,4 +13,4 @@ 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]%} ✱" \ No newline at end of file +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[grey]%} ✱" diff --git a/themes/tonotdo.zsh-theme b/themes/tonotdo.zsh-theme index a6407034c..52670e8a5 100644 --- a/themes/tonotdo.zsh-theme +++ b/themes/tonotdo.zsh-theme @@ -9,4 +9,4 @@ ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[yellow]%}✗%{$fg_bold[blue]%})" # LS colors, made with http://geoff.greer.fm/lscolors/ export LSCOLORS="Gxfxcxdxbxegedabagacad" -export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:' \ No newline at end of file +export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:' From 4727e12013d7d24901d87033dc64acfc3bd53ef2 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Wed, 1 Jun 2011 14:14:20 -0400 Subject: [PATCH 454/614] Merged lib/git.zsh and lib/rvm.zsh into plugins/. --- lib/git.zsh | 80 -------------------------------------- lib/rvm.zsh | 8 ---- plugins/git/git.plugin.zsh | 80 ++++++++++++++++++++++++++++++++++++++ plugins/rvm/rvm.plugin.zsh | 9 +++++ 4 files changed, 89 insertions(+), 88 deletions(-) delete mode 100644 lib/git.zsh delete mode 100644 lib/rvm.zsh diff --git a/lib/git.zsh b/lib/git.zsh deleted file mode 100644 index bb7f05381..000000000 --- a/lib/git.zsh +++ /dev/null @@ -1,80 +0,0 @@ -# Renders the name of the current branch. -function git_prompt_info() { - local branch=$(git_current_branch) - if [[ -n "$branch" ]]; then - echo "${ZSH_THEME_GIT_PROMPT_PREFIX}${branch}$(parse_git_dirty)${ZSH_THEME_GIT_PROMPT_SUFFIX}" - fi -} - -# Gets the current branch. -function git_current_branch() { - local ref=$(git symbolic-ref HEAD 2> /dev/null) - if [[ -n "$ref" ]]; then - echo "${ref#refs/heads/}" - fi -} - -# Checks if the working tree is dirty. -function parse_git_dirty() { - if [[ -n $(git status -s 2> /dev/null) ]]; then - echo "$ZSH_THEME_GIT_PROMPT_DIRTY" - else - echo "$ZSH_THEME_GIT_PROMPT_CLEAN" - fi -} - -# Checks if there are commits ahead from remote. -function git_prompt_ahead() { - if $(echo "$(git log origin/$(git_current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then - echo "$ZSH_THEME_GIT_PROMPT_AHEAD" - fi -} - -# Formats the prompt string for current git commit short SHA. -function git_prompt_short_sha() { - local sha=$(git rev-parse --short HEAD 2> /dev/null) - if [[ -n "$sha" ]]; then - echo "${ZSH_THEME_GIT_PROMPT_SHA_BEFORE}${sha}${ZSH_THEME_GIT_PROMPT_SHA_AFTER}" - fi -} - -# Formats the prompt string for current git commit long SHA. -function git_prompt_long_sha() { - local sha=$(git rev-parse HEAD 2> /dev/null) - if [[ -n "$sha" ]]; then - echo "${ZSH_THEME_GIT_PROMPT_SHA_BEFORE}${sha}${ZSH_THEME_GIT_PROMPT_SHA_AFTER}" - fi -} - -# Gets the status of the working tree. -function git_prompt_status() { - local indicators line untracked added modified renamed deleted - while IFS=$'\n' read line; do - if [[ "$line" =~ '^\?\? ' ]]; then - [[ -n $untracked ]] && continue || untracked='yes' - indicators="${ZSH_THEME_GIT_PROMPT_UNTRACKED}${indicators}" - fi - if [[ "$line" =~ '^(((A|M|D|T) )|(AD|AM|AT|MM)) ' ]]; then - [[ -n $added ]] && continue || added='yes' - indicators="${ZSH_THEME_GIT_PROMPT_ADDED}${indicators}" - fi - if [[ "$line" =~ '^(( (M|T))|(AM|AT|MM)) ' ]]; then - [[ -n $modified ]] && continue || modified='yes' - indicators="${ZSH_THEME_GIT_PROMPT_MODIFIED}${indicators}" - fi - if [[ "$line" =~ '^R ' ]]; then - [[ -n $renamed ]] && continue || renamed='yes' - indicators="${ZSH_THEME_GIT_PROMPT_RENAMED}${indicators}" - fi - if [[ "$line" =~ '^( D|AD) ' ]]; then - [[ -n $deleted ]] && continue || deleted='yes' - indicators="${ZSH_THEME_GIT_PROMPT_DELETED}${indicators}" - fi - if [[ "$line" =~ '^UU ' ]]; then - [[ -n $unmerged ]] && continue || unmerged='yes' - indicators="${ZSH_THEME_GIT_PROMPT_UNMERGED}${indicators}" - fi - done < <(git status --porcelain 2> /dev/null) - echo $indicators -} - diff --git a/lib/rvm.zsh b/lib/rvm.zsh deleted file mode 100644 index 25ba36b7d..000000000 --- a/lib/rvm.zsh +++ /dev/null @@ -1,8 +0,0 @@ -# Get the name of the current branch. -function rvm_prompt_info() { - local ruby_version=$(~/.rvm/bin/rvm-prompt 2> /dev/null) - if [[ -n "$ruby_version" ]]; then - echo "($ruby_version)" - fi -} - diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 6f0ce28c0..baf34b830 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -1,3 +1,83 @@ +# Renders the name of the current branch. +function git_prompt_info() { + local branch=$(git_current_branch) + if [[ -n "$branch" ]]; then + echo "${ZSH_THEME_GIT_PROMPT_PREFIX}${branch}$(parse_git_dirty)${ZSH_THEME_GIT_PROMPT_SUFFIX}" + fi +} + +# Gets the current branch. +function git_current_branch() { + local ref=$(git symbolic-ref HEAD 2> /dev/null) + if [[ -n "$ref" ]]; then + echo "${ref#refs/heads/}" + fi +} + +# Checks if the working tree is dirty. +function parse_git_dirty() { + if [[ -n $(git status -s 2> /dev/null) ]]; then + echo "$ZSH_THEME_GIT_PROMPT_DIRTY" + else + echo "$ZSH_THEME_GIT_PROMPT_CLEAN" + fi +} + +# Checks if there are commits ahead from remote. +function git_prompt_ahead() { + if $(echo "$(git log origin/$(git_current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then + echo "$ZSH_THEME_GIT_PROMPT_AHEAD" + fi +} + +# Formats the prompt string for current git commit short SHA. +function git_prompt_short_sha() { + local sha=$(git rev-parse --short HEAD 2> /dev/null) + if [[ -n "$sha" ]]; then + echo "${ZSH_THEME_GIT_PROMPT_SHA_BEFORE}${sha}${ZSH_THEME_GIT_PROMPT_SHA_AFTER}" + fi +} + +# Formats the prompt string for current git commit long SHA. +function git_prompt_long_sha() { + local sha=$(git rev-parse HEAD 2> /dev/null) + if [[ -n "$sha" ]]; then + echo "${ZSH_THEME_GIT_PROMPT_SHA_BEFORE}${sha}${ZSH_THEME_GIT_PROMPT_SHA_AFTER}" + fi +} + +# Gets the status of the working tree. +function git_prompt_status() { + local indicators line untracked added modified renamed deleted + while IFS=$'\n' read line; do + if [[ "$line" =~ '^\?\? ' ]]; then + [[ -n $untracked ]] && continue || untracked='yes' + indicators="${ZSH_THEME_GIT_PROMPT_UNTRACKED}${indicators}" + fi + if [[ "$line" =~ '^(((A|M|D|T) )|(AD|AM|AT|MM)) ' ]]; then + [[ -n $added ]] && continue || added='yes' + indicators="${ZSH_THEME_GIT_PROMPT_ADDED}${indicators}" + fi + if [[ "$line" =~ '^(( (M|T))|(AM|AT|MM)) ' ]]; then + [[ -n $modified ]] && continue || modified='yes' + indicators="${ZSH_THEME_GIT_PROMPT_MODIFIED}${indicators}" + fi + if [[ "$line" =~ '^R ' ]]; then + [[ -n $renamed ]] && continue || renamed='yes' + indicators="${ZSH_THEME_GIT_PROMPT_RENAMED}${indicators}" + fi + if [[ "$line" =~ '^( D|AD) ' ]]; then + [[ -n $deleted ]] && continue || deleted='yes' + indicators="${ZSH_THEME_GIT_PROMPT_DELETED}${indicators}" + fi + if [[ "$line" =~ '^UU ' ]]; then + [[ -n $unmerged ]] && continue || unmerged='yes' + indicators="${ZSH_THEME_GIT_PROMPT_UNMERGED}${indicators}" + fi + done < <(git status --porcelain 2> /dev/null) + echo $indicators +} + alias g='git' compdef g=git alias gst='git status' diff --git a/plugins/rvm/rvm.plugin.zsh b/plugins/rvm/rvm.plugin.zsh index 24621fe0b..89244f503 100644 --- a/plugins/rvm/rvm.plugin.zsh +++ b/plugins/rvm/rvm.plugin.zsh @@ -1,3 +1,11 @@ +# Get the name of the current branch. +function rvm_prompt_info() { + local ruby_version=$(~/.rvm/bin/rvm-prompt 2> /dev/null) + if [[ -n "$ruby_version" ]]; then + echo "($ruby_version)" + fi +} + alias rubies='rvm list rubies' alias gemsets='rvm gemset list' @@ -42,3 +50,4 @@ function gems { -Ee "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \ -Ee "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g" } + From b34e9e0022be626f04381b74d71b544f81b1fcb4 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Wed, 13 Jul 2011 13:03:11 -0400 Subject: [PATCH 455/614] Moved each theme under its own directory and changed the file extension. --- oh-my-zsh.sh | 7 +++---- themes/{Soliah.zsh-theme => Soliah/Soliah.theme.zsh} | 0 themes/{afowler.zsh-theme => afowler/afowler.theme.zsh} | 0 .../alanpeabody.theme.zsh} | 0 themes/{arrow.zsh-theme => arrow/arrow.theme.zsh} | 0 .../aussiegeek.theme.zsh} | 0 .../awesomepanda.theme.zsh} | 0 themes/{bira.zsh-theme => bira/bira.theme.zsh} | 0 themes/{candy.zsh-theme => candy/candy.theme.zsh} | 0 themes/{clean.zsh-theme => clean/clean.theme.zsh} | 0 themes/{cloud.zsh-theme => cloud/cloud.theme.zsh} | 0 themes/{cypher.zsh-theme => cypher/cypher.theme.zsh} | 0 themes/{dallas.zsh-theme => dallas/dallas.theme.zsh} | 0 .../{darkblood.zsh-theme => darkblood/darkblood.theme.zsh} | 0 .../daveverwer.theme.zsh} | 0 themes/{dieter.zsh-theme => dieter/dieter.theme.zsh} | 0 .../{dogenpunk.zsh-theme => dogenpunk/dogenpunk.theme.zsh} | 0 themes/{dst.zsh-theme => dst/dst.theme.zsh} | 0 themes/{dstufft.zsh-theme => dstufft/dstufft.theme.zsh} | 0 themes/{duellj.zsh-theme => duellj/duellj.theme.zsh} | 0 themes/{eastwood.zsh-theme => eastwood/eastwood.theme.zsh} | 0 themes/{edvardm.zsh-theme => edvardm/edvardm.theme.zsh} | 0 themes/{evan.zsh-theme => evan/evan.theme.zsh} | 0 themes/{example.zsh-theme => example/example.theme.zsh} | 0 themes/{fishy.zsh-theme => fishy/fishy.theme.zsh} | 0 themes/{flazz.zsh-theme => flazz/flazz.theme.zsh} | 0 .../{fletcherm.zsh-theme => fletcherm/fletcherm.theme.zsh} | 0 themes/{frisk.zsh-theme => frisk/frisk.theme.zsh} | 0 themes/{funky.zsh-theme => funky/funky.theme.zsh} | 0 themes/{fwalch.zsh-theme => fwalch/fwalch.theme.zsh} | 0 .../{gallifrey.zsh-theme => gallifrey/gallifrey.theme.zsh} | 0 themes/{gallois.zsh-theme => gallois/gallois.theme.zsh} | 0 .../garyblessington.theme.zsh} | 0 themes/{gentoo.zsh-theme => gentoo/gentoo.theme.zsh} | 0 .../geoffgarside.theme.zsh} | 0 themes/{gozilla.zsh-theme => gozilla/gozilla.theme.zsh} | 0 themes/{humza.zsh-theme => humza/humza.theme.zsh} | 0 themes/{imajes.zsh-theme => imajes/imajes.theme.zsh} | 0 .../jbergantine.theme.zsh} | 0 themes/{jispwoso.zsh-theme => jispwoso/jispwoso.theme.zsh} | 0 themes/{jnrowe.zsh-theme => jnrowe/jnrowe.theme.zsh} | 0 themes/{jonathan.zsh-theme => jonathan/jonathan.theme.zsh} | 0 themes/{josh.zsh-theme => josh/josh.theme.zsh} | 0 themes/{jreese.zsh-theme => jreese/jreese.theme.zsh} | 0 themes/{jtriley.zsh-theme => jtriley/jtriley.theme.zsh} | 0 .../juanghurtado.theme.zsh} | 0 themes/{kardan.zsh-theme => kardan/kardan.theme.zsh} | 0 .../kennethreitz.theme.zsh} | 0 themes/{kolo.zsh-theme => kolo/kolo.theme.zsh} | 0 themes/{kphoen.zsh-theme => kphoen/kphoen.theme.zsh} | 0 themes/{lambda.zsh-theme => lambda/lambda.theme.zsh} | 0 themes/{ => linuxonly}/linuxonly | 0 .../lukerandall.theme.zsh} | 0 .../macovsky-ruby.theme.zsh} | 0 themes/{macovsky.zsh-theme => macovsky/macovsky.theme.zsh} | 0 themes/{maran.zsh-theme => maran/maran.theme.zsh} | 0 themes/{mgutz.zsh-theme => mgutz/mgutz.theme.zsh} | 0 themes/{mikeh.zsh-theme => mikeh/mikeh.theme.zsh} | 0 .../miloshadzic.theme.zsh} | 0 themes/{minimal.zsh-theme => minimal/minimal.theme.zsh} | 0 themes/{mrtazz.zsh-theme => mrtazz/mrtazz.theme.zsh} | 0 .../{murilasso.zsh-theme => murilasso/murilasso.theme.zsh} | 0 themes/{muse.zsh-theme => muse/muse.theme.zsh} | 0 themes/{nanotech.zsh-theme => nanotech/nanotech.theme.zsh} | 0 themes/{nebirhos.zsh-theme => nebirhos/nebirhos.theme.zsh} | 0 themes/{nicoulaj.zsh-theme => nicoulaj/nicoulaj.theme.zsh} | 0 themes/{obraun.zsh-theme => obraun/obraun.theme.zsh} | 0 themes/{philips.zsh-theme => philips/philips.theme.zsh} | 0 themes/{pmcgee.zsh-theme => pmcgee/pmcgee.theme.zsh} | 0 themes/{re5et.zsh-theme => re5et/re5et.theme.zsh} | 0 themes/{rgm.zsh-theme => rgm/rgm.theme.zsh} | 0 themes/{risto.zsh-theme => risto/risto.theme.zsh} | 0 themes/{rixius.zsh-theme => rixius/rixius.theme.zsh} | 0 .../robbyrussell.theme.zsh} | 0 themes/{simple.zsh-theme => simple/simple.theme.zsh} | 0 themes/{skaro.zsh-theme => skaro/skaro.theme.zsh} | 0 themes/{smt.zsh-theme => smt/smt.theme.zsh} | 0 themes/{sorin.zsh-theme => sorin/sorin.theme.zsh} | 0 .../sporty_256.theme.zsh} | 0 themes/{steeef.zsh-theme => steeef/steeef.theme.zsh} | 0 themes/{sunaku.zsh-theme => sunaku/sunaku.theme.zsh} | 0 .../takashiyoshida.theme.zsh} | 0 .../theunraveler.theme.zsh} | 0 themes/{tjkirch.zsh-theme => tjkirch/tjkirch.theme.zsh} | 0 themes/{tonotdo.zsh-theme => tonotdo/tonotdo.theme.zsh} | 0 themes/{trapd00r.zsh-theme => trapd00r/trapd00r.theme.zsh} | 0 themes/{wezm+.zsh-theme => wezm+/wezm+.theme.zsh} | 0 themes/{wezm.zsh-theme => wezm/wezm.theme.zsh} | 0 .../xiong-chiamiov-plus.theme.zsh} | 0 .../xiong-chiamiov.theme.zsh} | 0 90 files changed, 3 insertions(+), 4 deletions(-) rename themes/{Soliah.zsh-theme => Soliah/Soliah.theme.zsh} (100%) rename themes/{afowler.zsh-theme => afowler/afowler.theme.zsh} (100%) rename themes/{alanpeabody.zsh-theme => alanpeabody/alanpeabody.theme.zsh} (100%) rename themes/{arrow.zsh-theme => arrow/arrow.theme.zsh} (100%) rename themes/{aussiegeek.zsh-theme => aussiegeek/aussiegeek.theme.zsh} (100%) rename themes/{awesomepanda.zsh-theme => awesomepanda/awesomepanda.theme.zsh} (100%) rename themes/{bira.zsh-theme => bira/bira.theme.zsh} (100%) rename themes/{candy.zsh-theme => candy/candy.theme.zsh} (100%) rename themes/{clean.zsh-theme => clean/clean.theme.zsh} (100%) rename themes/{cloud.zsh-theme => cloud/cloud.theme.zsh} (100%) rename themes/{cypher.zsh-theme => cypher/cypher.theme.zsh} (100%) rename themes/{dallas.zsh-theme => dallas/dallas.theme.zsh} (100%) rename themes/{darkblood.zsh-theme => darkblood/darkblood.theme.zsh} (100%) rename themes/{daveverwer.zsh-theme => daveverwer/daveverwer.theme.zsh} (100%) rename themes/{dieter.zsh-theme => dieter/dieter.theme.zsh} (100%) rename themes/{dogenpunk.zsh-theme => dogenpunk/dogenpunk.theme.zsh} (100%) rename themes/{dst.zsh-theme => dst/dst.theme.zsh} (100%) rename themes/{dstufft.zsh-theme => dstufft/dstufft.theme.zsh} (100%) rename themes/{duellj.zsh-theme => duellj/duellj.theme.zsh} (100%) rename themes/{eastwood.zsh-theme => eastwood/eastwood.theme.zsh} (100%) rename themes/{edvardm.zsh-theme => edvardm/edvardm.theme.zsh} (100%) rename themes/{evan.zsh-theme => evan/evan.theme.zsh} (100%) rename themes/{example.zsh-theme => example/example.theme.zsh} (100%) rename themes/{fishy.zsh-theme => fishy/fishy.theme.zsh} (100%) rename themes/{flazz.zsh-theme => flazz/flazz.theme.zsh} (100%) rename themes/{fletcherm.zsh-theme => fletcherm/fletcherm.theme.zsh} (100%) rename themes/{frisk.zsh-theme => frisk/frisk.theme.zsh} (100%) rename themes/{funky.zsh-theme => funky/funky.theme.zsh} (100%) rename themes/{fwalch.zsh-theme => fwalch/fwalch.theme.zsh} (100%) rename themes/{gallifrey.zsh-theme => gallifrey/gallifrey.theme.zsh} (100%) rename themes/{gallois.zsh-theme => gallois/gallois.theme.zsh} (100%) rename themes/{garyblessington.zsh-theme => garyblessington/garyblessington.theme.zsh} (100%) rename themes/{gentoo.zsh-theme => gentoo/gentoo.theme.zsh} (100%) rename themes/{geoffgarside.zsh-theme => geoffgarside/geoffgarside.theme.zsh} (100%) rename themes/{gozilla.zsh-theme => gozilla/gozilla.theme.zsh} (100%) rename themes/{humza.zsh-theme => humza/humza.theme.zsh} (100%) rename themes/{imajes.zsh-theme => imajes/imajes.theme.zsh} (100%) rename themes/{jbergantine.zsh-theme => jbergantine/jbergantine.theme.zsh} (100%) rename themes/{jispwoso.zsh-theme => jispwoso/jispwoso.theme.zsh} (100%) rename themes/{jnrowe.zsh-theme => jnrowe/jnrowe.theme.zsh} (100%) rename themes/{jonathan.zsh-theme => jonathan/jonathan.theme.zsh} (100%) rename themes/{josh.zsh-theme => josh/josh.theme.zsh} (100%) rename themes/{jreese.zsh-theme => jreese/jreese.theme.zsh} (100%) rename themes/{jtriley.zsh-theme => jtriley/jtriley.theme.zsh} (100%) rename themes/{juanghurtado.zsh-theme => juanghurtado/juanghurtado.theme.zsh} (100%) rename themes/{kardan.zsh-theme => kardan/kardan.theme.zsh} (100%) rename themes/{kennethreitz.zsh-theme => kennethreitz/kennethreitz.theme.zsh} (100%) rename themes/{kolo.zsh-theme => kolo/kolo.theme.zsh} (100%) rename themes/{kphoen.zsh-theme => kphoen/kphoen.theme.zsh} (100%) rename themes/{lambda.zsh-theme => lambda/lambda.theme.zsh} (100%) rename themes/{ => linuxonly}/linuxonly (100%) rename themes/{lukerandall.zsh-theme => lukerandall/lukerandall.theme.zsh} (100%) rename themes/{macovsky-ruby.zsh-theme => macovsky-ruby/macovsky-ruby.theme.zsh} (100%) rename themes/{macovsky.zsh-theme => macovsky/macovsky.theme.zsh} (100%) rename themes/{maran.zsh-theme => maran/maran.theme.zsh} (100%) rename themes/{mgutz.zsh-theme => mgutz/mgutz.theme.zsh} (100%) rename themes/{mikeh.zsh-theme => mikeh/mikeh.theme.zsh} (100%) rename themes/{miloshadzic.zsh-theme => miloshadzic/miloshadzic.theme.zsh} (100%) rename themes/{minimal.zsh-theme => minimal/minimal.theme.zsh} (100%) rename themes/{mrtazz.zsh-theme => mrtazz/mrtazz.theme.zsh} (100%) rename themes/{murilasso.zsh-theme => murilasso/murilasso.theme.zsh} (100%) rename themes/{muse.zsh-theme => muse/muse.theme.zsh} (100%) rename themes/{nanotech.zsh-theme => nanotech/nanotech.theme.zsh} (100%) rename themes/{nebirhos.zsh-theme => nebirhos/nebirhos.theme.zsh} (100%) rename themes/{nicoulaj.zsh-theme => nicoulaj/nicoulaj.theme.zsh} (100%) rename themes/{obraun.zsh-theme => obraun/obraun.theme.zsh} (100%) rename themes/{philips.zsh-theme => philips/philips.theme.zsh} (100%) rename themes/{pmcgee.zsh-theme => pmcgee/pmcgee.theme.zsh} (100%) rename themes/{re5et.zsh-theme => re5et/re5et.theme.zsh} (100%) rename themes/{rgm.zsh-theme => rgm/rgm.theme.zsh} (100%) rename themes/{risto.zsh-theme => risto/risto.theme.zsh} (100%) rename themes/{rixius.zsh-theme => rixius/rixius.theme.zsh} (100%) rename themes/{robbyrussell.zsh-theme => robbyrussell/robbyrussell.theme.zsh} (100%) rename themes/{simple.zsh-theme => simple/simple.theme.zsh} (100%) rename themes/{skaro.zsh-theme => skaro/skaro.theme.zsh} (100%) rename themes/{smt.zsh-theme => smt/smt.theme.zsh} (100%) rename themes/{sorin.zsh-theme => sorin/sorin.theme.zsh} (100%) rename themes/{sporty_256.zsh-theme => sporty_256/sporty_256.theme.zsh} (100%) rename themes/{steeef.zsh-theme => steeef/steeef.theme.zsh} (100%) rename themes/{sunaku.zsh-theme => sunaku/sunaku.theme.zsh} (100%) rename themes/{takashiyoshida.zsh-theme => takashiyoshida/takashiyoshida.theme.zsh} (100%) rename themes/{theunraveler.zsh-theme => theunraveler/theunraveler.theme.zsh} (100%) rename themes/{tjkirch.zsh-theme => tjkirch/tjkirch.theme.zsh} (100%) rename themes/{tonotdo.zsh-theme => tonotdo/tonotdo.theme.zsh} (100%) rename themes/{trapd00r.zsh-theme => trapd00r/trapd00r.theme.zsh} (100%) rename themes/{wezm+.zsh-theme => wezm+/wezm+.theme.zsh} (100%) rename themes/{wezm.zsh-theme => wezm/wezm.theme.zsh} (100%) rename themes/{xiong-chiamiov-plus.zsh-theme => xiong-chiamiov-plus/xiong-chiamiov-plus.theme.zsh} (100%) rename themes/{xiong-chiamiov.zsh-theme => xiong-chiamiov/xiong-chiamiov.theme.zsh} (100%) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 4dc081405..7961e8c06 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -29,15 +29,14 @@ done # Load the theme. if [[ "$ZSH_THEME" == "random" ]]; then - themes=($ZSH/themes/*.zsh-theme) + themes=($ZSH/themes/**/*.theme.zsh) theme_index=${#themes[@]} (( theme_index=((RANDOM % theme_index) + 1) )) random_theme="${themes[$theme_index]}" source "$random_theme" else - if [ ! "$ZSH_THEME" = "" ] - then - source "$ZSH/themes/$ZSH_THEME.zsh-theme" + if [[ -f "$ZSH/themes/$ZSH_THEME/$ZSH_THEME.theme.zsh" ]]; then + source "$ZSH/themes/$ZSH_THEME/$ZSH_THEME.theme.zsh" fi fi diff --git a/themes/Soliah.zsh-theme b/themes/Soliah/Soliah.theme.zsh similarity index 100% rename from themes/Soliah.zsh-theme rename to themes/Soliah/Soliah.theme.zsh diff --git a/themes/afowler.zsh-theme b/themes/afowler/afowler.theme.zsh similarity index 100% rename from themes/afowler.zsh-theme rename to themes/afowler/afowler.theme.zsh diff --git a/themes/alanpeabody.zsh-theme b/themes/alanpeabody/alanpeabody.theme.zsh similarity index 100% rename from themes/alanpeabody.zsh-theme rename to themes/alanpeabody/alanpeabody.theme.zsh diff --git a/themes/arrow.zsh-theme b/themes/arrow/arrow.theme.zsh similarity index 100% rename from themes/arrow.zsh-theme rename to themes/arrow/arrow.theme.zsh diff --git a/themes/aussiegeek.zsh-theme b/themes/aussiegeek/aussiegeek.theme.zsh similarity index 100% rename from themes/aussiegeek.zsh-theme rename to themes/aussiegeek/aussiegeek.theme.zsh diff --git a/themes/awesomepanda.zsh-theme b/themes/awesomepanda/awesomepanda.theme.zsh similarity index 100% rename from themes/awesomepanda.zsh-theme rename to themes/awesomepanda/awesomepanda.theme.zsh diff --git a/themes/bira.zsh-theme b/themes/bira/bira.theme.zsh similarity index 100% rename from themes/bira.zsh-theme rename to themes/bira/bira.theme.zsh diff --git a/themes/candy.zsh-theme b/themes/candy/candy.theme.zsh similarity index 100% rename from themes/candy.zsh-theme rename to themes/candy/candy.theme.zsh diff --git a/themes/clean.zsh-theme b/themes/clean/clean.theme.zsh similarity index 100% rename from themes/clean.zsh-theme rename to themes/clean/clean.theme.zsh diff --git a/themes/cloud.zsh-theme b/themes/cloud/cloud.theme.zsh similarity index 100% rename from themes/cloud.zsh-theme rename to themes/cloud/cloud.theme.zsh diff --git a/themes/cypher.zsh-theme b/themes/cypher/cypher.theme.zsh similarity index 100% rename from themes/cypher.zsh-theme rename to themes/cypher/cypher.theme.zsh diff --git a/themes/dallas.zsh-theme b/themes/dallas/dallas.theme.zsh similarity index 100% rename from themes/dallas.zsh-theme rename to themes/dallas/dallas.theme.zsh diff --git a/themes/darkblood.zsh-theme b/themes/darkblood/darkblood.theme.zsh similarity index 100% rename from themes/darkblood.zsh-theme rename to themes/darkblood/darkblood.theme.zsh diff --git a/themes/daveverwer.zsh-theme b/themes/daveverwer/daveverwer.theme.zsh similarity index 100% rename from themes/daveverwer.zsh-theme rename to themes/daveverwer/daveverwer.theme.zsh diff --git a/themes/dieter.zsh-theme b/themes/dieter/dieter.theme.zsh similarity index 100% rename from themes/dieter.zsh-theme rename to themes/dieter/dieter.theme.zsh diff --git a/themes/dogenpunk.zsh-theme b/themes/dogenpunk/dogenpunk.theme.zsh similarity index 100% rename from themes/dogenpunk.zsh-theme rename to themes/dogenpunk/dogenpunk.theme.zsh diff --git a/themes/dst.zsh-theme b/themes/dst/dst.theme.zsh similarity index 100% rename from themes/dst.zsh-theme rename to themes/dst/dst.theme.zsh diff --git a/themes/dstufft.zsh-theme b/themes/dstufft/dstufft.theme.zsh similarity index 100% rename from themes/dstufft.zsh-theme rename to themes/dstufft/dstufft.theme.zsh diff --git a/themes/duellj.zsh-theme b/themes/duellj/duellj.theme.zsh similarity index 100% rename from themes/duellj.zsh-theme rename to themes/duellj/duellj.theme.zsh diff --git a/themes/eastwood.zsh-theme b/themes/eastwood/eastwood.theme.zsh similarity index 100% rename from themes/eastwood.zsh-theme rename to themes/eastwood/eastwood.theme.zsh diff --git a/themes/edvardm.zsh-theme b/themes/edvardm/edvardm.theme.zsh similarity index 100% rename from themes/edvardm.zsh-theme rename to themes/edvardm/edvardm.theme.zsh diff --git a/themes/evan.zsh-theme b/themes/evan/evan.theme.zsh similarity index 100% rename from themes/evan.zsh-theme rename to themes/evan/evan.theme.zsh diff --git a/themes/example.zsh-theme b/themes/example/example.theme.zsh similarity index 100% rename from themes/example.zsh-theme rename to themes/example/example.theme.zsh diff --git a/themes/fishy.zsh-theme b/themes/fishy/fishy.theme.zsh similarity index 100% rename from themes/fishy.zsh-theme rename to themes/fishy/fishy.theme.zsh diff --git a/themes/flazz.zsh-theme b/themes/flazz/flazz.theme.zsh similarity index 100% rename from themes/flazz.zsh-theme rename to themes/flazz/flazz.theme.zsh diff --git a/themes/fletcherm.zsh-theme b/themes/fletcherm/fletcherm.theme.zsh similarity index 100% rename from themes/fletcherm.zsh-theme rename to themes/fletcherm/fletcherm.theme.zsh diff --git a/themes/frisk.zsh-theme b/themes/frisk/frisk.theme.zsh similarity index 100% rename from themes/frisk.zsh-theme rename to themes/frisk/frisk.theme.zsh diff --git a/themes/funky.zsh-theme b/themes/funky/funky.theme.zsh similarity index 100% rename from themes/funky.zsh-theme rename to themes/funky/funky.theme.zsh diff --git a/themes/fwalch.zsh-theme b/themes/fwalch/fwalch.theme.zsh similarity index 100% rename from themes/fwalch.zsh-theme rename to themes/fwalch/fwalch.theme.zsh diff --git a/themes/gallifrey.zsh-theme b/themes/gallifrey/gallifrey.theme.zsh similarity index 100% rename from themes/gallifrey.zsh-theme rename to themes/gallifrey/gallifrey.theme.zsh diff --git a/themes/gallois.zsh-theme b/themes/gallois/gallois.theme.zsh similarity index 100% rename from themes/gallois.zsh-theme rename to themes/gallois/gallois.theme.zsh diff --git a/themes/garyblessington.zsh-theme b/themes/garyblessington/garyblessington.theme.zsh similarity index 100% rename from themes/garyblessington.zsh-theme rename to themes/garyblessington/garyblessington.theme.zsh diff --git a/themes/gentoo.zsh-theme b/themes/gentoo/gentoo.theme.zsh similarity index 100% rename from themes/gentoo.zsh-theme rename to themes/gentoo/gentoo.theme.zsh diff --git a/themes/geoffgarside.zsh-theme b/themes/geoffgarside/geoffgarside.theme.zsh similarity index 100% rename from themes/geoffgarside.zsh-theme rename to themes/geoffgarside/geoffgarside.theme.zsh diff --git a/themes/gozilla.zsh-theme b/themes/gozilla/gozilla.theme.zsh similarity index 100% rename from themes/gozilla.zsh-theme rename to themes/gozilla/gozilla.theme.zsh diff --git a/themes/humza.zsh-theme b/themes/humza/humza.theme.zsh similarity index 100% rename from themes/humza.zsh-theme rename to themes/humza/humza.theme.zsh diff --git a/themes/imajes.zsh-theme b/themes/imajes/imajes.theme.zsh similarity index 100% rename from themes/imajes.zsh-theme rename to themes/imajes/imajes.theme.zsh diff --git a/themes/jbergantine.zsh-theme b/themes/jbergantine/jbergantine.theme.zsh similarity index 100% rename from themes/jbergantine.zsh-theme rename to themes/jbergantine/jbergantine.theme.zsh diff --git a/themes/jispwoso.zsh-theme b/themes/jispwoso/jispwoso.theme.zsh similarity index 100% rename from themes/jispwoso.zsh-theme rename to themes/jispwoso/jispwoso.theme.zsh diff --git a/themes/jnrowe.zsh-theme b/themes/jnrowe/jnrowe.theme.zsh similarity index 100% rename from themes/jnrowe.zsh-theme rename to themes/jnrowe/jnrowe.theme.zsh diff --git a/themes/jonathan.zsh-theme b/themes/jonathan/jonathan.theme.zsh similarity index 100% rename from themes/jonathan.zsh-theme rename to themes/jonathan/jonathan.theme.zsh diff --git a/themes/josh.zsh-theme b/themes/josh/josh.theme.zsh similarity index 100% rename from themes/josh.zsh-theme rename to themes/josh/josh.theme.zsh diff --git a/themes/jreese.zsh-theme b/themes/jreese/jreese.theme.zsh similarity index 100% rename from themes/jreese.zsh-theme rename to themes/jreese/jreese.theme.zsh diff --git a/themes/jtriley.zsh-theme b/themes/jtriley/jtriley.theme.zsh similarity index 100% rename from themes/jtriley.zsh-theme rename to themes/jtriley/jtriley.theme.zsh diff --git a/themes/juanghurtado.zsh-theme b/themes/juanghurtado/juanghurtado.theme.zsh similarity index 100% rename from themes/juanghurtado.zsh-theme rename to themes/juanghurtado/juanghurtado.theme.zsh diff --git a/themes/kardan.zsh-theme b/themes/kardan/kardan.theme.zsh similarity index 100% rename from themes/kardan.zsh-theme rename to themes/kardan/kardan.theme.zsh diff --git a/themes/kennethreitz.zsh-theme b/themes/kennethreitz/kennethreitz.theme.zsh similarity index 100% rename from themes/kennethreitz.zsh-theme rename to themes/kennethreitz/kennethreitz.theme.zsh diff --git a/themes/kolo.zsh-theme b/themes/kolo/kolo.theme.zsh similarity index 100% rename from themes/kolo.zsh-theme rename to themes/kolo/kolo.theme.zsh diff --git a/themes/kphoen.zsh-theme b/themes/kphoen/kphoen.theme.zsh similarity index 100% rename from themes/kphoen.zsh-theme rename to themes/kphoen/kphoen.theme.zsh diff --git a/themes/lambda.zsh-theme b/themes/lambda/lambda.theme.zsh similarity index 100% rename from themes/lambda.zsh-theme rename to themes/lambda/lambda.theme.zsh diff --git a/themes/linuxonly b/themes/linuxonly/linuxonly similarity index 100% rename from themes/linuxonly rename to themes/linuxonly/linuxonly diff --git a/themes/lukerandall.zsh-theme b/themes/lukerandall/lukerandall.theme.zsh similarity index 100% rename from themes/lukerandall.zsh-theme rename to themes/lukerandall/lukerandall.theme.zsh diff --git a/themes/macovsky-ruby.zsh-theme b/themes/macovsky-ruby/macovsky-ruby.theme.zsh similarity index 100% rename from themes/macovsky-ruby.zsh-theme rename to themes/macovsky-ruby/macovsky-ruby.theme.zsh diff --git a/themes/macovsky.zsh-theme b/themes/macovsky/macovsky.theme.zsh similarity index 100% rename from themes/macovsky.zsh-theme rename to themes/macovsky/macovsky.theme.zsh diff --git a/themes/maran.zsh-theme b/themes/maran/maran.theme.zsh similarity index 100% rename from themes/maran.zsh-theme rename to themes/maran/maran.theme.zsh diff --git a/themes/mgutz.zsh-theme b/themes/mgutz/mgutz.theme.zsh similarity index 100% rename from themes/mgutz.zsh-theme rename to themes/mgutz/mgutz.theme.zsh diff --git a/themes/mikeh.zsh-theme b/themes/mikeh/mikeh.theme.zsh similarity index 100% rename from themes/mikeh.zsh-theme rename to themes/mikeh/mikeh.theme.zsh diff --git a/themes/miloshadzic.zsh-theme b/themes/miloshadzic/miloshadzic.theme.zsh similarity index 100% rename from themes/miloshadzic.zsh-theme rename to themes/miloshadzic/miloshadzic.theme.zsh diff --git a/themes/minimal.zsh-theme b/themes/minimal/minimal.theme.zsh similarity index 100% rename from themes/minimal.zsh-theme rename to themes/minimal/minimal.theme.zsh diff --git a/themes/mrtazz.zsh-theme b/themes/mrtazz/mrtazz.theme.zsh similarity index 100% rename from themes/mrtazz.zsh-theme rename to themes/mrtazz/mrtazz.theme.zsh diff --git a/themes/murilasso.zsh-theme b/themes/murilasso/murilasso.theme.zsh similarity index 100% rename from themes/murilasso.zsh-theme rename to themes/murilasso/murilasso.theme.zsh diff --git a/themes/muse.zsh-theme b/themes/muse/muse.theme.zsh similarity index 100% rename from themes/muse.zsh-theme rename to themes/muse/muse.theme.zsh diff --git a/themes/nanotech.zsh-theme b/themes/nanotech/nanotech.theme.zsh similarity index 100% rename from themes/nanotech.zsh-theme rename to themes/nanotech/nanotech.theme.zsh diff --git a/themes/nebirhos.zsh-theme b/themes/nebirhos/nebirhos.theme.zsh similarity index 100% rename from themes/nebirhos.zsh-theme rename to themes/nebirhos/nebirhos.theme.zsh diff --git a/themes/nicoulaj.zsh-theme b/themes/nicoulaj/nicoulaj.theme.zsh similarity index 100% rename from themes/nicoulaj.zsh-theme rename to themes/nicoulaj/nicoulaj.theme.zsh diff --git a/themes/obraun.zsh-theme b/themes/obraun/obraun.theme.zsh similarity index 100% rename from themes/obraun.zsh-theme rename to themes/obraun/obraun.theme.zsh diff --git a/themes/philips.zsh-theme b/themes/philips/philips.theme.zsh similarity index 100% rename from themes/philips.zsh-theme rename to themes/philips/philips.theme.zsh diff --git a/themes/pmcgee.zsh-theme b/themes/pmcgee/pmcgee.theme.zsh similarity index 100% rename from themes/pmcgee.zsh-theme rename to themes/pmcgee/pmcgee.theme.zsh diff --git a/themes/re5et.zsh-theme b/themes/re5et/re5et.theme.zsh similarity index 100% rename from themes/re5et.zsh-theme rename to themes/re5et/re5et.theme.zsh diff --git a/themes/rgm.zsh-theme b/themes/rgm/rgm.theme.zsh similarity index 100% rename from themes/rgm.zsh-theme rename to themes/rgm/rgm.theme.zsh diff --git a/themes/risto.zsh-theme b/themes/risto/risto.theme.zsh similarity index 100% rename from themes/risto.zsh-theme rename to themes/risto/risto.theme.zsh diff --git a/themes/rixius.zsh-theme b/themes/rixius/rixius.theme.zsh similarity index 100% rename from themes/rixius.zsh-theme rename to themes/rixius/rixius.theme.zsh diff --git a/themes/robbyrussell.zsh-theme b/themes/robbyrussell/robbyrussell.theme.zsh similarity index 100% rename from themes/robbyrussell.zsh-theme rename to themes/robbyrussell/robbyrussell.theme.zsh diff --git a/themes/simple.zsh-theme b/themes/simple/simple.theme.zsh similarity index 100% rename from themes/simple.zsh-theme rename to themes/simple/simple.theme.zsh diff --git a/themes/skaro.zsh-theme b/themes/skaro/skaro.theme.zsh similarity index 100% rename from themes/skaro.zsh-theme rename to themes/skaro/skaro.theme.zsh diff --git a/themes/smt.zsh-theme b/themes/smt/smt.theme.zsh similarity index 100% rename from themes/smt.zsh-theme rename to themes/smt/smt.theme.zsh diff --git a/themes/sorin.zsh-theme b/themes/sorin/sorin.theme.zsh similarity index 100% rename from themes/sorin.zsh-theme rename to themes/sorin/sorin.theme.zsh diff --git a/themes/sporty_256.zsh-theme b/themes/sporty_256/sporty_256.theme.zsh similarity index 100% rename from themes/sporty_256.zsh-theme rename to themes/sporty_256/sporty_256.theme.zsh diff --git a/themes/steeef.zsh-theme b/themes/steeef/steeef.theme.zsh similarity index 100% rename from themes/steeef.zsh-theme rename to themes/steeef/steeef.theme.zsh diff --git a/themes/sunaku.zsh-theme b/themes/sunaku/sunaku.theme.zsh similarity index 100% rename from themes/sunaku.zsh-theme rename to themes/sunaku/sunaku.theme.zsh diff --git a/themes/takashiyoshida.zsh-theme b/themes/takashiyoshida/takashiyoshida.theme.zsh similarity index 100% rename from themes/takashiyoshida.zsh-theme rename to themes/takashiyoshida/takashiyoshida.theme.zsh diff --git a/themes/theunraveler.zsh-theme b/themes/theunraveler/theunraveler.theme.zsh similarity index 100% rename from themes/theunraveler.zsh-theme rename to themes/theunraveler/theunraveler.theme.zsh diff --git a/themes/tjkirch.zsh-theme b/themes/tjkirch/tjkirch.theme.zsh similarity index 100% rename from themes/tjkirch.zsh-theme rename to themes/tjkirch/tjkirch.theme.zsh diff --git a/themes/tonotdo.zsh-theme b/themes/tonotdo/tonotdo.theme.zsh similarity index 100% rename from themes/tonotdo.zsh-theme rename to themes/tonotdo/tonotdo.theme.zsh diff --git a/themes/trapd00r.zsh-theme b/themes/trapd00r/trapd00r.theme.zsh similarity index 100% rename from themes/trapd00r.zsh-theme rename to themes/trapd00r/trapd00r.theme.zsh diff --git a/themes/wezm+.zsh-theme b/themes/wezm+/wezm+.theme.zsh similarity index 100% rename from themes/wezm+.zsh-theme rename to themes/wezm+/wezm+.theme.zsh diff --git a/themes/wezm.zsh-theme b/themes/wezm/wezm.theme.zsh similarity index 100% rename from themes/wezm.zsh-theme rename to themes/wezm/wezm.theme.zsh diff --git a/themes/xiong-chiamiov-plus.zsh-theme b/themes/xiong-chiamiov-plus/xiong-chiamiov-plus.theme.zsh similarity index 100% rename from themes/xiong-chiamiov-plus.zsh-theme rename to themes/xiong-chiamiov-plus/xiong-chiamiov-plus.theme.zsh diff --git a/themes/xiong-chiamiov.zsh-theme b/themes/xiong-chiamiov/xiong-chiamiov.theme.zsh similarity index 100% rename from themes/xiong-chiamiov.zsh-theme rename to themes/xiong-chiamiov/xiong-chiamiov.theme.zsh From 00d4f280ae42e4aad0b728916ba6a52ef1531b67 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Wed, 13 Jul 2011 13:13:35 -0400 Subject: [PATCH 456/614] Changed the main file extension from sh to zsh. --- oh-my-zsh.sh => oh-my-zsh.zsh | 0 templates/{zshrc.zsh-template => zshrc.template.zsh} | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename oh-my-zsh.sh => oh-my-zsh.zsh (100%) rename templates/{zshrc.zsh-template => zshrc.template.zsh} (95%) diff --git a/oh-my-zsh.sh b/oh-my-zsh.zsh similarity index 100% rename from oh-my-zsh.sh rename to oh-my-zsh.zsh diff --git a/templates/zshrc.zsh-template b/templates/zshrc.template.zsh similarity index 95% rename from templates/zshrc.zsh-template rename to templates/zshrc.template.zsh index 6746feb28..6dfc2ee3e 100644 --- a/templates/zshrc.zsh-template +++ b/templates/zshrc.template.zsh @@ -18,7 +18,7 @@ export DISABLE_AUTO_TITLE='false' # Example: plugins=(rails git textmate ruby lighthouse) plugins=(git) -source "$ZSH/oh-my-zsh.sh" +source "$ZSH/oh-my-zsh.zsh" # Customize to your needs... From 3fd9cf9f86a163d2ae528ab677a6d37878b63628 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 14 Jul 2011 16:12:15 -0400 Subject: [PATCH 457/614] Renamed lib/ to functions/ and renamed files inside of it. --- lib/aliases.zsh => functions/alias.zsh | 0 lib/theme-and-appearance.zsh => functions/appearance.zsh | 0 {lib => functions}/completion.zsh | 0 {lib => functions}/correction.zsh | 0 lib/directories.zsh => functions/directory.zsh | 0 {lib => functions}/grep.zsh | 0 {lib => functions}/history.zsh | 0 lib/key-bindings.zsh => functions/keyboard.zsh | 0 lib/misc.zsh => functions/mixed.zsh | 0 {lib => functions}/spectrum.zsh | 0 lib/termsupport.zsh => functions/terminal.zsh | 0 lib/functions.zsh => functions/utility.zsh | 0 oh-my-zsh.zsh | 4 ++-- 13 files changed, 2 insertions(+), 2 deletions(-) rename lib/aliases.zsh => functions/alias.zsh (100%) rename lib/theme-and-appearance.zsh => functions/appearance.zsh (100%) rename {lib => functions}/completion.zsh (100%) rename {lib => functions}/correction.zsh (100%) rename lib/directories.zsh => functions/directory.zsh (100%) rename {lib => functions}/grep.zsh (100%) rename {lib => functions}/history.zsh (100%) rename lib/key-bindings.zsh => functions/keyboard.zsh (100%) rename lib/misc.zsh => functions/mixed.zsh (100%) rename {lib => functions}/spectrum.zsh (100%) rename lib/termsupport.zsh => functions/terminal.zsh (100%) rename lib/functions.zsh => functions/utility.zsh (100%) diff --git a/lib/aliases.zsh b/functions/alias.zsh similarity index 100% rename from lib/aliases.zsh rename to functions/alias.zsh diff --git a/lib/theme-and-appearance.zsh b/functions/appearance.zsh similarity index 100% rename from lib/theme-and-appearance.zsh rename to functions/appearance.zsh diff --git a/lib/completion.zsh b/functions/completion.zsh similarity index 100% rename from lib/completion.zsh rename to functions/completion.zsh diff --git a/lib/correction.zsh b/functions/correction.zsh similarity index 100% rename from lib/correction.zsh rename to functions/correction.zsh diff --git a/lib/directories.zsh b/functions/directory.zsh similarity index 100% rename from lib/directories.zsh rename to functions/directory.zsh diff --git a/lib/grep.zsh b/functions/grep.zsh similarity index 100% rename from lib/grep.zsh rename to functions/grep.zsh diff --git a/lib/history.zsh b/functions/history.zsh similarity index 100% rename from lib/history.zsh rename to functions/history.zsh diff --git a/lib/key-bindings.zsh b/functions/keyboard.zsh similarity index 100% rename from lib/key-bindings.zsh rename to functions/keyboard.zsh diff --git a/lib/misc.zsh b/functions/mixed.zsh similarity index 100% rename from lib/misc.zsh rename to functions/mixed.zsh diff --git a/lib/spectrum.zsh b/functions/spectrum.zsh similarity index 100% rename from lib/spectrum.zsh rename to functions/spectrum.zsh diff --git a/lib/termsupport.zsh b/functions/terminal.zsh similarity index 100% rename from lib/termsupport.zsh rename to functions/terminal.zsh diff --git a/lib/functions.zsh b/functions/utility.zsh similarity index 100% rename from lib/functions.zsh rename to functions/utility.zsh diff --git a/oh-my-zsh.zsh b/oh-my-zsh.zsh index 7961e8c06..2cd105b1e 100644 --- a/oh-my-zsh.zsh +++ b/oh-my-zsh.zsh @@ -6,8 +6,8 @@ if [[ "$TERM" == 'dumb' ]]; then fi # Load all files in $ZSH/oh-my-zsh/lib/ that end in .zsh. -for config_file in $ZSH/lib/*.zsh; do - source "$config_file" +for function_file in $ZSH/functions/*.zsh; do + source "$function_file" done # Add all defined plugins to fpath. From 7bf23fd6d2c0936464f0c74147dd1b9f443c8828 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 14 Jul 2011 16:16:22 -0400 Subject: [PATCH 458/614] Added a few aliases and fixed typos. --- functions/alias.zsh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/functions/alias.zsh b/functions/alias.zsh index 0cfafc6e0..8dff7aba3 100644 --- a/functions/alias.zsh +++ b/functions/alias.zsh @@ -1,4 +1,4 @@ -# The 'ls' family +# The 'ls' Family # ------------------------------------------------------------------------------ if [[ "$DISABLE_COLOR" != 'true' ]]; then if (( ${+commands[dircolors]} )); then @@ -21,7 +21,7 @@ alias ll='ls -lh' # Show human readable. alias la='ls -lhA' # Show hidden files. alias lx='ls -lhXB' # Sort by extension. alias lk='ls -lhSr' # Sort by size, biggest last. -alias lc='ls -lhtcr' # Sort by and show change time, most recent lasa. +alias lc='ls -lhtcr' # Sort by and show change time, most recent last. alias lu='ls -lhtur' # Sort by and show access time, most recent last. alias lt='ls -lhtr' # Sort by date, most recent last. alias lm='ls -lha | more' # Pipe through 'more'. @@ -40,12 +40,17 @@ alias df='df -kh' alias pu='pushd' alias po='popd' alias _='sudo' +alias o='open' alias e="$EDITOR" +alias v="$PAGER" +alias b="$BROWSER" alias history='fc -l 1' alias get='curl -C - -O' alias afind='ack -il' alias type='type -a' alias ssh='ssh -X' +alias pbc='pbcopy' +alias pbp='pbpaste' alias print-path='echo -e ${PATH//:/\\n}' alias t="t --task-dir ~/.tasks --list todo.txt --delete-if-empty" From 0ccc0c3fe6b007d3f3ce4854d35e7c800b48ce6c Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 14 Jul 2011 16:19:00 -0400 Subject: [PATCH 459/614] Use Git for coloured diff if colordiff is not installed. --- functions/alias.zsh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/functions/alias.zsh b/functions/alias.zsh index 8dff7aba3..03850ead0 100644 --- a/functions/alias.zsh +++ b/functions/alias.zsh @@ -63,11 +63,20 @@ fi if [[ "$DISABLE_COLOR" != 'true' ]]; then if [[ -x "${commands[colordiff]}" ]]; then - alias diff='colordiff' + alias diff='colordiff -u' + compdef colordiff=diff + elif [[ -x "${commands[git]}" ]]; then + function diff() { + git --no-pager diff --color=always --no-ext-diff --no-index "$@"; + } + compdef _git diff=git-diff + else + alias diff='diff -u' fi if [[ -x "${commands[colormake]}" ]]; then alias make='colormake' + compdef colormake=make fi fi From 571aa8c8e1b2e5c0e69b8d845d1b3197942f2c1f Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 14 Jul 2011 17:17:34 -0400 Subject: [PATCH 460/614] Fixed GNU Screen and tmux configuration file detection. --- functions/alias.zsh | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/functions/alias.zsh b/functions/alias.zsh index 03850ead0..2cbe9ad9e 100644 --- a/functions/alias.zsh +++ b/functions/alias.zsh @@ -82,19 +82,16 @@ fi # Terminal Multiplexer # ------------------------------------------------------------------------------ -local screenrc tmuxconf -if [[ "$TERM" == 'xterm-color' ]]; then - if [[ -e "$HOME/.screenrc" ]]; then - screenrc="-c '$HOME/.screenrc'" - tmuxconf="-f '$HOME/.tmux.conf'" - fi -fi - -if [[ "$TERM" == 'xterm-256color' ]]; then +if [[ "$TERM" == *256color* ]]; then if [[ -e "$HOME/.screenrc256" ]]; then screenrc="-c '$HOME/.screenrc256'" tmuxconf="-f '$HOME/.tmux256.conf'" fi +else + if [[ -e "$HOME/.screenrc" ]]; then + screenrc="-c '$HOME/.screenrc'" + tmuxconf="-f '$HOME/.tmux.conf'" + fi fi alias screen="screen $screenrc" @@ -102,6 +99,8 @@ alias sl="screen $screenrc -list" alias sr="screen $screenrc -a -A -U -D -R" alias S="screen $screenrc -U -S" -alias tmux="tmux $tmuxconf" -alias tls="tmux list-sessions" +if (( ${+commands[tmux]} )); then + alias tmux="tmux $tmuxconf" + alias tls="tmux list-sessions" +fi From 3c273c4ce7182ede32ca579a565339c45f4076b7 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 14 Jul 2011 17:19:05 -0400 Subject: [PATCH 461/614] Added slit, duh functions and comments. --- functions/utility.zsh | 60 ++++++++++++++++++++++++++++++------------- 1 file changed, 42 insertions(+), 18 deletions(-) diff --git a/functions/utility.zsh b/functions/utility.zsh index 1cfaf1aac..1af39029b 100644 --- a/functions/utility.zsh +++ b/functions/utility.zsh @@ -1,39 +1,42 @@ +# Lists the ten most used commands. function history-stat() { - history | awk '{print $2}' | sort | uniq -c | sort -rn | head + history | awk '{print $2}' | sort | uniq -c | sort -n -r | head } +# Makes a directory and changes to it. function mkdcd() { - mkdir -p "$1" - cd "$1" + mkdir -p "$@" + cd "$argv[-1]" } +compdef _mkdir mkdcd +# Changes to a directory and lists its contents. function cdll() { - if [[ -n "$1" ]]; then - builtin cd "$1" - ls -lFhA - else - ls -lFhA - fi + builtin cd "$@" + ll } +compdef _cd cdll +# Pushes an entry onto the directory stack and lists its contents. function pushdll() { - if [[ -n "$1" ]]; then - builtin pushd "$1" - ls -lFhA - else - ls -lFhA - fi + builtin pushd "$@" + ll } +compdef _cd pushdll +# Pops an entry off the directory stack and lists its contents. function popdll() { - builtin popd - ls -lFhA + builtin popd "$@" + ll } +compdef _cd popdll +# Gets ownership. function gown() { sudo chown -R "${USER}" "${1:-.}" } +# Reloads ~/.zshrc. function reload() { local zshrc="$HOME/.zshrc" if [[ -n "$1" ]]; then @@ -42,18 +45,39 @@ function reload() { source "$zshrc" } +# Provides a simple calculator. function calc() { echo "scale=4; $@" | bc -l } +# Displays human readable disk usage statistics. +function duh() { + (( $# == 0 )) && set -- * + if [[ "$OSTYPE" == linux* ]]; then + du -khsc "$@" | sort -h -r + else + du -kcs "$@" | awk '{ printf "%9.1fM %s\n", $1 / 1024, $2 } ' | sort -n -r + fi +} +compdef _du duh + +# Prints columns 1 2 3 ... n. +function slit() { + awk "{ print $(for n; do echo -n "\$$n,"; done | sed 's/,$//') }" +} + +# Displays user owned process status. function pmine() { ps "$@" -u "$USER" -o pid,%cpu,%mem,command } +compdef _ps pmine +# Finds files and executes a command on them. function findexec() { - find . -type f -iname "*${1:-}*" -exec "${2:-file}" {} \; + find . -type f -iname "*${1:-}*" -exec "${2:-file}" '{}' \; } +# Serves a directory via HTTP. function httpserve() { python -m SimpleHTTPServer "$@" } From c9e510696cef444e2446af01e1fcd9601fb9e65f Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 14 Jul 2011 17:23:17 -0400 Subject: [PATCH 462/614] Moved the setting of GNU Screen window number. --- functions/appearance.zsh | 7 ------- functions/terminal.zsh | 8 +++++++- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/functions/appearance.zsh b/functions/appearance.zsh index 2596013b6..277274d87 100644 --- a/functions/appearance.zsh +++ b/functions/appearance.zsh @@ -2,13 +2,6 @@ autoload -U colors colors -i -# Set the GNU Screen window number. -if [[ -n "$WINDOW" ]]; then - SCREEN_NO="%B$WINDOW%b " -else - SCREEN_NO="" -fi - # Set the default prompt theme. PS1="%n@%m:%~%# " diff --git a/functions/terminal.zsh b/functions/terminal.zsh index 5c1c812d1..e75137ab7 100644 --- a/functions/terminal.zsh +++ b/functions/terminal.zsh @@ -3,6 +3,13 @@ if [[ "$TERM" == 'dumb' ]]; then return fi +# Set the GNU Screen window number. +if [[ -n "$WINDOW" ]]; then + SCREEN_NO="%B$WINDOW%b " +else + SCREEN_NO="" +fi + # Fully supports GNU Screen, iTerm, and most modern xterm and rxvt terminals. # Partially supports Mac OS X Terminal since it can't set window and tab separately. # Usage: title "tab title" "window title" @@ -37,4 +44,3 @@ function preexec { local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]} title "$CMD" "%100>...>$2%<<" } - From 37dbcf7a20c394b2237cc3bf4f9a0a7813875e8f Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 14 Jul 2011 17:36:14 -0400 Subject: [PATCH 463/614] Cleaned up and documented history. --- functions/history.zsh | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/functions/history.zsh b/functions/history.zsh index 8a32e339a..314735e3d 100644 --- a/functions/history.zsh +++ b/functions/history.zsh @@ -1,14 +1,19 @@ -## Command history configuration -HISTFILE="$HOME/.zsh_history" +HISTFILE="$HOME/.zhistory" HISTSIZE=10000 SAVEHIST=10000 -setopt hist_verify -setopt hist_expire_dups_first -setopt hist_ignore_space -setopt hist_ignore_dups -setopt share_history -setopt append_history -setopt extended_history -setopt inc_append_history +setopt bang_hist # Treat the '!' character specially during expansion. +setopt extended_history # Write the history file in the ":start:elapsed;command" format. +setopt append_history # Append to the history file, don't replace it. +setopt inc_append_history # Write to the history file immediately, not when the shell exits. +setopt share_history # Share history between all sessions. +setopt hist_expire_dups_first # Expire duplicate entries first when trimming history. +setopt hist_ignore_dups # Don't record an entry that was just recorded again. +setopt hist_ignore_all_dups # Delete old recorded entry if new entry is a duplicate. +setopt hist_find_no_dups # Do not display a line previously found. +setopt hist_ignore_space # Don't record an entry starting with a space. +setopt hist_save_no_dups # Don't write duplicate entries in the history file. +setopt hist_reduce_blanks # Remove superfluous blanks before recording entry. +setopt hist_verify # Don't execute immediately upon history expansion. +setopt hist_beep # Beep when accessing nonexistent history. From 3d465712bc3e171f12c7b2cc847ad2e2e47d4dc3 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 14 Jul 2011 22:44:49 -0400 Subject: [PATCH 464/614] Refactored environment. --- functions/environment.zsh | 29 +++++++++++++++++++++++++++++ functions/grep.zsh | 12 ------------ functions/mixed.zsh | 17 ----------------- 3 files changed, 29 insertions(+), 29 deletions(-) create mode 100644 functions/environment.zsh delete mode 100644 functions/grep.zsh delete mode 100644 functions/mixed.zsh diff --git a/functions/environment.zsh b/functions/environment.zsh new file mode 100644 index 000000000..bb4ff8a9f --- /dev/null +++ b/functions/environment.zsh @@ -0,0 +1,29 @@ +# Smart URLs +autoload -Uz url-quote-magic +zle -N self-insert url-quote-magic + +# Jobs +setopt long_list_jobs + +# Locale +[[ -z "$LANG" ]] && export LANG="en_US.UTF-8" +[[ -z "$LC_ALL" ]] && export LC_ALL="en_US.UTF_8" +[[ -z "$LC_COLLATE" ]] && export LC_COLLATE="en_US.UTF-8" +[[ -z "$LC_CTYPE" ]] && export LC_CTYPE="en_US.UTF-8" +[[ -z "$LC_MESSAGES" ]] && export LC_MESSAGES="en_US.UTF-8" +[[ -z "$LC_MONETARY" ]] && export LC_MONETARY="en_US.UTF-8" +[[ -z "$LC_NUMERIC" ]] && export LC_NUMERIC="en_US.UTF-8" +[[ -z "$LC_TIME" ]] && export LC_TIME="en_US.UTF-8" + +# Pager +[[ -z "$PAGER" ]] && export PAGER=less + +# Grep +if [[ "$DISABLE_COLOR" != 'true' ]]; then + [[ -z "$GREP_OPTIONS" ]] && export GREP_OPTIONS='--color=auto' + [[ -z "$GREP_COLOR" ]] && export GREP_COLOR='37;45' +else + export GREP_OPTIONS='--color=none' + export GREP_COLOR='' +fi + diff --git a/functions/grep.zsh b/functions/grep.zsh deleted file mode 100644 index 75cfc2925..000000000 --- a/functions/grep.zsh +++ /dev/null @@ -1,12 +0,0 @@ -if [[ "$DISABLE_COLOR" != 'true' ]]; then - if [[ -z "$GREP_OPTIONS" ]]; then - export GREP_OPTIONS='--color=auto' - fi - if [[ -z "$GREP_COLOR" ]]; then - export GREP_COLOR='37;45' - fi -else - export GREP_OPTIONS='--color=none' - export GREP_COLOR='' -fi - diff --git a/functions/mixed.zsh b/functions/mixed.zsh deleted file mode 100644 index efc38400b..000000000 --- a/functions/mixed.zsh +++ /dev/null @@ -1,17 +0,0 @@ -# Smart URLs -autoload -U url-quote-magic -zle -N self-insert url-quote-magic - -# Jobs -setopt long_list_jobs - -# Pager -if [[ -z "$PAGER" ]]; then - export PAGER=less -fi - -# Localization -if [[ -z "$LC_CTYPE" ]]; then - export LC_CTYPE=en_US.UTF-8 -fi - From 771d06ffe79f04ef975dcb07c8d2b5bc546699f1 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 14 Jul 2011 22:50:40 -0400 Subject: [PATCH 465/614] Run compinit before sourcing functions. --- oh-my-zsh.zsh | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/oh-my-zsh.zsh b/oh-my-zsh.zsh index 2cd105b1e..48e5befab 100644 --- a/oh-my-zsh.zsh +++ b/oh-my-zsh.zsh @@ -5,11 +5,6 @@ if [[ "$TERM" == 'dumb' ]]; then DISABLE_COLOR='true' fi -# Load all files in $ZSH/oh-my-zsh/lib/ that end in .zsh. -for function_file in $ZSH/functions/*.zsh; do - source "$function_file" -done - # Add all defined plugins to fpath. plugin=${plugin:=()} for plugin in $plugins; do @@ -17,8 +12,12 @@ for plugin in $plugins; do done # Load and run compinit. -autoload -U compinit -compinit -i +autoload -Uz compinit && compinit -i + +# Load all files in $ZSH/oh-my-zsh/lib/ that end in .zsh. +for function_file in $ZSH/functions/*.zsh; do + source "$function_file" +done # Load all plugins defined in ~/.zshrc. for plugin in $plugins; do From 940bdae699fbb86f924a09e3a79423708c11fd76 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 14 Jul 2011 23:01:51 -0400 Subject: [PATCH 466/614] Quoted path to plugin. --- oh-my-zsh.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oh-my-zsh.zsh b/oh-my-zsh.zsh index 48e5befab..75a9c4535 100644 --- a/oh-my-zsh.zsh +++ b/oh-my-zsh.zsh @@ -8,7 +8,7 @@ fi # Add all defined plugins to fpath. plugin=${plugin:=()} for plugin in $plugins; do - fpath=($ZSH/plugins/$plugin $fpath) + fpath=("$ZSH/plugins/$plugin" $fpath) done # Load and run compinit. From 2815cc5691346fe892abfc6e86e7b4141f1ad3c3 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Fri, 15 Jul 2011 00:57:11 -0400 Subject: [PATCH 467/614] Renamed the ZSH environmental variable to OMZ. --- oh-my-zsh.zsh | 16 ++++++++-------- templates/zshrc.template.zsh | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/oh-my-zsh.zsh b/oh-my-zsh.zsh index 75a9c4535..67571dcbc 100644 --- a/oh-my-zsh.zsh +++ b/oh-my-zsh.zsh @@ -8,34 +8,34 @@ fi # Add all defined plugins to fpath. plugin=${plugin:=()} for plugin in $plugins; do - fpath=("$ZSH/plugins/$plugin" $fpath) + fpath=("$OMZ/plugins/$plugin" $fpath) done # Load and run compinit. autoload -Uz compinit && compinit -i -# Load all files in $ZSH/oh-my-zsh/lib/ that end in .zsh. -for function_file in $ZSH/functions/*.zsh; do +# Load all files in $OMZ/oh-my-zsh/lib/ that end in .zsh. +for function_file in $OMZ/functions/*.zsh; do source "$function_file" done # Load all plugins defined in ~/.zshrc. for plugin in $plugins; do - if [[ -f "$ZSH/plugins/$plugin/$plugin.plugin.zsh" ]]; then - source "$ZSH/plugins/$plugin/$plugin.plugin.zsh" + if [[ -f "$OMZ/plugins/$plugin/$plugin.plugin.zsh" ]]; then + source "$OMZ/plugins/$plugin/$plugin.plugin.zsh" fi done # Load the theme. if [[ "$ZSH_THEME" == "random" ]]; then - themes=($ZSH/themes/**/*.theme.zsh) + themes=($OMZ/themes/**/*.theme.zsh) theme_index=${#themes[@]} (( theme_index=((RANDOM % theme_index) + 1) )) random_theme="${themes[$theme_index]}" source "$random_theme" else - if [[ -f "$ZSH/themes/$ZSH_THEME/$ZSH_THEME.theme.zsh" ]]; then - source "$ZSH/themes/$ZSH_THEME/$ZSH_THEME.theme.zsh" + if [[ -f "$OMZ/themes/$ZSH_THEME/$ZSH_THEME.theme.zsh" ]]; then + source "$OMZ/themes/$ZSH_THEME/$ZSH_THEME.theme.zsh" fi fi diff --git a/templates/zshrc.template.zsh b/templates/zshrc.template.zsh index 6dfc2ee3e..99b9dafe3 100644 --- a/templates/zshrc.template.zsh +++ b/templates/zshrc.template.zsh @@ -1,7 +1,7 @@ # Path to oh-my-zsh. -export ZSH="$HOME/.oh-my-zsh" +export OMZ="$HOME/.oh-my-zsh" -# Set the name of the theme to load (see $ZSH/themes/). +# Set the name of the theme to load (see $OMZ/themes/). # Setting it to 'random' loads a random theme. export ZSH_THEME="robbyrussell" @@ -14,11 +14,11 @@ export DISABLE_COLOR='false' # Set to 'true' to disable auto setting the tab and window titles. export DISABLE_AUTO_TITLE='false' -# Set the plugins to load (see $ZSH/plugins/). +# Set the plugins to load (see $OMZ/plugins/). # Example: plugins=(rails git textmate ruby lighthouse) plugins=(git) -source "$ZSH/oh-my-zsh.zsh" +source "$OMZ/oh-my-zsh.zsh" # Customize to your needs... From aae3afbf3542266b0cbed37b658c0240dcc06c96 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Fri, 15 Jul 2011 13:32:56 -0400 Subject: [PATCH 468/614] Removed broken, ugly, and repetitive themes. --- themes/Soliah/Soliah.theme.zsh | 86 ----------- themes/afowler/afowler.theme.zsh | 10 -- themes/alanpeabody/alanpeabody.theme.zsh | 22 --- themes/arrow/arrow.theme.zsh | 14 -- themes/aussiegeek/aussiegeek.theme.zsh | 8 - themes/awesomepanda/awesomepanda.theme.zsh | 18 --- themes/bira/bira.theme.zsh | 14 -- themes/candy/candy.theme.zsh | 7 - themes/clean/clean.theme.zsh | 14 -- themes/cloud/cloud.theme.zsh | 6 - themes/cypher/cypher.theme.zsh | 4 - themes/dallas/dallas.theme.zsh | 26 ---- themes/darkblood/darkblood.theme.zsh | 9 -- themes/daveverwer/daveverwer.theme.zsh | 7 - themes/dieter/dieter.theme.zsh | 56 ------- themes/dogenpunk/dogenpunk.theme.zsh | 85 ----------- themes/dst/dst.theme.zsh | 16 -- themes/dstufft/dstufft.theme.zsh | 19 --- themes/duellj/duellj.theme.zsh | 8 - themes/eastwood/eastwood.theme.zsh | 19 --- themes/edvardm/edvardm.theme.zsh | 6 - themes/evan/evan.theme.zsh | 2 - themes/example/example.theme.zsh | 5 - themes/fishy/fishy.theme.zsh | 20 --- themes/flazz/flazz.theme.zsh | 19 --- themes/fletcherm/fletcherm.theme.zsh | 12 -- themes/frisk/frisk.theme.zsh | 10 -- themes/funky/funky.theme.zsh | 14 -- themes/fwalch/fwalch.theme.zsh | 6 - themes/gallifrey/gallifrey.theme.zsh | 8 - themes/gallois/gallois.theme.zsh | 19 --- .../garyblessington/garyblessington.theme.zsh | 6 - themes/gentoo/gentoo.theme.zsh | 4 - themes/geoffgarside/geoffgarside.theme.zsh | 5 - themes/gozilla/gozilla.theme.zsh | 15 -- themes/humza/humza.theme.zsh | 26 ---- themes/imajes/imajes.theme.zsh | 5 - themes/jbergantine/jbergantine.theme.zsh | 6 - themes/jispwoso/jispwoso.theme.zsh | 4 - themes/jnrowe/jnrowe.theme.zsh | 31 ---- themes/jonathan/jonathan.theme.zsh | 137 ------------------ themes/josh/josh.theme.zsh | 43 ------ themes/jreese/jreese.theme.zsh | 16 -- themes/jtriley/jtriley.theme.zsh | 8 - themes/juanghurtado/juanghurtado.theme.zsh | 46 ------ themes/kardan/kardan.theme.zsh | 12 -- themes/kennethreitz/kennethreitz.theme.zsh | 13 -- themes/kolo/kolo.theme.zsh | 21 --- themes/kphoen/kphoen.theme.zsh | 50 ------- themes/lambda/lambda.theme.zsh | 6 - themes/linuxonly/linuxonly | 80 ---------- themes/lukerandall/lukerandall.theme.zsh | 10 -- themes/macovsky-ruby/macovsky-ruby.theme.zsh | 8 - themes/macovsky/macovsky.theme.zsh | 8 - themes/maran/maran.theme.zsh | 6 - themes/mgutz/mgutz.theme.zsh | 6 - themes/mikeh/mikeh.theme.zsh | 23 --- themes/miloshadzic/miloshadzic.theme.zsh | 8 - themes/mrtazz/mrtazz.theme.zsh | 7 - themes/murilasso/murilasso.theme.zsh | 14 -- themes/muse/muse.theme.zsh | 30 ---- themes/nanotech/nanotech.theme.zsh | 7 - themes/nebirhos/nebirhos.theme.zsh | 17 --- themes/obraun/obraun.theme.zsh | 11 -- themes/philips/philips.theme.zsh | 14 -- themes/pmcgee/pmcgee.theme.zsh | 16 -- themes/re5et/re5et.theme.zsh | 15 -- themes/rgm/rgm.theme.zsh | 8 - themes/risto/risto.theme.zsh | 6 - themes/rixius/rixius.theme.zsh | 24 --- themes/robbyrussell/robbyrussell.theme.zsh | 6 - themes/simple/simple.theme.zsh | 6 - themes/skaro/skaro.theme.zsh | 7 - themes/smt/smt.theme.zsh | 91 ------------ themes/sporty_256/sporty_256.theme.zsh | 13 -- themes/sunaku/sunaku.theme.zsh | 26 ---- .../takashiyoshida/takashiyoshida.theme.zsh | 27 ---- themes/theunraveler/theunraveler.theme.zsh | 16 -- themes/tjkirch/tjkirch.theme.zsh | 15 -- themes/tonotdo/tonotdo.theme.zsh | 12 -- themes/trapd00r/trapd00r.theme.zsh | 95 ------------ themes/wezm+/wezm+.theme.zsh | 7 - themes/wezm/wezm.theme.zsh | 7 - .../xiong-chiamiov-plus.theme.zsh | 6 - .../xiong-chiamiov/xiong-chiamiov.theme.zsh | 6 - 85 files changed, 1681 deletions(-) delete mode 100644 themes/Soliah/Soliah.theme.zsh delete mode 100644 themes/afowler/afowler.theme.zsh delete mode 100644 themes/alanpeabody/alanpeabody.theme.zsh delete mode 100644 themes/arrow/arrow.theme.zsh delete mode 100644 themes/aussiegeek/aussiegeek.theme.zsh delete mode 100644 themes/awesomepanda/awesomepanda.theme.zsh delete mode 100644 themes/bira/bira.theme.zsh delete mode 100644 themes/candy/candy.theme.zsh delete mode 100644 themes/clean/clean.theme.zsh delete mode 100644 themes/cloud/cloud.theme.zsh delete mode 100644 themes/cypher/cypher.theme.zsh delete mode 100644 themes/dallas/dallas.theme.zsh delete mode 100644 themes/darkblood/darkblood.theme.zsh delete mode 100644 themes/daveverwer/daveverwer.theme.zsh delete mode 100644 themes/dieter/dieter.theme.zsh delete mode 100644 themes/dogenpunk/dogenpunk.theme.zsh delete mode 100644 themes/dst/dst.theme.zsh delete mode 100644 themes/dstufft/dstufft.theme.zsh delete mode 100644 themes/duellj/duellj.theme.zsh delete mode 100644 themes/eastwood/eastwood.theme.zsh delete mode 100644 themes/edvardm/edvardm.theme.zsh delete mode 100644 themes/evan/evan.theme.zsh delete mode 100644 themes/example/example.theme.zsh delete mode 100644 themes/fishy/fishy.theme.zsh delete mode 100644 themes/flazz/flazz.theme.zsh delete mode 100644 themes/fletcherm/fletcherm.theme.zsh delete mode 100644 themes/frisk/frisk.theme.zsh delete mode 100644 themes/funky/funky.theme.zsh delete mode 100644 themes/fwalch/fwalch.theme.zsh delete mode 100644 themes/gallifrey/gallifrey.theme.zsh delete mode 100644 themes/gallois/gallois.theme.zsh delete mode 100644 themes/garyblessington/garyblessington.theme.zsh delete mode 100644 themes/gentoo/gentoo.theme.zsh delete mode 100644 themes/geoffgarside/geoffgarside.theme.zsh delete mode 100644 themes/gozilla/gozilla.theme.zsh delete mode 100644 themes/humza/humza.theme.zsh delete mode 100644 themes/imajes/imajes.theme.zsh delete mode 100644 themes/jbergantine/jbergantine.theme.zsh delete mode 100644 themes/jispwoso/jispwoso.theme.zsh delete mode 100644 themes/jnrowe/jnrowe.theme.zsh delete mode 100644 themes/jonathan/jonathan.theme.zsh delete mode 100644 themes/josh/josh.theme.zsh delete mode 100644 themes/jreese/jreese.theme.zsh delete mode 100644 themes/jtriley/jtriley.theme.zsh delete mode 100644 themes/juanghurtado/juanghurtado.theme.zsh delete mode 100644 themes/kardan/kardan.theme.zsh delete mode 100644 themes/kennethreitz/kennethreitz.theme.zsh delete mode 100644 themes/kolo/kolo.theme.zsh delete mode 100644 themes/kphoen/kphoen.theme.zsh delete mode 100644 themes/lambda/lambda.theme.zsh delete mode 100644 themes/linuxonly/linuxonly delete mode 100644 themes/lukerandall/lukerandall.theme.zsh delete mode 100644 themes/macovsky-ruby/macovsky-ruby.theme.zsh delete mode 100644 themes/macovsky/macovsky.theme.zsh delete mode 100644 themes/maran/maran.theme.zsh delete mode 100644 themes/mgutz/mgutz.theme.zsh delete mode 100644 themes/mikeh/mikeh.theme.zsh delete mode 100644 themes/miloshadzic/miloshadzic.theme.zsh delete mode 100644 themes/mrtazz/mrtazz.theme.zsh delete mode 100644 themes/murilasso/murilasso.theme.zsh delete mode 100644 themes/muse/muse.theme.zsh delete mode 100644 themes/nanotech/nanotech.theme.zsh delete mode 100644 themes/nebirhos/nebirhos.theme.zsh delete mode 100644 themes/obraun/obraun.theme.zsh delete mode 100644 themes/philips/philips.theme.zsh delete mode 100644 themes/pmcgee/pmcgee.theme.zsh delete mode 100644 themes/re5et/re5et.theme.zsh delete mode 100644 themes/rgm/rgm.theme.zsh delete mode 100644 themes/risto/risto.theme.zsh delete mode 100644 themes/rixius/rixius.theme.zsh delete mode 100644 themes/robbyrussell/robbyrussell.theme.zsh delete mode 100644 themes/simple/simple.theme.zsh delete mode 100644 themes/skaro/skaro.theme.zsh delete mode 100644 themes/smt/smt.theme.zsh delete mode 100644 themes/sporty_256/sporty_256.theme.zsh delete mode 100644 themes/sunaku/sunaku.theme.zsh delete mode 100644 themes/takashiyoshida/takashiyoshida.theme.zsh delete mode 100644 themes/theunraveler/theunraveler.theme.zsh delete mode 100644 themes/tjkirch/tjkirch.theme.zsh delete mode 100644 themes/tonotdo/tonotdo.theme.zsh delete mode 100644 themes/trapd00r/trapd00r.theme.zsh delete mode 100644 themes/wezm+/wezm+.theme.zsh delete mode 100644 themes/wezm/wezm.theme.zsh delete mode 100644 themes/xiong-chiamiov-plus/xiong-chiamiov-plus.theme.zsh delete mode 100644 themes/xiong-chiamiov/xiong-chiamiov.theme.zsh diff --git a/themes/Soliah/Soliah.theme.zsh b/themes/Soliah/Soliah.theme.zsh deleted file mode 100644 index e0932c4b5..000000000 --- a/themes/Soliah/Soliah.theme.zsh +++ /dev/null @@ -1,86 +0,0 @@ -PROMPT='%{$fg[blue]%}%n%{$reset_color%} on %{$fg[red]%}%M%{$reset_color%} in %{$fg[blue]%}%~%b%{$reset_color%}$(git_time_since_commit)$(check_git_prompt_info) -$ ' - -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[white]%}" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%})" - -# Text to display if the branch is dirty -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*%{$reset_color%}" - -# Text to display if the branch is clean -ZSH_THEME_GIT_PROMPT_CLEAN="" - -# Colors vary depending on time lapsed. -ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT="%{$fg[green]%}" -ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM="%{$fg[yellow]%}" -ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG="%{$fg[red]%}" -ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[cyan]%}" - - -# Git sometimes goes into a detached head state. git_prompt_info doesn't -# return anything in this case. So wrap it in another function and check -# for an empty string. -function check_git_prompt_info() { - if git rev-parse --git-dir > /dev/null 2>&1; then - if [[ -z $(git_prompt_info) ]]; then - echo "%{$fg[magenta]%}detached-head%{$reset_color%})" - else - echo "$(git_prompt_info)" - fi - fi -} - -# Determine if we are using a gemset. -function rvm_gemset() { - GEMSET=`rvm gemset list | grep '=>' | cut -b4-` - if [[ -n $GEMSET ]]; then - echo "%{$fg[yellow]%}$GEMSET%{$reset_color%}|" - fi - -} - -# Determine the time since last commit. If branch is clean, -# use a neutral color, otherwise colors will vary according to time. -function git_time_since_commit() { - if git rev-parse --git-dir > /dev/null 2>&1; then - # Only proceed if there is actually a commit. - if [[ $(git log 2>&1 > /dev/null | grep -c "^fatal: bad default revision") == 0 ]]; then - # Get the last commit. - last_commit=`git log --pretty=format:'%at' -1 2> /dev/null` - now=`date +%s` - seconds_since_last_commit=$((now-last_commit)) - - # Totals - MINUTES=$((seconds_since_last_commit / 60)) - HOURS=$((seconds_since_last_commit/3600)) - - # Sub-hours and sub-minutes - DAYS=$((seconds_since_last_commit / 86400)) - SUB_HOURS=$((HOURS % 24)) - SUB_MINUTES=$((MINUTES % 60)) - - if [[ -n $(git status -s 2> /dev/null) ]]; then - if [ "$MINUTES" -gt 30 ]; then - COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG" - elif [ "$MINUTES" -gt 10 ]; then - COLOR="$ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM" - else - COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT" - fi - else - COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL" - fi - - if [ "$HOURS" -gt 24 ]; then - echo "($(rvm_gemset)$COLOR${DAYS}d${SUB_HOURS}h${SUB_MINUTES}m%{$reset_color%}|" - elif [ "$MINUTES" -gt 60 ]; then - echo "($(rvm_gemset)$COLOR${HOURS}h${SUB_MINUTES}m%{$reset_color%}|" - else - echo "($(rvm_gemset)$COLOR${MINUTES}m%{$reset_color%}|" - fi - else - COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL" - echo "($(rvm_gemset)$COLOR~|" - fi - fi -} diff --git a/themes/afowler/afowler.theme.zsh b/themes/afowler/afowler.theme.zsh deleted file mode 100644 index 3a4753fc1..000000000 --- a/themes/afowler/afowler.theme.zsh +++ /dev/null @@ -1,10 +0,0 @@ -if [ $UID -eq 0 ]; then CARETCOLOR="red"; else CARETCOLOR="blue"; fi - -local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" - -PROMPT='%m %{${fg_bold[blue]}%}:: %{$reset_color%}%{${fg[green]}%}%3~ $(git_prompt_info)%{${fg_bold[$CARETCOLOR]}%}»%{${reset_color}%} ' - -RPS1="${return_code}" - -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹" -ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}" diff --git a/themes/alanpeabody/alanpeabody.theme.zsh b/themes/alanpeabody/alanpeabody.theme.zsh deleted file mode 100644 index 1f66f1ec3..000000000 --- a/themes/alanpeabody/alanpeabody.theme.zsh +++ /dev/null @@ -1,22 +0,0 @@ - -local user='%{$fg[magenta]%}%n@%{$fg[magenta]%}%m%{$reset_color%}' -local pwd='%{$fg[blue]%}%~%{$reset_color%}' -local rvm='%{$fg[green]%}‹$(rvm-prompt i v g)›%{$reset_color%}' -local return_code='%(?..%{$fg[red]%}%? ↵%{$reset_color%})' -local git_branch='$(git_prompt_status)%{$reset_color%}$(git_prompt_info)%{$reset_color%}' - -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DIRTY="" -ZSH_THEME_GIT_PROMPT_CLEAN="" - -ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} ✚" -ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} ✹" -ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖" -ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜" -ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═" -ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭" - -PROMPT="${user} ${pwd}$ " -RPROMPT="${return_code} ${git_branch} ${rvm}" - diff --git a/themes/arrow/arrow.theme.zsh b/themes/arrow/arrow.theme.zsh deleted file mode 100644 index d62dcdcb9..000000000 --- a/themes/arrow/arrow.theme.zsh +++ /dev/null @@ -1,14 +0,0 @@ -if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="yellow"; fi - -PROMPT='%{$fg[$NCOLOR]%}%c ➤ %{$reset_color%}' -RPROMPT='%{$fg[$NCOLOR]%}%p $(git_prompt_info)%{$reset_color%}' - -ZSH_THEME_GIT_PROMPT_PREFIX="git:" -ZSH_THEME_GIT_PROMPT_SUFFIX="" -ZSH_THEME_GIT_PROMPT_DIRTY="*" -ZSH_THEME_GIT_PROMPT_CLEAN="" - -# See http://geoff.greer.fm/lscolors/ -export LSCOLORS="exfxcxdxbxbxbxbxbxbxbx" -export LS_COLORS="di=34;40:ln=35;40:so=32;40:pi=33;40:ex=31;40:bd=31;40:cd=31;40:su=31;40:sg=31;40:tw=31;40:ow=31;40:" - diff --git a/themes/aussiegeek/aussiegeek.theme.zsh b/themes/aussiegeek/aussiegeek.theme.zsh deleted file mode 100644 index c2c7f65b9..000000000 --- a/themes/aussiegeek/aussiegeek.theme.zsh +++ /dev/null @@ -1,8 +0,0 @@ - -PROMPT='$fg_bold[blue][ $fg[red]%t $fg_bold[blue]] $fg_bold[blue] [ $fg[red]%n@%m:%~$(git_prompt_info)$fg[yellow]$(rvm_prompt_info)$fg_bold[blue] ]$reset_color - $ ' -# git theming -ZSH_THEME_GIT_PROMPT_PREFIX="$fg_bold[green](" -ZSH_THEME_GIT_PROMPT_SUFFIX=")" -ZSH_THEME_GIT_PROMPT_CLEAN="✔" -ZSH_THEME_GIT_PROMPT_DIRTY="✗" diff --git a/themes/awesomepanda/awesomepanda.theme.zsh b/themes/awesomepanda/awesomepanda.theme.zsh deleted file mode 100644 index 1915bd13c..000000000 --- a/themes/awesomepanda/awesomepanda.theme.zsh +++ /dev/null @@ -1,18 +0,0 @@ -# the svn plugin has to be activated for this to work. - -PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%}$(svn_prompt_info)%{$reset_color%}' - -ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%})%{$fg[yellow]%} ✗ %{$reset_color%}" -ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%}) " - - - -ZSH_PROMPT_BASE_COLOR="%{$fg_bold[blue]%}" -ZSH_THEME_REPO_NAME_COLOR="%{$fg_bold[red]%}" - -ZSH_THEME_SVN_PROMPT_PREFIX="svn:(" -ZSH_THEME_SVN_PROMPT_SUFFIX=")" -ZSH_THEME_SVN_PROMPT_DIRTY="%{$fg[red]%} ✘ %{$reset_color%}" -ZSH_THEME_SVN_PROMPT_CLEAN=" " diff --git a/themes/bira/bira.theme.zsh b/themes/bira/bira.theme.zsh deleted file mode 100644 index 5642eaeb8..000000000 --- a/themes/bira/bira.theme.zsh +++ /dev/null @@ -1,14 +0,0 @@ -# ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png -local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" - -local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}' -local current_dir='%{$terminfo[bold]$fg[blue]%} %~%{$reset_color%}' -local rvm_ruby='%{$fg[red]%}‹$(rvm-prompt i v g)›%{$reset_color%}' -local git_branch='$(git_prompt_info)%{$reset_color%}' - -PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch} -╰─%B$%b " -RPS1="${return_code}" - -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹" -ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}" diff --git a/themes/candy/candy.theme.zsh b/themes/candy/candy.theme.zsh deleted file mode 100644 index bc125c5ce..000000000 --- a/themes/candy/candy.theme.zsh +++ /dev/null @@ -1,7 +0,0 @@ -PROMPT=$'%{$fg_bold[green]%}%n@%m %{$fg[blue]%}%D{[%I:%M:%S]} %{$reset_color%}%{$fg[white]%}[%~]%{$reset_color%} $(git_prompt_info)\ -%{$fg[blue]%}->%{$fg_bold[blue]%} %#%{$reset_color%} ' - -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}[" -ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}*%{$fg[green]%}" -ZSH_THEME_GIT_PROMPT_CLEAN="" diff --git a/themes/clean/clean.theme.zsh b/themes/clean/clean.theme.zsh deleted file mode 100644 index 7ee29cb8c..000000000 --- a/themes/clean/clean.theme.zsh +++ /dev/null @@ -1,14 +0,0 @@ -if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="white"; fi - -PROMPT='%{$fg[$NCOLOR]%}%B%n%b%{$reset_color%}:%{$fg[blue]%}%B%c/%b%{$reset_color%} $(git_prompt_info)%(!.#.$) ' -RPROMPT='[%*]' - -# git theming -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}(%{$fg_no_bold[yellow]%}%B" -ZSH_THEME_GIT_PROMPT_SUFFIX="%b%{$fg_bold[blue]%})%{$reset_color%} " -ZSH_THEME_GIT_PROMPT_CLEAN="" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%}✗" - -# LS colors, made with http://geoff.greer.fm/lscolors/ -export LSCOLORS="Gxfxcxdxbxegedabagacad" -export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:' diff --git a/themes/cloud/cloud.theme.zsh b/themes/cloud/cloud.theme.zsh deleted file mode 100644 index 4e94f61a7..000000000 --- a/themes/cloud/cloud.theme.zsh +++ /dev/null @@ -1,6 +0,0 @@ -PROMPT='%{$fg_bold[cyan]%}☁ %{$fg_bold[green]%}%p %{$fg[green]%}%c %{$fg_bold[cyan]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' - -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}[%{$fg[cyan]%}" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}] %{$fg[yellow]%}⚡%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%}]" diff --git a/themes/cypher/cypher.theme.zsh b/themes/cypher/cypher.theme.zsh deleted file mode 100644 index 45df53d22..000000000 --- a/themes/cypher/cypher.theme.zsh +++ /dev/null @@ -1,4 +0,0 @@ -# Based on evan's prompt -# Shows the exit status of the last command if non-zero -# Uses "#" instead of "»" when running with elevated privileges -PROMPT="%m %{${fg_bold[red]}%}:: %{${fg[green]}%}%3~%(0?. . ${fg[red]}%? )%{${fg[blue]}%}»%{${reset_color}%} " diff --git a/themes/dallas/dallas.theme.zsh b/themes/dallas/dallas.theme.zsh deleted file mode 100644 index eef32e998..000000000 --- a/themes/dallas/dallas.theme.zsh +++ /dev/null @@ -1,26 +0,0 @@ -# Personalized! - -# Grab the current date (%D) and time (%T) wrapped in {}: {%D %T} -DALLAS_CURRENT_TIME_="%{$fg[white]%}{%{$fg[yellow]%}%D %T%{$fg[white]%}}%{$reset_color%}" -# Grab the current version of ruby in use (via RVM): [ruby-1.8.7] -DALLAS_CURRENT_RUBY_="%{$fg[white]%}[%{$fg[magenta]%}\$(~/.rvm/bin/rvm-prompt i v)%{$fg[white]%}]%{$reset_color%}" -# Grab the current machine name: muscato -DALLAS_CURRENT_MACH_="%{$fg[green]%}%m%{$fg[white]%}:%{$reset_color%}" -# Grab the current filepath, use shortcuts: ~/Desktop -# Append the current git branch, if in a git repository: ~aw@master -DALLAS_CURRENT_LOCA_="%{$fg[cyan]%}%~\$(git_prompt_info)%{$reset_color%}" -# Grab the current username: dallas -DALLAS_CURRENT_USER_="%{$fg[red]%}%n%{$reset_color%}" -# Use a % for normal users and a # for privelaged (root) users. -DALLAS_PROMPT_CHAR_="%{$fg[white]%}%(!.#.%%)%{$reset_color%}" -# For the git prompt, use a white @ and blue text for the branch name -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[white]%}@%{$fg[blue]%}" -# Close it all off by resetting the color and styles. -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" -# Do nothing if the branch is clean (no changes). -ZSH_THEME_GIT_PROMPT_CLEAN="" -# Add 3 cyan ✗s if this branch is diiirrrty! Dirty branch! -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[cyan]%}✗✗✗" - -# Put it all together! -PROMPT="$DALLAS_CURRENT_TIME_$DALLAS_CURRENT_RUBY_$DALLAS_CURRENT_MACH_$DALLAS_CURRENT_LOCA_ $DALLAS_CURRENT_USER_$DALLAS_PROMPT_CHAR_ " diff --git a/themes/darkblood/darkblood.theme.zsh b/themes/darkblood/darkblood.theme.zsh deleted file mode 100644 index 33508fbd2..000000000 --- a/themes/darkblood/darkblood.theme.zsh +++ /dev/null @@ -1,9 +0,0 @@ -# meh. Dark Blood Rewind, a new beginning. - -PROMPT=$'%{$fg[red]%}┌[%{$fg_bold[white]%}%n%{$reset_color%}%{$fg[red]%}@%{$fg_bold[white]%}%m%{$reset_color%}%{$fg[red]%}] [%{$fg_bold[white]%}/dev/%y%{$reset_color%}%{$fg[red]%}] %{$(git_prompt_info)%}%(?,,%{$fg[red]%}[%{$fg_bold[white]%}%?%{$reset_color%}%{$fg[red]%}]) -%{$fg[red]%}└[%{$fg_bold[white]%}%~%{$reset_color%}%{$fg[red]%}]>%{$reset_color%} ' -PS2=$' %{$fg[red]%}|>%{$reset_color%} ' - -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[red]%}[%{$fg_bold[white]%}" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}%{$fg[red]%}] " -ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}⚡%{$reset_color%}" diff --git a/themes/daveverwer/daveverwer.theme.zsh b/themes/daveverwer/daveverwer.theme.zsh deleted file mode 100644 index 89aef926e..000000000 --- a/themes/daveverwer/daveverwer.theme.zsh +++ /dev/null @@ -1,7 +0,0 @@ -# Copied and modified from the oh-my-zsh theme from geoffgarside -# Red server name, green cwd, blue git status - -PROMPT='%{$fg[red]%}%m%{$reset_color%}:%{$fg[green]%}%c%{$reset_color%}$(git_prompt_info) %(!.#.$) ' - -ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[blue]%}(" -ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}" diff --git a/themes/dieter/dieter.theme.zsh b/themes/dieter/dieter.theme.zsh deleted file mode 100644 index 0a5e9265b..000000000 --- a/themes/dieter/dieter.theme.zsh +++ /dev/null @@ -1,56 +0,0 @@ -# the idea of this theme is to contain a lot of info in a small string, by -# compressing some parts and colorcoding, which bring useful visual cues, -# while limiting the amount of colors and such to keep it easy on the eyes. -# When a command exited >0, the timestamp will be in red and the exit code -# will be on the right edge. -# The exit code visual cues will only display once. -# (i.e. they will be reset, even if you hit enter a few times on empty command prompts) - -typeset -A host_repr - -# translate hostnames into shortened, colorcoded strings -host_repr=('dieter-ws-a7n8x-arch' "%{$fg_bold[green]%}ws" 'dieter-p4sci-arch' "%{$fg_bold[blue]%}p4") - -# local time, color coded by last return code -time_enabled="%(?.%{$fg[green]%}.%{$fg[red]%})%*%{$reset_color%}" -time_disabled="%{$fg[green]%}%*%{$reset_color%}" -time=$time_enabled - -# user part, color coded by privileges -local user="%(!.%{$fg[blue]%}.%{$fg[blue]%})%n%{$reset_color%}" - -# Hostname part. compressed and colorcoded per host_repr array -# if not found, regular hostname in default color -local host="@${host_repr[$(hostname)]:-$(hostname)}%{$reset_color%}" - -# Compacted $PWD -local pwd="%{$fg[blue]%}%c%{$reset_color%}" - -PROMPT='${time} ${user}${host} ${pwd} $(git_prompt_info)' - -# i would prefer 1 icon that shows the "most drastic" deviation from HEAD, -# but lets see how this works out -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%} %{$fg[yellow]%}?%{$fg[green]%}%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%}" - -# elaborate exitcode on the right when >0 -return_code_enabled="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" -return_code_disabled= -return_code=$return_code_enabled - -RPS1='${return_code}' - -function accept-line-or-clear-warning () { - if [[ -z $BUFFER ]]; then - time=$time_disabled - return_code=$return_code_disabled - else - time=$time_enabled - return_code=$return_code_enabled - fi - zle accept-line -} -zle -N accept-line-or-clear-warning -bindkey '^M' accept-line-or-clear-warning diff --git a/themes/dogenpunk/dogenpunk.theme.zsh b/themes/dogenpunk/dogenpunk.theme.zsh deleted file mode 100644 index f4d65ab74..000000000 --- a/themes/dogenpunk/dogenpunk.theme.zsh +++ /dev/null @@ -1,85 +0,0 @@ -# ----------------------------------------------------------------------------- -# FILE: dogenpunk.zsh-theme -# DESCRIPTION: oh-my-zsh theme file. -# AUTHOR: Matthew Nelson (dogenpunk@gmail.com) -# VERSION: 0.1 -# SCREENSHOT: coming soon -# ----------------------------------------------------------------------------- - -MODE_INDICATOR="%{$fg_bold[red]%}❮%{$reset_color%}%{$fg[red]%}❮❮%{$reset_color%}" -local return_status="%{$fg[red]%}%(?..⏎)%{$reset_color%}" - -PROMPT='%{$fg[blue]%}%m%{$reset_color%}%{$fg_bold[white]%} ओम् %{$reset_color%}%{$fg[cyan]%}%~:%{$reset_color%}$(git_time_since_commit)$(git_prompt_info) -%{$fg[red]%}%!%{$reset_color%} $(prompt_char) ' - -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[green]%}git%{$reset_color%}@%{$bg[white]%}%{$fg[black]%}" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%})" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}!%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_CLEAN="" - -RPROMPT='${return_status}$(git_prompt_status)%{$reset_color%}' - -ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} ✚" -ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} ✹" -ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖" -ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜" -ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═" -ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭" - -function prompt_char() { - git branch >/dev/null 2>/dev/null && echo "%{$fg[green]%}±%{$reset_color%}" && return - hg root >/dev/null 2>/dev/null && echo "%{$fg_bold[red]%}☿%{$reset_color%}" && return - echo "%{$fg[cyan]%}◯ %{$reset_color%}" -} - -# Colors vary depending on time lapsed. -ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT="%{$fg[green]%}" -ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM="%{$fg[yellow]%}" -ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG="%{$fg[red]%}" -ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[cyan]%}" - -# Determine the time since last commit. If branch is clean, -# use a neutral color, otherwise colors will vary according to time. -function git_time_since_commit() { - if git rev-parse --git-dir > /dev/null 2>&1; then - # Only proceed if there is actually a commit. - if [[ $(git log 2>&1 > /dev/null | grep -c "^fatal: bad default revision") == 0 ]]; then - # Get the last commit. - last_commit=`git log --pretty=format:'%at' -1 2> /dev/null` - now=`date +%s` - seconds_since_last_commit=$((now-last_commit)) - - # Totals - MINUTES=$((seconds_since_last_commit / 60)) - HOURS=$((seconds_since_last_commit/3600)) - - # Sub-hours and sub-minutes - DAYS=$((seconds_since_last_commit / 86400)) - SUB_HOURS=$((HOURS % 24)) - SUB_MINUTES=$((MINUTES % 60)) - - if [[ -n $(git status -s 2> /dev/null) ]]; then - if [ "$MINUTES" -gt 30 ]; then - COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG" - elif [ "$MINUTES" -gt 10 ]; then - COLOR="$ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM" - else - COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT" - fi - else - COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL" - fi - - if [ "$HOURS" -gt 24 ]; then - echo "($COLOR${DAYS}d${SUB_HOURS}h${SUB_MINUTES}m%{$reset_color%}|" - elif [ "$MINUTES" -gt 60 ]; then - echo "($COLOR${HOURS}h${SUB_MINUTES}m%{$reset_color%}|" - else - echo "($COLOR${MINUTES}m%{$reset_color%}|" - fi - else - COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL" - echo "($COLOR~|" - fi - fi -} diff --git a/themes/dst/dst.theme.zsh b/themes/dst/dst.theme.zsh deleted file mode 100644 index 3e2539d57..000000000 --- a/themes/dst/dst.theme.zsh +++ /dev/null @@ -1,16 +0,0 @@ - -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%}' diff --git a/themes/dstufft/dstufft.theme.zsh b/themes/dstufft/dstufft.theme.zsh deleted file mode 100644 index 5a23fcea5..000000000 --- a/themes/dstufft/dstufft.theme.zsh +++ /dev/null @@ -1,19 +0,0 @@ -function prompt_char { - git branch >/dev/null 2>/dev/null && echo '±' && return - hg root >/dev/null 2>/dev/null && echo 'Hg' && return - echo '○' -} - -function virtualenv_info { - [ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') ' -} - -PROMPT=' -%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$(git_prompt_info) -$(virtualenv_info)$(prompt_char) ' - -ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}!" -ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[green]%}?" -ZSH_THEME_GIT_PROMPT_CLEAN="" diff --git a/themes/duellj/duellj.theme.zsh b/themes/duellj/duellj.theme.zsh deleted file mode 100644 index 7350b4335..000000000 --- a/themes/duellj/duellj.theme.zsh +++ /dev/null @@ -1,8 +0,0 @@ - -# 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 -PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;34m%}@%{\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%}%!%{\e[0;34m%}%B]%b%{\e[0m%} -%{\e[0;34m%}%B└─%B[%{\e[1;35m%}$%{\e[0;34m%}%B]%{\e[0m%}%b ' -RPROMPT='[%*]' -PS2=$' \e[0;34m%}%B>%{\e[0m%}%b ' diff --git a/themes/eastwood/eastwood.theme.zsh b/themes/eastwood/eastwood.theme.zsh deleted file mode 100644 index 8f15f367f..000000000 --- a/themes/eastwood/eastwood.theme.zsh +++ /dev/null @@ -1,19 +0,0 @@ -#RVM settings -if [[ -s ~/.rvm/scripts/rvm ]] ; then - RPS1="%{$fg[yellow]%}rvm:%{$reset_color%}%{$fg[red]%}\$(~/.rvm/bin/rvm-prompt)%{$reset_color%} $EPS1" -fi - -ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}[" -ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_CLEAN="" - -#Customized git status, oh-my-zsh currently does not allow render dirty status before branch -git_custom_status() { - local cb=$(current_branch) - if [ -n "$cb" ]; then - echo "$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_PREFIX$(current_branch)$ZSH_THEME_GIT_PROMPT_SUFFIX" - fi -} - -PROMPT='$(git_custom_status)%{$fg[cyan]%}[%~% ]%{$reset_color%}%B$%b ' diff --git a/themes/edvardm/edvardm.theme.zsh b/themes/edvardm/edvardm.theme.zsh deleted file mode 100644 index f9ca1a9e2..000000000 --- a/themes/edvardm/edvardm.theme.zsh +++ /dev/null @@ -1,6 +0,0 @@ -PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg_bold[white]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' - -ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" diff --git a/themes/evan/evan.theme.zsh b/themes/evan/evan.theme.zsh deleted file mode 100644 index 2ebb27159..000000000 --- a/themes/evan/evan.theme.zsh +++ /dev/null @@ -1,2 +0,0 @@ -# Evan describes this sexy prompt as: "a skinny, topless prompt" -PROMPT='%m :: %2~ %B»%b ' diff --git a/themes/example/example.theme.zsh b/themes/example/example.theme.zsh deleted file mode 100644 index 4ad3b7cae..000000000 --- a/themes/example/example.theme.zsh +++ /dev/null @@ -1,5 +0,0 @@ -# Found on the ZshWiki -# http://zshwiki.org/home/config/prompt -# - -PROMPT="%{$fg[red]%}%n%{$reset_color%}@%{$fg[blue]%}%m %{$fg[yellow]%}%~ %{$reset_color%}%% " diff --git a/themes/fishy/fishy.theme.zsh b/themes/fishy/fishy.theme.zsh deleted file mode 100644 index f9e506cae..000000000 --- a/themes/fishy/fishy.theme.zsh +++ /dev/null @@ -1,20 +0,0 @@ -# ZSH Theme emulating the Fish shell's default prompt. - -local user_color='green'; [ $UID -eq 0 ] && user_color='red' -PROMPT='%n@%m %{$fg[$user_color]%}%~%{$reset_color%}%(!.#.>) ' -PROMPT2='%{$fg[red]%}\ %{$reset_color%}' - -local return_status="%{$fg_bold[red]%}%(?..%?)%{$reset_color%}" -RPROMPT='${return_status}$(git_prompt_info)$(git_prompt_status)%{$reset_color%}' - -ZSH_THEME_GIT_PROMPT_PREFIX=" " -ZSH_THEME_GIT_PROMPT_SUFFIX="" -ZSH_THEME_GIT_PROMPT_DIRTY="" -ZSH_THEME_GIT_PROMPT_CLEAN="" - -ZSH_THEME_GIT_PROMPT_ADDED="%{$fg_bold[green]%}+" -ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg_bold[blue]%}!" -ZSH_THEME_GIT_PROMPT_DELETED="%{$fg_bold[red]%}-" -ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg_bold[magenta]%}>" -ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg_bold[yellow]%}#" -ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg_bold[cyan]%}?" diff --git a/themes/flazz/flazz.theme.zsh b/themes/flazz/flazz.theme.zsh deleted file mode 100644 index 280794f2b..000000000 --- a/themes/flazz/flazz.theme.zsh +++ /dev/null @@ -1,19 +0,0 @@ -if [ "$(whoami)" = "root" ] -then CARETCOLOR="red" -else CARETCOLOR="blue" -fi - -local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" - -PROMPT='%m%{${fg_bold[magenta]}%} :: %{$reset_color%}%{${fg[green]}%}%3~ $(git_prompt_info)%{${fg_bold[$CARETCOLOR]}%}%#%{${reset_color}%} ' - -RPS1='$(vi_mode_prompt_info) ${return_code}' - -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[cyan]%}‹" -ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}" - -MODE_INDICATOR="%{$fg_bold[magenta]%}<%{$reset_color%}%{$fg[magenta]%}<<%{$reset_color%}" - -# TODO use 265 colors -#MODE_INDICATOR="$FX[bold]$FG[020]<$FX[no_bold]%{$fg[blue]%}<<%{$reset_color%}" -# TODO use two lines if git diff --git a/themes/fletcherm/fletcherm.theme.zsh b/themes/fletcherm/fletcherm.theme.zsh deleted file mode 100644 index e96188544..000000000 --- a/themes/fletcherm/fletcherm.theme.zsh +++ /dev/null @@ -1,12 +0,0 @@ -# Copied from old version of tonotdo's theme. LSCOLORS modified. -PROMPT='%{$fg_no_bold[cyan]%}%n%{$fg_no_bold[magenta]%}•%{$fg_no_bold[green]%}%3~$(git_prompt_info)%{$reset_color%}» ' -RPROMPT='[%*]' - -# git theming -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}(%{$fg_no_bold[red]%}" -ZSH_THEME_GIT_PROMPT_SUFFIX="" -ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[blue]%})" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[yellow]%}⚡%{$fg_bold[blue]%})" - -export LSCOLORS="exfxcxdxbxegedabagacad" -export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:' diff --git a/themes/frisk/frisk.theme.zsh b/themes/frisk/frisk.theme.zsh deleted file mode 100644 index f181aec90..000000000 --- a/themes/frisk/frisk.theme.zsh +++ /dev/null @@ -1,10 +0,0 @@ -PROMPT=$' -%{$fg[blue]%}%/%{$reset_color%} $(git_prompt_info)%{$fg[white]%}[%n@%m]%{$reset_color%} %{$fg[white]%}[%T]%{$reset_color%} -%{$fg_bold[black]%}>%{$reset_color%} ' - -PROMPT2="%{$fg_blod[black]%}%_> %{$reset_color%}" - -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}[" -ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%} " -ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}*%{$fg[green]%}" -ZSH_THEME_GIT_PROMPT_CLEAN="" diff --git a/themes/funky/funky.theme.zsh b/themes/funky/funky.theme.zsh deleted file mode 100644 index 503455485..000000000 --- a/themes/funky/funky.theme.zsh +++ /dev/null @@ -1,14 +0,0 @@ -# Taken from Tassilo's Blog -# http://tsdh.wordpress.com/2007/12/06/my-funky-zsh-prompt/ - -local blue_op="%{$fg[blue]%}[%{$reset_color%}" -local blue_cp="%{$fg[blue]%}]%{$reset_color%}" -local path_p="${blue_op}%~${blue_cp}" -local user_host="${blue_op}%n@%m${blue_cp}" -local ret_status="${blue_op}%?${blue_cp}" -local hist_no="${blue_op}%h${blue_cp}" -local smiley="%(?,%{$fg[green]%}:%)%{$reset_color%},%{$fg[red]%}:(%{$reset_color%})" -PROMPT="╭─${path_p}─${user_host}─${ret_status}─${hist_no} -╰─${blue_op}${smiley}${blue_cp} %# " -local cur_cmd="${blue_op}%_${blue_cp}" -PROMPT2="${cur_cmd}> " diff --git a/themes/fwalch/fwalch.theme.zsh b/themes/fwalch/fwalch.theme.zsh deleted file mode 100644 index 24edf55c0..000000000 --- a/themes/fwalch/fwalch.theme.zsh +++ /dev/null @@ -1,6 +0,0 @@ -PROMPT='%{$fg_bold[green]%}%p %{$fg[cyan]%}%c%{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' - -ZSH_THEME_GIT_PROMPT_PREFIX=" (%{$fg[red]%}" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" diff --git a/themes/gallifrey/gallifrey.theme.zsh b/themes/gallifrey/gallifrey.theme.zsh deleted file mode 100644 index fce7cb923..000000000 --- a/themes/gallifrey/gallifrey.theme.zsh +++ /dev/null @@ -1,8 +0,0 @@ -# ZSH Theme - Preview: http://img.skitch.com/20091113-qqtd3j8xinysujg5ugrsbr7x1y.jpg -local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" - -PROMPT='%{$fg[green]%}%m%{$reset_color%} %2~ $(git_prompt_info)%{$reset_color%}%B»%b ' -RPS1="${return_code}" - -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹" -ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}" diff --git a/themes/gallois/gallois.theme.zsh b/themes/gallois/gallois.theme.zsh deleted file mode 100644 index be8fe0999..000000000 --- a/themes/gallois/gallois.theme.zsh +++ /dev/null @@ -1,19 +0,0 @@ -ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}[" -ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_CLEAN="" - -#Customized git status, oh-my-zsh currently does not allow render dirty status before branch -git_custom_status() { - local cb=$(current_branch) - if [ -n "$cb" ]; then - echo "$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_PREFIX$(current_branch)$ZSH_THEME_GIT_PROMPT_SUFFIX" - fi -} - -#RVM and git settings -if [[ -s ~/.rvm/scripts/rvm ]] ; then - RPS1='$(git_custom_status)%{$fg[red]%}[`~/.rvm/bin/rvm-prompt`]%{$reset_color%} $EPS1' -fi - -PROMPT='%{$fg[cyan]%}[%~% ]%(?.%{$fg[green]%}.%{$fg[red]%})%B$%b ' diff --git a/themes/garyblessington/garyblessington.theme.zsh b/themes/garyblessington/garyblessington.theme.zsh deleted file mode 100644 index b4f84a71c..000000000 --- a/themes/garyblessington/garyblessington.theme.zsh +++ /dev/null @@ -1,6 +0,0 @@ -PROMPT='%{$fg[cyan]%}%c%{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%}% %{$reset_color%}: ' - -ZSH_THEME_GIT_PROMPT_PREFIX="(%{$fg[blue]%}" -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]%})" diff --git a/themes/gentoo/gentoo.theme.zsh b/themes/gentoo/gentoo.theme.zsh deleted file mode 100644 index cba143d42..000000000 --- a/themes/gentoo/gentoo.theme.zsh +++ /dev/null @@ -1,4 +0,0 @@ -PROMPT='%(!.%{$fg_bold[red]%}.%{$fg_bold[green]%}%n@)%m %{$fg_bold[blue]%}%(!.%1~.%~) $(git_prompt_info)%#%{$reset_color%} ' - -ZSH_THEME_GIT_PROMPT_PREFIX="(" -ZSH_THEME_GIT_PROMPT_SUFFIX=") " diff --git a/themes/geoffgarside/geoffgarside.theme.zsh b/themes/geoffgarside/geoffgarside.theme.zsh deleted file mode 100644 index 675ec7206..000000000 --- a/themes/geoffgarside/geoffgarside.theme.zsh +++ /dev/null @@ -1,5 +0,0 @@ -# PROMPT="[%*] %n:%c $(git_prompt_info)%(!.#.$) " -PROMPT='[%*] %{$fg[cyan]%}%n%{$reset_color%}:%{$fg[green]%}%c%{$reset_color%}$(git_prompt_info) %(!.#.$) ' - -ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[yellow]%}git:(" -ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}" diff --git a/themes/gozilla/gozilla.theme.zsh b/themes/gozilla/gozilla.theme.zsh deleted file mode 100644 index c6b752e9b..000000000 --- a/themes/gozilla/gozilla.theme.zsh +++ /dev/null @@ -1,15 +0,0 @@ -PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' - -ZSH_THEME_GIT_PROMPT_PREFIX="(" -ZSH_THEME_GIT_PROMPT_SUFFIX=")" -ZSH_THEME_GIT_PROMPT_DIRTY="" -ZSH_THEME_GIT_PROMPT_CLEAN="" - -RPROMPT='$(git_prompt_status)%{$reset_color%}' - -ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[cyan]%} ✈" -ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[yellow]%} ✭" -ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✗" -ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%} ➦" -ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[magenta]%} ✂" -ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[grey]%} ✱" diff --git a/themes/humza/humza.theme.zsh b/themes/humza/humza.theme.zsh deleted file mode 100644 index 107886295..000000000 --- a/themes/humza/humza.theme.zsh +++ /dev/null @@ -1,26 +0,0 @@ -# ZSH THEME Preview: https://skitch.com/huyy/rk979/humza.zshtheme - -let TotalBytes=0 -for Bytes in $(ls -l | grep "^-" | awk '{ print $5 }') -do - let TotalBytes=$TotalBytes+$Bytes -done - # should it say b, kb, Mb, or Gb -if [ $TotalBytes -lt 1024 ]; then - TotalSize=$(echo -e "scale=3 \n$TotalBytes \nquit" | bc) - suffix="b" -elif [ $TotalBytes -lt 1048576 ]; then - TotalSize=$(echo -e "scale=3 \n$TotalBytes/1024 \nquit" | bc) - suffix="kb" -elif [ $TotalBytes -lt 1073741824 ]; then - TotalSize=$(echo -e "scale=3 \n$TotalBytes/1048576 \nquit" | bc) - suffix="Mb" -else - TotalSize=$(echo -e "scale=3 \n$TotalBytes/1073741824 \nquit" | bc) - suffix="Gb" -fi - -PROMPT='%{$reset_color%}%n %{$fg[green]%}{%{$reset_color%}%~%{$fg[green]%}}%{$reset_color%}$(git_prompt_info) greetings, earthling %{$fg[green]%}[%{$reset_color%}%{$TotalSize%}%{$suffix%}%{$fg[green]%}]%{$fg[red]%}$%{$reset_color%} ☞ ' - -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[red]%}±(" -ZSH_THEME_GIT_PROMPT_SUFFIX=");%{$reset_color%}" diff --git a/themes/imajes/imajes.theme.zsh b/themes/imajes/imajes.theme.zsh deleted file mode 100644 index 918cd8081..000000000 --- a/themes/imajes/imajes.theme.zsh +++ /dev/null @@ -1,5 +0,0 @@ -# Found on the ZshWiki -# http://zshwiki.org/home/config/prompt -# - -PROMPT="%{$fg[red]%}%%%{$reset_color%} " diff --git a/themes/jbergantine/jbergantine.theme.zsh b/themes/jbergantine/jbergantine.theme.zsh deleted file mode 100644 index d84247cff..000000000 --- a/themes/jbergantine/jbergantine.theme.zsh +++ /dev/null @@ -1,6 +0,0 @@ -PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[white]%}$(git_prompt_info)%{$fg_bold[white]%} % %{$reset_color%}' - -ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[white]%}) %{$fg[yellow]%}✗%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[white]%})" diff --git a/themes/jispwoso/jispwoso.theme.zsh b/themes/jispwoso/jispwoso.theme.zsh deleted file mode 100644 index cdfef3871..000000000 --- a/themes/jispwoso/jispwoso.theme.zsh +++ /dev/null @@ -1,4 +0,0 @@ -PROMPT=$'%{$fg[green]%}%n@%m: %{$reset_color%}%{$fg[blue]%}%/%{$reset_color%} -%{$fg_bold[red]%}➜ %{$reset_color%} ' - -PROMPT2="%{$fg_blod[black]%}%_> %{$reset_color%}" diff --git a/themes/jnrowe/jnrowe.theme.zsh b/themes/jnrowe/jnrowe.theme.zsh deleted file mode 100644 index 7c8a7082e..000000000 --- a/themes/jnrowe/jnrowe.theme.zsh +++ /dev/null @@ -1,31 +0,0 @@ -autoload -U add-zsh-hook -autoload -Uz vcs_info - -zstyle ':vcs_info:*' actionformats \ - '%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f ' -zstyle ':vcs_info:*' formats \ - '%F{2}%s%F{7}:%F{2}(%F{1}%b%F{2})%f ' -zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r' -zstyle ':vcs_info:*' enable git - -add-zsh-hook precmd prompt_jnrowe_precmd - -prompt_jnrowe_precmd () { - vcs_info - - if [ "${vcs_info_msg_0_}" = "" ]; then - dir_status="%F{2}→%f" - elif [[ $(git diff --cached --name-status 2>/dev/null ) != "" ]]; then - dir_status="%F{1}▶%f" - elif [[ $(git diff --name-status 2>/dev/null ) != "" ]]; then - dir_status="%F{3}▶%f" - else - dir_status="%F{2}▶%f" - fi -} - -local ret_status="%(?:%{$fg_bold[green]%}Ξ:%{$fg_bold[red]%}%S↑%s%?)" - -PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg_bold[yellow]%}%2~ ${vcs_info_msg_0_}${dir_status}%{$reset_color%} ' - -# vim: set ft=zsh ts=4 sw=4 et: diff --git a/themes/jonathan/jonathan.theme.zsh b/themes/jonathan/jonathan.theme.zsh deleted file mode 100644 index 79d0d21ff..000000000 --- a/themes/jonathan/jonathan.theme.zsh +++ /dev/null @@ -1,137 +0,0 @@ -function precmd { - local TERMWIDTH - (( TERMWIDTH = ${COLUMNS} - 1 )) - - - ### - # Truncate the path if it's too long. - - PR_FILLBAR="" - PR_PWDLEN="" - - local promptsize=${#${(%):---(%n@%m:%l)---()--}} - local rubyprompt=`rvm_prompt_info` - local rubypromptsize=${#${rubyprompt}} - local pwdsize=${#${(%):-%~}} - - if [[ "$promptsize + $rubypromptsize + $pwdsize" -gt $TERMWIDTH ]]; then - ((PR_PWDLEN=$TERMWIDTH - $promptsize)) - else - PR_FILLBAR="\${(l.(($TERMWIDTH - ($promptsize + $rubypromptsize + $pwdsize)))..${PR_HBAR}.)}" - fi - -} - - -setopt extended_glob -preexec () { - if [[ "$TERM" == "screen" ]]; then - local CMD=${1[(wr)^(*=*|sudo|-*)]} - echo -n "\ek$CMD\e\\" - fi -} - - -setprompt () { - ### - # Need this so the prompt will work. - - setopt prompt_subst - - - ### - # See if we can use colors. - - autoload colors zsh/terminfo - if [[ "$terminfo[colors]" -ge 8 ]]; then - colors - fi - for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE GREY; do - eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}' - eval PR_LIGHT_$color='%{$fg[${(L)color}]%}' - (( count = $count + 1 )) - done - PR_NO_COLOUR="%{$terminfo[sgr0]%}" - - ### - # Modify Git prompt - ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[green]%}" - ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" - ZSH_THEME_GIT_PROMPT_DIRTY="" - ZSH_THEME_GIT_PROMPT_CLEAN="" - - ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} ✚" - ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} ✹" - ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖" - ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜" - ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═" - ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭" - - ### - # See if we can use extended characters to look nicer. - - typeset -A altchar - set -A altchar ${(s..)terminfo[acsc]} - PR_SET_CHARSET="%{$terminfo[enacs]%}" - PR_SHIFT_IN="%{$terminfo[smacs]%}" - PR_SHIFT_OUT="%{$terminfo[rmacs]%}" - PR_HBAR=${altchar[q]:--} - PR_ULCORNER=${altchar[l]:--} - PR_LLCORNER=${altchar[m]:--} - PR_LRCORNER=${altchar[j]:--} - PR_URCORNER=${altchar[k]:--} - - - ### - # Decide if we need to set titlebar text. - - case $TERM in - xterm*) - PR_TITLEBAR=$'%{\e]0;%(!.-=*[ROOT]*=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\a%}' - ;; - screen) - PR_TITLEBAR=$'%{\e_screen \005 (\005t) | %(!.-=[ROOT]=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\e\\%}' - ;; - *) - PR_TITLEBAR='' - ;; - esac - - - ### - # Decide whether to set a screen title - if [[ "$TERM" == "screen" ]]; then - PR_STITLE=$'%{\ekzsh\e\\%}' - else - PR_STITLE='' - fi - - - ### - # Finally, the prompt. - - PROMPT='$PR_SET_CHARSET$PR_STITLE${(e)PR_TITLEBAR}\ -$PR_CYAN$PR_SHIFT_IN$PR_ULCORNER$PR_HBAR$PR_SHIFT_OUT$PR_GREY(\ -$PR_GREEN%$PR_PWDLEN<...<%~%<<\ -$PR_GREY)`rvm_prompt_info`$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_HBAR${(e)PR_FILLBAR}$PR_HBAR$PR_SHIFT_OUT$PR_GREY(\ -$PR_CYAN%(!.%SROOT%s.%n)$PR_GREY@$PR_GREEN%m:%l\ -$PR_GREY)$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_URCORNER$PR_SHIFT_OUT\ - -$PR_CYAN$PR_SHIFT_IN$PR_LLCORNER$PR_BLUE$PR_HBAR$PR_SHIFT_OUT(\ -$PR_YELLOW%D{%H:%M:%S}\ -$PR_LIGHT_BLUE%{$reset_color%}`git_prompt_info``git_prompt_status`$PR_BLUE)$PR_CYAN$PR_SHIFT_IN$PR_HBAR\ -$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT\ ->$PR_NO_COLOUR ' - - # display exitcode on the right when >0 - return_code="%(?..%{$fg[red]%}%? ↵ %{$reset_color%})" - RPROMPT=' $return_code$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_BLUE$PR_HBAR$PR_SHIFT_OUT\ -($PR_YELLOW%D{%a,%b%d}$PR_BLUE)$PR_SHIFT_IN$PR_HBAR$PR_CYAN$PR_LRCORNER$PR_SHIFT_OUT$PR_NO_COLOUR' - - PS2='$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT\ -$PR_BLUE$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT(\ -$PR_LIGHT_GREEN%_$PR_BLUE)$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT\ -$PR_CYAN$PR_SHIFT_IN$PR_HBAR$PR_SHIFT_OUT$PR_NO_COLOUR ' -} - -setprompt diff --git a/themes/josh/josh.theme.zsh b/themes/josh/josh.theme.zsh deleted file mode 100644 index d6c64da8e..000000000 --- a/themes/josh/josh.theme.zsh +++ /dev/null @@ -1,43 +0,0 @@ -grey='\e[0;90m' - -ZSH_THEME_GIT_PROMPT_PREFIX="%{$grey%}(" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$grey%}) %{$fg[yellow]%}✗%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_CLEAN="%{$grey%})" - -function josh_prompt { - (( spare_width = ${COLUMNS} )) - prompt=" " - - branch=$(current_branch) - ruby_version=$(rvm_prompt_info) - path_size=${#PWD} - branch_size=${#branch} - ruby_size=${#ruby_version} - user_machine_size=${#${(%):-%n@%m-}} - - if [[ ${#branch} -eq 0 ]] - then (( ruby_size = ruby_size + 1 )) - else - (( branch_size = branch_size + 4 )) - if [[ -n $(git status -s 2> /dev/null) ]]; then - (( branch_size = branch_size + 2 )) - fi - fi - - (( spare_width = ${spare_width} - (${user_machine_size} + ${path_size} + ${branch_size} + ${ruby_size}) )) - - while [ ${#prompt} -lt $spare_width ]; do - prompt=" $prompt" - done - - prompt="%{%F{green}%}$PWD$prompt%{%F{red}%}$(rvm_prompt_info)%{$reset_color%} $(git_prompt_info)" - - echo $prompt -} - -setopt prompt_subst - -PROMPT=' -%n@%m $(josh_prompt) -%(?,%{%F{green}%},%{%F{red}%})⚡%{$reset_color%} ' diff --git a/themes/jreese/jreese.theme.zsh b/themes/jreese/jreese.theme.zsh deleted file mode 100644 index 0fa6b4ecd..000000000 --- a/themes/jreese/jreese.theme.zsh +++ /dev/null @@ -1,16 +0,0 @@ -# ZSH Theme - Preview: http://dl.dropbox.com/u/1552408/Screenshots/2010-04-08-oh-my-zsh.png - -if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="green"; fi -local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" - -PROMPT='%{$fg[$NCOLOR]%}%n%{$fg[green]%}@%m%{$reset_color%} %~ \ -$(git_prompt_info)\ -%{$fg[red]%}%(!.#.»)%{$reset_color%} ' -PROMPT2='%{$fg[red]%}\ %{$reset_color%}' -RPS1='${return_code}' - -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}±%{$fg[yellow]%}" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " -ZSH_THEME_GIT_PROMPT_CLEAN="" -ZSH_THEME_GIT_PROMPT_DIRTY="⚡" - diff --git a/themes/jtriley/jtriley.theme.zsh b/themes/jtriley/jtriley.theme.zsh deleted file mode 100644 index 15d77ed23..000000000 --- a/themes/jtriley/jtriley.theme.zsh +++ /dev/null @@ -1,8 +0,0 @@ -#PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' -PROMPT="%{$fg_bold[cyan]%}%T%{$fg_bold[green]%} %{$fg_bold[white]%}%n%{$fg[magenta]%}@%{$fg_bold[white]%}%m %{$fg_bold[green]%}%d -%{$fg_bold[yellow]%}%% %{$reset_color%}" - -#ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" -#ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" -#ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}" -#ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" diff --git a/themes/juanghurtado/juanghurtado.theme.zsh b/themes/juanghurtado/juanghurtado.theme.zsh deleted file mode 100644 index 3ca50cee8..000000000 --- a/themes/juanghurtado/juanghurtado.theme.zsh +++ /dev/null @@ -1,46 +0,0 @@ -# ------------------------------------------------------------------------ -# Juan G. Hurtado oh-my-zsh theme -# (Needs Git plugin for current_branch method) -# ------------------------------------------------------------------------ - -# Color shortcuts -RED=$fg[red] -YELLOW=$fg[yellow] -GREEN=$fg[green] -WHITE=$fg[white] -BLUE=$fg[blue] -RED_BOLD=$fg_bold[red] -YELLOW_BOLD=$fg_bold[yellow] -GREEN_BOLD=$fg_bold[green] -WHITE_BOLD=$fg_bold[white] -BLUE_BOLD=$fg_bold[blue] -RESET_COLOR=$reset_color - -# Format for git_prompt_info() -ZSH_THEME_GIT_PROMPT_PREFIX="" -ZSH_THEME_GIT_PROMPT_SUFFIX="" - -# Format for parse_git_dirty() -ZSH_THEME_GIT_PROMPT_DIRTY=" %{$RED%}(*)" -ZSH_THEME_GIT_PROMPT_CLEAN="" - -# Format for git_prompt_status() -ZSH_THEME_GIT_PROMPT_UNMERGED=" %{$RED%}unmerged" -ZSH_THEME_GIT_PROMPT_DELETED=" %{$RED%}deleted" -ZSH_THEME_GIT_PROMPT_RENAMED=" %{$YELLOW%}renamed" -ZSH_THEME_GIT_PROMPT_MODIFIED=" %{$YELLOW%}modified" -ZSH_THEME_GIT_PROMPT_ADDED=" %{$GREEN%}added" -ZSH_THEME_GIT_PROMPT_UNTRACKED=" %{$WHITE%}untracked" - -# Format for git_prompt_ahead() -ZSH_THEME_GIT_PROMPT_AHEAD=" %{$RED%}(!)" - -# Format for git_prompt_long_sha() and git_prompt_short_sha() -ZSH_THEME_GIT_PROMPT_SHA_BEFORE=" %{$WHITE%}[%{$YELLOW%}" -ZSH_THEME_GIT_PROMPT_SHA_AFTER="%{$WHITE%}]" - -# Prompt format -PROMPT=' -%{$GREEN_BOLD%}%n@%m%{$WHITE%}:%{$YELLOW%}%~%u$(parse_git_dirty)$(git_prompt_ahead)%{$RESET_COLOR%} -%{$BLUE%}>%{$RESET_COLOR%} ' -RPROMPT='%{$GREEN_BOLD%}$(current_branch)$(git_prompt_short_sha)$(git_prompt_status)%{$RESET_COLOR%}' diff --git a/themes/kardan/kardan.theme.zsh b/themes/kardan/kardan.theme.zsh deleted file mode 100644 index 59c938037..000000000 --- a/themes/kardan/kardan.theme.zsh +++ /dev/null @@ -1,12 +0,0 @@ -# Simple theme based on my old zsh settings. - -function get_host { - echo '@'`hostname`'' -} - -PROMPT='> ' -RPROMPT='%~$(git_prompt_info)$(get_host)' - -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}✗%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_PREFIX="(" -ZSH_THEME_GIT_PROMPT_SUFFIX=")" diff --git a/themes/kennethreitz/kennethreitz.theme.zsh b/themes/kennethreitz/kennethreitz.theme.zsh deleted file mode 100644 index 109be0c22..000000000 --- a/themes/kennethreitz/kennethreitz.theme.zsh +++ /dev/null @@ -1,13 +0,0 @@ -local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" - -PROMPT='%{$fg[green]%}%c \ -$(git_prompt_info)\ -%{$fg[red]%}%(!.#.»)%{$reset_color%} ' -PROMPT2='%{$fg[red]%}\ %{$reset_color%}' -RPS1='%{$fg[blue]%}%~%{$reset_color%} ${return_code} ' - -ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}:: %{$fg[yellow]%}(" -ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%} " -ZSH_THEME_GIT_PROMPT_CLEAN="" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*%{$fg[yellow]%}" - diff --git a/themes/kolo/kolo.theme.zsh b/themes/kolo/kolo.theme.zsh deleted file mode 100644 index 6e04e1595..000000000 --- a/themes/kolo/kolo.theme.zsh +++ /dev/null @@ -1,21 +0,0 @@ -autoload -U colors && colors - -autoload -Uz vcs_info - -zstyle ':vcs_info:*' stagedstr '%F{green}●' -zstyle ':vcs_info:*' unstagedstr '%F{yellow}●' -zstyle ':vcs_info:*' check-for-changes true -zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{11}%r' -zstyle ':vcs_info:*' enable git svn -precmd () { - if [[ -z $(git ls-files --other --exclude-standard 2> /dev/null) ]] { - zstyle ':vcs_info:*' formats ' [%b%c%u%B%F{green}]' - } else { - zstyle ':vcs_info:*' formats ' [%b%c%u%B%F{red}●%F{green}]' - } - - vcs_info -} - -setopt prompt_subst -PROMPT='%B%F{magenta}%c%B%F{green}${vcs_info_msg_0_}%B%F{magenta} %{$reset_color%}%% ' diff --git a/themes/kphoen/kphoen.theme.zsh b/themes/kphoen/kphoen.theme.zsh deleted file mode 100644 index 0e9b5e73c..000000000 --- a/themes/kphoen/kphoen.theme.zsh +++ /dev/null @@ -1,50 +0,0 @@ -# ------------------------------------------------------------------------------ -# FILE: kphoen.zsh-theme -# DESCRIPTION: oh-my-zsh theme file. -# AUTHOR: Kévin Gomez (geek63@gmail.com) -# VERSION: 1.0.0 -# SCREENSHOT: -# ------------------------------------------------------------------------------ - - -if [[ "$TERM" != "dumb" ]] && [[ "$DISABLE_LS_COLORS" != "true" ]]; then - PROMPT='[%{$fg[red]%}%n%{$reset_color%}@%{$fg[magenta]%}%m%{$reset_color%}:%{$fg[blue]%}%~%{$reset_color%}$(git_prompt_info)] -%# ' - - ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[green]%}" - ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" - ZSH_THEME_GIT_PROMPT_DIRTY="" - ZSH_THEME_GIT_PROMPT_CLEAN="" - - # display exitcode on the right when >0 - return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" - - RPROMPT='${return_code}$(git_prompt_status)%{$reset_color%}' - - ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} ✚" - ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} ✹" - ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖" - ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜" - ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═" - ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭" -else - PROMPT='[%n@%m:%~$(git_prompt_info)] -%# ' - - ZSH_THEME_GIT_PROMPT_PREFIX=" on" - ZSH_THEME_GIT_PROMPT_SUFFIX="" - ZSH_THEME_GIT_PROMPT_DIRTY="" - ZSH_THEME_GIT_PROMPT_CLEAN="" - - # display exitcode on the right when >0 - return_code="%(?..%? ↵)" - - RPROMPT='${return_code}$(git_prompt_status)' - - ZSH_THEME_GIT_PROMPT_ADDED=" ✚" - ZSH_THEME_GIT_PROMPT_MODIFIED=" ✹" - ZSH_THEME_GIT_PROMPT_DELETED=" ✖" - ZSH_THEME_GIT_PROMPT_RENAMED=" ➜" - ZSH_THEME_GIT_PROMPT_UNMERGED=" ═" - ZSH_THEME_GIT_PROMPT_UNTRACKED=" ✭" -fi diff --git a/themes/lambda/lambda.theme.zsh b/themes/lambda/lambda.theme.zsh deleted file mode 100644 index 63292d331..000000000 --- a/themes/lambda/lambda.theme.zsh +++ /dev/null @@ -1,6 +0,0 @@ -# ZSH Theme - Preview: http://cl.ly/350F0F0k1M2y3A2i3p1S - -PROMPT='λ %~/ $(git_prompt_info)%{$reset_color%}' - -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " diff --git a/themes/linuxonly/linuxonly b/themes/linuxonly/linuxonly deleted file mode 100644 index 335b2c4a7..000000000 --- a/themes/linuxonly/linuxonly +++ /dev/null @@ -1,80 +0,0 @@ -# vim: set ts=2 textwidth=0 - -autoload -U add-zsh-hook -autoload -Uz vcs_info -local c0=$(printf "\033[0m") -local c1=$(printf "\033[38;5;215m") -local c2=$(printf "\033[38;5;209m") -local c3=$(printf "\033[38;5;203m") -local c4=$(printf "\033[33;4m") -local c5=$(printf "\033[38;5;137m") -local c6=$(printf "\033[38;5;240m") -local c7=$(printf "\033[38;5;149m") -local c8=$(printf "\033[38;5;126m") -local c9=$(printf "\033[38;5;162m") - -local foopath=$(perl /home/scp1/bin/foopath) - -if [ "$TERM" = "linux" ]; then - c1=$(printf "\033[34;1m") - c2=$(printf "\033[35m") - c3=$(printf "\033[31m") - c4=$(printf "\033[31;1m") - c5=$(printf "\033[32m") - c6=$(printf "\033[32;1m") - c7=$(printf "\033[33m") - c8=$(printf "\033[33;1m") - c9=$(printf "\033[34m") -fi - -#local newtv=$(perl $HOME/devel/newtv.pl) -local newtv='' - -zstyle ':vcs_info:*' actionformats \ - '%{$c8%}(%f%s)%{$c7%}-%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f ' -zstyle ':vcs_info:*' formats \ - "%{$c8%}%s%{$c7%}:%{$c7%}(%{$c9%}%b%{$c7%})%f " -zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r' -zstyle ':vcs_info:*' enable git - -add-zsh-hook precmd prompt_jnrowe_precmd - -prompt_jnrowe_precmd () { - vcs_info - - if [ "${vcs_info_msg_0_}" = "" ]; then - #dir_status="|%F{3}%n%F{7}@%F{3}%m%F{7}:%F{9}%l%f" - #dir_status="$c1%n%F{7}@%F{9}%m%F{7}:%F{12}%/" - dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$c4%}%/ %{$c0%}(%{$c5%}%?%{$c0%})" - #dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$foopath%} %{$c0%}(%{$c5%}%?%{$c0%})" - - PROMPT='%{$fg_bold[green]%}%p%{$reset_color%}${vcs_info_msg_0_}${dir_status} ${ret_status}%{$reset_color%} -> ' - elif [[ $(git diff --cached --name-status 2>/dev/null ) != "" ]]; then - dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$c4%}%/ %{$c0%}(%{$c5%}%?%{$c0%})" - PROMPT='${vcs_info_msg_0_} -%{$fg_bold[green]%}%p%{$reset_color%}${dir_status} ${vcs_info_msg_0_}%{$reset_color%} -> ' - - elif [[ $(git diff --name-status 2>/dev/null ) != "" ]]; then - dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$c4%}%/ %{$c0%}(%{$c5%}%?%{$c0%})" - - PROMPT='${vcs_info_msg_0_} -%{$fg_bold[green]%}%p%{$reset_color%}${dir_status}%{$reset_color%} -%{$c9%}·>%{$c0%} ' - else - dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$c4%}%/ %{$c0%}(%{$c5%}%?%{$c0%})" - PROMPT='${vcs_info_msg_0_} -%{$fg_bold[green]%}%p%{$reset_color%}${dir_status} ${vcs_info_msg_0_}%{$reset_color%} -> ' - - fi -} - - -#PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$reset_color%} ${vcs_info_msg_0_}${dir_status}%{$reset_color%} -#> ' - -# vim: set ft=zsh ts=4 sw=4 et: - - diff --git a/themes/lukerandall/lukerandall.theme.zsh b/themes/lukerandall/lukerandall.theme.zsh deleted file mode 100644 index 24a0612b7..000000000 --- a/themes/lukerandall/lukerandall.theme.zsh +++ /dev/null @@ -1,10 +0,0 @@ -# ZSH Theme - Preview: http://cl.ly/f701d00760f8059e06dc -# Thanks to gallifrey, upon whose theme this is based - -local return_code="%(?..%{$fg_bold[red]%}%? ↵%{$reset_color%})" - -PROMPT='%{$fg_bold[green]%}%n@%m%{$reset_color%} %{$fg_bold[blue]%}%2~%{$reset_color%} $(git_prompt_info)%{$reset_color%}%B»%b ' -RPS1="${return_code}" - -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}(" -ZSH_THEME_GIT_PROMPT_SUFFIX=") %{$reset_color%}" diff --git a/themes/macovsky-ruby/macovsky-ruby.theme.zsh b/themes/macovsky-ruby/macovsky-ruby.theme.zsh deleted file mode 100644 index 4eb410233..000000000 --- a/themes/macovsky-ruby/macovsky-ruby.theme.zsh +++ /dev/null @@ -1,8 +0,0 @@ -# ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png -local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" - -PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(~/.rvm/bin/rvm-prompt i v)› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b ' -RPS1="${return_code}" - -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹" -ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}" diff --git a/themes/macovsky/macovsky.theme.zsh b/themes/macovsky/macovsky.theme.zsh deleted file mode 100644 index 4eb410233..000000000 --- a/themes/macovsky/macovsky.theme.zsh +++ /dev/null @@ -1,8 +0,0 @@ -# ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png -local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" - -PROMPT='%{$fg[green]%}%~%{$reset_color%} %{$fg[red]%}‹$(~/.rvm/bin/rvm-prompt i v)› %{$reset_color%} $(git_prompt_info)%{$reset_color%}%B$%b ' -RPS1="${return_code}" - -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹" -ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}" diff --git a/themes/maran/maran.theme.zsh b/themes/maran/maran.theme.zsh deleted file mode 100644 index 6fba04688..000000000 --- a/themes/maran/maran.theme.zsh +++ /dev/null @@ -1,6 +0,0 @@ -# Theme with full path names and hostname -# Handy if you work on different servers all the time; -PROMPT='%{$fg[cyan]%}%n%{$reset_color%}@%{$fg[yellow]%}%M:%{$fg[green]%}%/%{$reset_color%} $(git_prompt_info) %(!.#.$) ' - -ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[cyan]%}git:(" -ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%}" diff --git a/themes/mgutz/mgutz.theme.zsh b/themes/mgutz/mgutz.theme.zsh deleted file mode 100644 index dcf327041..000000000 --- a/themes/mgutz/mgutz.theme.zsh +++ /dev/null @@ -1,6 +0,0 @@ -PROMPT='%{$fg_bold[magenta]%}%1~$(git_prompt_info) %{$fg_bold[magenta]%}%# %{$reset_color%}' - -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[yellow]%}[" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DIRTY="*]" -ZSH_THEME_GIT_PROMPT_CLEAN="]" diff --git a/themes/mikeh/mikeh.theme.zsh b/themes/mikeh/mikeh.theme.zsh deleted file mode 100644 index e611b6832..000000000 --- a/themes/mikeh/mikeh.theme.zsh +++ /dev/null @@ -1,23 +0,0 @@ -setopt prompt_subst -autoload colors -colors - -autoload -U add-zsh-hook -autoload -Uz vcs_info - -# check-for-changes can be really slow. -# you should disable it, if you work with large repositories -zstyle ':vcs_info:*:prompt:*' check-for-changes true - -add-zsh-hook precmd mikeh_precmd - -mikeh_precmd() { - vcs_info -} - -# 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 -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{"%a %b %d, %I:%M"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} -%{\e[0;34m%}%B..%B[%{\e[1;35m%}$%{\e[0;34m%}%B] <($vcs_info_msg_0_)>%{\e[0m%}%b ' -PS2=$' \e[0;34m%}%B>%{\e[0m%}%b ' diff --git a/themes/miloshadzic/miloshadzic.theme.zsh b/themes/miloshadzic/miloshadzic.theme.zsh deleted file mode 100644 index ad5394423..000000000 --- a/themes/miloshadzic/miloshadzic.theme.zsh +++ /dev/null @@ -1,8 +0,0 @@ -# Yay! High voltage and arrows! - -ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[green]%}" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}⚡%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_CLEAN="" - -PROMPT='%{$fg[cyan]%}%1~%{$reset_color%}%{$fg[red]%}|%{$reset_color%}$(git_prompt_info)%{$fg[cyan]%}⇒%{$reset_color%} ' diff --git a/themes/mrtazz/mrtazz.theme.zsh b/themes/mrtazz/mrtazz.theme.zsh deleted file mode 100644 index 214ba5a47..000000000 --- a/themes/mrtazz/mrtazz.theme.zsh +++ /dev/null @@ -1,7 +0,0 @@ -PROMPT='%{$fg_bold[red]%}%m%{$reset_color%}:%{$fg[cyan]%}%c%{$reset_color%}:%# ' -RPROMPT='%{$fg_bold[green]%}$(git_prompt_info)%{$reset_color%}% ' - -ZSH_THEME_GIT_PROMPT_PREFIX="<%{$fg[red]%}" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%} %{$fg[yellow]%}✗%{$fg[green]%}>%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%}>" diff --git a/themes/murilasso/murilasso.theme.zsh b/themes/murilasso/murilasso.theme.zsh deleted file mode 100644 index 310357b45..000000000 --- a/themes/murilasso/murilasso.theme.zsh +++ /dev/null @@ -1,14 +0,0 @@ -local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" -local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}' -local current_dir='%{$terminfo[bold]$fg[blue]%}%~%{$reset_color%}' -local rvm_ruby='%{$fg[red]%}$(rvm_prompt_info)%{$reset_color%}' -local git_branch='%{$fg[blue]%}$(git_prompt_info)%{$reset_color%}' - -PROMPT="${user_host}:${current_dir} ${rvm_ruby} -${git_branch} %B$%b " -RPS1="${return_code}" - -ZSH_THEME_GIT_PROMPT_PREFIX="" -ZSH_THEME_GIT_PROMPT_SUFFIX="" -ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}✗%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_CLEAN=" %{$fg[green]%}✔%{$reset_color%}" diff --git a/themes/muse/muse.theme.zsh b/themes/muse/muse.theme.zsh deleted file mode 100644 index 4bd8fb825..000000000 --- a/themes/muse/muse.theme.zsh +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env zsh -#local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" - -setopt promptsubst - -autoload -U add-zsh-hook - -PROMPT_SUCCESS_COLOR=$FG[117] -PROMPT_FAILURE_COLOR=$FG[124] -PROMPT_VCS_INFO_COLOR=$FG[242] -PROMPT_PROMPT=$FG[077] -GIT_DIRTY_COLOR=$FG[133] -GIT_CLEAN_COLOR=$FG[118] -GIT_PROMPT_INFO=$FG[012] - -PROMPT='%{$PROMPT_SUCCESS_COLOR%}%~%{$reset_color%} %{$GIT_PROMPT_INFO%}$(git_prompt_info)%{$GIT_DIRTY_COLOR%}$(git_prompt_status) %{$reset_color%}%{$PROMPT_PROMPT%}ᐅ%{$reset_color%} ' - -#RPS1="${return_code}" - -ZSH_THEME_GIT_PROMPT_PREFIX="(" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$GIT_PROMPT_INFO%})" -ZSH_THEME_GIT_PROMPT_DIRTY=" %{$GIT_DIRTY_COLOR%}✘" -ZSH_THEME_GIT_PROMPT_CLEAN=" %{$GIT_CLEAN_COLOR%}✔" - -ZSH_THEME_GIT_PROMPT_ADDED="%{$FG[082]%}✚%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_MODIFIED="%{$FG[166]%}✹%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DELETED="%{$FG[160]%}✖%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_RENAMED="%{$FG[220]%}➜%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_UNMERGED="%{$FG[082]%}═%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$FG[190]%}✭%{$reset_color%}" diff --git a/themes/nanotech/nanotech.theme.zsh b/themes/nanotech/nanotech.theme.zsh deleted file mode 100644 index 5d3331639..000000000 --- a/themes/nanotech/nanotech.theme.zsh +++ /dev/null @@ -1,7 +0,0 @@ -PROMPT='%F{green}%2c%F{blue} [%f ' -RPROMPT='$(git_prompt_info) %F{blue}] %F{green}%D{%L:%M} %F{yellow}%D{%p}%f' - -ZSH_THEME_GIT_PROMPT_PREFIX="%F{yellow}" -ZSH_THEME_GIT_PROMPT_SUFFIX="%f" -ZSH_THEME_GIT_PROMPT_DIRTY=" %F{red}*%f" -ZSH_THEME_GIT_PROMPT_CLEAN="" diff --git a/themes/nebirhos/nebirhos.theme.zsh b/themes/nebirhos/nebirhos.theme.zsh deleted file mode 100644 index c49df972e..000000000 --- a/themes/nebirhos/nebirhos.theme.zsh +++ /dev/null @@ -1,17 +0,0 @@ -# Based on robbyrussell's theme, with host and rvm indicators. Example: -# @host ➜ currentdir rvm:(rubyversion@gemset) git:(branchname) - -# Get the current ruby version in use with RVM: -if [ -e ~/.rvm/bin/rvm-prompt ]; then - RUBY_PROMPT_="%{$fg_bold[blue]%}rvm:(%{$fg[green]%}\$(~/.rvm/bin/rvm-prompt s i v g)%{$fg_bold[blue]%})%{$reset_color%} " -fi - -# Get the host name (first 4 chars) -HOST_PROMPT_="%{$fg_bold[red]%}@$HOST[0,4] ➜ %{$fg_bold[cyan]%}%c " -GIT_PROMPT="%{$fg_bold[blue]%}\$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}" -PROMPT="$HOST_PROMPT_$RUBY_PROMPT_$GIT_PROMPT" - -ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" diff --git a/themes/obraun/obraun.theme.zsh b/themes/obraun/obraun.theme.zsh deleted file mode 100644 index 08d137665..000000000 --- a/themes/obraun/obraun.theme.zsh +++ /dev/null @@ -1,11 +0,0 @@ -if [ "$(whoami)" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="blue"; fi - -local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" - -PROMPT='%{$fg[green]%}[%*]%{$reset_color%} %{$fg_no_bold[cyan]%}%n %{${fg_bold[blue]}%}::%{$reset_color%} %{$fg[yellow]%}%m%{$reset_color%} %{$fg_no_bold[magenta]%} ➜ %{$reset_color%} %{${fg[green]}%}%3~ $(git_prompt_info)%{${fg_bold[$CARETCOLOR]}%}»%{${reset_color}%} ' - -RPS1="${return_code}" - -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[red]%}‹" -ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}" - diff --git a/themes/philips/philips.theme.zsh b/themes/philips/philips.theme.zsh deleted file mode 100644 index e7ea51a2f..000000000 --- a/themes/philips/philips.theme.zsh +++ /dev/null @@ -1,14 +0,0 @@ -if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="green"; fi - -PROMPT='%{$fg[$NCOLOR]%}%B%n%b%{$reset_color%}:%{$fg[blue]%}%B%c/%b%{$reset_color%} $(git_prompt_info)%(!.#.$) ' -RPROMPT='[%*]' - -# git theming -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}(%{$fg_no_bold[red]%}%B" -ZSH_THEME_GIT_PROMPT_SUFFIX="%b%{$fg_bold[blue]%})%{$reset_color%} " -ZSH_THEME_GIT_PROMPT_CLEAN="" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%}" - -# LS colors, made with http://geoff.greer.fm/lscolors/ -export LSCOLORS="Gxfxcxdxbxegedabagacad" -export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:' diff --git a/themes/pmcgee/pmcgee.theme.zsh b/themes/pmcgee/pmcgee.theme.zsh deleted file mode 100644 index e4e45c71a..000000000 --- a/themes/pmcgee/pmcgee.theme.zsh +++ /dev/null @@ -1,16 +0,0 @@ -if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="green"; fi - -PROMPT=' -%{$fg[$NCOLOR]%}%B%n@%m%b%{$reset_color%} %{$fg[white]%}%B${PWD/#$HOME/~}%b%{$reset_color%} -$(git_prompt_info)%(!.#.$) ' -RPROMPT='[%*]' - -# git theming -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_no_bold[yellow]%}%B" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " -ZSH_THEME_GIT_PROMPT_CLEAN="" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%}*" - -# LS colors, made with http://geoff.greer.fm/lscolors/ -export LSCOLORS="Gxfxcxdxbxegedabagacad" -export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:' diff --git a/themes/re5et/re5et.theme.zsh b/themes/re5et/re5et.theme.zsh deleted file mode 100644 index 5bded76a3..000000000 --- a/themes/re5et/re5et.theme.zsh +++ /dev/null @@ -1,15 +0,0 @@ -if [ "$(whoami)" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="magenta"; fi - -local return_code="%(?..%{$fg_bold[red]%}:( %?%{$reset_color%})" - -PROMPT=' -%{$fg_bold[cyan]%}%n%{$reset_color%}%{$fg[yellow]%}@%{$reset_color%}%{$fg_bold[blue]%}%m%{$reset_color%}:%{${fg_bold[green]}%}%~%{$reset_color%}$(git_prompt_info) -%{${fg[$CARETCOLOR]}%}%# %{${reset_color}%}' - -RPS1='${return_code} %D - %*' - -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[magenta]%}^%{$reset_color%}%{$fg_bold[yellow]%}" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%} ±" -ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ?" -ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[red]%} ♥" diff --git a/themes/rgm/rgm.theme.zsh b/themes/rgm/rgm.theme.zsh deleted file mode 100644 index 9452a8b0d..000000000 --- a/themes/rgm/rgm.theme.zsh +++ /dev/null @@ -1,8 +0,0 @@ -PROMPT=' -%n@%m %{$fg[cyan]%}%~ -%? $(git_prompt_info)%{$fg_bold[blue]%}%% %{$reset_color%}' - -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[red]%}" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}" -ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%}" diff --git a/themes/risto/risto.theme.zsh b/themes/risto/risto.theme.zsh deleted file mode 100644 index cb773a64e..000000000 --- a/themes/risto/risto.theme.zsh +++ /dev/null @@ -1,6 +0,0 @@ -# -*- sh -*- vim:set ft=sh ai et sw=4 sts=4: -# It might be bash like, but I can't have my co-workers knowing I use zsh -PROMPT='%{$fg[green]%}%n@%m:%{$fg_bold[blue]%}%2~ $(git_prompt_info)%{$reset_color%}%(!.#.$) ' - -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[red]%}‹" -ZSH_THEME_GIT_PROMPT_SUFFIX="›%{$reset_color%}" diff --git a/themes/rixius/rixius.theme.zsh b/themes/rixius/rixius.theme.zsh deleted file mode 100644 index 7e7c9c633..000000000 --- a/themes/rixius/rixius.theme.zsh +++ /dev/null @@ -1,24 +0,0 @@ -# /|/ Code by Stephen -# /|/ "Rixius" Middleton -# -# name in folder (github) -# ± if in github repo, or ≥ if otherwise Time in 24-hour format is on right. -function collapse_pwd { - echo $(pwd | sed -e "s,^$HOME,~,") -} -function prompt_char { - echo -n "%{$bg[white]%}%{$fg[red]%}" - git branch >/dev/null 2>/dev/null && echo "±%{$reset_color%}" && return - echo "≥%{$reset_color%}" -} -RIXIUS_PRE="%{$bg[white]%}%{$fg[red]%}" - -PROMPT=' -%{$RIXIUS_PRE%}%n%{$reset_color%} in %{$fg_bold[green]%}$(collapse_pwd)%{$reset_color%}$(git_prompt_info) -$(prompt_char) ' -RPROMPT='%{$RIXIUS_PRE%}%T%{$reset_color%}' - -ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DIRTY=" %{$RIXIUS_PRE%}!%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_CLEAN=" %{$RIXIUS_PRE%}√%{$reset_color%}" diff --git a/themes/robbyrussell/robbyrussell.theme.zsh b/themes/robbyrussell/robbyrussell.theme.zsh deleted file mode 100644 index 7b524e82d..000000000 --- a/themes/robbyrussell/robbyrussell.theme.zsh +++ /dev/null @@ -1,6 +0,0 @@ -PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' - -ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" diff --git a/themes/simple/simple.theme.zsh b/themes/simple/simple.theme.zsh deleted file mode 100644 index a88d9d72a..000000000 --- a/themes/simple/simple.theme.zsh +++ /dev/null @@ -1,6 +0,0 @@ -PROMPT='%{$fg[green]%}%~%{$fg_bold[blue]%}$(git_prompt_info)%{$reset_color%} ' - -ZSH_THEME_GIT_PROMPT_PREFIX="(" -ZSH_THEME_GIT_PROMPT_SUFFIX=")" -ZSH_THEME_GIT_PROMPT_DIRTY=" ✗" -ZSH_THEME_GIT_PROMPT_CLEAN=" ✔" diff --git a/themes/skaro/skaro.theme.zsh b/themes/skaro/skaro.theme.zsh deleted file mode 100644 index 84b7b11b0..000000000 --- a/themes/skaro/skaro.theme.zsh +++ /dev/null @@ -1,7 +0,0 @@ -PROMPT='%{$fg_bold[green]%}%h %{$fg[cyan]%}%2~ %{$fg_bold[blue]%}$(git_prompt_info) %{$reset_color%}» ' - -ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" - diff --git a/themes/smt/smt.theme.zsh b/themes/smt/smt.theme.zsh deleted file mode 100644 index 7a287523e..000000000 --- a/themes/smt/smt.theme.zsh +++ /dev/null @@ -1,91 +0,0 @@ -# ----------------------------------------------------------------------------- -# FILE: smt.zsh-theme -# DESCRIPTION: oh-my-zsh theme file, based on dogenpunk by Matthew Nelson. -# AUTHOR: Stephen Tudor (stephen@tudorstudio.com -# VERSION: 0.1 -# SCREENSHOT: coming soon -# ----------------------------------------------------------------------------- - -MODE_INDICATOR="%{$fg_bold[red]%}❮%{$reset_color%}%{$fg[red]%}❮❮%{$reset_color%}" -local return_status="%{$fg[red]%}%(?..⏎)%{$reset_color%} " - -ZSH_THEME_GIT_PROMPT_PREFIX="|" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%}⚡%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_AHEAD="%{$fg_bold[red]%}!%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%}✓%{$reset_color%}" - -ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} ✚" -ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} ✹" -ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖" -ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜" -ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═" -ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭" - -# Format for git_prompt_long_sha() and git_prompt_short_sha() -ZSH_THEME_GIT_PROMPT_SHA_BEFORE="➤ %{$fg_bold[yellow]%}" -ZSH_THEME_GIT_PROMPT_SHA_AFTER="%{$reset_color%}" - -function prompt_char() { - git branch >/dev/null 2>/dev/null && echo "%{$fg[green]%}±%{$reset_color%}" && return - hg root >/dev/null 2>/dev/null && echo "%{$fg_bold[red]%}☿%{$reset_color%}" && return - echo "%{$fg[cyan]%}◯%{$reset_color%}" -} - -# Colors vary depending on time lapsed. -ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT="%{$fg[green]%}" -ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM="%{$fg[yellow]%}" -ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG="%{$fg[red]%}" -ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[cyan]%}" - -# Determine the time since last commit. If branch is clean, -# use a neutral color, otherwise colors will vary according to time. -function git_time_since_commit() { - if git rev-parse --git-dir > /dev/null 2>&1; then - # Only proceed if there is actually a commit. - if [[ $(git log 2>&1 > /dev/null | grep -c "^fatal: bad default revision") == 0 ]]; then - # Get the last commit. - last_commit=`git log --pretty=format:'%at' -1 2> /dev/null` - now=`date +%s` - seconds_since_last_commit=$((now-last_commit)) - - # Totals - MINUTES=$((seconds_since_last_commit / 60)) - HOURS=$((seconds_since_last_commit/3600)) - - # Sub-hours and sub-minutes - DAYS=$((seconds_since_last_commit / 86400)) - SUB_HOURS=$((HOURS % 24)) - SUB_MINUTES=$((MINUTES % 60)) - - if [[ -n $(git status -s 2> /dev/null) ]]; then - if [ "$MINUTES" -gt 30 ]; then - COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG" - elif [ "$MINUTES" -gt 10 ]; then - COLOR="$ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM" - else - COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT" - fi - else - COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL" - fi - - if [ "$HOURS" -gt 24 ]; then - echo "[$COLOR${DAYS}d${SUB_HOURS}h${SUB_MINUTES}m%{$reset_color%}]" - elif [ "$MINUTES" -gt 60 ]; then - echo "[$COLOR${HOURS}h${SUB_MINUTES}m%{$reset_color%}]" - else - echo "[$COLOR${MINUTES}m%{$reset_color%}]" - fi - else - COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL" - echo "[$COLOR~]" - fi - fi -} - -PROMPT=' -%{$fg[blue]%}%m%{$reset_color%} 福 %{$fg[cyan]%}%~ %{$reset_color%}$(git_prompt_short_sha)$(git_prompt_info) -%{$fg[red]%}%!%{$reset_color%} $(prompt_char) : ' - -RPROMPT='${return_status}$(git_time_since_commit)$(git_prompt_status)%{$reset_color%}' diff --git a/themes/sporty_256/sporty_256.theme.zsh b/themes/sporty_256/sporty_256.theme.zsh deleted file mode 100644 index db0fc4277..000000000 --- a/themes/sporty_256/sporty_256.theme.zsh +++ /dev/null @@ -1,13 +0,0 @@ -# zsh theme requires 256 color enabled terminal -# i.e TERM=xterm-256color -# Preview - http://www.flickr.com/photos/adelcampo/4556482563/sizes/o/ -# based on robbyrussell's shell but louder! - -PROMPT='%{$fg_bold[blue]%}$(git_prompt_info) %F{208}%c%f -%{$fg_bold[white]%}%# %{$reset_color%}' -RPROMPT='%B%F{208}%n%f%{$fg_bold[white]%}@%F{039}%m%f%{$reset_color%}' - -ZSH_THEME_GIT_PROMPT_PREFIX="%F{154}±|%f%F{124}" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}%B✘%b%F{154}|%f%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_CLEAN=" %{$fg[green]%}✔%F{154}|" diff --git a/themes/sunaku/sunaku.theme.zsh b/themes/sunaku/sunaku.theme.zsh deleted file mode 100644 index 440fa90b4..000000000 --- a/themes/sunaku/sunaku.theme.zsh +++ /dev/null @@ -1,26 +0,0 @@ -# Git-centric variation of the "fishy" theme. -# See screenshot at http://ompldr.org/vOHcwZg - -ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%}+" -ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[magenta]%}!" -ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%}-" -ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%}>" -ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[cyan]%}#" -ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[yellow]%}?" - -ZSH_THEME_GIT_PROMPT_PREFIX="" -ZSH_THEME_GIT_PROMPT_SUFFIX=" " -ZSH_THEME_GIT_PROMPT_DIRTY="" -ZSH_THEME_GIT_PROMPT_CLEAN="" - -local user_color='green' -test $UID -eq 0 && user_color='red' - -PROMPT='%(?..%{$fg_bold[red]%}exit %? -%{$reset_color%})'\ -'%{$bold_color%}$(git_prompt_status)%{$reset_color%}'\ -'$(git_prompt_info)'\ -'%{$fg[$user_color]%}%~%{$reset_color%}'\ -'%(!.#.>) ' - -PROMPT2='%{$fg[red]%}\ %{$reset_color%}' diff --git a/themes/takashiyoshida/takashiyoshida.theme.zsh b/themes/takashiyoshida/takashiyoshida.theme.zsh deleted file mode 100644 index 419a8cf3f..000000000 --- a/themes/takashiyoshida/takashiyoshida.theme.zsh +++ /dev/null @@ -1,27 +0,0 @@ -# -# PROMPT -# -PROMPT_BRACKET_BEGIN='%{$fg_bold[white]%}[' -PROMPT_HOST='%{$fg_bold[cyan]%}%m' -PROMPT_SEPARATOR='%{$reset_color%}:' -PROMPT_DIR='%{$fg_bold[yellow]%}%c' -PROMPT_BRACKET_END='%{$fg_bold[white]%}]' - -PROMPT_USER='%{$fg_bold[white]%}%n' -PROMPT_SIGN='%{$reset_color%}%#' - -GIT_PROMPT_INFO='$(git_prompt_info)' - -# My current prompt looks like: -# [host:current_dir] (git_prompt_info) -# [username]% -PROMPT="${PROMPT_BRACKET_BEGIN}${PROMPT_HOST}${PROMPT_SEPARATOR}${PROMPT_DIR}${PROMPT_BRACKET_END}${GIT_PROMPT_INFO} -${PROMPT_BRACKET_BEGIN}${PROMPT_USER}${PROMPT_BRACKET_END}${PROMPT_SIGN} " - -# -# Git repository -# -ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}!" -ZSH_THEME_GIT_PROMPT_CLEAN='' diff --git a/themes/theunraveler/theunraveler.theme.zsh b/themes/theunraveler/theunraveler.theme.zsh deleted file mode 100644 index a896970df..000000000 --- a/themes/theunraveler/theunraveler.theme.zsh +++ /dev/null @@ -1,16 +0,0 @@ -# Comment - -PROMPT='%{$fg[magenta]%}[%c] %{$reset_color%}' - -RPROMPT='%{$fg[magenta]%}$(git_prompt_info)%{$reset_color%} $(git_prompt_status)%{$reset_color%}' - -ZSH_THEME_GIT_PROMPT_PREFIX="" -ZSH_THEME_GIT_PROMPT_SUFFIX="" -ZSH_THEME_GIT_PROMPT_DIRTY="" -ZSH_THEME_GIT_PROMPT_CLEAN="" -ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[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]%} ✱" diff --git a/themes/tjkirch/tjkirch.theme.zsh b/themes/tjkirch/tjkirch.theme.zsh deleted file mode 100644 index 446cde724..000000000 --- a/themes/tjkirch/tjkirch.theme.zsh +++ /dev/null @@ -1,15 +0,0 @@ -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%}' diff --git a/themes/tonotdo/tonotdo.theme.zsh b/themes/tonotdo/tonotdo.theme.zsh deleted file mode 100644 index 52670e8a5..000000000 --- a/themes/tonotdo/tonotdo.theme.zsh +++ /dev/null @@ -1,12 +0,0 @@ -PROMPT='%{$fg_no_bold[cyan]%}%n%{$fg_no_bold[magenta]%}➜%{$fg_no_bold[green]%}%3~$(git_prompt_info)%{$reset_color%}» ' -RPROMPT='[%*]' - -# git theming -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}(%{$fg_no_bold[red]%}" -ZSH_THEME_GIT_PROMPT_SUFFIX="" -ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[blue]%})" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[yellow]%}✗%{$fg_bold[blue]%})" - -# LS colors, made with http://geoff.greer.fm/lscolors/ -export LSCOLORS="Gxfxcxdxbxegedabagacad" -export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:' diff --git a/themes/trapd00r/trapd00r.theme.zsh b/themes/trapd00r/trapd00r.theme.zsh deleted file mode 100644 index cba14c42c..000000000 --- a/themes/trapd00r/trapd00r.theme.zsh +++ /dev/null @@ -1,95 +0,0 @@ -# Name: trapd00r zsh theme -# Author: Magnus Woldrich -# -# This theme needs a terminal supporting 256 colors as well as unicode. It also -# needs the script that splits up the current path and makes it fancy as located -# here: https://github.com/trapd00r/utils/blob/master/zsh_path -# -# By default it spans over two lines like so: -# -# scp1@shiva:pts/9-> /home » scp1 (0) -# > -# -# that's user@host:pts/-> splitted path (return status) -# -# If the current directory is a git repository, we span 3 lines; -# -# git❨ master ❩ DIRTY -# scp1@shiva:pts/4-> /home » scp1 » dev » utils (0) -# > - -autoload -U add-zsh-hook -autoload -Uz vcs_info - -local c0=$( printf "\e[m") -local c1=$( printf "\e[38;5;245m") -local c2=$( printf "\e[38;5;250m") -local c3=$( printf "\e[38;5;242m") -local c4=$( printf "\e[38;5;197m") -local c5=$( printf "\e[38;5;225m") -local c6=$( printf "\e[38;5;240m") -local c7=$( printf "\e[38;5;242m") -local c8=$( printf "\e[38;5;244m") -local c9=$( printf "\e[38;5;162m") -local c10=$(printf "\e[1m") -local c11=$(printf "\e[38;5;208m\e[1m") -local c12=$(printf "\e[38;5;142m\e[1m") -local c13=$(printf "\e[38;5;196m\e[1m") - - -# We dont want to use the extended colorset in the TTY / VC. -if [ "$TERM" = "linux" ]; then - c1=$( printf "\e[34;1m") - c2=$( printf "\e[35m") - c3=$( printf "\e[31m") - c4=$( printf "\e[31;1m") - c5=$( printf "\e[32m") - c6=$( printf "\e[32;1m") - c7=$( printf "\e[33m") - c8=$( printf "\e[33;1m") - c9=$( printf "\e[34m") - - c11=$(printf "\e[35;1m") - c12=$(printf "\e[36m") - c13=$(printf "\e[31;1m") -fi - -zstyle ':vcs_info:*' actionformats \ - '%{$c8%}(%f%s)%{$c7%}-%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f ' - -zstyle ':vcs_info:*' formats \ - "%{$c8%}%s%%{$c7%}❨ %{$c9%}%{$c11%}%b%{$c7%} ❩%{$reset_color%}%f " - -zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r' -zstyle ':vcs_info:*' enable git - -add-zsh-hook precmd prompt_jnrowe_precmd - -prompt_jnrowe_precmd () { - vcs_info - if [ "${vcs_info_msg_0_}" = "" ]; then - dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})" - PROMPT='%{$fg_bold[green]%}%p%{$reset_color%}${vcs_info_msg_0_}${dir_status} ${ret_status}%{$reset_color%} -> ' - -# modified, to be commited - elif [[ $(git diff --cached --name-status 2>/dev/null ) != "" ]]; then - dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})" - PROMPT='${vcs_info_msg_0_}%{$30%} %{$bg_bold[red]%}%{$fg_bold[cyan]%}C%{$fg_bold[black]%}OMMIT%{$reset_color%} -%{$fg_bold[green]%}%p%{$reset_color%}${dir_status}%{$reset_color%} -> ' - - elif [[ $(git diff --name-status 2>/dev/null ) != "" ]]; then - dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})" - PROMPT='${vcs_info_msg_0_}%{$bg_bold[red]%}%{$fg_bold[blue]%}D%{$fg_bold[black]%}IRTY%{$reset_color%} -%{$fg_bold[green]%}%p%{$reset_color%}${dir_status}%{$reset_color%} -%{$c13%}>%{$c0%} ' - else - dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})" - PROMPT='${vcs_info_msg_0_} -%{$fg_bold[green]%}%p%{$reset_color%}${dir_status} ${vcs_info_msg_0_}%{$reset_color%} -> ' -fi -} - -# vim: set ft=zsh sw=2 et tw=0: diff --git a/themes/wezm+/wezm+.theme.zsh b/themes/wezm+/wezm+.theme.zsh deleted file mode 100644 index fee3eb08e..000000000 --- a/themes/wezm+/wezm+.theme.zsh +++ /dev/null @@ -1,7 +0,0 @@ -PROMPT='%{${fg_bold[yellow]}%}%n%{$reset_color%}%{${fg[yellow]}%}@%m%{$reset_color%} $(git_prompt_info)%(?,,%{${fg_bold[white]}%}[%?]%{$reset_color%} )%{$fg[yellow]%}%#%{$reset_color%} ' -RPROMPT='%{$fg[green]%}%~%{$reset_color%}' - -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[blue]%}(" -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]%})" diff --git a/themes/wezm/wezm.theme.zsh b/themes/wezm/wezm.theme.zsh deleted file mode 100644 index 1881343b0..000000000 --- a/themes/wezm/wezm.theme.zsh +++ /dev/null @@ -1,7 +0,0 @@ -PROMPT='$(git_prompt_info)%(?,,%{${fg_bold[white]}%}[%?]%{$reset_color%} )%{$fg[yellow]%}%#%{$reset_color%} ' -RPROMPT='%{$fg[green]%}%~%{$reset_color%}' - -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[blue]%}(" -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]%})" diff --git a/themes/xiong-chiamiov-plus/xiong-chiamiov-plus.theme.zsh b/themes/xiong-chiamiov-plus/xiong-chiamiov-plus.theme.zsh deleted file mode 100644 index 095dae290..000000000 --- a/themes/xiong-chiamiov-plus/xiong-chiamiov-plus.theme.zsh +++ /dev/null @@ -1,6 +0,0 @@ -# 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 -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{"%a %b %d, %I:%M"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} -%{\e[0;34m%}%B└─%B[%{\e[1;35m%}$%{\e[0;34m%}%B] <$(git_prompt_info)>%{\e[0m%}%b ' -PS2=$' \e[0;34m%}%B>%{\e[0m%}%b ' diff --git a/themes/xiong-chiamiov/xiong-chiamiov.theme.zsh b/themes/xiong-chiamiov/xiong-chiamiov.theme.zsh deleted file mode 100644 index 7c4c2e4f8..000000000 --- a/themes/xiong-chiamiov/xiong-chiamiov.theme.zsh +++ /dev/null @@ -1,6 +0,0 @@ -# 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 -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{"%a %b %d, %I:%M"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} -%{\e[0;34m%}%B└─%B[%{\e[1;35m%}$%{\e[0;34m%}%B]>%{\e[0m%}%b ' -PS2=$' \e[0;34m%}%B>%{\e[0m%}%b ' From 94656ce760bec0198fad61f079672ac4f0aab32b Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sat, 16 Jul 2011 21:43:51 -0400 Subject: [PATCH 469/614] Fixed terminal window/tab title. --- functions/terminal.zsh | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/functions/terminal.zsh b/functions/terminal.zsh index e75137ab7..bdd71cc49 100644 --- a/functions/terminal.zsh +++ b/functions/terminal.zsh @@ -13,34 +13,43 @@ fi # Fully supports GNU Screen, iTerm, and most modern xterm and rxvt terminals. # Partially supports Mac OS X Terminal since it can't set window and tab separately. # Usage: title "tab title" "window title" -function title { +function terminal-title { if [[ "$DISABLE_AUTO_TITLE" != 'true' ]]; then if [[ "$TERM" == screen* ]]; then # Set GNU Screen's hardstatus (usually truncated at 20 characters). - print -Pn "\ek$1:q\e\\" + printf "\ek%s\e\\" ${(V)1} elif [[ "$TERM" == xterm* ]] || [[ "$TERM" == rxvt* ]]; then # Set the window title. - print -Pn "\e]2;$2:q\a" + printf "\e]2;%s\a" ${(V)2} # Set the tab title (will override window title on a broken terminal). - print -Pn "\e]1;$1:q\a" + printf "\e]1;%s\a" ${(V)1} fi fi } -# 15 character, left-truncated current working directory. -ZSH_THEME_TERM_TAB_TITLE_IDLE="%15<..<%~%<<" -ZSH_THEME_TERM_TITLE_IDLE="%n@%m: %~" +# Don't override precmd/preexec, append to hook array. +autoload -Uz add-zsh-hook # Set the tab and window titles before the prompt is displayed. -function precmd { - title "$ZSH_THEME_TERM_TAB_TITLE_IDLE" "$ZSH_THEME_TERM_TITLE_IDLE" +function terminal-title-precmd { + # 15 character, left-truncated current working directory. + local terminal_tab_title="${(%):-%15<...<%~%<<}" + local terminal_window_title="${(%):-%n@%m: %~}" + terminal-title "$terminal_tab_title" "$terminal_window_title" } +add-zsh-hook precmd terminal-title-precmd # Set the tab and window titles before command execution. -function preexec { +function terminal-title-preexec { emulate -L zsh setopt extended_glob # Command name only, or if this is sudo or ssh, the next command. local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]} - title "$CMD" "%100>...>$2%<<" + local trimmed="${2[1,100]}" + if [[ "$2" != "$trimmed" ]]; then + trimmed="${trimmed}..." + fi + terminal-title "$CMD" "$trimmed" } +add-zsh-hook preexec terminal-title-preexec + From d5ba17feacbfbdc3a1f1ce6d57aab102ff3efe2e Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sun, 17 Jul 2011 20:15:51 -0400 Subject: [PATCH 470/614] Converted OMZ themes to native ZSH themes. --- functions/appearance.zsh | 16 ---- oh-my-zsh.zsh | 21 +---- templates/zshrc.template.zsh | 19 ++--- themes/minimal/minimal.theme.zsh | 15 ---- themes/minimal/prompt_minimal_setup | 35 ++++++++ themes/nicoulaj/nicoulaj.theme.zsh | 43 ---------- themes/nicoulaj/prompt_nicoulaj_setup | 47 +++++++++++ themes/sorin/prompt_sorin_setup | 34 ++++++++ themes/sorin/sorin.theme.zsh | 48 ----------- themes/steeef/prompt_steeef_setup | 110 ++++++++++++++++++++++++++ themes/steeef/steeef.theme.zsh | 100 ----------------------- 11 files changed, 240 insertions(+), 248 deletions(-) delete mode 100644 functions/appearance.zsh delete mode 100644 themes/minimal/minimal.theme.zsh create mode 100644 themes/minimal/prompt_minimal_setup delete mode 100644 themes/nicoulaj/nicoulaj.theme.zsh create mode 100644 themes/nicoulaj/prompt_nicoulaj_setup create mode 100644 themes/sorin/prompt_sorin_setup delete mode 100644 themes/sorin/sorin.theme.zsh create mode 100644 themes/steeef/prompt_steeef_setup delete mode 100644 themes/steeef/steeef.theme.zsh diff --git a/functions/appearance.zsh b/functions/appearance.zsh deleted file mode 100644 index 277274d87..000000000 --- a/functions/appearance.zsh +++ /dev/null @@ -1,16 +0,0 @@ -# Load and run colors. -autoload -U colors -colors -i - -# Set the default prompt theme. -PS1="%n@%m:%~%# " - -# Set the default Git prompt theme. -ZSH_THEME_GIT_PROMPT_PREFIX="git:(" # Prefix before the branch name. -ZSH_THEME_GIT_PROMPT_SUFFIX=")" # Suffix after the branch name. -ZSH_THEME_GIT_PROMPT_DIRTY="*" # Indicator to display if the branch is dirty. -ZSH_THEME_GIT_PROMPT_CLEAN="" # Indicator to display if the branch is clean. - -# Enable parameter, arithmentic expansion and command substitution in prompt. -setopt prompt_subst - diff --git a/oh-my-zsh.zsh b/oh-my-zsh.zsh index 67571dcbc..3980b6431 100644 --- a/oh-my-zsh.zsh +++ b/oh-my-zsh.zsh @@ -5,11 +5,8 @@ if [[ "$TERM" == 'dumb' ]]; then DISABLE_COLOR='true' fi -# Add all defined plugins to fpath. -plugin=${plugin:=()} -for plugin in $plugins; do - fpath=("$OMZ/plugins/$plugin" $fpath) -done +# Add functions to fpath. +fpath+=(${OMZ}/plugins/${^plugins} $OMZ/themes/*(/)) # Load and run compinit. autoload -Uz compinit && compinit -i @@ -26,18 +23,8 @@ for plugin in $plugins; do fi done -# Load the theme. -if [[ "$ZSH_THEME" == "random" ]]; then - themes=($OMZ/themes/**/*.theme.zsh) - theme_index=${#themes[@]} - (( theme_index=((RANDOM % theme_index) + 1) )) - random_theme="${themes[$theme_index]}" - source "$random_theme" -else - if [[ -f "$OMZ/themes/$ZSH_THEME/$ZSH_THEME.theme.zsh" ]]; then - source "$OMZ/themes/$ZSH_THEME/$ZSH_THEME.theme.zsh" - fi -fi +# Load and run the prompt theming system. +autoload -Uz promptinit && promptinit -i # Compile zcompdump, if modified, to increase startup speed. if [[ "$HOME/.zcompdump" -nt "$HOME/.zcompdump.zwc" ]] || [[ ! -e "$HOME/.zcompdump.zwc" ]]; then diff --git a/templates/zshrc.template.zsh b/templates/zshrc.template.zsh index 99b9dafe3..510fcf953 100644 --- a/templates/zshrc.template.zsh +++ b/templates/zshrc.template.zsh @@ -1,24 +1,25 @@ # Path to oh-my-zsh. -export OMZ="$HOME/.oh-my-zsh" - -# Set the name of the theme to load (see $OMZ/themes/). -# Setting it to 'random' loads a random theme. -export ZSH_THEME="robbyrussell" +OMZ="$HOME/.oh-my-zsh" # Set to 'true' to enable case-sensitivity. -export CASE_SENSITIVE='false' +CASE_SENSITIVE='false' # Set to 'true' to disable color (auto set on dumb terminals). -export DISABLE_COLOR='false' +DISABLE_COLOR='false' # Set to 'true' to disable auto setting the tab and window titles. -export DISABLE_AUTO_TITLE='false' +DISABLE_AUTO_TITLE='false' # Set the plugins to load (see $OMZ/plugins/). -# Example: plugins=(rails git textmate ruby lighthouse) +# Example: plugins=(git lighthouse rails ruby textmate) plugins=(git) +# This will make you scream: OH MY ZSH! source "$OMZ/oh-my-zsh.zsh" +# Load the prompt theme (type prompt -l to list all themes). +# Setting it to 'random' loads a random theme. +[[ "$TERM" != 'dumb' ]] && prompt sorin || prompt off + # Customize to your needs... diff --git a/themes/minimal/minimal.theme.zsh b/themes/minimal/minimal.theme.zsh deleted file mode 100644 index d3c9e3663..000000000 --- a/themes/minimal/minimal.theme.zsh +++ /dev/null @@ -1,15 +0,0 @@ -ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[white]%}[" -ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}●%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_CLEAN="" - -#Customized git status, oh-my-zsh currently does not allow render dirty status before branch -git_custom_status() { - local cb=$(current_branch) - if [ -n "$cb" ]; then - echo "- $ZSH_THEME_GIT_PROMPT_PREFIX$(current_branch)$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX" - fi -} - - -PROMPT='%2~ $(git_custom_status) »%b ' diff --git a/themes/minimal/prompt_minimal_setup b/themes/minimal/prompt_minimal_setup new file mode 100644 index 000000000..765d2fac5 --- /dev/null +++ b/themes/minimal/prompt_minimal_setup @@ -0,0 +1,35 @@ +function +vi-git-status() { + # Untracked files. + if [[ -n $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then + hook_com[unstaged]='%F{red}●%f' + fi +} + +function prompt_minimal_precmd () { + setopt noxtrace noksharrays localoptions + vcs_info +} + +function prompt_minimal_setup() { + setopt noxtrace noksharrays localoptions + prompt_opts=(cr subst percent) + + autoload -Uz add-zsh-hook + autoload -Uz vcs_info + + add-zsh-hook precmd prompt_minimal_precmd + + zstyle ':vcs_info:*' enable bzr git hg svn + zstyle ':vcs_info:*' check-for-changes true + zstyle ':vcs_info:*' stagedstr '%F{green}●%f' + zstyle ':vcs_info:*' unstagedstr '%F{yellow}●%f' + zstyle ':vcs_info:*' formats ' - [%b%c%u]' + zstyle ':vcs_info:*' actionformats " - [%b%c%u|%F{cyan}%a%f]" + zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b|%F{cyan}%r%f' + zstyle ':vcs_info:git*+set-message:*' hooks git-status + + PROMPT='%2~${vcs_info_msg_0_} » ' +} + +prompt_minimal_setup "$@" + diff --git a/themes/nicoulaj/nicoulaj.theme.zsh b/themes/nicoulaj/nicoulaj.theme.zsh deleted file mode 100644 index 333aa5e70..000000000 --- a/themes/nicoulaj/nicoulaj.theme.zsh +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env zsh -# ------------------------------------------------------------------------------ -# Prompt for the Zsh shell: -# * One line. -# * VCS info on the right prompt. -# * Only shows the path on the left prompt by default. -# * Crops the path to a defined length and only shows the path relative to -# the current VCS repository root. -# * Wears a different color wether the last command succeeded/failed. -# * Shows user@hostname if connected through SSH. -# * Shows if logged in as root or not. -# ------------------------------------------------------------------------------ - -# Customizable parameters. -PROMPT_PATH_MAX_LENGTH=30 -PROMPT_DEFAULT_END=❯ -PROMPT_ROOT_END=❯❯❯ -PROMPT_SUCCESS_COLOR=$FG[071] -PROMPT_FAILURE_COLOR=$FG[124] -PROMPT_VCS_INFO_COLOR=$FG[242] - -# Set required options. -setopt promptsubst - -# Load required modules. -autoload -U add-zsh-hook -autoload -Uz vcs_info - -# Add hook for calling vcs_info before each command. -add-zsh-hook precmd vcs_info - -# Set vcs_info parameters. -zstyle ':vcs_info:*' enable hg bzr git -zstyle ':vcs_info:*:*' check-for-changes true # Can be slow on big repos. -zstyle ':vcs_info:*:*' unstagedstr '!' -zstyle ':vcs_info:*:*' stagedstr '+' -zstyle ':vcs_info:*:*' actionformats "%S" "%r/%s/%b %u%c (%a)" -zstyle ':vcs_info:*:*' formats "%S" "%r/%s/%b %u%c" -zstyle ':vcs_info:*:*' nvcsformats "%~" "" - -# Define prompts. -PROMPT="%(0?.%{$PROMPT_SUCCESS_COLOR%}.%{$PROMPT_FAILURE_COLOR%})${SSH_TTY:+[%n@%m]}%{$FX[bold]%}%$PROMPT_PATH_MAX_LENGTH<..<"'${vcs_info_msg_0_%%.}'"%<<%(!.$PROMPT_ROOT_END.$PROMPT_DEFAULT_END)%{$FX[no-bold]%}%{$FX[reset]%} " -RPROMPT="%{$PROMPT_VCS_INFO_COLOR%}"'$vcs_info_msg_1_'"%{$FX[reset]%}" diff --git a/themes/nicoulaj/prompt_nicoulaj_setup b/themes/nicoulaj/prompt_nicoulaj_setup new file mode 100644 index 000000000..71bbad3d4 --- /dev/null +++ b/themes/nicoulaj/prompt_nicoulaj_setup @@ -0,0 +1,47 @@ +# ------------------------------------------------------------------------------ +# Prompt for ZSH: +# * One line. +# * VCS info on the right prompt. +# * Only shows the path on the left prompt by default. +# * Crops the path to a defined length and only shows the path relative to +# the current VCS repository root. +# * Wears a different color wether the last command succeeded/failed. +# * Shows user@hostname if connected through SSH. +# * Shows if logged in as root or not. +# ------------------------------------------------------------------------------ + +function prompt_nicoulaj_setup() { + setopt noxtrace noksharrays localoptions + prompt_opts=(cr subst percent) + + # Load required modules. + autoload -Uz add-zsh-hook + autoload -Uz vcs_info + + # Add hook for calling vcs_info before each command. + add-zsh-hook precmd vcs_info + + # Customizable parameters. + local max_path_chars=30 + local user_char='❯' + local root_char='❯❯❯' + local success_color='%F{071}' + local failure_color='%F{124}' + local vcs_info_color='%F{242}' + + # Set vcs_info parameters. + zstyle ':vcs_info:*' enable bzr git hg svn + zstyle ':vcs_info:*:*' check-for-changes true # Can be slow on big repos. + zstyle ':vcs_info:*:*' unstagedstr '!' + zstyle ':vcs_info:*:*' stagedstr '+' + zstyle ':vcs_info:*:*' actionformats "%S" "%r/%s/%b %u%c (%a)" + zstyle ':vcs_info:*:*' formats "%S" "%r/%s/%b %u%c" + zstyle ':vcs_info:*:*' nvcsformats "%~" "" + + # Define prompts. + PROMPT="%(?.${success_color}.${failure_color})${SSH_TTY:+[%n@%m]}%B%${max_path_chars}<...<"'${vcs_info_msg_0_%%.}'"%<<%(!.${root_char}.${user_char})%b%f " + RPROMPT="${vcs_info_color}"'${vcs_info_msg_1_}'"%f" +} + +prompt_nicoulaj_setup "$@" + diff --git a/themes/sorin/prompt_sorin_setup b/themes/sorin/prompt_sorin_setup new file mode 100644 index 000000000..72e8a96a9 --- /dev/null +++ b/themes/sorin/prompt_sorin_setup @@ -0,0 +1,34 @@ +# ------------------------------------------------------------------------------ +# FILE: prompt_sorin_setup +# DESCRIPTION: oh-my-zsh theme file. +# AUTHOR: Sorin Ionescu +# VERSION: 1.0.4 +# SCREENSHOT: http://i.imgur.com/aipDQ.png +# ------------------------------------------------------------------------------ + + +function prompt_sorin_setup() { + setopt localoptions noxtrace noksharrays + prompt_opts=(cr subst percent) + + MODE_INDICATOR="%B%F{red}❮%f%b%F{red}❮❮%f" + ZSH_THEME_GIT_PROMPT_SHA_BEFORE="" + ZSH_THEME_GIT_PROMPT_SHA_AFTER="" + ZSH_THEME_GIT_PROMPT_AHEAD="" + ZSH_THEME_GIT_PROMPT_DIRTY="" + ZSH_THEME_GIT_PROMPT_CLEAN="" + ZSH_THEME_GIT_PROMPT_PREFIX=" %F{blue}git%f:%F{red}" + ZSH_THEME_GIT_PROMPT_SUFFIX="%f" + ZSH_THEME_GIT_PROMPT_ADDED="%F{green} ✚%f" + ZSH_THEME_GIT_PROMPT_MODIFIED="%F{blue} ✹%f" + ZSH_THEME_GIT_PROMPT_DELETED="%F{red} ✖%f" + ZSH_THEME_GIT_PROMPT_RENAMED="%F{magenta} ➜%f" + ZSH_THEME_GIT_PROMPT_UNMERGED="%F{yellow} ═%f" + ZSH_THEME_GIT_PROMPT_UNTRACKED="%F{cyan} ✭%f" + + PROMPT='%F{cyan}%~%f$(git-prompt-info) %(!.%B%F{red}#%f%b.%B%F{green}❯%f%b) ' + RPROMPT='%(?::%F{red}⏎%f)$(git-prompt-status)' +} + +prompt_sorin_setup "$@" + diff --git a/themes/sorin/sorin.theme.zsh b/themes/sorin/sorin.theme.zsh deleted file mode 100644 index a63a98441..000000000 --- a/themes/sorin/sorin.theme.zsh +++ /dev/null @@ -1,48 +0,0 @@ -# ------------------------------------------------------------------------------ -# FILE: sorin.zsh-theme -# DESCRIPTION: oh-my-zsh theme file. -# AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com) -# VERSION: 1.0.3 -# SCREENSHOT: http://i.imgur.com/aipDQ.png -# ------------------------------------------------------------------------------ - - -if [[ "$DISABLE_COLOR" != "true" ]]; then - MODE_INDICATOR="%{$fg_bold[red]%}❮%{$reset_color%}%{$fg[red]%}❮❮%{$reset_color%}" - local return_status="%{$fg[red]%}%(?..⏎)%{$reset_color%}" - - PROMPT='%{$fg[cyan]%}%c$(git_prompt_info) %(!.%{$fg_bold[red]%}#.%{$fg_bold[green]%}❯)%{$reset_color%} ' - - ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[blue]%}git%{$reset_color%}:%{$fg[red]%}" - ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" - ZSH_THEME_GIT_PROMPT_DIRTY="" - ZSH_THEME_GIT_PROMPT_CLEAN="" - - RPROMPT='${return_status}$(git_prompt_status)%{$reset_color%}' - - ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} ✚" - ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} ✹" - ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖" - ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜" - ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═" - ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭" -else - MODE_INDICATOR="❮❮❮" - local return_status="%(?::⏎)" - - PROMPT='%c$(git_prompt_info) %(!.#.❯) ' - - ZSH_THEME_GIT_PROMPT_PREFIX=" git:" - ZSH_THEME_GIT_PROMPT_SUFFIX="" - ZSH_THEME_GIT_PROMPT_DIRTY="" - ZSH_THEME_GIT_PROMPT_CLEAN="" - - RPROMPT='${return_status}$(git_prompt_status)' - - ZSH_THEME_GIT_PROMPT_ADDED=" ✚" - ZSH_THEME_GIT_PROMPT_MODIFIED=" ✹" - ZSH_THEME_GIT_PROMPT_DELETED=" ✖" - ZSH_THEME_GIT_PROMPT_RENAMED=" ➜" - ZSH_THEME_GIT_PROMPT_UNMERGED=" ═" - ZSH_THEME_GIT_PROMPT_UNTRACKED=" ✭" -fi diff --git a/themes/steeef/prompt_steeef_setup b/themes/steeef/prompt_steeef_setup new file mode 100644 index 000000000..96ee7b01b --- /dev/null +++ b/themes/steeef/prompt_steeef_setup @@ -0,0 +1,110 @@ +# Prompt style and colors based on Steve Losh's Prose theme: +# http://github.com/sjl/oh-my-zsh/blob/master/themes/prose.zsh-theme +# +# vcs_info modifications from Bart Trojanowski's zsh prompt: +# http://www.jukie.net/bart/blog/pimping-out-zsh-prompt +# +# Git untracked files modification from Brian Carper: +# http://briancarper.net/blog/570/git-info-in-your-zsh-prompt + +function virtualenv_info() { + if [[ -n "$VIRTUAL_ENV" ]]; then + echo '('`basename $VIRTUAL_ENV`') ' + fi +} + +function prompt_steeef_precmd() { + if [[ -n "$__PROMPT_STEEEF_VCS_UPDATE" ]] ; then + # Check for untracked files or updated submodules since vcs_info doesn't. + if [[ ! -z $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then + __PROMPT_STEEEF_VCS_UPDATE=1 + fmt_branch="(${__PROMPT_STEEEF_COLORS[1]}%b%f%u%c${__PROMPT_STEEEF_COLORS[4]}●%f)" + else + fmt_branch="(${__PROMPT_STEEEF_COLORS[1]}%b%f%u%c)" + fi + zstyle ':vcs_info:*:prompt:*' formats "${fmt_branch}" + + vcs_info 'prompt' + __PROMPT_STEEEF_VCS_UPDATE='' + fi +} + +function prompt_steeef_preexec() { + case "$(history $HISTCMD)" in + *git*) + __PROMPT_STEEEF_VCS_UPDATE=1 + ;; + *svn*) + __PROMPT_STEEEF_VCS_UPDATE=1 + ;; + esac +} + +function prompt_steeef_chpwd() { + __PROMPT_STEEEF_VCS_UPDATE=1 +} + +function prompt_steeef_setup() { + setopt localoptions noxtrace noksharrays + prompt_opts=(cr subst percent) + + autoload -Uz add-zsh-hook + autoload -Uz vcs_info + + add-zsh-hook precmd prompt_steeef_precmd + add-zsh-hook preexec prompt_steeef_preexec + add-zsh-hook chpwd prompt_steeef_chpwd + + __PROMPT_STEEEF_VCS_UPDATE=1 + + # Use extended color pallete if available. + if [[ $TERM = *256color* || $TERM = *rxvt* ]]; then + __PROMPT_STEEEF_COLORS=( + "%F{81}" # turquoise + "%F{166}" # orange + "%F{135}" # purple + "%F{161}" # hotpink + "%F{118}" # limegreen + ) + else + __PROMPT_STEEEF_COLORS=( + "%F{cyan}" + "%F{yellow}" + "%F{magenta}" + "%F{red}" + "%F{green}" + ) + fi + + # Enable VCS systems you use. + zstyle ':vcs_info:*' enable bzr git hg svn + + # check-for-changes can be really slow. + # You should disable it if you work with large repositories. + zstyle ':vcs_info:*:prompt:*' check-for-changes true + + # Formats: + # %b - branchname + # %u - unstagedstr (see below) + # %c - stagedstr (see below) + # %a - action (e.g. rebase-i) + # %R - repository path + # %S - path in the repository + local fmt_branch="(${__PROMPT_STEEEF_COLORS[1]}%b%f%u%c)" + local fmt_action="(${__PROMPT_STEEEF_COLORS[5]}%a%f)" + local fmt_unstaged="${__PROMPT_STEEEF_COLORS[2]}●%f" + local fmt_staged="${__PROMPT_STEEEF_COLORS[5]}●%f" + + zstyle ':vcs_info:*:prompt:*' unstagedstr "${fmt_unstaged}" + zstyle ':vcs_info:*:prompt:*' stagedstr "${fmt_staged}" + zstyle ':vcs_info:*:prompt:*' actionformats "${fmt_branch}${fmt_action}" + zstyle ':vcs_info:*:prompt:*' formats "${fmt_branch}" + zstyle ':vcs_info:*:prompt:*' nvcsformats "" + + PROMPT=" +${__PROMPT_STEEEF_COLORS[3]}%n%f at ${__PROMPT_STEEEF_COLORS[2]}%m%f in ${__PROMPT_STEEEF_COLORS[5]}%~%f "'${vcs_info_msg_0_}'" +"'$(virtualenv_info)'"$ " +} + +prompt_steeef_setup "$@" + diff --git a/themes/steeef/steeef.theme.zsh b/themes/steeef/steeef.theme.zsh deleted file mode 100644 index a2583b028..000000000 --- a/themes/steeef/steeef.theme.zsh +++ /dev/null @@ -1,100 +0,0 @@ -# prompt style and colors based on Steve Losh's Prose theme: -# http://github.com/sjl/oh-my-zsh/blob/master/themes/prose.zsh-theme -# -# vcs_info modifications from Bart Trojanowski's zsh prompt: -# http://www.jukie.net/bart/blog/pimping-out-zsh-prompt -# -# git untracked files modification from Brian Carper: -# http://briancarper.net/blog/570/git-info-in-your-zsh-prompt - -function virtualenv_info { - [ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') ' -} -PR_GIT_UPDATE=1 - -setopt prompt_subst -autoload colors -colors - -autoload -U add-zsh-hook -autoload -Uz vcs_info - -#use extended color pallete if available -if [[ $TERM = *256color* || $TERM = *rxvt* ]]; then - turquoise="%F{81}" - orange="%F{166}" - purple="%F{135}" - hotpink="%F{161}" - limegreen="%F{118}" -else - turquoise="$fg[cyan]" - orange="$fg[yellow]" - purple="$fg[magenta]" - hotpink="$fg[red]" - limegreen="$fg[green]" -fi - -# enable VCS systems you use -zstyle ':vcs_info:*' enable git svn - -# check-for-changes can be really slow. -# you should disable it, if you work with large repositories -zstyle ':vcs_info:*:prompt:*' check-for-changes true - -# set formats -# %b - branchname -# %u - unstagedstr (see below) -# %c - stagedstr (see below) -# %a - action (e.g. rebase-i) -# %R - repository path -# %S - path in the repository -PR_RST="%{${reset_color}%}" -FMT_BRANCH="(%{$turquoise%}%b%u%c${PR_RST})" -FMT_ACTION="(%{$limegreen%}%a${PR_RST})" -FMT_UNSTAGED="%{$orange%}●" -FMT_STAGED="%{$limegreen%}●" - -zstyle ':vcs_info:*:prompt:*' unstagedstr "${FMT_UNSTAGED}" -zstyle ':vcs_info:*:prompt:*' stagedstr "${FMT_STAGED}" -zstyle ':vcs_info:*:prompt:*' actionformats "${FMT_BRANCH}${FMT_ACTION}" -zstyle ':vcs_info:*:prompt:*' formats "${FMT_BRANCH}" -zstyle ':vcs_info:*:prompt:*' nvcsformats "" - - -function steeef_preexec { - case "$(history $HISTCMD)" in - *git*) - PR_GIT_UPDATE=1 - ;; - *svn*) - PR_GIT_UPDATE=1 - ;; - esac -} -add-zsh-hook preexec steeef_preexec - -function steeef_chpwd { - PR_GIT_UPDATE=1 -} -add-zsh-hook chpwd steeef_chpwd - -function steeef_precmd { - if [[ -n "$PR_GIT_UPDATE" ]] ; then - # check for untracked files or updated submodules, since vcs_info doesn't - if [[ ! -z $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then - PR_GIT_UPDATE=1 - FMT_BRANCH="(%{$turquoise%}%b%u%c%{$hotpink%}●${PR_RST})" - else - FMT_BRANCH="(%{$turquoise%}%b%u%c${PR_RST})" - fi - zstyle ':vcs_info:*:prompt:*' formats "${FMT_BRANCH}" - - vcs_info 'prompt' - PR_GIT_UPDATE= - fi -} -add-zsh-hook precmd steeef_precmd - -PROMPT=$' -%{$purple%}%n%{$reset_color%} at %{$orange%}%m%{$reset_color%} in %{$limegreen%}%~%{$reset_color%} $vcs_info_msg_0_ -$(virtualenv_info)$ ' From c17c459968124f7dac353f9f687793676c12108e Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sun, 17 Jul 2011 20:25:53 -0400 Subject: [PATCH 471/614] Cleaned up the Git plugin. --- plugins/git/git.plugin.zsh | 389 ++++++++++++++++++++++++++++++------- 1 file changed, 321 insertions(+), 68 deletions(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index baf34b830..cbf00395b 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -1,117 +1,370 @@ -# Renders the name of the current branch. -function git_prompt_info() { - local branch=$(git_current_branch) - if [[ -n "$branch" ]]; then - echo "${ZSH_THEME_GIT_PROMPT_PREFIX}${branch}$(parse_git_dirty)${ZSH_THEME_GIT_PROMPT_SUFFIX}" - fi -} - -# Gets the current branch. -function git_current_branch() { - local ref=$(git symbolic-ref HEAD 2> /dev/null) - if [[ -n "$ref" ]]; then - echo "${ref#refs/heads/}" - fi -} +# Set the default Git prompt theme. +ZSH_THEME_GIT_PROMPT_PREFIX="git:(" # Prefix before the branch name. +ZSH_THEME_GIT_PROMPT_SUFFIX=")" # Suffix after the branch name. +ZSH_THEME_GIT_PROMPT_SHA_BEFORE="" # Prefix before the SHA-1 hash. +ZSH_THEME_GIT_PROMPT_SHA_AFTER="" # Suffix after the SHA-1 hash. +ZSH_THEME_GIT_PROMPT_DIRTY="*" # Indicator to notify of dirty branch. +ZSH_THEME_GIT_PROMPT_CLEAN="" # Indicator to notify of clean branch. +ZSH_THEME_GIT_PROMPT_AHEAD="" # Indicator to notify of ahead branch +ZSH_THEME_GIT_PROMPT_UNTRACKED="" # Indicator to notify of untracked files. +ZSH_THEME_GIT_PROMPT_ADDED="" # Indicator to notify of added files. +ZSH_THEME_GIT_PROMPT_MODIFIED="" # Indicator to notify of modified files. +ZSH_THEME_GIT_PROMPT_RENAMED="" # Indicator to notify of renamed files. +ZSH_THEME_GIT_PROMPT_DELETED="" # Indicator to notify of deleted files. +ZSH_THEME_GIT_PROMPT_UNMERGED="" # Indicator to notify of unmerged files. # Checks if the working tree is dirty. -function parse_git_dirty() { - if [[ -n $(git status -s 2> /dev/null) ]]; then +function __git-parse-dirty() { + if [[ -n "$(git status -s 2> /dev/null)" ]]; then echo "$ZSH_THEME_GIT_PROMPT_DIRTY" else echo "$ZSH_THEME_GIT_PROMPT_CLEAN" fi } +# Renders the name of the current branch. +function git-prompt-info() { + local branch="$(git-current-branch)" + if [[ -n "$branch" ]]; then + echo "${ZSH_THEME_GIT_PROMPT_PREFIX}${branch}$(__git-parse-dirty)${ZSH_THEME_GIT_PROMPT_SUFFIX}" + else + return 1 + fi +} + +# Gets the current branch. +function git-current-branch() { + local ref="$(git symbolic-ref HEAD 2> /dev/null)" + if [[ -n "$ref" ]]; then + echo "${ref#refs/heads/}" + else + return 1 + fi +} + +# Gets the repository root. +function git-root() { + git rev-parse --show-toplevel +} + # Checks if there are commits ahead from remote. -function git_prompt_ahead() { - if $(echo "$(git log origin/$(git_current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then +function git-prompt-ahead() { + if $(echo "$(git log origin/$(git-current-branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then echo "$ZSH_THEME_GIT_PROMPT_AHEAD" + else + return 1 fi } # Formats the prompt string for current git commit short SHA. -function git_prompt_short_sha() { - local sha=$(git rev-parse --short HEAD 2> /dev/null) +function git-prompt-short-sha() { + local sha="$(git rev-parse --short HEAD 2> /dev/null)" if [[ -n "$sha" ]]; then echo "${ZSH_THEME_GIT_PROMPT_SHA_BEFORE}${sha}${ZSH_THEME_GIT_PROMPT_SHA_AFTER}" + else + return 1 fi } # Formats the prompt string for current git commit long SHA. -function git_prompt_long_sha() { - local sha=$(git rev-parse HEAD 2> /dev/null) +function git-prompt-long-sha() { + local sha="$(git rev-parse HEAD 2> /dev/null)" if [[ -n "$sha" ]]; then echo "${ZSH_THEME_GIT_PROMPT_SHA_BEFORE}${sha}${ZSH_THEME_GIT_PROMPT_SHA_AFTER}" + else + return 1 fi } # Gets the status of the working tree. -function git_prompt_status() { - local indicators line untracked added modified renamed deleted +function git-prompt-status() { + local indicators line untracked added modified renamed deleted unmerged + + if ! git rev-parse &>/dev/null; then + return 1 + fi + while IFS=$'\n' read line; do - if [[ "$line" =~ '^\?\? ' ]]; then - [[ -n $untracked ]] && continue || untracked='yes' + if [[ "$line" == \?\?\ * ]] && [[ untracked != 'yes' ]]; then + untracked='yes' indicators="${ZSH_THEME_GIT_PROMPT_UNTRACKED}${indicators}" fi - if [[ "$line" =~ '^(((A|M|D|T) )|(AD|AM|AT|MM)) ' ]]; then - [[ -n $added ]] && continue || added='yes' + if [[ "$line" == (((A|M|D|T) )|(AD|AM|AT|MM))\ * ]] && [[ added != 'yes' ]]; then + added='yes' indicators="${ZSH_THEME_GIT_PROMPT_ADDED}${indicators}" fi - if [[ "$line" =~ '^(( (M|T))|(AM|AT|MM)) ' ]]; then - [[ -n $modified ]] && continue || modified='yes' + if [[ "$line" == (( (M|T))|(AM|AT|MM))\ * ]] && [[ modified != 'yes' ]]; then + modified='yes' indicators="${ZSH_THEME_GIT_PROMPT_MODIFIED}${indicators}" fi - if [[ "$line" =~ '^R ' ]]; then - [[ -n $renamed ]] && continue || renamed='yes' + if [[ "$line" == R\ \ * ]] && [[ renamed != 'yes' ]]; then + renamed='yes' indicators="${ZSH_THEME_GIT_PROMPT_RENAMED}${indicators}" fi - if [[ "$line" =~ '^( D|AD) ' ]]; then - [[ -n $deleted ]] && continue || deleted='yes' + if [[ "$line" == ( D|AD)\ * ]] && [[ deleted != 'yes' ]]; then + deleted='yes' indicators="${ZSH_THEME_GIT_PROMPT_DELETED}${indicators}" fi - if [[ "$line" =~ '^UU ' ]]; then - [[ -n $unmerged ]] && continue || unmerged='yes' + if [[ "$line" == UU\ * ]] && [[ unmerged != 'yes' ]]; then + unmerged='yes' indicators="${ZSH_THEME_GIT_PROMPT_UNMERGED}${indicators}" fi done < <(git status --porcelain 2> /dev/null) - echo $indicators + + if [[ -n "$indicators" ]]; then + echo $indicators + fi } +# Open the GitHub repository in the browser. +function git-hub() { + local url=$( + git config -l \ + | grep "remote.origin.url" \ + | sed -En "s/remote.origin.url=(git|https?)(@|:\/\/)github.com(:|\/)(.+)\/(.+).git/https:\/\/github.com\/\4\/\5/p" + ) + + if [[ -n "$url" ]]; then + url="${url}/tree/${$(git-current-branch):-master}" + + if (( $+commands[$BROWSER] )); then + "$BROWSER" "$url" + else + echo "fatal: Browser not set or set to a non-existent browser." >&2 + return 1 + fi + else + echo "fatal: Not a Git repository or origin remote not set." >&2 + return 1 + fi +} + +# Git alias g='git' compdef g=git -alias gst='git status' -compdef _git gst=git-status -alias gl='git pull' -compdef _git gl=git-pull -alias gup='git fetch && git rebase' -compdef _git gup=git-fetch -alias gp='git push' -compdef _git gp=git-push -gdv() { git-diff -w "$@" | view - } -compdef _git gdv=git-diff -alias gc='git commit -v' -compdef _git gc=git-commit -alias gca='git commit -v -a' -compdef _git gca=git-commit -alias gco='git checkout' -compdef _git gco=git-checkout + +# Working Copy (w) +alias gws='git status --short' +compdef _git gws=git-status +alias gwS='git status' +compdef _git gwS=git-status +alias gwd='git diff --no-ext-diff' +compdef _git gwd=git-diff +function gwD() { git diff --no-ext-diff --ignore-all-space "$@" | view - } +compdef _git gwD=git-diff +alias gwr='git reset --soft' +compdef _git gwr=git-reset +alias gwR='git reset --hard' +compdef _git gwR=git-reset +alias gwc='git clean -n' +compdef _git gwc=git-clean +alias gwC='git clean -f' +compdef _git gwC=git-clean +alias gwx='git rm -r' +compdef _git gwx=git-rm +alias gwX='git rm -rf' +compdef _git gwX=git-rm + +# Index +alias gia='git add' +compdef _git gia=git-add +alias giA='git add --patch' +compdef _git giA=git-add +alias giu='git add --update' +compdef _git giu=git-add +alias gid='git diff --no-ext-diff --cached' +compdef _git gid=git-diff +alias gir='git reset' +compdef _git gir=git-reset +alias giR='git reset --mixed' +compdef _git giR=git-reset +alias gix='git rm -r --cached' +compdef _git gix=git-rm +alias giX='git rm -rf --cached' +compdef _git giX=git-rm + +# Branah (b) alias gb='git branch' compdef _git gb=git-branch -alias gba='git branch -a' -compdef _git gba=git-branch -alias gcount='git shortlog -sn' -compdef gcount=git +alias gbc='git checkout -b' +compdef _git gbc=git-checkout +alias gbl='git branch -v' +compdef _git gbl=git-branch +alias gbL='git branch -av' +compdef _git gbL=git-branch +alias gbx='git branch -d' +compdef _git gbx=git-branch +alias gbX='git branch -D' +compdef _git gbX=git-branch +alias gbm='git branch -m' +compdef _git gbm=git-branch +alias gbM='git branch -M' +compdef _git gbM=git-branch + +# Commit (c) +alias gc='git commit' +compdef _git gc=git-commit +alias gca='git commit --all' +compdef _git gca=git-commit +alias gcm='git commit --message' +compdef _git gcm=git-commit +alias gco='git checkout' +compdef _git gco=git-checkout +alias gcO='git checkout HEAD --' +compdef _git gcO=git-checkout +alias gcf='git commit --amend --reuse-message HEAD' +compdef _git gcf=git-commit alias gcp='git cherry-pick' compdef _git gcp=git-cherry-pick -alias glg='git log --stat --max-count=5' -compdef _git glg=git-log -alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk' -compdef git-svn-dcommit-push=git -alias ggpull='git pull origin $(git_current_branch)' -compdef ggpull=git -alias ggpush='git push origin $(git_current_branch)' -compdef ggpush=git -alias ggpnp='git pull origin $(git_current_branch) && git push origin $(git_current_branch)' -compdef ggpnp=git +alias gcr='git revert' +compdef _git gcr=git-revert +alias gcR='git reset "HEAD^"' +compdef _git gcR=git-reset +alias gcs='git show' +compdef _git gcs=git-show +alias gcv='git fsck | awk '\''/dangling commit/ {print $3}'\'' | git show --format="SHA1: %C(green)%h%C(reset) %f" --stdin | awk '\''/SHA1/ {sub("SHA1: ", ""); print}'\''' + +# Conflict (k) +alias gkl='git status | sed -n "s/^.*both [a-z]*ed: *//p"' +alias gka='git add $(gkl)' +compdef _git gka=git-add +alias gke='git mergetool $(gkl)' +alias gko='git checkout --ours --' +compdef _git gko=git-checkout +alias gkO='gko $(gkl)' +alias gkt='git checkout --theirs --' +compdef _git gkt=git-checkout +alias gkT='gkt $(gkl)' + +# File Data (d) +alias gd='git ls-files' +compdef _git gd=git-ls-files +alias gdc='git ls-files --cached' +compdef _git gdc=git-ls-files +alias gdx='git ls-files --deleted' +compdef _git gdx=git-ls-files +alias gdm='git ls-files --modified' +compdef _git gdm=git-ls-files +alias gdu='git ls-files --others' +compdef _git gdu=git-ls-files +alias gdk='git ls-files --killed' +compdef _git gdk=git-ls-files +alias gdi='git status --porcelain --short --ignored | sed -n "s/^!! //p"' + +# Merge (m) +alias gm='git merge --no-ff' +compdef _git gm=git-merge +alias gmf='git merge --ff' +compdef _git gmf=git-merge +alias gma='git merge --abort' +compdef _git gma=git-merge + +# Pull +alias gf='git fetch' +compdef _git gf=git-fetch +alias gfc='git clone' +compdef _git gfc=git-clone +alias gfm='git pull' +compdef _git gfm=git-pull +alias gfr='git pull --rebase' +compdef _git gfr=git-pull + +# Push +alias gp='git push' +compdef _git gp=git-push +alias gpf='git push --force' +compdef _git gpf=git-push +alias gpa='git push --all' +compdef _git gpa=git-push +alias gpA='git push --all && git push --tags' +compdef _git gpA=git-push +alias gpt='git push --tags' +compdef _git gpt=git-push +alias gpc='git push --set-upstream origin $(git-current-branch)' +compdef _git gpc=git-push +alias gpp='git pull origin $(git-current-branch) && git push origin $(git-current-branch)' + +# Rebase (r) +alias gr='git rebase' +compdef _git gr=git-rebase +alias gra='git rebase --abort' +compdef _git gra=git-rebase +alias grc='git rebase --continue' +compdef _git grc=git-rebase +alias gri='git rebase --interactive' +compdef _git gri=git-rebase +alias grs='git rebase --skip' +compdef _git grs=git-rebase + +# Remote Host (h) +alias gh='git remote' +compdef _git gh=git-remote +alias ghl='git remote --verbose' +compdef _git ghl=git-remote +alias gha='git remote add' +compdef _git gha=git-remote +alias ghx='git remote rm' +compdef _git ghx=git-remote +alias ghm='git remote rename' +compdef _git ghm=git-remote +alias ghu='git remote update' +compdef _git ghu=git-remote +alias ghc='git remote prune' +compdef _git ghc=git-remote +alias ghs='git remote show' +compdef _git ghs=git-remote + +# Stash (t) +alias gta='git stash apply' +compdef _git gta=git-stash +alias gtc='git stash clear' +compdef _git gtc=git-stash +alias gtx='git stash drop' +compdef _git gtx=git-stash +alias gtl='git stash list' +compdef _git gtl=git-stash +alias gtL='git stash show --patch --stat' +compdef _git gtL=git-stash +alias gtp='git stash pop' +compdef _git gtp=git-stash +alias gts='git stash save' +compdef _git gts=git-stash + +# Submodule (u) +alias gu='git submodule' +compdef _git gu=git-submodule +alias gua='git submodule add' +compdef _git gua=git-submodule +alias guf='git submodule foreach' +compdef _git guf=git-submodule +alias gui='git submodule init' +compdef _git gui=git-submodule +alias gul='git submodule status' +compdef _git gul=git-submodule +alias gus='git submodule sync' +compdef _git gus=git-submodule +alias guu='git submodule update' +compdef _git guu=git-submodule +alias guU='git submodule update --init --recursive' +compdef _git guU=git-submdoule + +# Git log (pretty). +git_log_format_oneline='--pretty=format:%C(green)%h%C(reset) %s%C(red)%d%C(reset)' +git_log_format_oneline_more='--pretty=format:%C(green)%h%C(reset) %C(blue)%ad%C(reset) %s%C(red)%d%C(reset) [%C(magenta)%an%C(reset)]' +git_log_format_medium='--pretty=format:%C(green)Commit: %H%C(red)%d%C(reset)%n%C(magenta)Author: %an <%ae>%C(reset)%n%C(blue)Date: %cd%C(reset)%n%+s%n%+b' + +alias gl='git log' +compdef _git gl=git-log +alias glo='git log --topo-order ${git_log_format_oneline}' +compdef _git glo=git-log +alias glO='git log --topo-order --date=short ${git_log_format_oneline_more}' +compdef _git glO=git-log +alias glg='git log --graph --topo-order ${git_log_format_medium}' +compdef _git glg=git-log +alias gls='git log --graph --topo-order --stat ${git_log_format_medium}' +compdef _git gls=git-log +alias gld='git log --graph --topo-order --stat --patch --full-diff ${git_log_format_medium}' +compdef _git gld=git-log +alias glc='git shortlog --summary --numbered' +compdef _git glc=git-shortlog From af04d5794846da860754ea9382ba8621a7c62b37 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sun, 17 Jul 2011 20:28:50 -0400 Subject: [PATCH 472/614] Check for bashcompinit availability before loading it; unset variables. --- plugins/compleat/compleat.plugin.zsh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/plugins/compleat/compleat.plugin.zsh b/plugins/compleat/compleat.plugin.zsh index 7fbd2b953..660131002 100644 --- a/plugins/compleat/compleat.plugin.zsh +++ b/plugins/compleat/compleat.plugin.zsh @@ -1,20 +1,20 @@ # ------------------------------------------------------------------------------ # FILE: compleat.plugin.zsh # DESCRIPTION: oh-my-zsh plugin file. -# AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com) -# VERSION: 1.0.0 +# AUTHOR: Sorin Ionescu +# VERSION: 1.0.1 # ------------------------------------------------------------------------------ if (( ${+commands[compleat]} )); then - local prefix="${commands[compleat]:h:h}" - local setup="${prefix}/share/compleat-1.0/compleat_setup" + compleat_setup="${commands[compleat]:h:h}/share/compleat-1.0/compleat_setup" - if [[ -f "$setup" ]]; then + if [[ -f "$compleat_setup" ]]; then if ! bashcompinit >/dev/null 2>&1; then - autoload -U bashcompinit - bashcompinit -i + autoload -Uz bashcompinit && bashcompinit fi - source "$setup" + source "$compleat_setup" + unset compleat_setup fi fi + From 9662a4d43b7d40598dc0724a539e527558d68d2e Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sun, 17 Jul 2011 20:42:16 -0400 Subject: [PATCH 473/614] Simplified verbose comments in GNU utils plugin. --- plugins/gnu-utils/gnu-utils.plugin.zsh | 35 ++++++++------------------ 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/plugins/gnu-utils/gnu-utils.plugin.zsh b/plugins/gnu-utils/gnu-utils.plugin.zsh index ab118e868..9505cb8ca 100644 --- a/plugins/gnu-utils/gnu-utils.plugin.zsh +++ b/plugins/gnu-utils/gnu-utils.plugin.zsh @@ -1,13 +1,13 @@ # ------------------------------------------------------------------------------ # FILE: gnu-utils.plugin.zsh # DESCRIPTION: oh-my-zsh plugin file. -# AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com) -# VERSION: 1.0.0 +# AUTHOR: Sorin Ionescu +# VERSION: 1.0.1 # ------------------------------------------------------------------------------ -if [[ -x "${commands[gwhoami]}" ]]; then - __gnu_utils() { +if (( ${+commands[gwhoami]} )); then + function __gnu_utils() { emulate -L zsh local gcmds local gcmd @@ -38,21 +38,10 @@ if [[ -x "${commands[gwhoami]}" ]]; then # 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//"["/"\\["}" + if (( ${+commands[$gcmd]} )); then + hash "${gcmd[2,-1]}"="${commands[$gcmd]}" + unhash "$gcmd" + fi done return 0 @@ -69,11 +58,7 @@ if [[ -x "${commands[gwhoami]}" ]]; then } function rehash() { - if [[ "$*" =~ "-f" ]]; then - builtin rehash "$@" - __gnu_utils - else - builtin rehash "$@" - fi + hash -r "$@" } fi + From 6324fcf7f11ac7e387df19ab5e774adfe69336d3 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 28 Jul 2011 19:34:21 -0400 Subject: [PATCH 474/614] Fixed minor bugs in gnu-utils plugin. --- plugins/gnu-utils/gnu-utils.plugin.zsh | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/plugins/gnu-utils/gnu-utils.plugin.zsh b/plugins/gnu-utils/gnu-utils.plugin.zsh index 9505cb8ca..23a9b8d2d 100644 --- a/plugins/gnu-utils/gnu-utils.plugin.zsh +++ b/plugins/gnu-utils/gnu-utils.plugin.zsh @@ -6,7 +6,7 @@ # ------------------------------------------------------------------------------ -if (( ${+commands[gwhoami]} )); then +if (( $+commands[gwhoami] )); then function __gnu_utils() { emulate -L zsh local gcmds @@ -30,17 +30,16 @@ if (( ${+commands[gwhoami]} )); then 'gwhoami' 'gyes') # Not part of coreutils, installed separately. - gcmds+=('gsed' 'gtar' 'gtime') + gcmds+=('ggrep' 'gsed' 'gtar' 'gtime') - for gcmd in "${gcmds[@]}"; do + 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. # - if (( ${+commands[$gcmd]} )); then - hash "${gcmd[2,-1]}"="${commands[$gcmd]}" - unhash "$gcmd" + if (( $+commands[$gcmd] )); then + hash "$gcmd[2,-1]"="$commands[$gcmd]" fi done @@ -49,7 +48,7 @@ if (( ${+commands[gwhoami]} )); then __gnu_utils; function hash() { - if [[ "$*" =~ "-(r|f)" ]]; then + if (( $+argv[(er)-r] )) || (( $+argv[(er)-f] )); then builtin hash "$@" __gnu_utils else From 869b7e56bedec29fed896d2e4a29434b532bc7ef Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Mon, 18 Jul 2011 00:00:35 -0400 Subject: [PATCH 475/614] Converted README from Textile to Markdown and cleaned up the contents. --- README.md | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++ README.textile | 55 ------------------------------------------ 2 files changed, 65 insertions(+), 55 deletions(-) create mode 100644 README.md delete mode 100644 README.textile diff --git a/README.md b/README.md new file mode 100644 index 000000000..fab2f748c --- /dev/null +++ b/README.md @@ -0,0 +1,65 @@ +A handful of functions, auto-complete helpers, and stuff that makes you shout... + +> “OH MY ZSHELL!” + +## Setup + +`oh-my-zsh` should work with any recent release of [ZSH](http://www.zsh.org), but the +minimum recommended version is 4.3.9. + +1. Clone the repository. + + `git clone git://github.com/sorin-ionescu/oh-my-zsh.git ~/.oh-my-zsh` + +2. Create a new ZSH configuration by copying the ZSH template provided. + +**NOTE**: If you already have a `~/.zshrc` file, you should back it up with `cp +~/.zshrc{,.orig}` in case you want to go back to your original settings. + + cp ~/.oh-my-zsh/templates/zshrc.template.zsh ~/.zshrc + +3. Set ZSH as your default shell: + + `chsh -s /bin/zsh` + +4. Start / restart ZSH by opening a new terminal window or tab. + +### Problems? + +If you are not able to find certain commands after switching to *Oh My ZSH*, you need +to modify `PATH` in `~/.zshrc`. + +## Usage + +- Enable the plugins you want in `~/.zshrc`. + - Browse `plugins/` to see what is available. + - Populate the plugins array `plugins=(git osx ruby)`. + +- Change the prompt in `~/.zshrc`. + - For a list of themes, type `prompt -l`. + - To preview a theme, type `prompt -p name`. + +## Useful + +The [ZSH Reference Card](http://www.bash2zsh.com/zsh_refcard/refcard.pdf) is tasty. + +### Customization + +If you have many related functions, you can organise them in a file in the +`functions/` directory. + +## Help out! + +I am not a ZSH expert and suspect that there are improvements to be made. If you have +ideas on how to make the configuration easier to maintain or improve the performance, +do not hesitate to fork and send pull requests! + +## Contributors + +This project would not exist without all of our awesome users and contributors. + +- View the growing [list](https://github.com/robbyrussell/oh-my-zsh/contributors) of + contributors. + +Thank you so much! + diff --git a/README.textile b/README.textile deleted file mode 100644 index c176540fd..000000000 --- a/README.textile +++ /dev/null @@ -1,55 +0,0 @@ -A handful of functions, auto-complete helpers, and stuff that makes you shout... - -bq. "OH MY ZSHELL!" - -h2. Setup - -@oh-my-zsh@ should work with any recent release of "zsh":http://www.zsh.org/, the minimum recommended version is 4.3.9. - -1. Clone the repository - - @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. - - *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@ - -3. Set zsh as your default shell: - - @chsh -s /bin/zsh@ - -4. Start / restart zsh (open a new terminal is easy enough...) - -h3. Problems? - -You _might_ need to modify your PATH in ~/.zshrc if you're not able to find some commands after switching to _Oh My Zsh_. - -h2. Usage - -* enable the plugins you want in your @~/.zshrc@ (take a look at @plugins/@ to see what's possible) -** example: @plugins=(git osx ruby)@ -* Theme support: Change the @ZSH_THEME@ environment variable in @~/.zshrc@. -** Take a look at the "current themes":https://wiki.github.com/robbyrussell/oh-my-zsh/themes that come bundled with _Oh My Zsh_. -* much much more... take a look at @lib/@ what _Oh My Zsh_ offers... - -h2. Useful - -the "refcard":http://www.bash2zsh.com/zsh_refcard/refcard.pdf is pretty tasty for tips. - -h3. Customization - -If you have many functions which go good together you can put them as a *.plugin.zsh file in the @custom/plugins/@ directory and then enable this plugin. - -h2. Help out! - -I'm far from being a zsh-expert and suspect there are many ways to improve. If you have ideas on how to make the configuration easier to maintain (and faster), don't hesitate to fork and send pull requests! - -h2. Contributors - -This project wouldn't exist without all of our awesome users and contributors. - -* "View our growing list of contributors":https://github.com/robbyrussell/oh-my-zsh/contributors - -Thank you so much! From f75f5316a10dc19bd194b774129212c62004ed2a Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 28 Jul 2011 15:43:26 -0400 Subject: [PATCH 476/614] Merged correction.zsh into alias.zsh. --- functions/alias.zsh | 18 ++++++++++++++++-- functions/correction.zsh | 11 ----------- 2 files changed, 16 insertions(+), 13 deletions(-) delete mode 100644 functions/correction.zsh diff --git a/functions/alias.zsh b/functions/alias.zsh index 2cbe9ad9e..bde89ca8d 100644 --- a/functions/alias.zsh +++ b/functions/alias.zsh @@ -1,3 +1,6 @@ +setopt correct # Correct commands. +setopt correct_all # Correct all arguments. + # The 'ls' Family # ------------------------------------------------------------------------------ if [[ "$DISABLE_COLOR" != 'true' ]]; then @@ -30,11 +33,16 @@ alias sl='ls' # I often screw this up. # General # ------------------------------------------------------------------------------ -alias rm='nocorrect rm -i' +alias cd='nocorrect cd' alias cp='nocorrect cp -i' -alias mv='nocorrect mv -i' +alias find='noglob find' +alias gcc='nocorrect gcc' alias ln='nocorrect ln -i' +alias man='nocorrect man' alias mkdir='nocorrect mkdir -p' +alias mv='nocorrect mv -i' +alias rm='nocorrect rm -i' +alias scp='nocorrect scp' alias du='du -kh' alias df='df -kh' alias pu='pushd' @@ -54,6 +62,12 @@ alias pbp='pbpaste' alias print-path='echo -e ${PATH//:/\\n}' alias t="t --task-dir ~/.tasks --list todo.txt --delete-if-empty" +(( $+commands[ebuild] )) && alias ebuild='nocorrect ebuild' +(( $+commands[gist] )) && alias gist='nocorrect gist' +(( $+commands[heroku] )) && alias heroku='nocorrect heroku' +(( $+commands[hpodder] )) && alias hpodder='nocorrect hpodder' +(( $+commands[mysql] )) && alias mysql='nocorrect mysql' + if [[ -x "${commands[htop]}" ]]; then alias top=htop else diff --git a/functions/correction.zsh b/functions/correction.zsh deleted file mode 100644 index 5b3c58fe4..000000000 --- a/functions/correction.zsh +++ /dev/null @@ -1,11 +0,0 @@ -setopt correct_all - -alias man='nocorrect man' -alias mv='nocorrect mv' -alias mysql='nocorrect mysql' -alias mkdir='nocorrect mkdir' -alias gist='nocorrect gist' -alias heroku='nocorrect heroku' -alias ebuild='nocorrect ebuild' -alias hpodder='nocorrect hpodder' - From 65c5f613e1f6ed7e1e47fca14bae93d51cd665f8 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 28 Jul 2011 15:44:48 -0400 Subject: [PATCH 477/614] Improved completion. --- functions/completion.zsh | 162 +++++++++++++++++++++++++++------------ 1 file changed, 113 insertions(+), 49 deletions(-) diff --git a/functions/completion.zsh b/functions/completion.zsh index c60faf636..c0ae21d19 100644 --- a/functions/completion.zsh +++ b/functions/completion.zsh @@ -3,64 +3,128 @@ if [[ "$TERM" == 'dumb' ]]; then return fi -unsetopt menu_complete # Do not autoselect the first completion entry. -unsetopt flow_control # Disable start/stop characters in shell editor. -setopt auto_menu # Show completion menu on a succesive tab press. setopt complete_in_word # Complete from both ends of a word. setopt always_to_end # Move cursor to the end of a completed word. +setopt path_dirs # Perform path search even on command names with slashes. +setopt auto_menu # Show completion menu on a succesive tab press. +setopt auto_list # Automatically list choices on ambiguous completion. +setopt auto_param_slash # If completed parameter is a directory, add a trailing slash. +unsetopt menu_complete # Do not autoselect the first completion entry. +unsetopt flow_control # Disable start/stop characters in shell editor. -WORDCHARS='' - -# FIXME: complist is crashing ZSH on menu completion. -# zmodload -i zsh/complist - -## Case-insensitive (all), partial-word, and then substring completion. -if [[ "$CASE_SENSITIVE" == "true" ]]; then - zstyle ':completion:*' matcher-list 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' - unset CASE_SENSITIVE -else - zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' -fi - -zstyle ':completion:*' list-colors '' - -# FIXME: It depends on complist which crashes ZSH on menu completion. -# Should this be in key-bindings.zsh? -# bindkey -M menuselect '^o' accept-and-infer-next-history - -zstyle ':completion:*:*:*:*:*' menu select -zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01' -zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm -w -w" - -# Disable named-directories autocompletion. -zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories -cdpath=(.) - -# Use /etc/hosts and known_hosts for hostname completion. -[ -r ~/.ssh/known_hosts ] && _ssh_hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=() -[ -r /etc/hosts ] && : ${(A)_etc_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$(/dev/null)"}%%[#| ]*}//,/ } + ${=${(f)"$(cat /etc/hosts(|)(N) <<(ypcat hosts 2>/dev/null))"}%%\#*} + ${=${${${${(@M)${(f)"$(cat ~/.ssh/config 2>/dev/null)"}:#Host *}#Host }:#*\**}:#*\?*}} +)' # Don't complete uninteresting users... zstyle ':completion:*:*:*:users' ignored-patterns \ - adm amanda apache avahi beaglidx bin cacti canna clamav daemon \ - dbus distcache dovecot fax ftp games gdm gkrellmd gopher \ - hacluster haldaemon halt hsqldb ident junkbust ldap lp mail \ - mailman mailnull mldonkey mysql nagios \ - named netdump news nfsnobody nobody nscd ntp nut nx openvpn \ - operator pcap postfix postgres privoxy pulse pvm quagga radvd \ - rpc rpcuser rpm shutdown squid sshd sync uucp vcsa xfs + adm amanda apache avahi beaglidx bin cacti canna clamav daemon \ + dbus distcache dovecot fax ftp games gdm gkrellmd gopher \ + hacluster haldaemon halt hsqldb ident junkbust ldap lp mail \ + mailman mailnull mldonkey mysql nagios \ + named netdump news nfsnobody nobody nscd ntp nut nx openvpn \ + operator pcap postfix postgres privoxy pulse pvm quagga radvd \ + rpc rpcuser rpm shutdown squid sshd sync uucp vcsa xfs '_*' # ... unless we really want to. zstyle '*' single-ignored show +# Ignore multiple entries. +zstyle ':completion:*:(rm|kill|diff):*' ignore-line yes +zstyle ':completion:*:rm:*' file-patterns '*:all-files' + +# Kill +zstyle ':completion:*:*:*:*:processes' command 'ps -u $USER -o pid,user,comm -w' +zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;36=0=01' +zstyle ':completion:*:*:kill:*' menu yes select +zstyle ':completion:*:*:kill:*' force-list always +zstyle ':completion:*:*:kill:*' insert-ids single + +# Man +zstyle ':completion:*:manuals' separate-sections true +zstyle ':completion:*:manuals.(^1*)' insert-sections true + +# Media Players +zstyle ':completion:*:*:mpg123:*' file-patterns '*.(mp3|MP3):mp3\ files *(-/):directories' +zstyle ':completion:*:*:mpg321:*' file-patterns '*.(mp3|MP3):mp3\ files *(-/):directories' +zstyle ':completion:*:*:ogg123:*' file-patterns '*.(ogg|OGG|flac):ogg\ files *(-/):directories' +zstyle ':completion:*:*:mocp:*' file-patterns '*.(wav|WAV|mp3|MP3|ogg|OGG|flac):ogg\ files *(-/):directories' + +# Mutt +if [[ -f ~/.mutt/aliases ]]; then + zstyle ':completion:*:*:mutt:*' menu yes select + zstyle ':completion:*:mutt:*' users ${${${(f)"$(<~/.mutt/aliases)"}#alias[[:space:]]}%%[[:space:]]*} +fi + +# SSH/SCP/RSYNC +zstyle ':completion:*:(scp|rsync):*' tag-order 'hosts:-host hosts:-domain:domain hosts:-ipaddr:ip\ address *' +zstyle ':completion:*:(scp|rsync):*' group-order users files all-files hosts-domain hosts-host hosts-ipaddr +zstyle ':completion:*:ssh:*' tag-order users 'hosts:-host hosts:-domain:domain hosts:-ipaddr:ip\ address *' +zstyle ':completion:*:ssh:*' group-order hosts-domain hosts-host users hosts-ipaddr +zstyle ':completion:*:(ssh|scp|rsync):*:hosts-host' ignored-patterns '*.*' loopback localhost +zstyle ':completion:*:(ssh|scp|rsync):*:hosts-domain' ignored-patterns '<->.<->.<->.<->' '^*.*' '*@*' +zstyle ':completion:*:(ssh|scp|rsync):*:hosts-ipaddr' ignored-patterns '^<->.<->.<->.<->' '127.0.0.<->' + From a54974864c466e112183f810d862c3a3e201f0c3 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 28 Jul 2011 16:01:32 -0400 Subject: [PATCH 478/614] Removed unneeded aliases since Lion's Terminal supports 256 colours. --- functions/alias.zsh | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/functions/alias.zsh b/functions/alias.zsh index bde89ca8d..2622aee9f 100644 --- a/functions/alias.zsh +++ b/functions/alias.zsh @@ -95,26 +95,8 @@ if [[ "$DISABLE_COLOR" != 'true' ]]; then fi # Terminal Multiplexer -# ------------------------------------------------------------------------------ -if [[ "$TERM" == *256color* ]]; then - if [[ -e "$HOME/.screenrc256" ]]; then - screenrc="-c '$HOME/.screenrc256'" - tmuxconf="-f '$HOME/.tmux256.conf'" - fi -else - if [[ -e "$HOME/.screenrc" ]]; then - screenrc="-c '$HOME/.screenrc'" - tmuxconf="-f '$HOME/.tmux.conf'" - fi -fi - -alias screen="screen $screenrc" -alias sl="screen $screenrc -list" -alias sr="screen $screenrc -a -A -U -D -R" -alias S="screen $screenrc -U -S" - -if (( ${+commands[tmux]} )); then - alias tmux="tmux $tmuxconf" - alias tls="tmux list-sessions" -fi +alias sl="screen -list" +alias sr="screen -a -A -U -D -R" +alias sn="screen -U -S" +alias tl="tmux list-sessions" From 7223cd236108e22544e13de7d52a2aa97525373c Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 28 Jul 2011 16:16:27 -0400 Subject: [PATCH 479/614] Refactored aliases. --- functions/alias.zsh | 91 +++++++++++++++++++++++++++------------------ 1 file changed, 54 insertions(+), 37 deletions(-) diff --git a/functions/alias.zsh b/functions/alias.zsh index 2622aee9f..62af43ce9 100644 --- a/functions/alias.zsh +++ b/functions/alias.zsh @@ -2,16 +2,9 @@ setopt correct # Correct commands. setopt correct_all # Correct all arguments. # The 'ls' Family -# ------------------------------------------------------------------------------ if [[ "$DISABLE_COLOR" != 'true' ]]; then - if (( ${+commands[dircolors]} )); then - dircolors="${commands[dircolors]}" - fi - if (( ${+commands[gdircolors]} )); then - dircolors="${commands[gdircolors]}" - fi - if [[ -x "$dircolors" ]] && [[ -e "$HOME/.dir_colors" ]]; then - eval $("$dircolors" "$HOME/.dir_colors") + if [[ -f "$HOME/.dir_colors" ]] && ( (( $+commands[dircolors] )) || ( (( $+plugins[(er)gnu-utils] )) && (( $+commands[gdircolors] )) ) ); then + eval $("${commands[dircolors]:-$commands[gdircolors]}" "$HOME/.dir_colors") alias ls='ls -hF --group-directories-first --color=auto' else export CLICOLOR=1 @@ -20,6 +13,7 @@ if [[ "$DISABLE_COLOR" != 'true' ]]; then fi fi +alias l='ls -1A' # Show files in one column. alias ll='ls -lh' # Show human readable. alias la='ls -lhA' # Show hidden files. alias lx='ls -lhXB' # Sort by extension. @@ -32,54 +26,65 @@ alias lr='ls -lhR' # Recursive ls. alias sl='ls' # I often screw this up. # General -# ------------------------------------------------------------------------------ +alias _='sudo' +alias b="$BROWSER" alias cd='nocorrect cd' alias cp='nocorrect cp -i' +alias df='df -kh' +alias du='du -kh' +alias e="$EDITOR" alias find='noglob find' alias gcc='nocorrect gcc' +alias history='fc -l 1' alias ln='nocorrect ln -i' +alias locate='noglob locate' alias man='nocorrect man' alias mkdir='nocorrect mkdir -p' alias mv='nocorrect mv -i' +alias po='popd' +alias pu='pushd' +alias rake='noglob rake' alias rm='nocorrect rm -i' alias scp='nocorrect scp' -alias du='du -kh' -alias df='df -kh' -alias pu='pushd' -alias po='popd' -alias _='sudo' -alias o='open' -alias e="$EDITOR" -alias v="$PAGER" -alias b="$BROWSER" -alias history='fc -l 1' -alias get='curl -C - -O' -alias afind='ack -il' alias type='type -a' -alias ssh='ssh -X' +alias v="$PAGER" + +# Mac OS X +if [[ "$OSTYPE" != darwin* ]]; then + alias open='xdg-open' + alias get='wget --continue --progress=bar' + + if (( $+commands[xclip] )); then + alias pbcopy='xclip -selection clipboard -in' + alias pbpaste='xclip -selection clipboard -out' + fi + + if (( $+commands[xsel] )); then + alias pbcopy='xsel --clipboard --input' + alias pbpaste='xsel --clipboard --output' + fi +else + alias get='curl --continue-at - --location --progress-bar --remote-name' +fi + +alias o='open' alias pbc='pbcopy' alias pbp='pbpaste' -alias print-path='echo -e ${PATH//:/\\n}' -alias t="t --task-dir ~/.tasks --list todo.txt --delete-if-empty" -(( $+commands[ebuild] )) && alias ebuild='nocorrect ebuild' -(( $+commands[gist] )) && alias gist='nocorrect gist' -(( $+commands[heroku] )) && alias heroku='nocorrect heroku' -(( $+commands[hpodder] )) && alias hpodder='nocorrect hpodder' -(( $+commands[mysql] )) && alias mysql='nocorrect mysql' - -if [[ -x "${commands[htop]}" ]]; then +# Top +if (( $+commands[htop] )); then alias top=htop else alias topm='top -o vsize' alias topc='top -o cpu' fi +# Diff/Make if [[ "$DISABLE_COLOR" != 'true' ]]; then - if [[ -x "${commands[colordiff]}" ]]; then + if (( $+commands[colordiff] )); then alias diff='colordiff -u' compdef colordiff=diff - elif [[ -x "${commands[git]}" ]]; then + elif (( $+commands[git] )); then function diff() { git --no-pager diff --color=always --no-ext-diff --no-index "$@"; } @@ -88,7 +93,7 @@ if [[ "$DISABLE_COLOR" != 'true' ]]; then alias diff='diff -u' fi - if [[ -x "${commands[colormake]}" ]]; then + if (( $+commands[colormake] )); then alias make='colormake' compdef colormake=make fi @@ -96,7 +101,19 @@ fi # Terminal Multiplexer alias sl="screen -list" -alias sr="screen -a -A -U -D -R" alias sn="screen -U -S" -alias tl="tmux list-sessions" +alias sr="screen -a -A -U -D -R" + +if (( $+commands[tmux] )); then + alias ta="tmux attach-session" + alias tl="tmux list-sessions" +fi + +# Miscellaneous +(( $+commands[ack] )) && alias afind='ack -il' +(( $+commands[ebuild] )) && alias ebuild='nocorrect ebuild' +(( $+commands[gist] )) && alias gist='nocorrect gist' +(( $+commands[heroku] )) && alias heroku='nocorrect heroku' +(( $+commands[hpodder] )) && alias hpodder='nocorrect hpodder' +(( $+commands[mysql] )) && alias mysql='nocorrect mysql' From 910b854ab46853227b1d4cca4bffd388e7ef3a42 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 28 Jul 2011 16:28:11 -0400 Subject: [PATCH 480/614] Added new directory options and removed cd aliases. --- functions/directory.zsh | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/functions/directory.zsh b/functions/directory.zsh index d5a116717..eb7e0571a 100644 --- a/functions/directory.zsh +++ b/functions/directory.zsh @@ -1,16 +1,15 @@ setopt auto_cd # Auto cd to a directory without typing cd. setopt auto_pushd # Push the old directory onto the stack on cd. setopt pushd_ignore_dups # Don't store duplicates in the stack. +setopt pushd_silent # Do not print the directory stack after pushd or popd. +setopt pushd_to_home # Push to home directory when no argument is given. +setopt pushd_minus # Use +/-n to specify a directory in the stack. setopt cdable_vars # Change directory to a path stored in a variable. setopt auto_name_dirs # Auto add variable-stored paths to ~ list. setopt multios # Write to multiple descriptors. - -alias ..='cd ..' -alias cd..='cd ..' -alias cd...='cd ../..' -alias cd....='cd ../../..' -alias cd.....='cd ../../../..' -alias cd/='cd /' +setopt extended_glob # Use extended globbing syntax. +unsetopt clobber # Don't overwrite existing files with > and >>. + # Use >! and >>! to bypass. alias 1='cd -' alias 2='cd +2' @@ -22,17 +21,3 @@ alias 7='cd +7' alias 8='cd +8' alias 9='cd +9' -cd () { - if [[ "x$*" == "x..." ]]; then - cd ../.. - elif [[ "x$*" == "x...." ]]; then - cd ../../.. - elif [[ "x$*" == "x....." ]]; then - cd ../../.. - elif [[ "x$*" == "x......" ]]; then - cd ../../../.. - else - builtin cd "$@" - fi -} - From 90da5fc874cb5da8354bbf77b04a883abc7a6c67 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 28 Jul 2011 16:36:41 -0400 Subject: [PATCH 481/614] Merged zshenv into environment.zsh. --- README.md | 3 +- functions/environment.zsh | 106 ++++++++++++++++++++++++++++++++------ 2 files changed, 91 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index fab2f748c..c22982a3d 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,8 @@ minimum recommended version is 4.3.9. ### Problems? If you are not able to find certain commands after switching to *Oh My ZSH*, you need -to modify `PATH` in `~/.zshrc`. +to modify `PATH` in `~/.zshrc`, or better yet, in `~/functions/environment.zsh` (may +be subject to merge conflicts). ## Usage diff --git a/functions/environment.zsh b/functions/environment.zsh index bb4ff8a9f..4909ea98e 100644 --- a/functions/environment.zsh +++ b/functions/environment.zsh @@ -2,28 +2,100 @@ autoload -Uz url-quote-magic zle -N self-insert url-quote-magic +# General +setopt rc_quotes # Allow 'Henry''s Garage' instead of 'Henry'\''s Garage'. +unsetopt mail_warning # Don't print a warning message if a mail file has been accessed + # Jobs -setopt long_list_jobs +setopt long_list_jobs # List jobs in the long format by default. +setopt auto_resume # Attempt to resume existing job before creating a new process. +setopt notify # Report status of background jobs immediately. +unsetopt bg_nice # Don't run all background jobs at a lower priority. +unsetopt hup # Don't kill jobs on shell exit. +unsetopt check_jobs # Don't report on jobs when shell exit. -# Locale -[[ -z "$LANG" ]] && export LANG="en_US.UTF-8" -[[ -z "$LC_ALL" ]] && export LC_ALL="en_US.UTF_8" -[[ -z "$LC_COLLATE" ]] && export LC_COLLATE="en_US.UTF-8" -[[ -z "$LC_CTYPE" ]] && export LC_CTYPE="en_US.UTF-8" -[[ -z "$LC_MESSAGES" ]] && export LC_MESSAGES="en_US.UTF-8" -[[ -z "$LC_MONETARY" ]] && export LC_MONETARY="en_US.UTF-8" -[[ -z "$LC_NUMERIC" ]] && export LC_NUMERIC="en_US.UTF-8" -[[ -z "$LC_TIME" ]] && export LC_TIME="en_US.UTF-8" +# PATH +typeset -U path manpath cdpath fpath -# Pager -[[ -z "$PAGER" ]] && export PAGER=less +path=( + $HOME/.tilde/bin + $HOME/.tilde/opt/bin + /usr/local/bin + /usr/local/sbin + /usr/bin + /bin + /usr/sbin + /sbin +) + +for path_file in /etc/paths.d/*; do + path+=($(<$path_file)) +done + +manpath=( + $HOME/.tilde/share/man + $HOME/.tilde/opt/share/man + /usr/local/share/man + /usr/share/man +) + +for path_file in /etc/manpaths.d/*; do + manpath+=($(<$path_file)) +done + +cdpath=( + $HOME + $HOME/Developer +) + +# Language +export LANG="en_AU.UTF-8" +export LC_ALL="$LANG" +export LC_COLLATE="$LANG" +export LC_CTYPE="$LANG" +export LC_MESSAGES="$LANG" +export LC_MONETARY="$LANG" +export LC_NUMERIC="$LANG" +export LC_TIME="$LANG" + +# Editors +export EDITOR="vim" +export VISUAL="vim" +export PAGER='less' # Grep if [[ "$DISABLE_COLOR" != 'true' ]]; then - [[ -z "$GREP_OPTIONS" ]] && export GREP_OPTIONS='--color=auto' - [[ -z "$GREP_COLOR" ]] && export GREP_COLOR='37;45' -else - export GREP_OPTIONS='--color=none' - export GREP_COLOR='' + export GREP_COLOR='37;45' + export GREP_OPTIONS='--color=auto' +fi + +# Browser (Default) +if (( $+commands[xdg-open] )); then + export BROWSER='xdg-open' +fi + +if (( $+commands[open] )); then + export BROWSER='open' +fi + +# Less +export LESSCHARSET="UTF-8" +export LESSHISTFILE='-' +export LESSEDIT='vim ?lm+%lm. %f' +export LESS='-F -g -i -M -R -S -w -X -z-4' + +if (( $+commands[lesspipe.sh] )); then + export LESSOPEN='| /usr/bin/env lesspipe.sh %s 2>&-' +fi + +# Termcap +if [[ "$DISABLE_COLOR" != 'true' ]]; then + export LESS_TERMCAP_mb=$'\E[01;31m' # begin blinking + export LESS_TERMCAP_md=$'\E[01;31m' # begin bold + export LESS_TERMCAP_me=$'\E[0m' # end mode + export LESS_TERMCAP_se=$'\E[0m' # end standout-mode + export LESS_TERMCAP_so=$'\E[00;47;30m' # begin standout-mode + export LESS_TERMCAP_ue=$'\E[0m' # end underline + export LESS_TERMCAP_us=$'\E[01;32m' # begin underline fi From 9c24ac82110309da3b742d5c1b2c0aaf6b5e15a9 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 28 Jul 2011 16:41:39 -0400 Subject: [PATCH 482/614] Added helper functions. --- functions/alias.zsh | 4 +-- functions/environment.zsh | 4 +-- functions/helper.zsh | 50 ++++++++++++++++++++++++++++ functions/terminal.zsh | 2 +- plugins/compleat/compleat.plugin.zsh | 4 +-- plugins/git/git.plugin.zsh | 12 +++---- 6 files changed, 63 insertions(+), 13 deletions(-) create mode 100644 functions/helper.zsh diff --git a/functions/alias.zsh b/functions/alias.zsh index 62af43ce9..436b80554 100644 --- a/functions/alias.zsh +++ b/functions/alias.zsh @@ -2,7 +2,7 @@ setopt correct # Correct commands. setopt correct_all # Correct all arguments. # The 'ls' Family -if [[ "$DISABLE_COLOR" != 'true' ]]; then +if ! check-bool "$DISABLE_COLOR"; then if [[ -f "$HOME/.dir_colors" ]] && ( (( $+commands[dircolors] )) || ( (( $+plugins[(er)gnu-utils] )) && (( $+commands[gdircolors] )) ) ); then eval $("${commands[dircolors]:-$commands[gdircolors]}" "$HOME/.dir_colors") alias ls='ls -hF --group-directories-first --color=auto' @@ -80,7 +80,7 @@ else fi # Diff/Make -if [[ "$DISABLE_COLOR" != 'true' ]]; then +if ! check-bool "$DISABLE_COLOR"; then if (( $+commands[colordiff] )); then alias diff='colordiff -u' compdef colordiff=diff diff --git a/functions/environment.zsh b/functions/environment.zsh index 4909ea98e..ec725ffbf 100644 --- a/functions/environment.zsh +++ b/functions/environment.zsh @@ -64,7 +64,7 @@ export VISUAL="vim" export PAGER='less' # Grep -if [[ "$DISABLE_COLOR" != 'true' ]]; then +if ! check-bool "$DISABLE_COLOR"; then export GREP_COLOR='37;45' export GREP_OPTIONS='--color=auto' fi @@ -89,7 +89,7 @@ if (( $+commands[lesspipe.sh] )); then fi # Termcap -if [[ "$DISABLE_COLOR" != 'true' ]]; then +if ! check-bool "$DISABLE_COLOR"; then export LESS_TERMCAP_mb=$'\E[01;31m' # begin blinking export LESS_TERMCAP_md=$'\E[01;31m' # begin bold export LESS_TERMCAP_me=$'\E[0m' # end mode diff --git a/functions/helper.zsh b/functions/helper.zsh new file mode 100644 index 000000000..89e751405 --- /dev/null +++ b/functions/helper.zsh @@ -0,0 +1,50 @@ +# Checks if a file can be autoloaded by trying to load it in a subshell. +function autoloadable() { + ( unfunction $1 ; autoload -U +X $1 ) &> /dev/null +} + +# Checks boolean variable for "true" (case insensitive "1", "y", "yes", "t", "true", "o", and "on"). +function check-bool { + [[ -n "$1" && "$1" == (1|[Yy]([Ee][Ss]|)|[Tt]([Rr][Uu][Ee]|)|[Oo]([Nn]|)) ]] +} + +# Trap signals were generated with 'kill -l'. +# DEBUG, EXIT, and ZERR are ZSH signals. +TRAP_SIGNALS=( + ABRT ALRM BUS CHLD CONT EMT FPE HUP ILL INFO INT IO KILL PIPE PROF QUIT + SEGV STOP SYS TERM TRAP TSTP TTIN TTOU URG USR1 USR2 VTALRM WINCH XCPU XFSZ + DEBUG EXIT ZERR +) + +# Adds a function to a list to be called when a trap is triggered. +function add-zsh-trap { + if (( $# < 2 )); then + echo "Usage: $0 type function" + return 1 + fi + + if [[ -z "$TRAP_SIGNALS[(r)$1]" ]]; then + echo "$0: unknown signal: $1" + return 1 + fi + + local trap_functions="TRAP${1}_FUNCTIONS" + if (( ! ${(P)+trap_functions} )); then + typeset -gaU "$trap_functions" + fi + eval "$trap_functions+="$2"" + + if (( ! $+functions[TRAP${1}] )); then + eval " + function TRAP${1}() { + for trap_function in \"\$TRAP${1}_FUNCTIONS[@]\"; do + if (( \$+functions[\$trap_function] )); then + \"\$trap_function\" \"\$1\" + fi + done + return \$(( 128 + \$1 )) + } + " + fi +} + diff --git a/functions/terminal.zsh b/functions/terminal.zsh index bdd71cc49..ab5071aec 100644 --- a/functions/terminal.zsh +++ b/functions/terminal.zsh @@ -14,7 +14,7 @@ fi # Partially supports Mac OS X Terminal since it can't set window and tab separately. # Usage: title "tab title" "window title" function terminal-title { - if [[ "$DISABLE_AUTO_TITLE" != 'true' ]]; then + if ! check-bool "$DISABLE_AUTO_TITLE"; then if [[ "$TERM" == screen* ]]; then # Set GNU Screen's hardstatus (usually truncated at 20 characters). printf "\ek%s\e\\" ${(V)1} diff --git a/plugins/compleat/compleat.plugin.zsh b/plugins/compleat/compleat.plugin.zsh index 660131002..10107334c 100644 --- a/plugins/compleat/compleat.plugin.zsh +++ b/plugins/compleat/compleat.plugin.zsh @@ -2,14 +2,14 @@ # FILE: compleat.plugin.zsh # DESCRIPTION: oh-my-zsh plugin file. # AUTHOR: Sorin Ionescu -# VERSION: 1.0.1 +# VERSION: 1.0.2 # ------------------------------------------------------------------------------ if (( ${+commands[compleat]} )); then compleat_setup="${commands[compleat]:h:h}/share/compleat-1.0/compleat_setup" if [[ -f "$compleat_setup" ]]; then - if ! bashcompinit >/dev/null 2>&1; then + if autoloadable bashcompinit; then autoload -Uz bashcompinit && bashcompinit fi diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index cbf00395b..c89ce016c 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -85,27 +85,27 @@ function git-prompt-status() { fi while IFS=$'\n' read line; do - if [[ "$line" == \?\?\ * ]] && [[ untracked != 'yes' ]]; then + if [[ "$line" == \?\?\ * ]] && ! check-bool "$untracked"; then untracked='yes' indicators="${ZSH_THEME_GIT_PROMPT_UNTRACKED}${indicators}" fi - if [[ "$line" == (((A|M|D|T) )|(AD|AM|AT|MM))\ * ]] && [[ added != 'yes' ]]; then + if [[ "$line" == (((A|M|D|T) )|(AD|AM|AT|MM))\ * ]] && ! check-bool "$added"; then added='yes' indicators="${ZSH_THEME_GIT_PROMPT_ADDED}${indicators}" fi - if [[ "$line" == (( (M|T))|(AM|AT|MM))\ * ]] && [[ modified != 'yes' ]]; then + if [[ "$line" == (( (M|T))|(AM|AT|MM))\ * ]] && ! check-bool "$modified"; then modified='yes' indicators="${ZSH_THEME_GIT_PROMPT_MODIFIED}${indicators}" fi - if [[ "$line" == R\ \ * ]] && [[ renamed != 'yes' ]]; then + if [[ "$line" == R\ \ * ]] && ! check-bool "$renamed"; then renamed='yes' indicators="${ZSH_THEME_GIT_PROMPT_RENAMED}${indicators}" fi - if [[ "$line" == ( D|AD)\ * ]] && [[ deleted != 'yes' ]]; then + if [[ "$line" == ( D|AD)\ * ]] && ! check-bool "$deleted"; then deleted='yes' indicators="${ZSH_THEME_GIT_PROMPT_DELETED}${indicators}" fi - if [[ "$line" == UU\ * ]] && [[ unmerged != 'yes' ]]; then + if [[ "$line" == UU\ * ]] && ! check-bool "$unmerged"; then unmerged='yes' indicators="${ZSH_THEME_GIT_PROMPT_UNMERGED}${indicators}" fi From e2eeef5f860b5a98eec35c0ac59ba70bd3d1493a Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 28 Jul 2011 16:59:15 -0400 Subject: [PATCH 483/614] Prepend, not append, to fpath. --- oh-my-zsh.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/oh-my-zsh.zsh b/oh-my-zsh.zsh index 3980b6431..12c3d4838 100644 --- a/oh-my-zsh.zsh +++ b/oh-my-zsh.zsh @@ -6,9 +6,9 @@ if [[ "$TERM" == 'dumb' ]]; then fi # Add functions to fpath. -fpath+=(${OMZ}/plugins/${^plugins} $OMZ/themes/*(/)) +fpath=($OMZ/themes/*(/) $OMZ/plugins/${^plugins} $OMZ/functions $fpath) -# Load and run compinit. +# Load and initialize the completion system. autoload -Uz compinit && compinit -i # Load all files in $OMZ/oh-my-zsh/lib/ that end in .zsh. From 9f4b8793e74a0cd1cca75702f5e56db69d45f23a Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 28 Jul 2011 17:00:56 -0400 Subject: [PATCH 484/614] Compile files into a pre-parsed form for faster sourcing. --- .gitignore | 6 ++---- oh-my-zsh.zsh | 26 ++++++++++++++++++++++---- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 31cc75cb9..5d74a078a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,2 @@ -locals.zsh -log/.zsh_history -projects.zsh -cache +*.zwc +*.zwc.old diff --git a/oh-my-zsh.zsh b/oh-my-zsh.zsh index 12c3d4838..f063a1db5 100644 --- a/oh-my-zsh.zsh +++ b/oh-my-zsh.zsh @@ -26,8 +26,26 @@ done # Load and run the prompt theming system. autoload -Uz promptinit && promptinit -i -# Compile zcompdump, if modified, to increase startup speed. -if [[ "$HOME/.zcompdump" -nt "$HOME/.zcompdump.zwc" ]] || [[ ! -e "$HOME/.zcompdump.zwc" ]]; then - zcompile "$HOME/.zcompdump" -fi +# Load the automatic recompiler. +autoload -Uz zrecompile + +# Compile files. +for zsh_file in $HOME/.z{login,logout,profile,shenv,shrc,compdump}(N) $OMZ/*.zsh(N); do + zrecompile -q -p -U -z "$zsh_file" +done + +# Compile function directories. +for (( i=1; i <= $#fpath; i++ )); do + function_dir="$fpath[i]" + [[ "$function_dir" == (.|..) ]] \ + || [[ "$function_dir" == (.|..)/* ]] \ + || [[ ! -w "$function_dir:h" ]] && continue + function_files=($function_dir/^*(\.(rej|orig)|~|\#)(N-.)) + [[ -n "$function_files" ]] \ + && function_files=(${${(M)function_files%/*/*}#/}) \ + && ( cd "$function_dir:h" && zrecompile -q -p -U -z "${function_dir:t}.zwc" "$function_files[@]" ) \ + && fpath[i]="$fpath[i].zwc" +done +unset function_dir +unset function_files From 2e4a053c8c5bde6d11313a9232758dcb8d1e5771 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 28 Jul 2011 17:06:45 -0400 Subject: [PATCH 485/614] Source functions in the order needed. --- README.md | 4 ++-- functions/init.zsh | 12 ++++++++++++ oh-my-zsh.zsh | 6 ++---- 3 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 functions/init.zsh diff --git a/README.md b/README.md index c22982a3d..38d65e946 100644 --- a/README.md +++ b/README.md @@ -27,8 +27,8 @@ minimum recommended version is 4.3.9. ### Problems? If you are not able to find certain commands after switching to *Oh My ZSH*, you need -to modify `PATH` in `~/.zshrc`, or better yet, in `~/functions/environment.zsh` (may -be subject to merge conflicts). +to modify `PATH` in `~/.zshrc`, or better yet, in `~/functions/02.environment.zsh` +(may be subject to merge conflicts). ## Usage diff --git a/functions/init.zsh b/functions/init.zsh new file mode 100644 index 000000000..0c7765db4 --- /dev/null +++ b/functions/init.zsh @@ -0,0 +1,12 @@ +# Source function files (the order matters). +source "${0:h}/helper.zsh" +source "${0:h}/environment.zsh" +source "${0:h}/terminal.zsh" +source "${0:h}/keyboard.zsh" +source "${0:h}/completion.zsh" +source "${0:h}/history.zsh" +source "${0:h}/directory.zsh" +source "${0:h}/alias.zsh" +source "${0:h}/spectrum.zsh" +source "${0:h}/utility.zsh" + diff --git a/oh-my-zsh.zsh b/oh-my-zsh.zsh index f063a1db5..965bb90aa 100644 --- a/oh-my-zsh.zsh +++ b/oh-my-zsh.zsh @@ -11,10 +11,8 @@ fpath=($OMZ/themes/*(/) $OMZ/plugins/${^plugins} $OMZ/functions $fpath) # Load and initialize the completion system. autoload -Uz compinit && compinit -i -# Load all files in $OMZ/oh-my-zsh/lib/ that end in .zsh. -for function_file in $OMZ/functions/*.zsh; do - source "$function_file" -done +# Source function files. +source "$OMZ/functions/init.zsh" # Load all plugins defined in ~/.zshrc. for plugin in $plugins; do From 49c5517d1be4f1586ef4e4495d3f0c3ec28de618 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 28 Jul 2011 18:06:47 -0400 Subject: [PATCH 486/614] Added archive listing to extract plugin. --- plugins/extract/_ls-archive | 6 ++++ plugins/extract/extract.plugin.zsh | 53 +++++++++++++++++++++++++++--- 2 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 plugins/extract/_ls-archive diff --git a/plugins/extract/_ls-archive b/plugins/extract/_ls-archive new file mode 100644 index 000000000..591aeec69 --- /dev/null +++ b/plugins/extract/_ls-archive @@ -0,0 +1,6 @@ +#compdef ls-archive +#autoload + +_arguments \ + '(-v --verbose)'{-v,--remove}'[Verbose archive listing.]' \ + "*::archive file:_files -g '(#i)*.(tar|tgz|tbz|tbz2|txz|tlz|gz|bz2|xz|lzma|Z|zip|rar|7z)(-.)'" && return 0 diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh index 02b05eb4b..006afad55 100644 --- a/plugins/extract/extract.plugin.zsh +++ b/plugins/extract/extract.plugin.zsh @@ -1,8 +1,8 @@ # ------------------------------------------------------------------------------ # FILE: extract.plugin.zsh # DESCRIPTION: oh-my-zsh plugin file. -# AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com) -# VERSION: 1.0.1 +# AUTHOR: Sorin Ionescu +# VERSION: 1.0.2 # ------------------------------------------------------------------------------ @@ -15,7 +15,7 @@ function extract() { if (( $# == 0 )); then echo "Usage: extract [-option] [file ...]" echo - echo Options: + echo "Options:" echo " -r, --remove Remove archive." echo echo "Report bugs to ." @@ -76,5 +76,50 @@ function extract() { done } -alias x=extract +function ls-archive() { + local verbose + + if (( $# == 0 )); then + echo "Usage: extract [-option] [file ...]" + echo + echo "Options:" + echo " -v, --verbose Verbose archive listing." + echo + echo "Report bugs to ." + fi + + if [[ "$1" == "-v" ]] || [[ "$1" == "--verbose" ]]; then + verbose=0 + shift + fi + + while (( $# > 0 )); do + if [[ ! -f "$1" ]]; then + echo "extract: '$1' is not a valid file" 1>&2 + shift + continue + fi + + case "$1" in + (*.tar.gz|*.tgz) tar t${verbose:+v}vzf "$1" ;; + (*.tar.bz2|*.tbz|*.tbz2) tar t${verbose:+v}jf "$1" ;; + (*.tar.xz|*.txz) tar --xz --help &> /dev/null \ + && tar --xz -t${verbose:+v}f "$1" \ + || xzcat "$1" | tar t${verbose:+v}f - ;; + (*.tar.zma|*.tlz) tar --lzma --help &> /dev/null \ + && tar --lzma -t${verbose:+v}f "$1" \ + || lzcat "$1" | tar x${verbose:+v}f - ;; + (*.tar) tar t${verbose:+v}f "$1" ;; + (*.zip) unzip -l${verbose:+v} "$1" ;; + (*.rar) unrar ${${verbose:+v}:-l} "$1" ;; + (*.7z) 7za l "$1" ;; + (*) + echo "ls-archive: '$1' cannot be listed" 1>&2 + success=1 + ;; + esac + + shift + done +} From df12f2feefdc4708d7fb652f16c6f84b0bcdfb3a Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 28 Jul 2011 18:07:34 -0400 Subject: [PATCH 487/614] Renamed extract plugin to archive. --- plugins/{extract => archive}/_extract | 0 plugins/{extract => archive}/_ls-archive | 0 .../{extract/extract.plugin.zsh => archive/archive.plugin.zsh} | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename plugins/{extract => archive}/_extract (100%) rename plugins/{extract => archive}/_ls-archive (100%) rename plugins/{extract/extract.plugin.zsh => archive/archive.plugin.zsh} (100%) diff --git a/plugins/extract/_extract b/plugins/archive/_extract similarity index 100% rename from plugins/extract/_extract rename to plugins/archive/_extract diff --git a/plugins/extract/_ls-archive b/plugins/archive/_ls-archive similarity index 100% rename from plugins/extract/_ls-archive rename to plugins/archive/_ls-archive diff --git a/plugins/extract/extract.plugin.zsh b/plugins/archive/archive.plugin.zsh similarity index 100% rename from plugins/extract/extract.plugin.zsh rename to plugins/archive/archive.plugin.zsh From eaf74b253445f03a656a628ac0df04c3dacb91a3 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 28 Jul 2011 18:20:36 -0400 Subject: [PATCH 488/614] Added metadata file removal to osx plugin. --- plugins/osx/osx.plugin.zsh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh index 0e436aa7b..eb75a2da5 100644 --- a/plugins/osx/osx.plugin.zsh +++ b/plugins/osx/osx.plugin.zsh @@ -1,8 +1,8 @@ # ------------------------------------------------------------------------------ # FILE: osx.plugin.zsh # DESCRIPTION: oh-my-zsh plugin file. -# AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com) -# VERSION: 1.0.1 +# AUTHOR: Sorin Ionescu +# VERSION: 1.0.2 # ------------------------------------------------------------------------------ @@ -96,3 +96,8 @@ function trash() { done IFS=$temp_ifs } + +function rm-osx-cruft() { + find ${@:-$PWD} \( -type f -name ".DS_Store" \) -o \( -type d -name '__MACOSX' \) -delete +} + From 27b9c859004e9c6235220edbf026fabb88f0f857 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sat, 30 Jul 2011 01:54:11 -0400 Subject: [PATCH 489/614] Implemented GNU Emacs key bindings. --- functions/keyboard.zsh | 136 +++++++++++++++++++++++++++++------------ 1 file changed, 97 insertions(+), 39 deletions(-) diff --git a/functions/keyboard.zsh b/functions/keyboard.zsh index fd795ed78..5ab37220f 100644 --- a/functions/keyboard.zsh +++ b/functions/keyboard.zsh @@ -1,49 +1,107 @@ -# TODO: Write a GNU Emacs key bindings file akin to the vi-mode plugin. +# Beep on error in line editor. +setopt beep -bindkey -e -bindkey '\ew' kill-region -bindkey -s '\el' "ls\n" -bindkey -s '\e.' "..\n" -bindkey '^r' history-incremental-search-backward -bindkey "^[[5~" up-line-or-history -bindkey "^[[6~" down-line-or-history +# Use human-friendly identifiers. +typeset -g -A keys +keys=( + 'Control' '\C-' + 'Escape' '\e' + 'Meta' '\M-' + 'F1' '^[OP' + 'F2' '^[OQ' + 'F3' '^[OR' + 'F4' '^[OS' + 'F5' '^[[15~' + 'F6' '^[[17~' + 'F7' '^[[18~' + 'F8' '^[[19~' + 'F9' '^[[20~' + 'F10' '^[[21~' + 'F11' '^[[23~' + 'F12' '^[[24~' + 'Backspace' '^?' + 'Insert' '^[[2~' + 'Home' '^[[H' + 'PageUp' '^[[5~' + 'Delete' '^[[3~' + 'End' '^[[F' + 'PageDown' '^[[6~' + 'Up' '^[[A' + 'Left' '^[[D' + 'Down' '^[[B' + 'Right' '^[[C' + 'Menu' '^[[29~' +) -# Make key up/down move up/down or search history. -bindkey '^[[A' up-line-or-search -bindkey '^[[B' down-line-or-search - -bindkey "^[[H" beginning-of-line -bindkey "^[[1~" beginning-of-line -bindkey "^[[F" end-of-line -bindkey "^[[4~" end-of-line +bindkey -d # Reset to default key bindings. +bindkey -e # Use Emacs key bindings. # Do history expansion on space. bindkey ' ' magic-space -# File rename magick. -bindkey "^[m" copy-prev-shell-word -bindkey '^[[Z' reverse-menu-complete +# Avoid binding ^J, ^M, ^C, ^?, ^S, ^Q, etc. +bindkey "${keys[Home]}" beginning-of-line +bindkey "${keys[End]}" end-of-line -# Make the delete key (or Fn + Delete on the Mac) work instead of outputting a ~. -bindkey "^[[3~" delete-char -bindkey "^[3;5~" delete-char -bindkey "\e[3~" delete-char +bindkey "${keys[Insert]}" overwrite-mode +bindkey "${keys[Delete]}" delete-char -# Consider GNU Emacs keybindings: +bindkey "${keys[Up]}" up-line-or-history +bindkey "${keys[Down]}" down-line-or-history -#bindkey -e # Emacs key bindings. -# -#bindkey '^[[A' up-line-or-search -#bindkey '^[[B' down-line-or-search -#bindkey '^[^[[C' emacs-forward-word -#bindkey '^[^[[D' emacs-backward-word -# -#bindkey -s '^X^Z' '%-^M' -#bindkey '^[e' expand-cmd-path -#bindkey '^[^I' reverse-menu-complete -#bindkey '^X^N' accept-and-infer-next-history -#bindkey '^W' kill-region -#bindkey '^I' complete-word -## FIXME: A weird sequence that rxvt produces -#bindkey -s '^[[Z' '\t' +bindkey "${keys[Left]}" backward-char +bindkey "${keys[Right]}" forward-char + +bindkey "${keys[Meta]}b" emacs-backward-word +bindkey "${keys[Meta]}f" emacs-forward-word +bindkey "${keys[Escape]}${keys[Left]}" emacs-backward-word +bindkey "${keys[Escape]}${keys[Right]}" emacs-forward-word + +bindkey "${keys[Control]}w" kill-region + +bindkey "${keys[Escape]}e" expand-cmd-path +bindkey "${keys[Escape]}m" copy-prev-shell-word + +bindkey '^[[Z' reverse-menu-complete # Shift + Tab +bindkey "${keys[Control]}i" expand-or-complete-prefix # Complete in middle of word. + +bindkey "${keys[Control]}_" undo +bindkey "${keys[Escape]}_" redo + +# History +if autoloadable history-search-end; then + autoload -U history-search-end + zle -N history-beginning-search-backward-end history-search-end + zle -N history-beginning-search-forward-end history-search-end + bindkey "${keys[Control]}p" history-beginning-search-backward-end + bindkey "${keys[Control]}n" history-beginning-search-forward-end +else + bindkey "${keys[Control]}p" history-beginning-search-backward + bindkey "${keys[Control]}n" history-beginning-search-forward +fi + +if (( ${+widgets[history-incremental-pattern-search-backward]} )); then + bindkey "${keys[Control]}r" history-incremental-pattern-search-backward + bindkey "${keys[Control]}s" history-incremental-pattern-search-forward +else + bindkey "${keys[Control]}r" history-incremental-search-backward + bindkey "${keys[Control]}s" history-incremental-search-forward +fi + +# Allow command line editing in an external editor. +autoload -Uz edit-command-line +zle -N edit-command-line +bindkey "${keys[Control]}x${keys[Control]}e" edit-command-line + +# Convert .... to ../.. automatically. +function rationalize-dot() { + if [[ $LBUFFER = *.. ]]; then + LBUFFER+=/.. + else + LBUFFER+=. + fi +} +zle -N rationalize-dot +bindkey '.' rationalize-dot +bindkey -M isearch . self-insert 2>/dev/null From 3fa9dff013182a5bbe1e19d8134ad788359895a8 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sat, 30 Jul 2011 01:59:05 -0400 Subject: [PATCH 490/614] Added new key bindings to vi-mode plugin. --- plugins/vi-mode/vi-mode.plugin.zsh | 67 +++++++++++++++++++++++------- 1 file changed, 52 insertions(+), 15 deletions(-) diff --git a/plugins/vi-mode/vi-mode.plugin.zsh b/plugins/vi-mode/vi-mode.plugin.zsh index 08480475d..f9aafb952 100644 --- a/plugins/vi-mode/vi-mode.plugin.zsh +++ b/plugins/vi-mode/vi-mode.plugin.zsh @@ -1,8 +1,8 @@ # ------------------------------------------------------------------------------ # FILE: vi-mode.plugin.zsh # DESCRIPTION: oh-my-zsh plugin file. -# AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com) -# VERSION: 1.0.2 +# AUTHOR: Sorin Ionescu +# VERSION: 1.0.3 # ------------------------------------------------------------------------------ @@ -11,13 +11,9 @@ autoload -Uz edit-command-line # If mode indicator wasn't setup by theme, define a default. if [[ "$MODE_INDICATOR" == "" ]]; then - MODE_INDICATOR="%{$fg_bold[red]%}<%{$reset_color%}%{$fg[red]%}<<%{$reset_color%}" + MODE_INDICATOR="%B%F{red}<%f%b%F{red}<<%f" fi -function zle-line-init zle-keymap-select { - zle reset-prompt -} - # If I am using vi keys, I want to know what mode I'm currently using. # zle-keymap-select is executed every time KEYMAP changes. # From http://zshwiki.org/home/examples/zlewidgets @@ -55,13 +51,54 @@ bindkey -M vicmd v edit-command-line # ESC-v to edit in an external editor. bindkey ' ' magic-space bindkey -M vicmd "gg" beginning-of-history bindkey -M vicmd "G" end-of-history -bindkey -M vicmd "k" history-search-backward -bindkey -M vicmd "j" history-search-forward -bindkey -M vicmd "?" history-incremental-search-backward -bindkey -M vicmd "/" history-incremental-search-forward -bindkey -M viins "^L" clear-screen -bindkey -M viins "^W" backward-kill-word -bindkey -M viins "^A" beginning-of-line -bindkey -M viins "^E" end-of-line +# Bind to history substring search plugin if enabled; +# otherwise, bind to built-in ZSH history search. +if (( $+plugins[(er)history-substring-search] )); then + bindkey -M vicmd "k" history-substring-search-up + bindkey -M vicmd "j" history-substring-search-down +else + bindkey -M vicmd "k" history-search-backward + bindkey -M vicmd "j" history-search-forward +fi + +bindkey "^P" up-line-or-search +bindkey -M vicmd "k" up-line-or-search +bindkey -M vicmd "^k" up-line-or-search +bindkey -M viins "^k" up-line-or-search +bindkey "^N" down-line-or-search +bindkey -M vicmd "j" down-line-or-search +bindkey -M vicmd "^j" down-line-or-search +bindkey -M viins "^j" down-line-or-search + +bindkey -M viins '^r' history-incremental-pattern-search-backward +bindkey -M viins '^f' history-incremental-pattern-search-forward +bindkey -M vicmd "?" history-incremental-pattern-search-backward +bindkey -M vicmd "/" history-incremental-pattern-search-forward + +bindkey -M vicmd "^l" clear-screen +bindkey -M viins "^l" clear-screen + +bindkey -M vicmd "^w" backward-kill-word +bindkey -M viins "^w" backward-kill-word + +bindkey -M vicmd "^a" beginning-of-line +bindkey -M viins "^a" beginning-of-line + +bindkey -M vicmd "^e" end-of-line +bindkey -M viins "^e" end-of-line + +bindkey -M vicmd '^d' delete +bindkey -M viins '^d' delete + +bindkey -M vicmd '^?' backward-delete-char +bindkey -M viins '^?' backward-delete-char + +# 'jj' = ESC +bindkey -M viins 'jj' vi-cmd-mode + +if (( ${+functions[rationalize-dot]} )); then + bindkey -M viins '.' rationalize-dot + bindkey -M isearch . self-insert 2>/dev/null +fi From cee7ff7e4065ed94f5d83d960b76e9c5a49d830d Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Mon, 1 Aug 2011 02:50:51 -0400 Subject: [PATCH 491/614] Added job control detection to title setting functions. --- functions/terminal.zsh | 108 +++++++++++++++++++++++++++-------------- 1 file changed, 71 insertions(+), 37 deletions(-) diff --git a/functions/terminal.zsh b/functions/terminal.zsh index ab5071aec..2c1a2b2bf 100644 --- a/functions/terminal.zsh +++ b/functions/terminal.zsh @@ -5,51 +5,85 @@ fi # Set the GNU Screen window number. if [[ -n "$WINDOW" ]]; then - SCREEN_NO="%B$WINDOW%b " + export SCREEN_NO="%B${WINDOW}%b " else - SCREEN_NO="" + export SCREEN_NO="" fi -# Fully supports GNU Screen, iTerm, and most modern xterm and rxvt terminals. -# Partially supports Mac OS X Terminal since it can't set window and tab separately. -# Usage: title "tab title" "window title" -function terminal-title { - if ! check-bool "$DISABLE_AUTO_TITLE"; then - if [[ "$TERM" == screen* ]]; then - # Set GNU Screen's hardstatus (usually truncated at 20 characters). - printf "\ek%s\e\\" ${(V)1} - elif [[ "$TERM" == xterm* ]] || [[ "$TERM" == rxvt* ]]; then - # Set the window title. - printf "\e]2;%s\a" ${(V)2} - # Set the tab title (will override window title on a broken terminal). - printf "\e]1;%s\a" ${(V)1} - fi +# Sets the GNU Screen title. +function set-screen-title() { + if [[ "$TERM" == screen* ]]; then + printf "\ek%s\e\\" ${(V)argv} fi } -# Don't override precmd/preexec, append to hook array. +# Sets the terminal window title. +function set-window-title() { + if [[ "$TERM" == ((x|a|ml|dt|E)term*|(u|)rxvt*) ]]; then + printf "\e]2;%s\a" ${(V)argv} + fi +} + +# Sets the terminal tab title. +function set-tab-title() { + if [[ "$TERM" == ((x|a|ml|dt|E)term*|(u|)rxvt*) ]]; then + printf "\e]1;%s\a" ${(V)argv} + fi +} + +function set-title-by-command() { + emulate -L zsh + setopt localoptions extended_glob + + # Get the command name that is under job control. + if [[ "${1[(w)1]}" == (fg|%*)(\;|) ]]; then + # Get the job name, and, if missing, set it to the default %+. + local job_name="${${1[(wr)%*(\;|)]}:-%+}" + + # Make a local copy for use in the subshell. + local -A jobtexts_from_parent_shell + jobtexts_from_parent_shell=(${(kv)jobtexts}) + + jobs $job_name 2>/dev/null > >( + read index discarded + # The index is already surrounded by brackets: [1]. + set-title-by-command "${(e):-\$jobtexts_from_parent_shell$index}" + ) + else + # Set the command name, or in the case of sudo or ssh, the next command. + local cmd=${1[(wr)^(*=*|sudo|ssh|-*)]} + + # Right-truncate the command name to 15 characters. + if (( $#cmd > 15 )); then + cmd="${cmd[1,15]}..." + fi + + for kind in window tab screen; do + set-${kind}-title "$cmd" + done + fi +} + +# Don't override precmd/preexec; append to hook array. autoload -Uz add-zsh-hook -# Set the tab and window titles before the prompt is displayed. -function terminal-title-precmd { - # 15 character, left-truncated current working directory. - local terminal_tab_title="${(%):-%15<...<%~%<<}" - local terminal_window_title="${(%):-%n@%m: %~}" - terminal-title "$terminal_tab_title" "$terminal_window_title" -} -add-zsh-hook precmd terminal-title-precmd - -# Set the tab and window titles before command execution. -function terminal-title-preexec { - emulate -L zsh - setopt extended_glob - # Command name only, or if this is sudo or ssh, the next command. - local CMD=${1[(wr)^(*=*|sudo|ssh|-*)]} - local trimmed="${2[1,100]}" - if [[ "$2" != "$trimmed" ]]; then - trimmed="${trimmed}..." +# Sets the tab and window titles before the prompt is displayed. +function set-title-precmd { + if ! check-bool "$DISABLE_AUTO_TITLE"; then + set-window-title "${(%):-%~}" + for kind in tab screen; do + # Left-truncate the current working directory to 15 characters. + set-${kind}-title "${(%):-%15<...<%~%<<}" + done fi - terminal-title "$CMD" "$trimmed" } -add-zsh-hook preexec terminal-title-preexec +add-zsh-hook precmd set-title-precmd + +# Sets the tab and window titles before command execution. +function set-title-preexec { + if ! check-bool "$DISABLE_AUTO_TITLE"; then + set-title-by-command "$2" + fi +} +add-zsh-hook preexec set-title-preexec From 0e284f6c2a32013582bc58e6128bcad987d1ac3f Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sun, 14 Aug 2011 21:14:57 -0400 Subject: [PATCH 492/614] Merged vi-mode plugin with Emacs key bindings. --- functions/keyboard.zsh | 276 ++++++++++++++++++++++------- plugins/vi-mode/vi-mode.plugin.zsh | 104 ----------- templates/zshrc.template.zsh | 9 + 3 files changed, 223 insertions(+), 166 deletions(-) delete mode 100644 plugins/vi-mode/vi-mode.plugin.zsh diff --git a/functions/keyboard.zsh b/functions/keyboard.zsh index 5ab37220f..e71fb1b45 100644 --- a/functions/keyboard.zsh +++ b/functions/keyboard.zsh @@ -1,6 +1,13 @@ # Beep on error in line editor. setopt beep +# Reset to default key bindings. +bindkey -d + +# Allow command line editing in an external editor. +autoload -Uz edit-command-line +zle -N edit-command-line + # Use human-friendly identifiers. typeset -g -A keys keys=( @@ -33,75 +40,220 @@ keys=( 'Menu' '^[[29~' ) -bindkey -d # Reset to default key bindings. -bindkey -e # Use Emacs key bindings. +if [[ "$KEYMAP" == (emacs|) ]]; then + # Use Emacs key bindings. + bindkey -e -# Do history expansion on space. + bindkey "${keys[Escape]}b" emacs-backward-word + bindkey "${keys[Escape]}f" emacs-forward-word + bindkey "${keys[Escape]}${keys[Left]}" emacs-backward-word + bindkey "${keys[Escape]}${keys[Right]}" emacs-forward-word + + # Kill to the beginning of the line. + bindkey "${keys[Control]}u" backward-kill-line + + # Kill to the beginning of the word. + bindkey "${keys[Control]}w" backward-kill-word + + # Undo/Redo + bindkey "${keys[Control]}_" undo + bindkey "${keys[Escape]}_" redo + + # Search character. + bindkey "${keys[Control]}]" vi-find-next-char + bindkey "${keys[Escape]}${keys[Control]}]" vi-find-prev-char + + # Edit command in an external editor. + bindkey "${keys[Control]}x${keys[Control]}e" edit-command-line + + # Expand .... to ../.. + if ! check-bool "$DISABLE_DOT_EXPANSION"; then + bindkey "." expand-dot-to-parent-directory-path + fi + + # Bind to history substring search plugin if enabled; + # otherwise, bind to built-in ZSH history search. + if (( ${+widgets[history-incremental-pattern-search-backward]} )); then + bindkey "${keys[Control]}r" history-incremental-pattern-search-backward + bindkey "${keys[Control]}s" history-incremental-pattern-search-forward + else + bindkey "${keys[Control]}r" history-incremental-search-backward + bindkey "${keys[Control]}s" history-incremental-search-forward + fi +elif [[ "$KEYMAP" == 'vi' ]]; then + # Use vi key bindings. + bindkey -v + + # The default mode indicator. + MODE_INDICATOR="%B%F{red}❮%f%b%F{red}❮❮%f" + + # Restores RPROMPT when exiting vicmd. + function vi-restore-rprompt() { + if (( $+RPROMPT_CACHED )); then + RPROMPT="$RPROMPT_CACHED" + unset RPROMPT_CACHED + zle reset-prompt + return 0 + fi + return 1 + } + add-zsh-trap INT vi-restore-rprompt + + # Displays the current vi mode (command). + function zle-keymap-select() { + if ! vi-restore-rprompt && [[ "$KEYMAP" == 'vicmd' ]]; then + RPROMPT_CACHED="$RPROMPT" + RPROMPT="$MODE_INDICATOR" + zle reset-prompt + fi + } + zle -N zle-keymap-select + + # Resets the prompt after exiting edit-command-line. + function zle-line-init() { + vi-restore-rprompt + } + zle -N zle-line-init + + # Resets the prompt after the line has been accepted. + function zle-line-finish() { + vi-restore-rprompt + } + zle -N zle-line-finish + + # Edit command in an external editor. + bindkey -M vicmd "v" edit-command-line + + # Show cursor position. + bindkey -M vicmd "ga" what-cursor-position + + # Undo/Redo + bindkey -M vicmd "u" undo + bindkey -M vicmd "${keys[Control]}r" redo + + # Expand .... to ../.. + if ! check-bool "$DISABLE_DOT_EXPANSION"; then + bindkey -M viins "." expand-dot-to-parent-directory-path + fi + + # Switch to command mode. + bindkey -M viins "jk" vi-cmd-mode + bindkey -M viins "kj" vi-cmd-mode + + # Emacs key bindings in insert mode. + bindkey -M viins "${keys[Control]}a" beginning-of-line + bindkey -M viins "${keys[Control]}b" backward-char + bindkey -M viins "${keys[Escape]}b" emacs-backward-word + bindkey -M viins "${keys[Control]}d" delete-char-or-list + bindkey -M viins "${keys[Escape]}d" kill-word + bindkey -M viins "${keys[Control]}e" end-of-line + bindkey -M viins "${keys[Control]}f" forward-char + bindkey -M viins "${keys[Escape]}f" emacs-forward-word + bindkey -M viins "${keys[Control]}k" kill-line + bindkey -M viins "${keys[Control]}u" backward-kill-line + bindkey -M viins "${keys[Control]}w" backward-kill-word + bindkey -M viins "${keys[Escape]}w" copy-region-as-kill + bindkey -M viins "${keys[Escape]}h" run-help + bindkey -M viins "${keys[Escape]}${keys[Left]}" emacs-backward-word + bindkey -M viins "${keys[Escape]}${keys[Right]}" emacs-forward-word + + # History + bindkey -M vicmd "gg" beginning-of-history + bindkey -M vicmd "G" end-of-history + + # Bind to history substring search plugin if enabled; + # otherwise, bind to built-in ZSH history search. + if (( $+plugins[(er)history-substring-search] )); then + bindkey -M vicmd "k" history-substring-search-up + bindkey -M vicmd "j" history-substring-search-down + else + bindkey -M vicmd "k" up-line-or-history + bindkey -M vicmd "j" down-line-or-history + fi + + if (( ${+widgets[history-incremental-pattern-search-backward]} )); then + bindkey -M vicmd "?" history-incremental-pattern-search-backward + bindkey -M vicmd "/" history-incremental-pattern-search-forward + + # Emacs key bindings in insert mode. + bindkey -M viins "${keys[Control]}r" history-incremental-pattern-search-backward + bindkey -M viins "${keys[Control]}s" history-incremental-pattern-search-forward + else + bindkey -M vicmd "?" history-incremental-search-backward + bindkey -M vicmd "/" history-incremental-search-forward + + # Emacs key bindings in insert mode. + bindkey -M viins "${keys[Control]}r" history-incremental-search-backward + bindkey -M viins "${keys[Control]}s" history-incremental-search-forward + fi +else + echo "oh-my-zsh: KEYMAP must be set 'emacs' or 'vi' but is set to '$KEYMAP'" >&2 + return 1 +fi + +# The next key bindings are for both Emacs and Vi. +bindkey "${keys[Home]}" beginning-of-line +bindkey "${keys[End]}" end-of-line + +bindkey "${keys[Insert]}" overwrite-mode +bindkey "${keys[Delete]}" delete-char +bindkey "${keys[Backspace]}" backward-delete-char + +bindkey "${keys[Left]}" backward-char +bindkey "${keys[Right]}" forward-char + +# Expand history on space. bindkey ' ' magic-space -# Avoid binding ^J, ^M, ^C, ^?, ^S, ^Q, etc. -bindkey "${keys[Home]}" beginning-of-line -bindkey "${keys[End]}" end-of-line - -bindkey "${keys[Insert]}" overwrite-mode -bindkey "${keys[Delete]}" delete-char - -bindkey "${keys[Up]}" up-line-or-history -bindkey "${keys[Down]}" down-line-or-history - -bindkey "${keys[Left]}" backward-char -bindkey "${keys[Right]}" forward-char - -bindkey "${keys[Meta]}b" emacs-backward-word -bindkey "${keys[Meta]}f" emacs-forward-word -bindkey "${keys[Escape]}${keys[Left]}" emacs-backward-word -bindkey "${keys[Escape]}${keys[Right]}" emacs-forward-word - -bindkey "${keys[Control]}w" kill-region - -bindkey "${keys[Escape]}e" expand-cmd-path -bindkey "${keys[Escape]}m" copy-prev-shell-word - -bindkey '^[[Z' reverse-menu-complete # Shift + Tab -bindkey "${keys[Control]}i" expand-or-complete-prefix # Complete in middle of word. - -bindkey "${keys[Control]}_" undo -bindkey "${keys[Escape]}_" redo - -# History -if autoloadable history-search-end; then - autoload -U history-search-end - zle -N history-beginning-search-backward-end history-search-end - zle -N history-beginning-search-forward-end history-search-end - bindkey "${keys[Control]}p" history-beginning-search-backward-end - bindkey "${keys[Control]}n" history-beginning-search-forward-end +if (( $+plugins[(er)history-substring-search] )); then + bindkey "${keys[Up]}" history-substring-search-up + bindkey "${keys[Down]}" history-substring-search-down + bindkey "${keys[Control]}p" history-substring-search-up + bindkey "${keys[Control]}n" history-substring-search-down else - bindkey "${keys[Control]}p" history-beginning-search-backward - bindkey "${keys[Control]}n" history-beginning-search-forward + bindkey "${keys[Up]}" up-line-or-history + bindkey "${keys[Down]}" down-line-or-history + bindkey "${keys[Control]}p" up-line-or-history + bindkey "${keys[Control]}n" down-line-or-history fi -if (( ${+widgets[history-incremental-pattern-search-backward]} )); then - bindkey "${keys[Control]}r" history-incremental-pattern-search-backward - bindkey "${keys[Control]}s" history-incremental-pattern-search-forward -else - bindkey "${keys[Control]}r" history-incremental-search-backward - bindkey "${keys[Control]}s" history-incremental-search-forward -fi +# Clear screen. +bindkey "${keys[Control]}l" clear-screen -# Allow command line editing in an external editor. -autoload -Uz edit-command-line -zle -N edit-command-line -bindkey "${keys[Control]}x${keys[Control]}e" edit-command-line +# Expand command name to full path. +bindkey "${keys[Escape]}e" expand-cmd-path + +# Duplicate the previous word. +bindkey "${keys[Escape]}m" copy-prev-shell-word + +# Bind Shift + Tab to go to the previous menu item. +bindkey '^[[Z' reverse-menu-complete + +# Complete in the middle of word. +bindkey "${keys[Control]}i" expand-or-complete-prefix # Convert .... to ../.. automatically. -function rationalize-dot() { - if [[ $LBUFFER = *.. ]]; then - LBUFFER+=/.. - else - LBUFFER+=. - fi -} -zle -N rationalize-dot -bindkey '.' rationalize-dot -bindkey -M isearch . self-insert 2>/dev/null +if ! check-bool "$DISABLE_DOT_EXPANSION"; then + function expand-dot-to-parent-directory-path() { + if [[ $LBUFFER = *.. ]]; then + LBUFFER+=/.. + else + LBUFFER+=. + fi + } + zle -N expand-dot-to-parent-directory-path + # Do not expand .... to ../.. during incremental search. + bindkey -M isearch . self-insert 2>/dev/null +fi + +# Display an indicator when completing. +if ! check-bool "$DISABLE_COMPLETION_INDICATOR"; then + function expand-or-complete-prefix-with-indicator() { + echo -n "\e[31m...\e[0m" + zle expand-or-complete-prefix + zle redisplay + } + zle -N expand-or-complete-prefix-with-indicator + bindkey "${keys[Control]}i" expand-or-complete-prefix-with-indicator +fi diff --git a/plugins/vi-mode/vi-mode.plugin.zsh b/plugins/vi-mode/vi-mode.plugin.zsh deleted file mode 100644 index f9aafb952..000000000 --- a/plugins/vi-mode/vi-mode.plugin.zsh +++ /dev/null @@ -1,104 +0,0 @@ -# ------------------------------------------------------------------------------ -# FILE: vi-mode.plugin.zsh -# DESCRIPTION: oh-my-zsh plugin file. -# AUTHOR: Sorin Ionescu -# VERSION: 1.0.3 -# ------------------------------------------------------------------------------ - - -# Allow command line editing in an external editor. -autoload -Uz edit-command-line - -# If mode indicator wasn't setup by theme, define a default. -if [[ "$MODE_INDICATOR" == "" ]]; then - MODE_INDICATOR="%B%F{red}<%f%b%F{red}<<%f" -fi - -# If I am using vi keys, I want to know what mode I'm currently using. -# zle-keymap-select is executed every time KEYMAP changes. -# From http://zshwiki.org/home/examples/zlewidgets -function zle-line-init zle-keymap-select { - if [[ "$KEYMAP" == 'vicmd' ]]; then - rprompt_cached="$RPROMPT" - RPROMPT="$MODE_INDICATOR" - elif [[ -n "$rprompt_cached" ]]; then - RPROMPT="$rprompt_cached" - rprompt_cached="" - fi - zle reset-prompt -} - -# Accept RETURN in vi command mode. -function accept_line { - if [[ -n "$rprompt_cached" ]]; then - RPROMPT="$rprompt_cached" - rprompt_cached="" - fi - builtin zle .accept-line -} - -zle -N zle-line-init -zle -N zle-keymap-select -zle -N accept_line -zle -N edit-command-line - -# Avoid binding ^J, ^M, ^C, ^?, ^S, ^Q, etc. -bindkey -d # Reset to default. -bindkey -v # Use vi key bindings. -bindkey -M vicmd "^M" accept_line # Alow RETURN in vi command. -bindkey -M vicmd v edit-command-line # ESC-v to edit in an external editor. - -bindkey ' ' magic-space -bindkey -M vicmd "gg" beginning-of-history -bindkey -M vicmd "G" end-of-history - -# Bind to history substring search plugin if enabled; -# otherwise, bind to built-in ZSH history search. -if (( $+plugins[(er)history-substring-search] )); then - bindkey -M vicmd "k" history-substring-search-up - bindkey -M vicmd "j" history-substring-search-down -else - bindkey -M vicmd "k" history-search-backward - bindkey -M vicmd "j" history-search-forward -fi - -bindkey "^P" up-line-or-search -bindkey -M vicmd "k" up-line-or-search -bindkey -M vicmd "^k" up-line-or-search -bindkey -M viins "^k" up-line-or-search -bindkey "^N" down-line-or-search -bindkey -M vicmd "j" down-line-or-search -bindkey -M vicmd "^j" down-line-or-search -bindkey -M viins "^j" down-line-or-search - -bindkey -M viins '^r' history-incremental-pattern-search-backward -bindkey -M viins '^f' history-incremental-pattern-search-forward -bindkey -M vicmd "?" history-incremental-pattern-search-backward -bindkey -M vicmd "/" history-incremental-pattern-search-forward - -bindkey -M vicmd "^l" clear-screen -bindkey -M viins "^l" clear-screen - -bindkey -M vicmd "^w" backward-kill-word -bindkey -M viins "^w" backward-kill-word - -bindkey -M vicmd "^a" beginning-of-line -bindkey -M viins "^a" beginning-of-line - -bindkey -M vicmd "^e" end-of-line -bindkey -M viins "^e" end-of-line - -bindkey -M vicmd '^d' delete -bindkey -M viins '^d' delete - -bindkey -M vicmd '^?' backward-delete-char -bindkey -M viins '^?' backward-delete-char - -# 'jj' = ESC -bindkey -M viins 'jj' vi-cmd-mode - -if (( ${+functions[rationalize-dot]} )); then - bindkey -M viins '.' rationalize-dot - bindkey -M isearch . self-insert 2>/dev/null -fi - diff --git a/templates/zshrc.template.zsh b/templates/zshrc.template.zsh index 510fcf953..d630e9eae 100644 --- a/templates/zshrc.template.zsh +++ b/templates/zshrc.template.zsh @@ -1,6 +1,9 @@ # Path to oh-my-zsh. OMZ="$HOME/.oh-my-zsh" +# Set the key mapping style to 'emacs' or 'vi'. +KEYMAP='emacs' + # Set to 'true' to enable case-sensitivity. CASE_SENSITIVE='false' @@ -10,6 +13,12 @@ DISABLE_COLOR='false' # Set to 'true' to disable auto setting the tab and window titles. DISABLE_AUTO_TITLE='false' +# Set to 'false' to enable converting .... to ../.. automatically. +DISABLE_DOT_EXPANSION='true' + +# Set to 'false' to enable the completion indicator. +DISABLE_COMPLETION_INDICATOR='true' + # Set the plugins to load (see $OMZ/plugins/). # Example: plugins=(git lighthouse rails ruby textmate) plugins=(git) From ba9900a4888df87901a5f6e7b185075325144002 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Fri, 26 Aug 2011 02:58:19 -0400 Subject: [PATCH 493/614] Merge branch 'master' of https://github.com/robbyrussell/oh-my-zsh Conflicts: .gitignore lib/aliases.zsh lib/completion.zsh lib/functions.zsh lib/git.zsh lib/key-bindings.zsh lib/misc.zsh lib/spectrum.zsh plugins/git/git.plugin.zsh plugins/osx/_man-preview plugins/osx/osx.plugin.zsh plugins/svn/svn.plugin.zsh templates/zshrc.zsh-template themes/lukerandall.zsh-theme themes/philips.zsh-theme tools/upgrade.sh --- plugins/archlinux/archlinux.plugin.zsh | 76 +++ plugins/bundler/bundler.plugin.zsh | 34 + plugins/cake/cake.plugin.zsh | 32 + plugins/cloudapp/cloudapp.plugin.zsh | 2 + plugins/cloudapp/cloudapp.rb | 60 ++ plugins/django/django.plugin.zsh | 222 ++++++ plugins/gas/_gas | 34 + plugins/heroku/_heroku | 158 +++++ plugins/history-substring-search/README | 7 + .../history-substring-search.plugin.zsh | 12 + .../history-substring-search.zsh | 642 ++++++++++++++++++ plugins/kate/kate.plugin.zsh | 9 + plugins/knife/_knife | 174 +++++ plugins/powder/_powder | 4 + plugins/rails3/rails3.plugin.zsh | 11 - plugins/redis-cli/_redis-cli | 2 +- plugins/ssh-agent/ssh-agent.plugin.zsh | 65 +- plugins/svn/svn.plugin.zsh | 10 +- plugins/taskwarrior/_task | 280 ++++++++ plugins/taskwarrior/taskwarrior.plugin.zsh | 21 + 20 files changed, 1825 insertions(+), 30 deletions(-) create mode 100644 plugins/archlinux/archlinux.plugin.zsh create mode 100644 plugins/cake/cake.plugin.zsh create mode 100644 plugins/cloudapp/cloudapp.plugin.zsh create mode 100755 plugins/cloudapp/cloudapp.rb create mode 100644 plugins/django/django.plugin.zsh create mode 100644 plugins/gas/_gas create mode 100644 plugins/heroku/_heroku create mode 100644 plugins/history-substring-search/README create mode 100644 plugins/history-substring-search/history-substring-search.plugin.zsh create mode 100644 plugins/history-substring-search/history-substring-search.zsh create mode 100644 plugins/kate/kate.plugin.zsh create mode 100644 plugins/knife/_knife create mode 100644 plugins/powder/_powder create mode 100644 plugins/taskwarrior/_task create mode 100644 plugins/taskwarrior/taskwarrior.plugin.zsh diff --git a/plugins/archlinux/archlinux.plugin.zsh b/plugins/archlinux/archlinux.plugin.zsh new file mode 100644 index 000000000..b5e519036 --- /dev/null +++ b/plugins/archlinux/archlinux.plugin.zsh @@ -0,0 +1,76 @@ +# Archlinux zsh aliases and functions +# Usage is also described at https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins + +# Look for yaourt, and add some useful functions if we have it. +if [[ -x `which yaourt` ]]; then + upgrade () { + yaourt -Syu + } + alias yaconf='yaourt -C' # Fix all configuration files with vimdiff + # Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips + alias yaupg='yaourt -Syu' # Synchronize with repositories before upgrading packages that are out of date on the local system. + alias yain='yaourt -S' # Install specific package(s) from the repositories + alias yains='yaourt -U' # Install specific package not from the repositories but from a file + alias yare='yaourt -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies + alias yarem='yaourt -Rns' # Remove the specified package(s), its configuration(s) and unneeded dependencies + alias yarep='yaourt -Si' # Display information about a given package in the repositories + alias yareps='yaourt -Ss' # Search for package(s) in the repositories + alias yaloc='yaourt -Qi' # Display information about a given package in the local database + alias yalocs='yaourt -Qs' # Search for package(s) in the local database + # Additional yaourt alias examples + if [[ -x `which abs` ]]; then + alias yaupd='yaourt -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories + else + alias yaupd='yaourt -Sy' # Update and refresh the local package and ABS databases against repositories + fi + alias yainsd='yaourt -S --asdeps' # Install given package(s) as dependencies of another package + alias yamir='yaourt -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist +else + upgrade() { + sudo pacman -Syu + } +fi + +# Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips +alias pacupg='sudo pacman -Syu' # Synchronize with repositories before upgrading packages that are out of date on the local system. +alias pacin='sudo pacman -S' # Install specific package(s) from the repositories +alias pacins='sudo pacman -U' # Install specific package not from the repositories but from a file +alias pacre='sudo pacman -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies +alias pacrem='sudo pacman -Rns' # Remove the specified package(s), its configuration(s) and unneeded dependencies +alias pacrep='pacman -Si' # Display information about a given package in the repositories +alias pacreps='pacman -Ss' # Search for package(s) in the repositories +alias pacloc='pacman -Qi' # Display information about a given package in the local database +alias paclocs='pacman -Qs' # Search for package(s) in the local database +# Additional pacman alias examples +if [[ -x `which abs` ]]; then + alias pacupd='sudo pacman -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories +else + alias pacupd='sudo pacman -Sy' # Update and refresh the local package and ABS databases against repositories +fi +alias pacinsd='sudo pacman -S --asdeps' # Install given package(s) as dependencies of another package +alias pacmir='sudo pacman -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist + +# https://bbs.archlinux.org/viewtopic.php?id=93683 +paclist() { + sudo pacman -Qei $(pacman -Qu|cut -d" " -f 1)|awk ' BEGIN {FS=":"}/^Name/{printf("\033[1;36m%s\033[1;37m", $2)}/^Description/{print $2}' +} + +alias paclsorphans='sudo pacman -Qdt' +alias pacrmorphans='sudo pacman -Rs $(pacman -Qtdq)' + +pacdisowned() { + tmp=${TMPDIR-/tmp}/pacman-disowned-$UID-$$ + db=$tmp/db + fs=$tmp/fs + + mkdir "$tmp" + trap 'rm -rf "$tmp"' EXIT + + pacman -Qlq | sort -u > "$db" + + find /bin /etc /lib /sbin /usr \ + ! -name lost+found \ + \( -type d -printf '%p/\n' -o -print \) | sort > "$fs" + + comm -23 "$fs" "$db" +} diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index fb40e2cec..a6c116407 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -1,3 +1,37 @@ alias be="bundle exec" alias bi="bundle install" +alias bl="bundle list" alias bu="bundle update" +alias bp="bundle package" + +# 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) + +## Functions + +_bundler-installed() { + which bundle > /dev/null 2>&1 +} + +_within-bundled-project() { + local check_dir=$PWD + while [ "$(dirname $check_dir)" != "/" ]; do + [ -f "$check_dir/Gemfile" ] && return + check_dir="$(dirname $check_dir)" + done + false +} + +_run-with-bundler() { + if _bundler-installed && _within-bundled-project; then + bundle exec $@ + else + $@ + fi +} + +## Main program +for cmd in $bundled_commands; do + alias $cmd="_run-with-bundler $cmd" +done diff --git a/plugins/cake/cake.plugin.zsh b/plugins/cake/cake.plugin.zsh new file mode 100644 index 000000000..f968c71d5 --- /dev/null +++ b/plugins/cake/cake.plugin.zsh @@ -0,0 +1,32 @@ +# Set this to 1 if you want to cache the tasks +cache_task_list=1 + +# Cache filename +cache_file='.cake_task_cache' + +_cake_does_target_list_need_generating () { + + if [ $cache_task_list -eq 0 ]; then + return 1; + fi + + if [ ! -f $cache_file ]; then return 0; + else + accurate=$(stat -f%m $cache_file) + changed=$(stat -f%m Cakefile) + return $(expr $accurate '>=' $changed) + fi +} + +_cake () { + if [ -f Cakefile ]; then + if _cake_does_target_list_need_generating; then + cake | sed -e "s/cake \([^ ]*\) .*/\1/" | grep -v '^$' > $cache_file + compadd `cat $cache_file` + else + compadd `cake | sed -e "s/cake \([^ ]*\) .*/\1/" | grep -v '^$'` + fi + fi +} + +compdef _cake cake diff --git a/plugins/cloudapp/cloudapp.plugin.zsh b/plugins/cloudapp/cloudapp.plugin.zsh new file mode 100644 index 000000000..859c84ec6 --- /dev/null +++ b/plugins/cloudapp/cloudapp.plugin.zsh @@ -0,0 +1,2 @@ +alias cloudapp="${0:r:r}.rb" + diff --git a/plugins/cloudapp/cloudapp.rb b/plugins/cloudapp/cloudapp.rb new file mode 100755 index 000000000..a11cfdb32 --- /dev/null +++ b/plugins/cloudapp/cloudapp.rb @@ -0,0 +1,60 @@ +#!/usr/bin/env ruby +# +# cloudapp +# Zach Holman / @holman +# +# Uploads a file from the command line to CloudApp, drops it into your +# clipboard (on a Mac, at least). +# +# Example: +# +# cloudapp drunk-blake.png +# +# This requires Aaron Russell's cloudapp_api gem: +# +# gem install cloudapp_api +# +# Requires you set your CloudApp credentials in ~/.cloudapp as a simple file of: +# +# email +# password + +require 'rubygems' +begin + require 'cloudapp_api' +rescue LoadError + puts "You need to install cloudapp_api: gem install cloudapp_api" + exit!(1) +end + +config_file = "#{ENV['HOME']}/.cloudapp" +unless File.exist?(config_file) + puts "You need to type your email and password (one per line) into "+ + "`~/.cloudapp`" + exit!(1) +end + +email,password = File.read(config_file).split("\n") + +class HTTParty::Response + # Apparently HTTPOK.ok? IS NOT OKAY WTFFFFFFFFFFUUUUUUUUUUUUUU + # LETS MONKEY PATCH IT I FEEL OKAY ABOUT IT + def ok? ; true end +end + +if ARGV[0].nil? + puts "You need to specify a file to upload." + exit!(1) +end + +CloudApp.authenticate(email,password) +url = CloudApp::Item.create(:upload, {:file => ARGV[0]}).url + +# Say it for good measure. +puts "Uploaded to #{url}." + +# Get the embed link. +url = "#{url}/#{ARGV[0].split('/').last}" + +# Copy it to your (Mac's) clipboard. +`echo '#{url}' | tr -d "\n" | pbcopy` diff --git a/plugins/django/django.plugin.zsh b/plugins/django/django.plugin.zsh new file mode 100644 index 000000000..1d72a2f2c --- /dev/null +++ b/plugins/django/django.plugin.zsh @@ -0,0 +1,222 @@ +#compdef manage.py + +typeset -ga nul_args +nul_args=( + '--settings=-[the Python path to a settings module.]:file:_files' + '--pythonpath=-[a directory to add to the Python path.]::directory:_directories' + '--traceback[print traceback on exception.]' + "--version[show program's version number and exit.]" + {-h,--help}'[show this help message and exit.]' +) + +_managepy-adminindex(){ + _arguments -s : \ + $nul_args \ + '*::directory:_directories' && ret=0 +} + +_managepy-createcachetable(){ + _arguments -s : \ + $nul_args && ret=0 +} + +_managepy-dbshell(){ + _arguments -s : \ + $nul_args && ret=0 +} + +_managepy-diffsettings(){ + _arguments -s : \ + $nul_args && ret=0 +} + +_managepy-dumpdata(){ + _arguments -s : \ + '--format=-[specifies the output serialization format for fixtures.]:format:(json yaml xml)' \ + '--indent=-[specifies the indent level to use when pretty-printing output.]:' \ + $nul_args \ + '*::appname:_applist' && ret=0 +} + +_managepy-flush(){ + _arguments -s : \ + '--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' \ + '--noinput[tells Django to NOT prompt the user for input of any kind.]' \ + $nul_args && ret=0 +} + +_managepy-help(){ + _arguments -s : \ + '*:command:_managepy_cmds' \ + $nul_args && ret=0 +} + +_managepy_cmds(){ + local line + local -a cmd + _call_program help-command ./manage.py help \ + |& sed -n '/^ /s/[(), ]/ /gp' \ + | while read -A line; do cmd=($line $cmd) done + _describe -t managepy-command 'manage.py command' cmd +} + +_managepy-inspectdb(){ + _arguments -s : \ + $nul_args && ret=0 +} + +_managepy-loaddata(){ + _arguments -s : \ + '--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' \ + '*::file:_files' \ + $nul_args && ret=0 +} + +_managepy-reset(){ + _arguments -s : \ + '--noinput[tells Django to NOT prompt the user for input of any kind.]' \ + '*::appname:_applist' \ + $nul_args && ret=0 +} + +_managepy-runfcgi(){ + local state + + local fcgi_opts + fcgi_opts=( + 'protocol[fcgi, scgi, ajp, ... (default fcgi)]:protocol:(fcgi scgi ajp)' + 'host[hostname to listen on..]:' + 'port[port to listen on.]:' + 'socket[UNIX socket to listen on.]::file:_files' + 'method[prefork or threaded (default prefork)]:method:(prefork threaded)' + 'maxrequests[number of requests a child handles before it is killed and a new child is forked (0 = no limit).]:' + 'maxspare[max number of spare processes / threads.]:' + 'minspare[min number of spare processes / threads.]:' + 'maxchildren[hard limit number of processes / threads.]:' + 'daemonize[whether to detach from terminal.]:boolean:(False True)' + 'pidfile[write the spawned process-id to this file.]:file:_files' + 'workdir[change to this directory when daemonizing.]:directory:_files' + 'outlog[write stdout to this file.]:file:_files' + 'errlog[write stderr to this file.]:file:_files' + ) + + _arguments -s : \ + $nul_args \ + '*: :_values "FCGI Setting" $fcgi_opts' && ret=0 +} + +_managepy-runserver(){ + _arguments -s : \ + '--noreload[tells Django to NOT use the auto-reloader.]' \ + '--adminmedia[specifies the directory from which to serve admin media.]:directory:_files' \ + $nul_args && ret=0 +} + +_managepy-shell(){ + _arguments -s : \ + '--plain[tells Django to use plain Python, not IPython.]' \ + $nul_args && ret=0 +} + +_managepy-sql(){} +_managepy-sqlall(){} +_managepy-sqlclear(){} +_managepy-sqlcustom(){} +_managepy-sqlflush(){} +_managepy-sqlindexes(){} +_managepy-sqlinitialdata(){} +_managepy-sqlreset(){} +_managepy-sqlsequencereset(){} +_managepy-startapp(){} + +_managepy-syncdb() { + _arguments -s : \ + '--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' \ + '--noinput[tells Django to NOT prompt the user for input of any kind.]' \ + $nul_args && ret=0 +} + +_managepy-test() { + _arguments -s : \ + '--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' \ + '--noinput[tells Django to NOT prompt the user for input of any kind.]' \ + '*::appname:_applist' \ + $nul_args && ret=0 +} + +_managepy-testserver() { + _arguments -s : \ + '--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' \ + '--addrport=-[port number or ipaddr:port to run the server on.]' \ + '*::fixture:_files' \ + $nul_args && ret=0 +} + +_managepy-validate() { + _arguments -s : \ + $nul_args && ret=0 +} + +_managepy-commands() { + local -a commands + + commands=( + 'adminindex:prints the admin-index template snippet for the given app name(s).' + 'createcachetable:creates the table needed to use the SQL cache backend.' + 'dbshell:runs the command-line client for the current DATABASE_ENGINE.' + "diffsettings:displays differences between the current settings.py and Django's default settings." + 'dumpdata:Output the contents of the database as a fixture of the given format.' + 'flush:Executes ``sqlflush`` on the current database.' + 'help:manage.py help.' + 'inspectdb:Introspects the database tables in the given database and outputs a Django model module.' + 'loaddata:Installs the named fixture(s) in the database.' + 'reset:Executes ``sqlreset`` for the given app(s) in the current database.' + 'runfcgi:Run this project as a fastcgi (or some other protocol supported by flup) application,' + 'runserver:Starts a lightweight Web server for development.' + 'shell:Runs a Python interactive interpreter.' + 'sql:Prints the CREATE TABLE SQL statements for the given app name(s).' + 'sqlall:Prints the CREATE TABLE, custom SQL and CREATE INDEX SQL statements for the given model module name(s).' + 'sqlclear:Prints the DROP TABLE SQL statements for the given app name(s).' + 'sqlcustom:Prints the custom table modifying SQL statements for the given app name(s).' + 'sqlflush:Returns a list of the SQL statements required to return all tables in the database to the state they were in just after they were installed.' + 'sqlindexes:Prints the CREATE INDEX SQL statements for the given model module name(s).' + "sqlinitialdata:RENAMED: see 'sqlcustom'" + 'sqlreset:Prints the DROP TABLE SQL, then the CREATE TABLE SQL, for the given app name(s).' + 'sqlsequencereset:Prints the SQL statements for resetting sequences for the given app name(s).' + "startapp:Creates a Django app directory structure for the given app name in this project's directory." + "syncdb:Create the database tables for all apps in INSTALLED_APPS whose tables haven't already been created." + 'test:Runs the test suite for the specified applications, or the entire site if no apps are specified.' + 'testserver:Runs a development server with data from the given fixture(s).' + 'validate:Validates all installed models.' + ) + + _describe -t commands 'manage.py command' commands && ret=0 +} + +_applist() { + local line + local -a apps + _call_program help-command "python -c \"import os.path as op, re, django.conf, sys;\\ + bn=op.basename(op.abspath(op.curdir));[sys\\ + .stdout.write(str(re.sub(r'^%s\.(.*?)$' % + bn, r'\1', i)) + '\n') for i in django.conf.settings.\\ + INSTALLED_APPS if re.match(r'^%s' % bn, i)]\"" \ + | while read -A line; do apps=($line $apps) done + _values 'Application' $apps && ret=0 +} + +_managepy() { + local curcontext=$curcontext ret=1 + + if ((CURRENT == 2)); then + _managepy-commands + else + shift words + (( CURRENT -- )) + curcontext="${curcontext%:*:*}:managepy-$words[1]:" + _call_function ret _managepy-$words[1] + fi +} + +compdef _managepy manage.py +compdef _managepy django diff --git a/plugins/gas/_gas b/plugins/gas/_gas new file mode 100644 index 000000000..befdc9459 --- /dev/null +++ b/plugins/gas/_gas @@ -0,0 +1,34 @@ +#compdef gas + +local curcontext="$curcontext" state line cmds ret=1 + +_arguments -C \ + '(- 1 *)'{-v,--version}'[display version information]' \ + '(-h|--help)'{-h,--help}'[show help information]' \ + '1: :->cmds' \ + '*: :->args' && ret=0 + +case $state in + cmds) + cmds=( + "version:Prints Gas's version" + "use:Uses author" + "show:Shows your current user" + "list:Lists your authors" + "import:Imports current user to gasconfig" + "help:Describe available tasks or one specific task" + "delete:Deletes author" + "add:Adds author to gasconfig" + ) + _describe -t commands 'gas command' cmds && ret=0 + ;; + args) + case $line[1] in + (use|delete) + _values -S , 'authors' $(cat ~/.gas | sed -n -e 's/^\[\(.*\)\]/\1/p') && ret=0 + ;; + esac + ;; +esac + +return ret diff --git a/plugins/heroku/_heroku b/plugins/heroku/_heroku new file mode 100644 index 000000000..dc899e2b2 --- /dev/null +++ b/plugins/heroku/_heroku @@ -0,0 +1,158 @@ +#compdef heroku + +# Heroku Autocomplete plugin for Oh-My-Zsh +# Requires: The Heroku client gem (https://github.com/heroku/heroku) +# Author: Ali B. (http://awhitebox.com) + +local -a _1st_arguments +_1st_arguments=( + "account\:confirm_billing":"Confirm that your account can be billed at the end of the month" + "addons":"list installed addons" + "addons\:list":"list all available addons" + "addons\:add":"install an addon" + "addons\:upgrade":"upgrade an existing addon" + "addons\:downgrade":"downgrade an existing addon" + "addons\:remove":"uninstall an addon" + "addons\:open":"open an addon's dashboard in your browser" + "apps":"list your apps" + "apps\:info":"show detailed app information" + "apps\:create":"create a new app" + "apps\:rename":"rename the app" + "apps\:open":"open the app in a web browser" + "apps\:destroy":"permanently destroy an app" + "auth\:login":"log in with your heroku credentials" + "auth\:logout":"clear local authentication credentials" + "config":"display the config vars for an app" + "config\:add":"add one or more config vars" + "config\:remove":"remove a config var" + "db\:push":"push local data up to your app" + "db\:pull":"pull heroku data down into your local database" + "domains":"list custom domains for an app" + "domains\:add":"add a custom domain to an app" + "domains\:remove":"remove a custom domain from an app" + "domains\:clear":"remove all custom domains from an app" + "help":"list available commands or display help for a specific command" + "keys":"display keys for the current user" + "keys\:add":"add a key for the current user" + "keys\:remove":"remove a key from the current user" + "keys\:clear":"remove all authentication keys from the current user" + "logs":"display recent log output" + "logs\:cron":"DEPRECATED: display cron logs from legacy logging" + "logs\:drains":"manage syslog drains" + "maintenance\:on":"put the app into maintenance mode" + "maintenance\:off":"take the app out of maintenance mode" + "pg\:info":"display database information" + "pg\:ingress":"allow direct connections to the database from this IP for one minute" + "pg\:promote":"sets DATABASE as your DATABASE_URL" + "pg\:psql":"open a psql shell to the database" + "pg\:reset":"delete all data in DATABASE" + "pg\:unfollow":"stop a replica from following and make it a read/write database" + "pg\:wait":"monitor database creation, exit when complete" + "pgbackups":"list captured backups" + "pgbackups\:url":"get a temporary URL for a backup" + "pgbackups\:capture":"capture a backup from a database id" + "pgbackups\:restore":"restore a backup to a database" + "pgbackups\:destroy":"destroys a backup" + "plugins":"list installed plugins" + "plugins\:install":"install a plugin" + "plugins\:uninstall":"uninstall a plugin" + "ps\:dynos":"scale to QTY web processes" + "ps\:workers":"scale to QTY background processes" + "ps":"list processes for an app" + "ps\:restart":"restart an app process" + "ps\:scale":"scale processes by the given amount" + "releases":"list releases" + "releases\:info":"view detailed information for a release" + "rollback":"roll back to an older release" + "run":"run an attached process" + "run\:rake":"remotely execute a rake command" + "run\:console":"open a remote console session" + "sharing":"list collaborators on an app" + "sharing\:add":"add a collaborator to an app" + "sharing\:remove":"remove a collaborator from an app" + "sharing\:transfer":"transfer an app to a new owner" + "ssl":"list certificates for an app" + "ssl\:add":"add an ssl certificate to an app" + "ssl\:remove":"remove an ssl certificate from an app" + "ssl\:clear":"remove all ssl certificates from an app" + "stack":"show the list of available stacks" + "stack\:migrate":"prepare migration of this app to a new stack" + "version":"show heroku client version" +) + +_arguments '*:: :->command' + +if (( CURRENT == 1 )); then + _describe -t commands "heroku command" _1st_arguments + return +fi + +local -a _command_args +case "$words[1]" in + apps:info) + _command_args=( + '(-r|--raw)'{-r,--raw}'[output info as raw key/value pairs]' \ + ) + ;; + apps:create) + _command_args=( + '(-a|--addons)'{-a,--addons}'[a list of addons to install]' \ + '(-r|--remote)'{-r,--remote}'[the git remote to create, default "heroku"]' \ + '(-s|--stack)'{-s,--stack}'[the stack on which to create the app]' \ + ) + ;; + config) + _command_args=( + '(-s|--shell)'{-s,--shell}'[output config vars in shell format]' \ + ) + ;; + db:push) + _command_args=( + '(-c|--chunksize)'{-c,--chunksize}'[specify the number of rows to send in each batch]' \ + '(-d|--debug)'{-d,--debug}'[enable debugging output]' \ + '(-e|--exclude)'{-e,--exclude}'[exclude the specified tables from the push]' \ + '(-f|--filter)'{-f,--filter}'[only push certain tables]' \ + '(-r|--resume)'{-r,--resume}'[resume transfer described by a .dat file]' \ + '(-t|--tables)'{-t,--tables}'[only push the specified tables]' \ + ) + ;; + db:pull) + _command_args=( + '(-c|--chunksize)'{-c,--chunksize}'[specify the number of rows to send in each batch]' \ + '(-d|--debug)'{-d,--debug}'[enable debugging output]' \ + '(-e|--exclude)'{-e,--exclude}'[exclude the specified tables from the pull]' \ + '(-f|--filter)'{-f,--filter}'[only pull certain tables]' \ + '(-r|--resume)'{-r,--resume}'[resume transfer described by a .dat file]' \ + '(-t|--tables)'{-t,--tables}'[only pull the specified tables]' \ + ) + ;; + keys) + _command_args=( + '(-l|--long)'{-l,--long}'[display extended information for each key]' \ + ) + ;; + logs) + _command_args=( + '(-n|--num)'{-n,--num}'[the number of lines to display]' \ + '(-p|--ps)'{-p,--ps}'[only display logs from the given process]' \ + '(-s|--source)'{-s,--source}'[only display logs from the given source]' \ + '(-t|--tail)'{-t,--tail}'[continually stream logs]' \ + ) + ;; + pgbackups:capture) + _command_args=( + '(-e|--expire)'{-e,--expire}'[if no slots are available to capture, delete the oldest backup to make room]' \ + ) + ;; + stack) + _command_args=( + '(-a|--all)'{-a,--all}'[include deprecated stacks]' \ + ) + ;; + esac + +_arguments \ + $_command_args \ + '(--app)--app[the app name]' \ + && return 0 + diff --git a/plugins/history-substring-search/README b/plugins/history-substring-search/README new file mode 100644 index 000000000..be11adf76 --- /dev/null +++ b/plugins/history-substring-search/README @@ -0,0 +1,7 @@ +To activate this script, load it into an interactive ZSH session: + + % source history-substring-search.zsh + +See the "history-substring-search.zsh" file for more information: + + % sed -n '2,/^$/s/^#//p' history-substring-search.zsh | more diff --git a/plugins/history-substring-search/history-substring-search.plugin.zsh b/plugins/history-substring-search/history-substring-search.plugin.zsh new file mode 100644 index 000000000..5d22b8a20 --- /dev/null +++ b/plugins/history-substring-search/history-substring-search.plugin.zsh @@ -0,0 +1,12 @@ +# This file integrates the history-substring-search script into oh-my-zsh. + +source "${0:r:r}.zsh" + +if test "$CASE_SENSITIVE" = true; then + unset HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS +fi + +if test "$DISABLE_COLOR" = true; then + unset HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND + unset HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND +fi diff --git a/plugins/history-substring-search/history-substring-search.zsh b/plugins/history-substring-search/history-substring-search.zsh new file mode 100644 index 000000000..53f707c79 --- /dev/null +++ b/plugins/history-substring-search/history-substring-search.zsh @@ -0,0 +1,642 @@ +#!/usr/bin/env zsh +# +# This is a clean-room implementation of the Fish[1] shell's history search +# feature, where you can type in any part of any previously entered command +# and press the UP and DOWN arrow keys to cycle through the matching commands. +# +#----------------------------------------------------------------------------- +# Usage +#----------------------------------------------------------------------------- +# +# 1. Load this script into your interactive ZSH session: +# +# % source history-substring-search.zsh +# +# If you want to use the zsh-syntax-highlighting[6] script along with this +# script, then make sure that you load it *before* you load this script: +# +# % source zsh-syntax-highlighting.zsh +# % source history-substring-search.zsh +# +# 2. Type any part of any previous command and then: +# +# * Press the UP arrow key to select the nearest command that (1) contains +# your query and (2) is older than the current command in the command +# history. +# +# * Press the DOWN arrow key to select the nearest command that (1) +# contains your query and (2) is newer than the current command in the +# command history. +# +# * Press ^U (the Control and U keys simultaneously) to abort the search. +# +# 3. If a matching command spans more than one line of text, press the LEFT +# arrow key to move the cursor away from the end of the command, and then: +# +# * Press the UP arrow key to move the cursor to the line above. When the +# cursor reaches the first line of the command, pressing the UP arrow +# key again will cause this script to perform another search. +# +# * Press the DOWN arrow key to move the cursor to the line below. When +# the cursor reaches the last line of the command, pressing the DOWN +# arrow key again will cause this script to perform another search. +# +#----------------------------------------------------------------------------- +# Configuration +#----------------------------------------------------------------------------- +# +# This script defines the following global variables. You may override their +# default values only after having loaded this script into your ZSH session. +# +# * HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND is a global variable that defines +# how the query should be highlighted inside a matching command. Its default +# value causes this script to highlight using bold, white text on a magenta +# background. See the "Character Highlighting" section in the zshzle(1) man +# page to learn about the kinds of values you may assign to this variable. +# +# * HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND is a global variable that +# defines how the query should be highlighted when no commands in the +# history match it. Its default value causes this script to highlight using +# bold, white text on a red background. See the "Character Highlighting" +# section in the zshzle(1) man page to learn about the kinds of values you +# may assign to this variable. +# +# * HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS is a global variable that defines +# how the command history will be searched for your query. Its default value +# causes this script to perform a case-insensitive search. See the "Globbing +# Flags" section in the zshexpn(1) man page to learn about the kinds of +# values you may assign to this variable. +# +#----------------------------------------------------------------------------- +# History +#----------------------------------------------------------------------------- +# +# This script was originally written by Peter Stephenson[2], who published it +# to the ZSH users mailing list (thereby making it public domain) in September +# 2009. It was later revised by Guido van Steen and released under the BSD +# license (see below) as part of the fizsh[3] project in January 2011. +# +# It was later extracted from fizsh[3] release 1.0.1, refactored heavily, and +# repackaged as both an oh-my-zsh plugin[4] and as an independently loadable +# ZSH script[5] by Suraj N. Kurapati in 2011. +# +# It was further developed[4] by Guido van Steen, Suraj N. Kurapati, Sorin +# Ionescu, and Vincent Guerci in 2011. +# +# [1]: http://fishshell.com +# [2]: http://www.zsh.org/mla/users/2009/msg00818.html +# [3]: http://sourceforge.net/projects/fizsh/ +# [4]: https://github.com/robbyrussell/oh-my-zsh/pull/215 +# [5]: https://github.com/sunaku/zsh-history-substring-search +# [6]: https://github.com/nicoulaj/zsh-syntax-highlighting +# +############################################################################## +# +# Copyright (c) 2009 Peter Stephenson +# Copyright (c) 2011 Guido van Steen +# Copyright (c) 2011 Suraj N. Kurapati +# Copyright (c) 2011 Sorin Ionescu +# Copyright (c) 2011 Vincent Guerci +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# * Neither the name of the FIZSH nor the names of its contributors +# may be used to endorse or promote products derived from this +# software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################## + +#----------------------------------------------------------------------------- +# configuration variables +#----------------------------------------------------------------------------- + +HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND='bg=magenta,fg=white,bold' +HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND='bg=red,fg=white,bold' +HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS='i' + +#----------------------------------------------------------------------------- +# the main ZLE widgets +#----------------------------------------------------------------------------- + +function history-substring-search-up() { + _history-substring-search-begin + + _history-substring-search-up-history || + _history-substring-search-up-buffer || + _history-substring-search-up-search + + _history-substring-search-end +} + +function history-substring-search-down() { + _history-substring-search-begin + + _history-substring-search-down-history || + _history-substring-search-down-buffer || + _history-substring-search-down-search + + _history-substring-search-end +} + +zle -N history-substring-search-up +zle -N history-substring-search-down + +bindkey '\e[A' history-substring-search-up +bindkey '\e[B' history-substring-search-down + +#----------------------------------------------------------------------------- +# implementation details +#----------------------------------------------------------------------------- + +setopt extendedglob +zmodload -F zsh/parameter + +# +# We have to "override" some keys and widgets if the +# zsh-syntax-highlighting plugin has not been loaded: +# +# https://github.com/nicoulaj/zsh-syntax-highlighting +# +if [[ $+functions[_zsh_highlight] -eq 0 ]]; then + # + # Dummy implementation of _zsh_highlight() + # that simply removes existing highlights + # + function _zsh_highlight() { + region_highlight=() + } + + # + # Remove existing highlights when the user + # inserts printable characters into $BUFFER + # + function ordinary-key-press() { + if [[ $KEYS == [[:print:]] ]]; then + region_highlight=() + fi + zle .self-insert + } + zle -N self-insert ordinary-key-press + + # + # Override ZLE widgets to invoke _zsh_highlight() + # + # https://github.com/nicoulaj/zsh-syntax-highlighting/blob/ + # bb7fcb79fad797a40077bebaf6f4e4a93c9d8163/zsh-syntax-highlighting.zsh#L121 + # + #--------------8<-------------------8<-------------------8<----------------- + # + # Copyright (c) 2010-2011 zsh-syntax-highlighting contributors + # All rights reserved. + # + # Redistribution and use in source and binary forms, with or without + # modification, are permitted provided that the following conditions are + # met: + # + # * Redistributions of source code must retain the above copyright + # notice, this list of conditions and the following disclaimer. + # + # * Redistributions in binary form must reproduce the above copyright + # notice, this list of conditions and the following disclaimer in the + # documentation and/or other materials provided with the distribution. + # + # * Neither the name of the zsh-syntax-highlighting contributors nor the + # names of its contributors may be used to endorse or promote products + # derived from this software without specific prior written permission. + # + # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + # IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + # Load ZSH module zsh/zleparameter, needed to override user defined widgets. + zmodload zsh/zleparameter 2>/dev/null || { + echo 'zsh-syntax-highlighting: failed loading zsh/zleparameter, exiting.' >&2 + return -1 + } + + # Override ZLE widgets to make them invoke _zsh_highlight. + for event in ${${(f)"$(zle -la)"}:#(_*|orig-*|.run-help|.which-command)}; do + if [[ "$widgets[$event]" == completion:* ]]; then + eval "zle -C orig-$event ${${${widgets[$event]}#*:}/:/ } ; $event() { builtin zle orig-$event && _zsh_highlight } ; zle -N $event" + else + case $event in + accept-and-menu-complete) + eval "$event() { builtin zle .$event && _zsh_highlight } ; zle -N $event" + ;; + + # The following widgets should NOT remove any previously + # applied highlighting. Therefore we do not remap them. + .forward-char|.backward-char|.up-line-or-history|.down-line-or-history) + ;; + + .*) + clean_event=$event[2,${#event}] # Remove the leading dot in the event name + case ${widgets[$clean_event]-} in + (completion|user):*) + ;; + *) + eval "$clean_event() { builtin zle $event && _zsh_highlight } ; zle -N $clean_event" + ;; + esac + ;; + *) + ;; + esac + fi + done + unset event clean_event + #-------------->8------------------->8------------------->8----------------- +fi + +function _history-substring-search-begin() { + _history_substring_search_move_cursor_eol=false + _history_substring_search_query_highlight= + + # + # Continue using the previous $_history_substring_search_result by default, + # unless the current query was cleared or a new/different query was entered. + # + if [[ -z $BUFFER || $BUFFER != $_history_substring_search_result ]]; then + # + # For the purpose of highlighting we will also keep + # a version without doubly-escaped meta characters. + # + _history_substring_search_query=$BUFFER + + # + # $BUFFER contains the text that is in the command-line currently. + # we put an extra "\\" before meta characters such as "\(" and "\)", + # so that they become "\\\(" and "\\\)". + # + _history_substring_search_query_escaped=${BUFFER//(#m)[\][()|\\*?#<>~^]/\\$MATCH} + + # + # Find all occurrences of the search query in the history file. + # + # (k) turns it an array of line numbers. + # + # (on) seems to remove duplicates, which are default + # options. They can be turned off by (ON). + # + _history_substring_search_matches=(${(kon)history[(R)(#$HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS)*${_history_substring_search_query_escaped}*]}) + + # + # Define the range of values that $_history_substring_search_match_index + # can take: [0, $_history_substring_search_matches_count_plus]. + # + _history_substring_search_matches_count=$#_history_substring_search_matches + _history_substring_search_matches_count_plus=$(( _history_substring_search_matches_count + 1 )) + _history_substring_search_matches_count_sans=$(( _history_substring_search_matches_count - 1 )) + + # + # If $_history_substring_search_match_index is equal to + # $_history_substring_search_matches_count_plus, this indicates that we + # are beyond the beginning of $_history_substring_search_matches. + # + # If $_history_substring_search_match_index is equal to 0, this indicates + # that we are beyond the end of $_history_substring_search_matches. + # + # If we have initially pressed "up" we have to initialize + # $_history_substring_search_match_index to + # $_history_substring_search_matches_count_plus so that it will be + # decreased to $_history_substring_search_matches_count. + # + # If we have initially pressed "down" we have to initialize + # $_history_substring_search_match_index to + # $_history_substring_search_matches_count so that it will be increased to + # $_history_substring_search_matches_count_plus. + # + if [[ $WIDGET == history-substring-search-down ]]; then + _history_substring_search_match_index=$_history_substring_search_matches_count + else + _history_substring_search_match_index=$_history_substring_search_matches_count_plus + fi + fi +} + +function _history-substring-search-end() { + _history_substring_search_result=$BUFFER + + # move the cursor to the end of the command line + if [[ $_history_substring_search_move_cursor_eol == true ]]; then + CURSOR=${#BUFFER} + fi + + # highlight command line using zsh-syntax-highlighting + _zsh_highlight + + # highlight the search query inside the command line + if [[ -n $_history_substring_search_query_highlight && -n $_history_substring_search_query ]]; then + # + # The following expression yields a variable $MBEGIN, which + # indicates the begin position + 1 of the first occurrence + # of _history_substring_search_query_escaped in $BUFFER. + # + : ${(S)BUFFER##(#m$HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS)($_history_substring_search_query##)} + local begin=$(( MBEGIN - 1 )) + local end=$(( begin + $#_history_substring_search_query )) + region_highlight+=("$begin $end $_history_substring_search_query_highlight") + fi + + # For debugging purposes: + # zle -R "mn: "$_history_substring_search_match_index" m#: "${#_history_substring_search_matches} + # read -k -t 200 && zle -U $REPLY + + # Exit successfully from the history-substring-search-* widgets. + true +} + +function _history-substring-search-up-buffer() { + # + # Check if the UP arrow was pressed to move the cursor within a multi-line + # buffer. This amounts to three tests: + # + # 1. $#buflines -gt 1. + # + # 2. $CURSOR -ne $#BUFFER. + # + # 3. Check if we are on the first line of the current multi-line buffer. + # If so, pressing UP would amount to leaving the multi-line buffer. + # + # We check this by adding an extra "x" to $LBUFFER, which makes + # sure that xlbuflines is always equal to the number of lines + # until $CURSOR (including the line with the cursor on it). + # + local buflines XLBUFFER xlbuflines + buflines=(${(f)BUFFER}) + XLBUFFER=$LBUFFER"x" + xlbuflines=(${(f)XLBUFFER}) + + if [[ $#buflines -gt 1 && $CURSOR -ne $#BUFFER && $#xlbuflines -ne 1 ]]; then + zle up-line-or-history + return true + fi + + false +} + +function _history-substring-search-down-buffer() { + # + # Check if the DOWN arrow was pressed to move the cursor within a multi-line + # buffer. This amounts to three tests: + # + # 1. $#buflines -gt 1. + # + # 2. $CURSOR -ne $#BUFFER. + # + # 3. Check if we are on the last line of the current multi-line buffer. + # If so, pressing DOWN would amount to leaving the multi-line buffer. + # + # We check this by adding an extra "x" to $RBUFFER, which makes + # sure that xrbuflines is always equal to the number of lines + # from $CURSOR (including the line with the cursor on it). + # + local buflines XRBUFFER xrbuflines + buflines=(${(f)BUFFER}) + XRBUFFER="x"$RBUFFER + xrbuflines=(${(f)XRBUFFER}) + + if [[ $#buflines -gt 1 && $CURSOR -ne $#BUFFER && $#xrbuflines -ne 1 ]]; then + zle down-line-or-history + return true + fi + + false +} + +function _history-substring-search-up-history() { + # + # Behave like up in ZSH, except clear the $BUFFER + # when beginning of history is reached like in Fish. + # + if [[ -z $_history_substring_search_query ]]; then + + # we have reached the absolute top of history + if [[ $HISTNO -eq 1 ]]; then + BUFFER= + + # going up from somewhere below the top of history + else + zle up-history + fi + + return true + fi + + false +} + +function _history-substring-search-down-history() { + # + # Behave like down-history in ZSH, except clear the + # $BUFFER when end of history is reached like in Fish. + # + if [[ -z $_history_substring_search_query ]]; then + + # going down from the absolute top of history + if [[ $HISTNO -eq 1 && -z $BUFFER ]]; then + BUFFER=${history[1]} + _history_substring_search_move_cursor_eol=true + + # going down from somewhere above the bottom of history + else + zle down-history + fi + + return true + fi + + false +} + +function _history-substring-search-up-search() { + _history_substring_search_move_cursor_eol=true + + # + # Highlight matches during history-substring-up-search: + # + # The following constants have been initialized in + # _history-substring-search-up/down-search(): + # + # $_history_substring_search_matches is the current list of matches + # $_history_substring_search_matches_count is the current number of matches + # $_history_substring_search_matches_count_plus is the current number of matches + 1 + # $_history_substring_search_matches_count_sans is the current number of matches - 1 + # $_history_substring_search_match_index is the index of the current match + # + # The range of values that $_history_substring_search_match_index can take + # is: [0, $_history_substring_search_matches_count_plus]. A value of 0 + # indicates that we are beyond the end of + # $_history_substring_search_matches. A value of + # $_history_substring_search_matches_count_plus indicates that we are beyond + # the beginning of $_history_substring_search_matches. + # + # In _history-substring-search-up-search() the initial value of + # $_history_substring_search_match_index is + # $_history_substring_search_matches_count_plus. This value is set in + # _history-substring-search-begin(). _history-substring-search-up-search() + # will initially decrease it to $_history_substring_search_matches_count. + # + if [[ $_history_substring_search_match_index -ge 2 ]]; then + # + # Highlight the next match: + # + # 1. Decrease the value of $_history_substring_search_match_index. + # + # 2. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND + # to highlight the current buffer. + # + (( _history_substring_search_match_index-- )) + BUFFER=$history[$_history_substring_search_matches[$_history_substring_search_match_index]] + _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND + + elif [[ $_history_substring_search_match_index -eq 1 ]]; then + # + # We will move beyond the end of $_history_substring_search_matches: + # + # 1. Decrease the value of $_history_substring_search_match_index. + # + # 2. Save the current buffer in $_history_substring_search_old_buffer, + # so that it can be retrieved by + # _history-substring-search-down-search() later. + # + # 3. Make $BUFFER equal to $_history_substring_search_query. + # + # 4. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND + # to highlight the current buffer. + # + (( _history_substring_search_match_index-- )) + _history_substring_search_old_buffer=$BUFFER + BUFFER=$_history_substring_search_query + _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND + + elif [[ $_history_substring_search_match_index -eq $_history_substring_search_matches_count_plus ]]; then + # + # We were beyond the beginning of $_history_substring_search_matches but + # UP makes us move back to $_history_substring_search_matches: + # + # 1. Decrease the value of $_history_substring_search_match_index. + # + # 2. Restore $BUFFER from $_history_substring_search_old_buffer. + # + # 3. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND + # to highlight the current buffer. + # + (( _history_substring_search_match_index-- )) + BUFFER=$_history_substring_search_old_buffer + _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND + fi +} + +function _history-substring-search-down-search() { + _history_substring_search_move_cursor_eol=true + + # + # Highlight matches during history-substring-up-search: + # + # The following constants have been initialized in + # _history-substring-search-up/down-search(): + # + # $_history_substring_search_matches is the current list of matches + # $_history_substring_search_matches_count is the current number of matches + # $_history_substring_search_matches_count_plus is the current number of matches + 1 + # $_history_substring_search_matches_count_sans is the current number of matches - 1 + # $_history_substring_search_match_index is the index of the current match + # + # The range of values that $_history_substring_search_match_index can take + # is: [0, $_history_substring_search_matches_count_plus]. A value of 0 + # indicates that we are beyond the end of + # $_history_substring_search_matches. A value of + # $_history_substring_search_matches_count_plus indicates that we are beyond + # the beginning of $_history_substring_search_matches. + # + # In _history-substring-search-down-search() the initial value of + # $_history_substring_search_match_index is + # $_history_substring_search_matches_count. This value is set in + # _history-substring-search-begin(). + # _history-substring-search-down-search() will initially increase it to + # $_history_substring_search_matches_count_plus. + # + if [[ $_history_substring_search_match_index -le $_history_substring_search_matches_count_sans ]]; then + # + # Highlight the next match: + # + # 1. Increase $_history_substring_search_match_index by 1. + # + # 2. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND + # to highlight the current buffer. + # + (( _history_substring_search_match_index++ )) + BUFFER=$history[$_history_substring_search_matches[$_history_substring_search_match_index]] + _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND + + elif [[ $_history_substring_search_match_index -eq $_history_substring_search_matches_count ]]; then + # + # We will move beyond the beginning of $_history_substring_search_matches: + # + # 1. Increase $_history_substring_search_match_index by 1. + # + # 2. Save the current buffer in $_history_substring_search_old_buffer, so + # that it can be retrieved by _history-substring-search-up-search() + # later. + # + # 3. Make $BUFFER equal to $_history_substring_search_query. + # + # 4. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND + # to highlight the current buffer. + # + (( _history_substring_search_match_index++ )) + _history_substring_search_old_buffer=$BUFFER + BUFFER=$_history_substring_search_query + _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND + + elif [[ $_history_substring_search_match_index -eq 0 ]]; then + # + # We were beyond the end of $_history_substring_search_matches but DOWN + # makes us move back to the $_history_substring_search_matches: + # + # 1. Increase $_history_substring_search_match_index by 1. + # + # 2. Restore $BUFFER from $_history_substring_search_old_buffer. + # + # 3. Use $HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND + # to highlight the current buffer. + # + (( _history_substring_search_match_index++ )) + BUFFER=$_history_substring_search_old_buffer + _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND + fi +} + +# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- +# vim: ft=zsh sw=2 ts=2 et diff --git a/plugins/kate/kate.plugin.zsh b/plugins/kate/kate.plugin.zsh new file mode 100644 index 000000000..eb16522ac --- /dev/null +++ b/plugins/kate/kate.plugin.zsh @@ -0,0 +1,9 @@ + +# Kate +# Start kate always silent +alias kate='kate >/dev/null 2>&1' + +function kt () { + cd $1 + kate $1 +} \ No newline at end of file diff --git a/plugins/knife/_knife b/plugins/knife/_knife new file mode 100644 index 000000000..7f8c95ee5 --- /dev/null +++ b/plugins/knife/_knife @@ -0,0 +1,174 @@ +#compdef knife + +# These flags should be available everywhere according to man knife +knife_general_flags=( --help --server-url --key --config --editor --format --log_level --logfile --no-editor --user --print-after --version --yes ) + +# knife has a very special syntax, some example calls are: +# knife status +# knife cookbook list +# knife role show ROLENAME +# knife data bag show DATABAGNAME +# knife role show ROLENAME --attribute ATTRIBUTENAME +# knife cookbook show COOKBOOKNAME COOKBOOKVERSION recipes + +# The -Q switch in compadd allow for completions of things like "data bag" without having to go through two rounds of completion and avoids zsh inserting a \ for escaping spaces +_knife() { + local curcontext="$curcontext" state line + typeset -A opt_args + cloudproviders=(bluebox ec2 rackspace slicehost terremark) + _arguments \ + '1: :->knifecmd'\ + '2: :->knifesubcmd'\ + '3: :->knifesubcmd2' \ + '4: :->knifesubcmd3' \ + '5: :->knifesubcmd4' \ + '6: :->knifesubcmd5' + + case $state in + knifecmd) + compadd -Q "$@" bootstrap client configure cookbook "cookbook site" "data bag" exec index node recipe role search ssh status windows $cloudproviders + ;; + knifesubcmd) + case $words[2] in + (bluebox|ec2|rackspace|slicehost|terremark) + compadd "$@" server images + ;; + client) + compadd -Q "$@" "bulk delete" list create show delete edit reregister + ;; + configure) + compadd "$@" client + ;; + cookbook) + compadd -Q "$@" test list create download delete "metadata from" show "bulk delete" metadata upload + ;; + node) + compadd -Q "$@" "from file" create show edit delete list run_list "bulk delete" + ;; + recipe) + compadd "$@" list + ;; + role) + compadd -Q "$@" "bulk delete" create delete edit "from file" list show + ;; + windows) + compadd "$@" bootstrap + ;; + *) + _arguments '2:Subsubcommands:($(_knife_options1))' + esac + ;; + knifesubcmd2) + case $words[3] in + server) + compadd "$@" list create delete + ;; + images) + compadd "$@" list + ;; + site) + compadd "$@" vendor show share search download list unshare + ;; + (show|delete|edit) + _arguments '3:Subsubcommands:($(_chef_$words[2]s_remote))' + ;; + (upload|test) + _arguments '3:Subsubcommands:($(_chef_$words[2]s_local) --all)' + ;; + list) + compadd -a "$@" knife_general_flags + ;; + bag) + compadd -Q "$@" show edit list "from file" create delete + ;; + *) + _arguments '3:Subsubcommands:($(_knife_options2))' + esac + ;; + knifesubcmd3) + case $words[3] in + show) + case $words[2] in + cookbook) + versioncomp=1 + _arguments '4:Cookbookversions:($(_cookbook_versions) latest)' + ;; + (node|client|role) + compadd "$@" --attribute + esac + esac + case $words[4] in + (show|edit) + _arguments '4:Subsubsubcommands:($(_chef_$words[2]_$words[3]s_remote))' + ;; + file) + _arguments '*:file or directory:_files -g "*.(rb|json)"' + ;; + list) + compadd -a "$@" knife_general_flags + ;; + *) + _arguments '*:Subsubcommands:($(_knife_options3))' + esac + ;; + knifesubcmd4) + if (( versioncomp > 0 )); then + compadd "$@" attributes definitions files libraries providers recipes resources templates + else + _arguments '*:Subsubcommands:($(_knife_options2))' + fi + ;; + knifesubcmd5) + _arguments '*:Subsubcommands:($(_knife_options3))' + esac +} + +# Helper functions to provide the argument completion for several depths of commands +_knife_options1() { + ( for line in $( knife $words[2] --help | grep -v "^knife" ); do echo $line | grep "\-\-"; done ) +} + +_knife_options2() { + ( for line in $( knife $words[2] $words[3] --help | grep -v "^knife" ); do echo $line | grep "\-\-"; done ) +} + +_knife_options3() { + ( for line in $( knife $words[2] $words[3] $words[4] --help | grep -v "^knife" ); do echo $line | grep "\-\-"; done ) +} + +# The chef_x_remote functions use knife to get a list of objects of type x on the server +_chef_roles_remote() { + (knife role list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') +} + +_chef_clients_remote() { + (knife client list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') +} + +_chef_nodes_remote() { + (knife node list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') +} + +_chef_cookbooks_remote() { + (knife cookbook list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') +} + +_chef_sitecookbooks_remote() { + (knife cookbook site list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') +} + +_chef_data_bags_remote() { + (knife data bag list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') +} + +# The chef_x_local functions use the knife config to find the paths of relevant objects x to be uploaded to the server +_chef_cookbooks_local() { + (for i in $( grep cookbook_path $HOME/.chef/knife.rb | awk 'BEGIN {FS = "[" }; {print $2}' | sed 's/\,//g' | sed "s/'//g" | sed 's/\(.*\)]/\1/' ); do ls $i; done) +} + +# This function extracts the available cookbook versions on the chef server +_cookbook_versions() { + (knife cookbook show $words[4] | grep -v $words[4] | grep -v -E '\]|\[|\{|\}' | sed 's/ //g' | sed 's/"//g') +} + +_knife "$@" diff --git a/plugins/powder/_powder b/plugins/powder/_powder new file mode 100644 index 000000000..84e260a15 --- /dev/null +++ b/plugins/powder/_powder @@ -0,0 +1,4 @@ +#compdef powder +#autoload + +compadd `powder help | grep powder | cut -d " " -f 4` diff --git a/plugins/rails3/rails3.plugin.zsh b/plugins/rails3/rails3.plugin.zsh index f669ef047..f4ee637e6 100644 --- a/plugins/rails3/rails3.plugin.zsh +++ b/plugins/rails3/rails3.plugin.zsh @@ -1,13 +1,5 @@ # Rails 3 aliases, backwards-compatible with Rails 2. -function _bundle_command { - if command -v bundle && [ -e "Gemfile" ]; then - bundle exec $@ - else - $@ - fi -} - function _rails_command () { if [ -e "script/server" ]; then ruby script/$@ @@ -25,6 +17,3 @@ alias rp='_rails_command plugin' alias rs='_rails_command server' alias rsd='_rails_command server --debugger' alias devlog='tail -f log/development.log' - -alias rspec='_bundle_command rspec' -alias cuke='_bundle_command cucumber' diff --git a/plugins/redis-cli/_redis-cli b/plugins/redis-cli/_redis-cli index ae82dcd58..135dd973e 100644 --- a/plugins/redis-cli/_redis-cli +++ b/plugins/redis-cli/_redis-cli @@ -51,7 +51,7 @@ _1st_arguments=( 'keys:find all keys matching the given pattern' 'lastsave:get the UNIX timestamp of the last successful save to disk' 'lindex:get an element from a list by its index' - 'linset:insert an element before or after another element in a list' + 'linsert:insert an element before or after another element in a list' 'llen:get the length of a list' 'lpop:remove and get the first element in a list' 'lpush:prepend a value to a list' diff --git a/plugins/ssh-agent/ssh-agent.plugin.zsh b/plugins/ssh-agent/ssh-agent.plugin.zsh index 0efc4546f..c4e92a1fe 100644 --- a/plugins/ssh-agent/ssh-agent.plugin.zsh +++ b/plugins/ssh-agent/ssh-agent.plugin.zsh @@ -1,23 +1,62 @@ -# Based on code from Joseph M. Reagle -# http://www.cygwin.com/ml/cygwin/2001-06/msg00537.html +# +# INSTRUCTIONS +# +# To enabled agent forwarding support add the following to +# your .zshrc file: +# +# zstyle :omz:plugins:ssh-agent agent-forwarding on +# +# To load multiple identies use the identities style, For +# example: +# +# zstyle :omz:plugins:ssh-agent id_rsa id_rsa2 id_github +# +# +# CREDITS +# +# Based on code from Joseph M. Reagle +# http://www.cygwin.com/ml/cygwin/2001-06/msg00537.html +# +# Agent forwarding support based on ideas from +# Florent Thoumie and Jonas Pfenniger +# -local SSH_ENV=$HOME/.ssh/environment-$HOST +local _plugin__ssh_env=$HOME/.ssh/environment-$HOST +local _plugin__forwarding -function start_agent { - /usr/bin/env ssh-agent | sed 's/^echo/#echo/' > ${SSH_ENV} - chmod 600 ${SSH_ENV} - . ${SSH_ENV} > /dev/null - /usr/bin/ssh-add; +function _plugin__start_agent() +{ + local -a identities + + # start ssh-agent and setup environment + /usr/bin/env ssh-agent | sed 's/^echo/#echo/' > ${_plugin__ssh_env} + chmod 600 ${_plugin__ssh_env} + . ${_plugin__ssh_env} > /dev/null + + # load identies + zstyle -a :omz:plugins:ssh-agent identities identities + echo starting... + /usr/bin/ssh-add $HOME/.ssh/${^identities} } -# Source SSH settings, if applicable +# test if agent-forwarding is enabled +zstyle -b :omz:plugins:ssh-agent agent-forwarding _plugin__forwarding +if [[ ${_plugin__forwarding} == "yes" && -n "$SSH_AUTH_SOCK" ]]; then + # Add a nifty symlink for screen/tmux if agent forwarding + [[ -L $SSH_AUTH_SOCK ]] || ln -sf "$SSH_AUTH_SOCK" /tmp/ssh-agent-$USER-screen -if [ -f "${SSH_ENV}" ]; then - . ${SSH_ENV} > /dev/null +elif [ -f "${_plugin__ssh_env}" ]; then + # Source SSH settings, if applicable + . ${_plugin__ssh_env} > /dev/null ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || { - start_agent; + _plugin__start_agent; } else - start_agent; + _plugin__start_agent; fi +# tidy up after ourselves +unfunction _plugin__start_agent +unset _plugin__forwarding +unset _plugin__ssh_env + diff --git a/plugins/svn/svn.plugin.zsh b/plugins/svn/svn.plugin.zsh index 9b9f1b6b0..53a8a513a 100644 --- a/plugins/svn/svn.plugin.zsh +++ b/plugins/svn/svn.plugin.zsh @@ -1,5 +1,5 @@ function svn_prompt_info { - if [[ -d .svn ]]; then + if [ in_svn ]; then echo "$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_PREFIX\ $ZSH_THEME_REPO_NAME_COLOR$(svn_get_repo_name)$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_SVN_PROMPT_SUFFIX$ZSH_PROMPT_BASE_COLOR$(svn_dirty)$ZSH_PROMPT_BASE_COLOR" fi @@ -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" | sed "s/\/.*$//" fi } @@ -28,10 +28,10 @@ function svn_get_rev_nr { function svn_dirty_choose { if [ in_svn ]; then - s=$(svn status 2>/dev/null) - if [ $s ]; then + s=$(svn status|grep -E '^\s*[ACDIM!?L]' 2>/dev/null) + if [ $s ]; then echo $1 - else + else echo $2 fi fi diff --git a/plugins/taskwarrior/_task b/plugins/taskwarrior/_task new file mode 100644 index 000000000..5bffa9119 --- /dev/null +++ b/plugins/taskwarrior/_task @@ -0,0 +1,280 @@ +#compdef task +# +# zsh completion for taskwarrior +# +# Copyright 2010 - 2011 Johannes Schlatow +# Copyright 2009 P.C. Shyamshankar +# All rights reserved. +# +# This script is part of the taskwarrior project. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the +# +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA +# 02110-1301 +# USA +# +typeset -g _task_cmds _task_projects _task_tags _task_config _task_modifiers +_task_projects=($(task _projects)) +_task_tags=($(task _tags)) +_task_ids=($(task _ids)) +_task_config=($(task _config)) +_task_modifiers=( + 'before' \ + 'after' \ + 'none' \ + 'any' \ + 'is' \ + 'isnt' \ + 'has' \ + 'hasnt' \ + 'startswith' \ + 'endswith' \ + 'word' \ + 'noword' +) +_task_cmds=($(task _commands)) +_task_zshcmds=( ${(f)"$(task _zshcommands)"} ) + + +_task_idCmds=( + 'append' \ + 'prepend' \ + 'annotate' \ + 'denotate' \ + 'edit' \ + 'duplicate' \ + 'info' \ + 'start' \ + 'stop' \ + 'done' +) + +_task_idCmdsDesc=( + 'append:Appends more description to an existing task.' \ + 'prepend:Prepends more description to an existing task.' \ + 'annotate:Adds an annotation to an existing task.' \ + 'denotate:Deletes an annotation of an existing task.' \ + 'edit:Launches an editor to let you modify a task directly.' \ + 'duplicate:Duplicates the specified task, and allows modifications.' \ + 'info:Shows all data, metadata for specified task.' \ + 'start:Marks specified task as started.' \ + 'stop:Removes the start time from a task.' \ + 'done:Marks the specified task as completed.' +) + +_task() { + _arguments -s -S \ + "*::task command:_task_commands" + return 0 +} + +local -a reply args word +word=$'[^\0]#\0' + +# priorities +local -a task_priorities +_regex_words values 'task priorities' \ + 'H:High' \ + 'M:Middle' \ + 'L:Low' +task_priorities=("$reply[@]") + +# projects +local -a task_projects +task_projects=( + /"$word"/ + ":values:task projects:compadd -a _task_projects" +) + +local -a _task_dates +_regex_words values 'task dates' \ + 'tod*ay:Today' \ + 'yes*terday:Yesterday' \ + 'tom*orrow:Tomorrow' \ + 'sow:Start of week' \ + 'soww:Start of work week' \ + 'socw:Start of calendar week' \ + 'som:Start of month' \ + 'soy:Start of year' \ + 'eow:End of week' \ + 'eoww:End of work week' \ + 'eocw:End of calendar week' \ + 'eom:End of month' \ + 'eoy:End of year' \ + 'mon:Monday' \ + 'tue:Tuesday'\ + 'wed:Wednesday' \ + 'thu:Thursday' \ + 'fri:Friday' \ + 'sat:Saturday' \ + 'sun:Sunday' +_task_dates=("$reply[@]") + +local -a _task_reldates +_regex_words values 'task reldates' \ + 'hrs:n hours' \ + 'day:n days' \ + '1st:first' \ + '2nd:second' \ + '3rd:third' \ + 'th:4th, 5th, etc.' \ + 'wks:weeks' +_task_reldates=("$reply[@]") + +task_dates=( + \( "$_task_dates[@]" \| + \( /$'[0-9][0-9]#'/- \( "$_task_reldates[@]" \) \) + \) +) + +_regex_words values 'task frequencies' \ + 'daily:Every day' \ + 'day:Every day' \ + 'weekdays:Every day skipping weekend days' \ + 'weekly:Every week' \ + 'biweekly:Every two weeks' \ + 'fortnight:Every two weeks' \ + 'quarterly:Every three months' \ + 'semiannual:Every six months' \ + 'annual:Every year' \ + 'yearly:Every year' \ + 'biannual:Every two years' \ + 'biyearly:Every two years' +_task_freqs=("$reply[@]") + +local -a _task_frequencies +_regex_words values 'task frequencies' \ + 'd:days' \ + 'w:weeks' \ + 'q:quarters' \ + 'y:years' +_task_frequencies=("$reply[@]") + +task_freqs=( + \( "$_task_freqs[@]" \| + \( /$'[0-9][0-9]#'/- \( "$_task_frequencies[@]" \) \) + \) +) + +# attributes +local -a task_attributes +_regex_words -t ':' default 'task attributes' \ + 'pro*ject:Project name:$task_projects' \ + 'du*e:Due date:$task_dates' \ + 'wa*it:Date until task becomes pending:$task_dates' \ + 're*cur:Recurrence frequency:$task_freqs' \ + 'pri*ority:priority:$task_priorities' \ + 'un*til:Recurrence end date:$task_dates' \ + 'fg:Foreground color' \ + 'bg:Background color' \ + 'li*mit:Desired number of rows in report' +task_attributes=("$reply[@]") + +args=( + \( "$task_attributes[@]" \| + \( /'(project|due|wait|recur|priority|until|fg|bg|limit).'/- \( /$'[^:]#:'/ ":default:modifiers:compadd -S ':' -a _task_modifiers" \) \) \| + \( /'(rc).'/- \( /$'[^:]#:'/ ":arguments:config:compadd -S ':' -a _task_config" \) \) \| + \( /'(+|-)'/- \( /"$word"/ ":values:remove tag:compadd -a _task_tags" \) \) \| + \( /"$word"/ \) + \) \# +) +_regex_arguments _task_attributes "${args[@]}" + +## task commands + +# default completion +(( $+functions[_task_default] )) || +_task_default() { + _task_attributes "$@" +} + +# commands expecting an ID +(( $+functions[_task_id] )) || +_task_id() { + if (( CURRENT < 3 )); then + # update IDs + _task_zshids=( ${(f)"$(task _zshids)"} ) + _describe -t values 'task IDs' _task_zshids + else + _task_attributes "$@" + fi +} + +# merge completion +(( $+functions[_task_merge] )) || +_task_merge() { + # TODO match URIs in .taskrc + _files +} + +# push completion +(( $+functions[_task_push] )) || +_task_push() { + # TODO match URIs in .taskrc + _files +} + +# pull completion +(( $+functions[_task_pull] )) || +_task_pull() { + # TODO match URIs in .taskrc + _files +} + + +# modify (task [0-9]* ...) completion +(( $+functions[_task_modify] )) || +_task_modify() { + _describe -t commands 'task command' _task_idCmdsDesc + _task_attributes "$@" +} + +## first level completion => task sub-command completion +(( $+functions[_task_commands] )) || +_task_commands() { + local cmd ret=1 + if (( CURRENT == 1 )); then + # update IDs + _task_zshids=( ${(f)"$(task _zshids)"} ) + + _describe -t commands 'task command' _task_zshcmds + _describe -t values 'task IDs' _task_zshids + # TODO match more than one ID + elif [[ $words[1] =~ ^[0-9]*$ ]] then + _call_function ret _task_modify + return ret + else +# local curcontext="${curcontext}" +# cmd="${_task_cmds[(r)$words[1]:*]%%:*}" + cmd="${_task_cmds[(r)$words[1]]}" + idCmd="${(M)_task_idCmds[@]:#$words[1]}" + if (( $#cmd )); then +# curcontext="${curcontext%:*:*}:task-${cmd}" + + if (( $#idCmd )); then + _call_function ret _task_id + else + _call_function ret _task_${cmd} || + _call_function ret _task_default || + _message "No command remaining." + fi + else + _message "Unknown subcommand ${cmd}" + fi + return ret + fi +} diff --git a/plugins/taskwarrior/taskwarrior.plugin.zsh b/plugins/taskwarrior/taskwarrior.plugin.zsh new file mode 100644 index 000000000..c1830042e --- /dev/null +++ b/plugins/taskwarrior/taskwarrior.plugin.zsh @@ -0,0 +1,21 @@ +################################################################################ +# Author: Pete Clark +# Email: pete[dot]clark[at]gmail[dot]com +# Version: 0.1 (05/24/2011) +# License: WTFPL +# +# This oh-my-zsh plugin adds smart tab completion for +# TaskWarrior. It uses the zsh tab completion +# script (_task) distributed with TaskWarrior for the completion definitions. +# +# Typing task[tabtab] will give you a list of current tasks, task 66[tabtab] +# gives a list of available modifications for that task, etc. +################################################################################ + +zstyle ':completion:*:*:task:*' verbose yes +zstyle ':completion:*:*:task:*:descriptions' format '%U%B%d%b%u' + +zstyle ':completion:*:*:task:*' group-name '' + +alias t=task +compdef _task t=task From 638cfb79bdbf4fb6dc7d18122575a398cd73bc47 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sat, 27 Aug 2011 19:09:06 -0400 Subject: [PATCH 494/614] Added Python plugin, moved pip completion into it. --- plugins/{pip => python}/_pip | 9 +++++---- plugins/python/python.plugin.zsh | 11 +++++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) rename plugins/{pip => python}/_pip (89%) create mode 100644 plugins/python/python.plugin.zsh diff --git a/plugins/pip/_pip b/plugins/python/_pip similarity index 89% rename from plugins/pip/_pip rename to plugins/python/_pip index b58010173..ea2b0c3ff 100644 --- a/plugins/pip/_pip +++ b/plugins/python/_pip @@ -1,9 +1,9 @@ #compdef pip #autoload -# pip zsh completion, based on homebrew completion +# This completion is based on the Homebrew completion. -_pip_installed() { +function _pip-installed() { installed_pkgs=(`pip freeze`) } @@ -37,10 +37,11 @@ fi case "$words[1]" in list) if [[ "$state" == forms ]]; then - _pip_installed + _pip-installed _requested installed_pkgs expl 'installed packages' compadd -a installed_pkgs fi ;; uninstall) - _pip_installed + _pip-installed _wanted installed_pkgs expl 'installed packages' compadd -a installed_pkgs ;; esac + diff --git a/plugins/python/python.plugin.zsh b/plugins/python/python.plugin.zsh new file mode 100644 index 000000000..3bc947c4c --- /dev/null +++ b/plugins/python/python.plugin.zsh @@ -0,0 +1,11 @@ +# Prepend PEP 370 per user site packages directory, which defaults to +# ~/Library/Python on Mac OS X and ~/.local elsewhere, to PATH/MANPATH. +if [[ "$OSTYPE" == darwin* ]]; then + path=($HOME/Library/Python/*/bin(N) $path) + manpath=($HOME/Library/Python/*/{,share/}man(N) $manpath) +else + # This is subject to change. + path=($HOME/.local/bin $path) + manpath=($HOME/.local/{,share/}man(N) $manpath) +fi + From 38283f86c1bf623e5d53e8e27dc08d3c20eb1389 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sat, 27 Aug 2011 19:14:55 -0400 Subject: [PATCH 495/614] Moved gem completion into Ruby plugin. --- plugins/{gem => ruby}/_gem | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) rename plugins/{gem => ruby}/_gem (94%) diff --git a/plugins/gem/_gem b/plugins/ruby/_gem similarity index 94% rename from plugins/gem/_gem rename to plugins/ruby/_gem index 83cba40d1..8901492ae 100644 --- a/plugins/gem/_gem +++ b/plugins/ruby/_gem @@ -1,9 +1,9 @@ #compdef gem #autoload -# gem zsh completion, based on homebrew completion +# This completion is based on the Homebrew completion. -_gem_installed() { +function _gem-installed() { installed_gems=(`gem list --local --no-versions`) } @@ -55,10 +55,11 @@ fi case "$words[1]" in list) if [[ "$state" == forms ]]; then - _gem_installed + _gem-installed _requested installed_gems expl 'installed gems' compadd -a installed_gems fi ;; uninstall|update) - _gem_installed + _gem-installed _wanted installed_gems expl 'installed gems' compadd -a installed_gems ;; esac + From d60b9bd17b146a1c712eafb56e0f5f37eda2d403 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sat, 27 Aug 2011 20:37:54 -0400 Subject: [PATCH 496/614] Abide by Mac conventions when installing gems. --- plugins/ruby/ruby.plugin.zsh | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/plugins/ruby/ruby.plugin.zsh b/plugins/ruby/ruby.plugin.zsh index 08ca9c601..2b467b3ce 100644 --- a/plugins/ruby/ruby.plugin.zsh +++ b/plugins/ruby/ruby.plugin.zsh @@ -1,6 +1,16 @@ -# TODO: Make this compatible with rvm. -# Run sudo gem on the system ruby, not the active ruby. -alias sgem='sudo gem' +# Install local gems according to Mac OS X conventions. +if [[ "$OSTYPE" == darwin* ]]; then + export GEM_HOME=$HOME/Library/Ruby/Gems/1.8 + export PATH=$GEM_HOME/bin:$PATH + + # gem is slow; cache its output. + cache_file="${0:h}/cache.zsh" + if [[ ! -f "$cache_file" ]]; then + echo export GEM_PATH=$GEM_HOME:$(gem env gempath) >! "$cache_file" + source "$cache_file" + else + source "$cache_file" + fi + unset cache_file +fi -# Find ruby file -alias rfind='find . -name *.rb | xargs grep -n' From aa00cab97e0334a6a907cd78617a5917bd32735c Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sat, 27 Aug 2011 21:02:46 -0400 Subject: [PATCH 497/614] Merged npm plugin into node plugin. --- plugins/node/node.plugin.zsh | 10 +++++++--- plugins/npm/npm.plugin.zsh | 1 - 2 files changed, 7 insertions(+), 4 deletions(-) delete mode 100644 plugins/npm/npm.plugin.zsh diff --git a/plugins/node/node.plugin.zsh b/plugins/node/node.plugin.zsh index 519bc18da..a9c3b45f4 100644 --- a/plugins/node/node.plugin.zsh +++ b/plugins/node/node.plugin.zsh @@ -1,5 +1,9 @@ +# Complete npm. +eval "$(npm completion 2>/dev/null)" + # Open the node api for your current version to the optional section. -# TODO: Make the section part easier to use. -function node-docs { - open "http://nodejs.org/docs/$(node --version)/api/all.html#$1" +# TODO: Make the sections easier to use. +function node-docs() { + open "http://nodejs.org/docs/$(node --version)/api/all.html#$1" } + diff --git a/plugins/npm/npm.plugin.zsh b/plugins/npm/npm.plugin.zsh deleted file mode 100644 index c3eb91d31..000000000 --- a/plugins/npm/npm.plugin.zsh +++ /dev/null @@ -1 +0,0 @@ -eval "$(npm completion 2>/dev/null)" From b52adc8373e3696603d379d2fef48eff316cb967 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sat, 27 Aug 2011 21:03:50 -0400 Subject: [PATCH 498/614] Added npm completion caching. --- plugins/node/node.plugin.zsh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/node/node.plugin.zsh b/plugins/node/node.plugin.zsh index a9c3b45f4..442afa033 100644 --- a/plugins/node/node.plugin.zsh +++ b/plugins/node/node.plugin.zsh @@ -1,5 +1,13 @@ # Complete npm. -eval "$(npm completion 2>/dev/null)" +cache_file="${0:h}/cache.zsh" +if [[ ! -f "$cache_file" ]] && (( $+commands[npm] )); then + # npm is slow; cache its output. + npm completion >! "$cache_file" 2>/dev/null + source "$cache_file" +else + source "$cache_file" +fi +unset cache_file # Open the node api for your current version to the optional section. # TODO: Make the sections easier to use. From 8398eb72c08aff9f0962078420d3075c4176c035 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sun, 28 Aug 2011 15:28:09 -0400 Subject: [PATCH 499/614] Cleaned up the Perl plugin. --- plugins/perl/perl.plugin.zsh | 70 ++++++++++++------------------------ 1 file changed, 22 insertions(+), 48 deletions(-) diff --git a/plugins/perl/perl.plugin.zsh b/plugins/perl/perl.plugin.zsh index c5590e531..05f2a2247 100644 --- a/plugins/perl/perl.plugin.zsh +++ b/plugins/perl/perl.plugin.zsh @@ -1,62 +1,36 @@ -# https://github.com/dbbolton -# -# Below are some useful Perl-related aliases/functions that I use with zsh. - - -# Aliases ################################################################### - -# perlbrew ######## +# Aliases alias pbi='perlbrew install' alias pbl='perlbrew list' alias pbo='perlbrew off' alias pbs='perlbrew switch' alias pbu='perlbrew use' - -# Perl ############ - -# perldoc` +alias ple='perl -wlne' alias pd='perldoc' -# use perl like awk/sed -alias ple='perl -wlne' +# Perl Global Substitution +function pgs() { + if (( $# < 2 )) ; then + echo "Usage: $0 find replace [file ...]" >&2 + return 1 + fi -# show the latest stable release of Perl -alias latest-perl='curl -s http://www.perl.org/get.html | perl -wlne '\''if (/perl\-([\d\.]+)\.tar\.gz/) { print $1; exit;}'\' + local find="$1" + local replace="$2" + repeat 2 shift - - -# Functions ################################################################# - -# newpl - creates a basic Perl script file and opens it with $EDITOR -newpl () { - # set $EDITOR to 'vim' if it is undefined - [[ -z $EDITOR ]] && EDITOR=vim - - # if the file exists, just open it - [[ -e $1 ]] && print "$1 exists; not modifying.\n" && $EDITOR $1 - - # if it doesn't, make it, and open it - [[ ! -e $1 ]] && print '#!/usr/bin/perl'"\n"'use strict;'"\n"'use warnings;'\ - "\n\n" > $1 && $EDITOR $1 + perl -i.orig -pe 's/'"$find"'/'"$replace"'/g' "$@" } +# Perl grep since 'grep -P' is terrible. +function prep() { + if (( $# < 1 )) ; then + echo "Usage: $0 pattern [file ...]" >&2 + return 1 + fi -# pgs - Perl Global Substitution -# find pattern = 1st arg -# replace pattern = 2nd arg -# filename = 3rd arg -pgs() { # [find] [replace] [filename] - perl -i.orig -pe 's/'"$1"'/'"$2"'/g' "$3" -} - - -# Perl grep, because 'grep -P' is terrible. Lets you work with pipes or files. -prep() { # [pattern] [filename unless STDOUT] - perl -nle 'print if /'"$1"'/;' $2 -} - -# say - append a newline to 'print' -say() { - print "$1\n" + local pattern="$1" + shift + + perl -nle 'print if /'"$pattern"'/;' "$@" } From b72183ba65d475a5003658d05265e0b8457649ad Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sun, 28 Aug 2011 15:29:56 -0400 Subject: [PATCH 500/614] Added local CPAN module installation for Mac OS X. --- plugins/perl/perl.plugin.zsh | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/plugins/perl/perl.plugin.zsh b/plugins/perl/perl.plugin.zsh index 05f2a2247..7adad86f5 100644 --- a/plugins/perl/perl.plugin.zsh +++ b/plugins/perl/perl.plugin.zsh @@ -1,3 +1,38 @@ +# For Perl older than 5.10.14, install local::lib. +# curl -L -C - -O http://search.cpan.org/CPAN/authors/id/A/AP/APEIRON/local-lib-1.008004.tar.gz +# tar xvf local-lib-1.008004.tar.gz +# cd local-lib-1.008004 +# perl Makefile.PL --bootstrap=$HOME/Library/Perl/5.12 +# make && make test && make install +# +# Install cpanminus: +# curl -L http://cpanmin.us | perl - --self-upgrade +# +if [[ "$OSTYPE" == darwin* ]]; then + # Perl is slow; cache its output. + cache_file="${0:h}/cache.zsh" + perl_path="$HOME/Library/Perl/5.12" + if [[ -f "$perl_path/lib/perl5/local/lib.pm" ]]; then + export MANPATH="$perl_path/man:$MANPATH" + if [[ ! -f "$cache_file" ]]; then + perl -I$perl_path/lib/perl5 -Mlocal::lib=$perl_path >! "$cache_file" + source "$cache_file" + else + source "$cache_file" + fi + fi + unset perl_path + unset cache_file +fi + +# Set environment variables for launchd processes. +if [[ "$OSTYPE" == darwin* ]]; then + for env_var in PERL_LOCAL_LIB_ROOT PERL_MB_OPT PERL_MM_OPT PERL5LIB; do + launchctl setenv "$env_var" "${(P)env_var}" &! + done + unset env_var +fi + # Aliases alias pbi='perlbrew install' alias pbl='perlbrew list' From 422307c3cae7651958ba9385b1767dfdbbc75543 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sun, 28 Aug 2011 15:33:58 -0400 Subject: [PATCH 501/614] Ignore plugin cache files. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 5d74a078a..fb1de5bb1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.zwc *.zwc.old +plugins/*/cache.zsh From 90e7debc30134f863f739e32cd0d9f45a66747ad Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Tue, 30 Aug 2011 23:16:15 -0400 Subject: [PATCH 502/614] Cleaned up the plugins. --- plugins/ant/ant.plugin.zsh | 19 +- .../apache2-macports.plugin.zsh | 6 - plugins/archive/_extract | 1 + plugins/archive/_ls-archive | 1 + plugins/archlinux/archlinux.plugin.zsh | 76 ----- plugins/autojump/autojump.plugin.zsh | 9 +- plugins/brew/.gitignore | 1 + plugins/brew/_brew | 80 ----- plugins/brew/brew.plugin.zsh | 18 ++ plugins/bundler/bundler.plugin.zsh | 45 +-- plugins/cake/cake.plugin.zsh | 45 +-- plugins/cap/cap.plugin.zsh | 21 -- plugins/capistrano/_cap | 20 ++ plugins/chef/_knife | 191 ++++++++++++ plugins/cloudapp/cloudapp.plugin.zsh | 2 - plugins/cloudapp/cloudapp.rb | 60 ---- .../command-not-found.plugin.zsh | 11 +- plugins/deb/deb.plugin.zsh | 13 - plugins/debian/debian.plugin.zsh | 60 ---- plugins/dirpersist/dirpersist.plugin.zsh | 39 --- plugins/django/django.plugin.zsh | 222 -------------- plugins/dpkg/dpkg.plugin.zsh | 49 +++ plugins/gas/_gas | 52 ++-- plugins/github/_github | 5 +- plugins/github/github.plugin.zsh | 12 +- plugins/gpg-agent/gpg-agent.plugin.zsh | 29 +- plugins/heroku/_heroku | 1 + plugins/history-substring-search/README | 1 + .../history-substring-search.plugin.zsh | 1 + .../history-substring-search.zsh | 175 +++-------- plugins/kate/kate.plugin.zsh | 14 +- plugins/knife/_knife | 174 ----------- plugins/lein/lein.plugin.zsh | 27 -- plugins/leiningen/leiningen.plugin.zsh | 28 ++ plugins/lighthouse/lighthouse.plugin.zsh | 16 - plugins/lol/lol.plugin.zsh | 26 -- plugins/macports/macports.plugin.zsh | 2 +- .../mysql-macports/mysql-macports.plugin.zsh | 8 - plugins/node/node.plugin.zsh | 2 +- plugins/osx/_man-preview | 1 + plugins/pacman/pacman.plugin.zsh | 82 +++++ plugins/phing/phing.plugin.zsh | 10 +- plugins/pow/_pow | 20 ++ plugins/pow/pow.plugin.zsh | 81 ++++- plugins/powder/_powder | 1 + plugins/rails/rails.plugin.zsh | 27 +- plugins/rails3/rails3.plugin.zsh | 19 -- plugins/{redis-cli => redis}/_redis-cli | 3 +- plugins/rsync/rsync.plugin.zsh | 10 + plugins/ruby/.gitignore | 1 + plugins/ruby/_gem | 16 +- plugins/ruby/ruby.plugin.zsh | 37 +++ plugins/rvm/_rvm | 147 --------- plugins/rvm/rvm.plugin.zsh | 53 ---- plugins/ssh-agent/ssh-agent.plugin.zsh | 56 ++-- plugins/svn/svn.plugin.zsh | 42 --- plugins/taskwarrior/.gitignore | 1 + plugins/taskwarrior/_task | 280 ------------------ plugins/taskwarrior/taskwarrior.plugin.zsh | 32 +- plugins/textmate/textmate.plugin.zsh | 7 +- plugins/thor/_thor | 1 + plugins/vagrant/_vagrant | 116 ++++---- plugins/wakeonlan/README | 30 ++ plugins/wakeonlan/_wake | 5 + plugins/wakeonlan/wakeonlan.plugin.zsh | 15 + plugins/yum/yum.plugin.zsh | 21 +- 66 files changed, 902 insertions(+), 1774 deletions(-) delete mode 100644 plugins/apache2-macports/apache2-macports.plugin.zsh delete mode 100644 plugins/archlinux/archlinux.plugin.zsh create mode 100644 plugins/brew/.gitignore delete mode 100644 plugins/brew/_brew delete mode 100644 plugins/cap/cap.plugin.zsh create mode 100644 plugins/capistrano/_cap create mode 100644 plugins/chef/_knife delete mode 100644 plugins/cloudapp/cloudapp.plugin.zsh delete mode 100755 plugins/cloudapp/cloudapp.rb delete mode 100644 plugins/deb/deb.plugin.zsh delete mode 100644 plugins/debian/debian.plugin.zsh delete mode 100644 plugins/dirpersist/dirpersist.plugin.zsh delete mode 100644 plugins/django/django.plugin.zsh create mode 100644 plugins/dpkg/dpkg.plugin.zsh delete mode 100644 plugins/knife/_knife delete mode 100644 plugins/lein/lein.plugin.zsh create mode 100644 plugins/leiningen/leiningen.plugin.zsh delete mode 100644 plugins/lighthouse/lighthouse.plugin.zsh delete mode 100644 plugins/lol/lol.plugin.zsh delete mode 100644 plugins/mysql-macports/mysql-macports.plugin.zsh create mode 100644 plugins/pacman/pacman.plugin.zsh create mode 100644 plugins/pow/_pow delete mode 100644 plugins/rails3/rails3.plugin.zsh rename plugins/{redis-cli => redis}/_redis-cli (99%) create mode 100644 plugins/rsync/rsync.plugin.zsh create mode 100644 plugins/ruby/.gitignore delete mode 100644 plugins/rvm/_rvm delete mode 100644 plugins/rvm/rvm.plugin.zsh delete mode 100644 plugins/svn/svn.plugin.zsh create mode 100644 plugins/taskwarrior/.gitignore delete mode 100644 plugins/taskwarrior/_task create mode 100644 plugins/wakeonlan/README create mode 100644 plugins/wakeonlan/_wake create mode 100644 plugins/wakeonlan/wakeonlan.plugin.zsh diff --git a/plugins/ant/ant.plugin.zsh b/plugins/ant/ant.plugin.zsh index 691d4d2db..3bdde6b79 100644 --- a/plugins/ant/ant.plugin.zsh +++ b/plugins/ant/ant.plugin.zsh @@ -1,12 +1,12 @@ -stat -f%m . > /dev/null 2>&1 -if [ "$?" = 0 ]; then - stat_cmd=(stat -f%m) +if stat -f%m . &> /dev/null; then + stat_cmd=(stat -f%m) else - stat_cmd=(stat -L --format=%Y) + stat_cmd=(stat -L --format=%Y) fi -_ant_does_target_list_need_generating () { - if [ ! -f .ant_targets ]; then return 0; +function _ant_does_target_list_need_generating() { + if [[ ! -f .ant_targets ]]; then + return 0 else accurate=$($stat_cmd .ant_targets) changed=$($stat_cmd build.xml) @@ -14,13 +14,14 @@ _ant_does_target_list_need_generating () { fi } -_ant () { - if [ -f build.xml ]; then +function _ant() { + if [[ -f build.xml ]]; then if _ant_does_target_list_need_generating; then - sed -n '/ .ant_targets + sed -n '/ .ant_targets fi compadd `cat .ant_targets` fi } compdef _ant ant + diff --git a/plugins/apache2-macports/apache2-macports.plugin.zsh b/plugins/apache2-macports/apache2-macports.plugin.zsh deleted file mode 100644 index 1caa4cf9d..000000000 --- a/plugins/apache2-macports/apache2-macports.plugin.zsh +++ /dev/null @@ -1,6 +0,0 @@ -# commands to control local apache2 server installation -# paths are for osx installation via macports - -alias apache2start='sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper start' -alias apache2stop='sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper stop' -alias apache2restart='sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper restart' diff --git a/plugins/archive/_extract b/plugins/archive/_extract index 30ca9292a..5756cd7f0 100644 --- a/plugins/archive/_extract +++ b/plugins/archive/_extract @@ -4,3 +4,4 @@ _arguments \ '(-r --remove)'{-r,--remove}'[Remove archive.]' \ "*::archive file:_files -g '(#i)*.(tar|tgz|tbz|tbz2|txz|tlz|gz|bz2|xz|lzma|Z|zip|rar|7z|deb)(-.)'" && return 0 + diff --git a/plugins/archive/_ls-archive b/plugins/archive/_ls-archive index 591aeec69..370d37b91 100644 --- a/plugins/archive/_ls-archive +++ b/plugins/archive/_ls-archive @@ -4,3 +4,4 @@ _arguments \ '(-v --verbose)'{-v,--remove}'[Verbose archive listing.]' \ "*::archive file:_files -g '(#i)*.(tar|tgz|tbz|tbz2|txz|tlz|gz|bz2|xz|lzma|Z|zip|rar|7z)(-.)'" && return 0 + diff --git a/plugins/archlinux/archlinux.plugin.zsh b/plugins/archlinux/archlinux.plugin.zsh deleted file mode 100644 index b5e519036..000000000 --- a/plugins/archlinux/archlinux.plugin.zsh +++ /dev/null @@ -1,76 +0,0 @@ -# Archlinux zsh aliases and functions -# Usage is also described at https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins - -# Look for yaourt, and add some useful functions if we have it. -if [[ -x `which yaourt` ]]; then - upgrade () { - yaourt -Syu - } - alias yaconf='yaourt -C' # Fix all configuration files with vimdiff - # Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips - alias yaupg='yaourt -Syu' # Synchronize with repositories before upgrading packages that are out of date on the local system. - alias yain='yaourt -S' # Install specific package(s) from the repositories - alias yains='yaourt -U' # Install specific package not from the repositories but from a file - alias yare='yaourt -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies - alias yarem='yaourt -Rns' # Remove the specified package(s), its configuration(s) and unneeded dependencies - alias yarep='yaourt -Si' # Display information about a given package in the repositories - alias yareps='yaourt -Ss' # Search for package(s) in the repositories - alias yaloc='yaourt -Qi' # Display information about a given package in the local database - alias yalocs='yaourt -Qs' # Search for package(s) in the local database - # Additional yaourt alias examples - if [[ -x `which abs` ]]; then - alias yaupd='yaourt -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories - else - alias yaupd='yaourt -Sy' # Update and refresh the local package and ABS databases against repositories - fi - alias yainsd='yaourt -S --asdeps' # Install given package(s) as dependencies of another package - alias yamir='yaourt -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist -else - upgrade() { - sudo pacman -Syu - } -fi - -# Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips -alias pacupg='sudo pacman -Syu' # Synchronize with repositories before upgrading packages that are out of date on the local system. -alias pacin='sudo pacman -S' # Install specific package(s) from the repositories -alias pacins='sudo pacman -U' # Install specific package not from the repositories but from a file -alias pacre='sudo pacman -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies -alias pacrem='sudo pacman -Rns' # Remove the specified package(s), its configuration(s) and unneeded dependencies -alias pacrep='pacman -Si' # Display information about a given package in the repositories -alias pacreps='pacman -Ss' # Search for package(s) in the repositories -alias pacloc='pacman -Qi' # Display information about a given package in the local database -alias paclocs='pacman -Qs' # Search for package(s) in the local database -# Additional pacman alias examples -if [[ -x `which abs` ]]; then - alias pacupd='sudo pacman -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories -else - alias pacupd='sudo pacman -Sy' # Update and refresh the local package and ABS databases against repositories -fi -alias pacinsd='sudo pacman -S --asdeps' # Install given package(s) as dependencies of another package -alias pacmir='sudo pacman -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist - -# https://bbs.archlinux.org/viewtopic.php?id=93683 -paclist() { - sudo pacman -Qei $(pacman -Qu|cut -d" " -f 1)|awk ' BEGIN {FS=":"}/^Name/{printf("\033[1;36m%s\033[1;37m", $2)}/^Description/{print $2}' -} - -alias paclsorphans='sudo pacman -Qdt' -alias pacrmorphans='sudo pacman -Rs $(pacman -Qtdq)' - -pacdisowned() { - tmp=${TMPDIR-/tmp}/pacman-disowned-$UID-$$ - db=$tmp/db - fs=$tmp/fs - - mkdir "$tmp" - trap 'rm -rf "$tmp"' EXIT - - pacman -Qlq | sort -u > "$db" - - find /bin /etc /lib /sbin /usr \ - ! -name lost+found \ - \( -type d -printf '%p/\n' -o -print \) | sort > "$fs" - - comm -23 "$fs" "$db" -} diff --git a/plugins/autojump/autojump.plugin.zsh b/plugins/autojump/autojump.plugin.zsh index da0a12765..aee4b6457 100644 --- a/plugins/autojump/autojump.plugin.zsh +++ b/plugins/autojump/autojump.plugin.zsh @@ -1,3 +1,8 @@ -if [ -f `brew --prefix`/etc/autojump ]; then - . `brew --prefix`/etc/autojump +if [[ -f /etc/profile.d/autojump.zsh ]]; then + source /etc/profile.d/autojump.zsh +elif [[ -f /opt/local/etc/profile.d/autojump.zsh ]]; then + source /opt/local/etc/profile.d/autojump.zsh +elif [[ -f "$(brew --prefix 2> /dev/null)/etc/autojump.zsh" ]]; then + source "$(brew --prefix)/etc/autojump.zsh" fi + diff --git a/plugins/brew/.gitignore b/plugins/brew/.gitignore new file mode 100644 index 000000000..d5e2d21bb --- /dev/null +++ b/plugins/brew/.gitignore @@ -0,0 +1 @@ +_brew diff --git a/plugins/brew/_brew b/plugins/brew/_brew deleted file mode 100644 index 1dcf0a4bf..000000000 --- a/plugins/brew/_brew +++ /dev/null @@ -1,80 +0,0 @@ -#compdef brew -#autoload - -# imported from the latest homebrew contributions - -_brew_all_formulae() { - formulae=(`brew search`) -} - -_brew_installed_formulae() { - installed_formulae=(`brew list`) -} - -local -a _1st_arguments -_1st_arguments=( - 'cat:display formula file for a formula' - 'cleanup:uninstall unused and old versions of packages' - 'create:create a new formula' - 'deps:list dependencies and dependants of a formula' - 'doctor:audits your installation for common issues' - 'edit:edit a formula' - 'home:visit the homepage of a formula or the brew project' - 'info:information about a formula' - 'install:install a formula' - 'link:link a formula' - 'list:list files in a formula or not-installed formulae' - 'log:git commit log for a formula' - 'missing:check all installed formuale for missing dependencies.' - 'outdated:list formulas for which a newer version is available' - 'prune:remove dead links' - 'remove:remove a formula' - 'search:search for a formula (/regex/ or string)' - 'server:start a local web app that lets you browse formulae (requires Sinatra)' - 'unlink:unlink a formula' - 'update:freshen up links' - 'upgrade:upgrade outdated formulae' - 'uses:show formulas which depend on a formula' -) - -local expl -local -a formulae installed_formulae - -_arguments \ - '(-v)-v[verbose]' \ - '(--cellar)--cellar[brew cellar]' \ - '(--config)--config[brew configuration]' \ - '(--env)--env[brew environment]' \ - '(--repository)--repository[brew repository]' \ - '(--version)--version[version information]' \ - '(--prefix)--prefix[where brew lives on this system]' \ - '(--cache)--cache[brew cache]' \ - '*:: :->subcmds' && return 0 - -if (( CURRENT == 1 )); then - _describe -t commands "brew subcommand" _1st_arguments - return -fi - -case "$words[1]" in - search|-S) - _arguments \ - '(--macports)--macports[search the macports repository]' \ - '(--fink)--fink[search the fink repository]' ;; - list|ls) - _arguments \ - '(--unbrewed)--unbrewed[files in brew --prefix not controlled by brew]' \ - '(--versions)--versions[list all installed versions of a formula]' \ - '1: :->forms' && return 0 - - if [[ "$state" == forms ]]; then - _brew_installed_formulae - _wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae - fi ;; - install|home|homepage|log|info|abv|uses|cat|deps|edit|options) - _brew_all_formulae - _wanted formulae expl 'all formulae' compadd -a formulae ;; - remove|rm|uninstall|unlink|cleanup|link|ln) - _brew_installed_formulae - _wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae ;; -esac diff --git a/plugins/brew/brew.plugin.zsh b/plugins/brew/brew.plugin.zsh index c2e95884e..a2f63cefb 100644 --- a/plugins/brew/brew.plugin.zsh +++ b/plugins/brew/brew.plugin.zsh @@ -1 +1,19 @@ +# Complete brew. +completion_file="${0:h}/_brew" +if [[ ! -e "$completion_file" ]]; then + if [[ -L "$completion_file" ]]; then + unlink "$completion_file" 2> /dev/null + fi + + if (( $+commands[brew] )); then + ln -s \ + "$(brew --prefix)/Library/Contributions/brew_zsh_completion.zsh" \ + "$completion_file" \ + 2> /dev/null + fi +fi +unset completion_file + +# Aliases alias brews='brew list -1' + diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index a6c116407..cb3841562 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -1,37 +1,10 @@ -alias be="bundle exec" -alias bi="bundle install" -alias bl="bundle list" -alias bu="bundle update" -alias bp="bundle package" +# Aliases +alias b='bundle' +alias be='b exec' +alias bi='b install --path vendor' +alias bl='b list' +alias bo='b open' +alias bp='b package' +alias bu='b update' +alias binit="bi && b package && echo '\nvendor/ruby' >>! .gitignore" -# 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) - -## Functions - -_bundler-installed() { - which bundle > /dev/null 2>&1 -} - -_within-bundled-project() { - local check_dir=$PWD - while [ "$(dirname $check_dir)" != "/" ]; do - [ -f "$check_dir/Gemfile" ] && return - check_dir="$(dirname $check_dir)" - done - false -} - -_run-with-bundler() { - if _bundler-installed && _within-bundled-project; then - bundle exec $@ - else - $@ - fi -} - -## Main program -for cmd in $bundled_commands; do - alias $cmd="_run-with-bundler $cmd" -done diff --git a/plugins/cake/cake.plugin.zsh b/plugins/cake/cake.plugin.zsh index f968c71d5..590183402 100644 --- a/plugins/cake/cake.plugin.zsh +++ b/plugins/cake/cake.plugin.zsh @@ -1,32 +1,33 @@ -# Set this to 1 if you want to cache the tasks +# Set this to 1 if you want to cache the tasks. cache_task_list=1 -# Cache filename +# Cache filename. cache_file='.cake_task_cache' -_cake_does_target_list_need_generating () { +function _cake_does_target_list_need_generating() { + if [[ $cache_task_list -eq 0 ]]; then + return 1 + fi - if [ $cache_task_list -eq 0 ]; then - return 1; - fi - - if [ ! -f $cache_file ]; then return 0; - else - accurate=$(stat -f%m $cache_file) - changed=$(stat -f%m Cakefile) - return $(expr $accurate '>=' $changed) - fi + if [[ ! -f $cache_file ]]; then + return 0 + else + accurate=$(stat -f%m $cache_file) + changed=$(stat -f%m Cakefile) + return $(expr $accurate '>=' $changed) + fi } -_cake () { - if [ -f Cakefile ]; then - if _cake_does_target_list_need_generating; then - cake | sed -e "s/cake \([^ ]*\) .*/\1/" | grep -v '^$' > $cache_file - compadd `cat $cache_file` - else - compadd `cake | sed -e "s/cake \([^ ]*\) .*/\1/" | grep -v '^$'` - fi - fi +function _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` + else + compadd `cake | sed -e "s/cake \([^ ]*\) .*/\1/" | grep -v '^$'` + fi + fi } compdef _cake cake + diff --git a/plugins/cap/cap.plugin.zsh b/plugins/cap/cap.plugin.zsh deleted file mode 100644 index 8336182d5..000000000 --- a/plugins/cap/cap.plugin.zsh +++ /dev/null @@ -1,21 +0,0 @@ -function _cap_does_task_list_need_generating () { - if [ ! -f .cap_tasks~ ]; then return 0; - else - accurate=$(stat -f%m .cap_tasks~) - changed=$(stat -f%m config/deploy.rb) - return $(expr $accurate '>=' $changed) - fi -} - -function _cap () { - if [ -f config/deploy.rb ]; then - if _cap_does_task_list_need_generating; then - echo "\nGenerating .cap_tasks~..." > /dev/stderr - cap show_tasks -q | cut -d " " -f 1 | sed -e '/^ *$/D' -e '1,2D' -> .cap_tasks~ - fi - compadd `cat .cap_tasks~` - fi -} - -compctl -K _cap cap diff --git a/plugins/capistrano/_cap b/plugins/capistrano/_cap new file mode 100644 index 000000000..afbdb431c --- /dev/null +++ b/plugins/capistrano/_cap @@ -0,0 +1,20 @@ +#compdef cap +#autoload + +function _cap-does-task-list-need-generating() { + if [[ ! -f .cap_tasks~ ]]; then return 0; + else + accurate=$(stat -f%m .cap_tasks~) + changed=$(stat -f%m config/deploy.rb) + return $(expr $accurate '>=' $changed) + fi +} + +if [[ -f config/deploy.rb ]]; then + if _cap-does-task-list-need-generating; then + echo "\nGenerating .cap_tasks~..." > /dev/stderr + cap --tasks | grep '#' | cut -d " " -f 2 > .cap_tasks~ + fi + compadd $(cat .cap_tasks~) +fi + diff --git a/plugins/chef/_knife b/plugins/chef/_knife new file mode 100644 index 000000000..94d9cff24 --- /dev/null +++ b/plugins/chef/_knife @@ -0,0 +1,191 @@ +#compdef knife + +# These flags should be available everywhere according to the knife man page. +knife_general_flags=( + --help + --server-url + --key + --config + --editor + --format + --log_level + --logfile + --no-editor + --user + --print-after + --version + --yes +) + +# Knife has a very special syntax, some example calls are: +# knife status +# knife cookbook list +# knife role show ROLENAME +# knife data bag show DATABAGNAME +# knife role show ROLENAME --attribute ATTRIBUTENAME +# knife cookbook show COOKBOOKNAME COOKBOOKVERSION recipes + +# The -Q switch in compadd allows for completion of things like "data bag" without +# having to go through two rounds of completion and avoids ZSH inserting a '\' for +# escaping spaces. +function _knife() { + local curcontext="$curcontext" state line + typeset -A opt_args + cloudproviders=(bluebox ec2 rackspace slicehost terremark) + _arguments \ + '1: :->knifecmd'\ + '2: :->knifesubcmd'\ + '3: :->knifesubcmd2' \ + '4: :->knifesubcmd3' \ + '5: :->knifesubcmd4' \ + '6: :->knifesubcmd5' + + case $state in + (knifecmd) + compadd -Q "$@" bootstrap client configure cookbook "cookbook site" "data bag" exec index node recipe role search ssh status windows $cloudproviders + ;; + (knifesubcmd) + case $words[2] in + (bluebox|ec2|rackspace|slicehost|terremark) + compadd "$@" server images + ;; + (client) + compadd -Q "$@" "bulk delete" list create show delete edit reregister + ;; + (configure) + compadd "$@" client + ;; + (cookbook) + compadd -Q "$@" test list create download delete "metadata from" show "bulk delete" metadata upload + ;; + (node) + compadd -Q "$@" "from file" create show edit delete list run_list "bulk delete" + ;; + (recipe) + compadd "$@" list + ;; + (role) + compadd -Q "$@" "bulk delete" create delete edit "from file" list show + ;; + (windows) + compadd "$@" bootstrap + ;; + (*) + _arguments '2:Subsubcommands:($(_knife_options1))' + esac + ;; + (knifesubcmd2) + case $words[3] in + (server) + compadd "$@" list create delete + ;; + (images) + compadd "$@" list + ;; + (site) + compadd "$@" vendor show share search download list unshare + ;; + (show|delete|edit) + _arguments '3:Subsubcommands:($(_chef_$words[2]s_remote))' + ;; + (upload|test) + _arguments '3:Subsubcommands:($(_chef_$words[2]s_local) --all)' + ;; + (list) + compadd -a "$@" knife_general_flags + ;; + (bag) + compadd -Q "$@" show edit list "from file" create delete + ;; + (*) + _arguments '3:Subsubcommands:($(_knife_options2))' + esac + ;; + (knifesubcmd3) + case $words[3] in + (show) + case $words[2] in + (cookbook) + versioncomp=1 + _arguments '4:Cookbookversions:($(_cookbook_versions) latest)' + ;; + (node|client|role) + compadd "$@" --attribute + esac + esac + case $words[4] in + (show|edit) + _arguments '4:Subsubsubcommands:($(_chef_$words[2]_$words[3]s_remote))' + ;; + (file) + _arguments '*:file or directory:_files -g "*.(rb|json)"' + ;; + (list) + compadd -a "$@" knife_general_flags + ;; + (*) + _arguments '*:Subsubcommands:($(_knife_options3))' + esac + ;; + (knifesubcmd4) + if (( versioncomp > 0 )); then + compadd "$@" attributes definitions files libraries providers recipes resources templates + else + _arguments '*:Subsubcommands:($(_knife_options2))' + fi + ;; + (knifesubcmd5) + _arguments '*:Subsubcommands:($(_knife_options3))' + esac +} + +# Helper functions to provide the argument completion for several depths of commands +function _knife_options1() { + ( for line in $( knife $words[2] --help | grep -v "^knife" ); do echo $line | grep "\-\-"; done ) +} + +function _knife_options2() { + ( for line in $( knife $words[2] $words[3] --help | grep -v "^knife" ); do echo $line | grep "\-\-"; done ) +} + +function _knife_options3() { + ( for line in $( knife $words[2] $words[3] $words[4] --help | grep -v "^knife" ); do echo $line | grep "\-\-"; done ) +} + +# The chef_x_remote functions use knife to get a list of objects of type x on the server +function _chef_roles_remote() { + (knife role list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') +} + +function _chef_clients_remote() { + (knife client list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') +} + +function _chef_nodes_remote() { + (knife node list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') +} + +function _chef_cookbooks_remote() { + (knife cookbook list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') +} + +function _chef_sitecookbooks_remote() { + (knife cookbook site list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') +} + +function _chef_data_bags_remote() { + (knife data bag list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') +} + +# The chef_x_local functions use the knife config to find the paths of relevant objects x to be uploaded to the server +function _chef_cookbooks_local() { + (for i in $( grep cookbook_path $HOME/.chef/knife.rb | awk 'BEGIN {FS = "[" }; {print $2}' | sed 's/\,//g' | sed "s/'//g" | sed 's/\(.*\)]/\1/' ); do ls $i; done) +} + +# This function extracts the available cookbook versions on the chef server +function _cookbook_versions() { + (knife cookbook show $words[4] | grep -v $words[4] | grep -v -E '\]|\[|\{|\}' | sed 's/ //g' | sed 's/"//g') +} + +function _knife "$@" + diff --git a/plugins/cloudapp/cloudapp.plugin.zsh b/plugins/cloudapp/cloudapp.plugin.zsh deleted file mode 100644 index 859c84ec6..000000000 --- a/plugins/cloudapp/cloudapp.plugin.zsh +++ /dev/null @@ -1,2 +0,0 @@ -alias cloudapp="${0:r:r}.rb" - diff --git a/plugins/cloudapp/cloudapp.rb b/plugins/cloudapp/cloudapp.rb deleted file mode 100755 index a11cfdb32..000000000 --- a/plugins/cloudapp/cloudapp.rb +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/env ruby -# -# cloudapp -# Zach Holman / @holman -# -# Uploads a file from the command line to CloudApp, drops it into your -# clipboard (on a Mac, at least). -# -# Example: -# -# cloudapp drunk-blake.png -# -# This requires Aaron Russell's cloudapp_api gem: -# -# gem install cloudapp_api -# -# Requires you set your CloudApp credentials in ~/.cloudapp as a simple file of: -# -# email -# password - -require 'rubygems' -begin - require 'cloudapp_api' -rescue LoadError - puts "You need to install cloudapp_api: gem install cloudapp_api" - exit!(1) -end - -config_file = "#{ENV['HOME']}/.cloudapp" -unless File.exist?(config_file) - puts "You need to type your email and password (one per line) into "+ - "`~/.cloudapp`" - exit!(1) -end - -email,password = File.read(config_file).split("\n") - -class HTTParty::Response - # Apparently HTTPOK.ok? IS NOT OKAY WTFFFFFFFFFFUUUUUUUUUUUUUU - # LETS MONKEY PATCH IT I FEEL OKAY ABOUT IT - def ok? ; true end -end - -if ARGV[0].nil? - puts "You need to specify a file to upload." - exit!(1) -end - -CloudApp.authenticate(email,password) -url = CloudApp::Item.create(:upload, {:file => ARGV[0]}).url - -# Say it for good measure. -puts "Uploaded to #{url}." - -# Get the embed link. -url = "#{url}/#{ARGV[0].split('/').last}" - -# Copy it to your (Mac's) clipboard. -`echo '#{url}' | tr -d "\n" | pbcopy` diff --git a/plugins/command-not-found/command-not-found.plugin.zsh b/plugins/command-not-found/command-not-found.plugin.zsh index 5ab03d5a9..b8f3fe9c9 100644 --- a/plugins/command-not-found/command-not-found.plugin.zsh +++ b/plugins/command-not-found/command-not-found.plugin.zsh @@ -1,5 +1,8 @@ -# Uses the command-not-found package zsh support -# as seen in http://www.porcheron.info/command-not-found-for-zsh/ -# this is installed in Ubuntu +# Uses the command-not-found package ZSH support as seen in +# http://www.porcheron.info/command-not-found-for-zsh/ and +# installed in Ubuntu. + +if [[ -f /etc/zsh_command_not_found ]]; then + source /etc/zsh_command_not_found +fi -source /etc/zsh_command_not_found 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 deleted file mode 100644 index f8865a412..000000000 --- a/plugins/debian/debian.plugin.zsh +++ /dev/null @@ -1,60 +0,0 @@ -# https://github.com/dbbolton/ -# -# Debian-related zsh aliases and functions for zsh - - -# Aliases ################################################################### - -# Some self-explanatory aliases -alias afs='apt-file search --regexp' -alias aps='aptitude search' -alias apsrc='apt-get source' -alias apv='apt-cache policy' - -alias apdg='su -c "aptitude update && aptitude safe-upgrade"' -alias apud='su -c "aptitude update"' -alias apug='su -c "aptitude safe-upgrade"' - -# 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 -c "dpkg -i ./*.deb"' - -# 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' - - - -# Functions ################################################################# - -# create a simple script that can be used to 'duplicate' a system -apt-copy() { - 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;') - - print 'aptitude install '"$list\n" >> apt-copy.sh - - chmod +x apt-copy.sh -} - - -# Kernel-package building shortcut -dbb-build () { - MAKEFLAGS='' # temporarily unset MAKEFLAGS ( '-j3' will fail ) - appendage='-custom' # this shows up in $ (uname -r ) - revision=$(date +"%Y%m%d") # this shows up in the .deb file name - - make-kpkg clean - - time fakeroot make-kpkg --append-to-version "$appendage" --revision \ - "$revision" kernel_image kernel_headers -} - - diff --git a/plugins/dirpersist/dirpersist.plugin.zsh b/plugins/dirpersist/dirpersist.plugin.zsh deleted file mode 100644 index baf21b1da..000000000 --- a/plugins/dirpersist/dirpersist.plugin.zsh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/zsh -# -# Make the dirstack more persistant -# -# Add dirpersist to $plugins in ~/.zshrc to load -# - -# $zdirstore is the file used to persist the stack -zdirstore=~/.zdirstore - -dirpersistinstall () { - if grep 'dirpersiststore' ~/.zlogout > /dev/null; then - else - if read -q \?"Would you like to set up your .zlogout file for use with dirspersist? (y/n) "; then - echo "# Store dirs stack\n# See ~/.oh-my-zsh/plugins/dirspersist.plugin.zsh\ndirpersiststore" >> ~/.zlogout - else - echo "If you don't want this message to appear, remove dirspersist from \$plugins" - fi - fi -} - -dirpersiststore () { - dirs -p | perl -e 'foreach (reverse ) {chomp;s/([& ])/\\$1/g ;print "if [ -d $_ ]; then pushd -q $_; fi\n"}' > $zdirstore -} - -dirpersistrestore () { - if [ -f $zdirstore ]; then - source $zdirstore - fi -} - -DIRSTACKSIZE=10 -setopt autopushd pushdminus pushdsilent pushdtohome pushdignoredups - -dirpersistinstall -dirpersistrestore - -# Make popd changes permanent without having to wait for logout -alias popd="popd;dirpersiststore" diff --git a/plugins/django/django.plugin.zsh b/plugins/django/django.plugin.zsh deleted file mode 100644 index 1d72a2f2c..000000000 --- a/plugins/django/django.plugin.zsh +++ /dev/null @@ -1,222 +0,0 @@ -#compdef manage.py - -typeset -ga nul_args -nul_args=( - '--settings=-[the Python path to a settings module.]:file:_files' - '--pythonpath=-[a directory to add to the Python path.]::directory:_directories' - '--traceback[print traceback on exception.]' - "--version[show program's version number and exit.]" - {-h,--help}'[show this help message and exit.]' -) - -_managepy-adminindex(){ - _arguments -s : \ - $nul_args \ - '*::directory:_directories' && ret=0 -} - -_managepy-createcachetable(){ - _arguments -s : \ - $nul_args && ret=0 -} - -_managepy-dbshell(){ - _arguments -s : \ - $nul_args && ret=0 -} - -_managepy-diffsettings(){ - _arguments -s : \ - $nul_args && ret=0 -} - -_managepy-dumpdata(){ - _arguments -s : \ - '--format=-[specifies the output serialization format for fixtures.]:format:(json yaml xml)' \ - '--indent=-[specifies the indent level to use when pretty-printing output.]:' \ - $nul_args \ - '*::appname:_applist' && ret=0 -} - -_managepy-flush(){ - _arguments -s : \ - '--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' \ - '--noinput[tells Django to NOT prompt the user for input of any kind.]' \ - $nul_args && ret=0 -} - -_managepy-help(){ - _arguments -s : \ - '*:command:_managepy_cmds' \ - $nul_args && ret=0 -} - -_managepy_cmds(){ - local line - local -a cmd - _call_program help-command ./manage.py help \ - |& sed -n '/^ /s/[(), ]/ /gp' \ - | while read -A line; do cmd=($line $cmd) done - _describe -t managepy-command 'manage.py command' cmd -} - -_managepy-inspectdb(){ - _arguments -s : \ - $nul_args && ret=0 -} - -_managepy-loaddata(){ - _arguments -s : \ - '--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' \ - '*::file:_files' \ - $nul_args && ret=0 -} - -_managepy-reset(){ - _arguments -s : \ - '--noinput[tells Django to NOT prompt the user for input of any kind.]' \ - '*::appname:_applist' \ - $nul_args && ret=0 -} - -_managepy-runfcgi(){ - local state - - local fcgi_opts - fcgi_opts=( - 'protocol[fcgi, scgi, ajp, ... (default fcgi)]:protocol:(fcgi scgi ajp)' - 'host[hostname to listen on..]:' - 'port[port to listen on.]:' - 'socket[UNIX socket to listen on.]::file:_files' - 'method[prefork or threaded (default prefork)]:method:(prefork threaded)' - 'maxrequests[number of requests a child handles before it is killed and a new child is forked (0 = no limit).]:' - 'maxspare[max number of spare processes / threads.]:' - 'minspare[min number of spare processes / threads.]:' - 'maxchildren[hard limit number of processes / threads.]:' - 'daemonize[whether to detach from terminal.]:boolean:(False True)' - 'pidfile[write the spawned process-id to this file.]:file:_files' - 'workdir[change to this directory when daemonizing.]:directory:_files' - 'outlog[write stdout to this file.]:file:_files' - 'errlog[write stderr to this file.]:file:_files' - ) - - _arguments -s : \ - $nul_args \ - '*: :_values "FCGI Setting" $fcgi_opts' && ret=0 -} - -_managepy-runserver(){ - _arguments -s : \ - '--noreload[tells Django to NOT use the auto-reloader.]' \ - '--adminmedia[specifies the directory from which to serve admin media.]:directory:_files' \ - $nul_args && ret=0 -} - -_managepy-shell(){ - _arguments -s : \ - '--plain[tells Django to use plain Python, not IPython.]' \ - $nul_args && ret=0 -} - -_managepy-sql(){} -_managepy-sqlall(){} -_managepy-sqlclear(){} -_managepy-sqlcustom(){} -_managepy-sqlflush(){} -_managepy-sqlindexes(){} -_managepy-sqlinitialdata(){} -_managepy-sqlreset(){} -_managepy-sqlsequencereset(){} -_managepy-startapp(){} - -_managepy-syncdb() { - _arguments -s : \ - '--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' \ - '--noinput[tells Django to NOT prompt the user for input of any kind.]' \ - $nul_args && ret=0 -} - -_managepy-test() { - _arguments -s : \ - '--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' \ - '--noinput[tells Django to NOT prompt the user for input of any kind.]' \ - '*::appname:_applist' \ - $nul_args && ret=0 -} - -_managepy-testserver() { - _arguments -s : \ - '--verbosity=-[verbosity level; 0=minimal output, 1=normal output, 2=all output.]:Verbosity:((0\:minimal 1\:normal 2\:all))' \ - '--addrport=-[port number or ipaddr:port to run the server on.]' \ - '*::fixture:_files' \ - $nul_args && ret=0 -} - -_managepy-validate() { - _arguments -s : \ - $nul_args && ret=0 -} - -_managepy-commands() { - local -a commands - - commands=( - 'adminindex:prints the admin-index template snippet for the given app name(s).' - 'createcachetable:creates the table needed to use the SQL cache backend.' - 'dbshell:runs the command-line client for the current DATABASE_ENGINE.' - "diffsettings:displays differences between the current settings.py and Django's default settings." - 'dumpdata:Output the contents of the database as a fixture of the given format.' - 'flush:Executes ``sqlflush`` on the current database.' - 'help:manage.py help.' - 'inspectdb:Introspects the database tables in the given database and outputs a Django model module.' - 'loaddata:Installs the named fixture(s) in the database.' - 'reset:Executes ``sqlreset`` for the given app(s) in the current database.' - 'runfcgi:Run this project as a fastcgi (or some other protocol supported by flup) application,' - 'runserver:Starts a lightweight Web server for development.' - 'shell:Runs a Python interactive interpreter.' - 'sql:Prints the CREATE TABLE SQL statements for the given app name(s).' - 'sqlall:Prints the CREATE TABLE, custom SQL and CREATE INDEX SQL statements for the given model module name(s).' - 'sqlclear:Prints the DROP TABLE SQL statements for the given app name(s).' - 'sqlcustom:Prints the custom table modifying SQL statements for the given app name(s).' - 'sqlflush:Returns a list of the SQL statements required to return all tables in the database to the state they were in just after they were installed.' - 'sqlindexes:Prints the CREATE INDEX SQL statements for the given model module name(s).' - "sqlinitialdata:RENAMED: see 'sqlcustom'" - 'sqlreset:Prints the DROP TABLE SQL, then the CREATE TABLE SQL, for the given app name(s).' - 'sqlsequencereset:Prints the SQL statements for resetting sequences for the given app name(s).' - "startapp:Creates a Django app directory structure for the given app name in this project's directory." - "syncdb:Create the database tables for all apps in INSTALLED_APPS whose tables haven't already been created." - 'test:Runs the test suite for the specified applications, or the entire site if no apps are specified.' - 'testserver:Runs a development server with data from the given fixture(s).' - 'validate:Validates all installed models.' - ) - - _describe -t commands 'manage.py command' commands && ret=0 -} - -_applist() { - local line - local -a apps - _call_program help-command "python -c \"import os.path as op, re, django.conf, sys;\\ - bn=op.basename(op.abspath(op.curdir));[sys\\ - .stdout.write(str(re.sub(r'^%s\.(.*?)$' % - bn, r'\1', i)) + '\n') for i in django.conf.settings.\\ - INSTALLED_APPS if re.match(r'^%s' % bn, i)]\"" \ - | while read -A line; do apps=($line $apps) done - _values 'Application' $apps && ret=0 -} - -_managepy() { - local curcontext=$curcontext ret=1 - - if ((CURRENT == 2)); then - _managepy-commands - else - shift words - (( CURRENT -- )) - curcontext="${curcontext%:*:*}:managepy-$words[1]:" - _call_function ret _managepy-$words[1] - fi -} - -compdef _managepy manage.py -compdef _managepy django diff --git a/plugins/dpkg/dpkg.plugin.zsh b/plugins/dpkg/dpkg.plugin.zsh new file mode 100644 index 000000000..0b6f440a3 --- /dev/null +++ b/plugins/dpkg/dpkg.plugin.zsh @@ -0,0 +1,49 @@ +# Debian ZSH Aliases and Functions + +# 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. +alias afs='apt-file search --regexp' # Find file's packake. + +# 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 debi='su -c "dpkg -i ./*.deb"' + +# Create a basic .deb package. +alias debc='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' + +# Functions + +# Create a simple script that can be used to 'duplicate' a system. +function apt-copy() { + 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;') + + print 'aptitude install '"$list\n" >> apt-copy.sh + + chmod +x apt-copy.sh +} + +# Kernel-package building shortcut. +function dbb-build() { + MAKEFLAGS='' # Temporarily unset MAKEFLAGS ( '-j3' will fail ). + appendage='-custom' # This shows up in $ (uname -r ). + revision=$(date +"%Y%m%d") # This shows up in the .deb file name. + + make-kpkg clean + + time fakeroot make-kpkg --append-to-version "$appendage" --revision \ + "$revision" kernel_image kernel_headers +} + diff --git a/plugins/gas/_gas b/plugins/gas/_gas index befdc9459..7b642a331 100644 --- a/plugins/gas/_gas +++ b/plugins/gas/_gas @@ -1,34 +1,36 @@ #compdef gas +#autoload local curcontext="$curcontext" state line cmds ret=1 _arguments -C \ - '(- 1 *)'{-v,--version}'[display version information]' \ - '(-h|--help)'{-h,--help}'[show help information]' \ - '1: :->cmds' \ - '*: :->args' && ret=0 + '(- 1 *)'{-v,--version}'[display version information]' \ + '(-h|--help)'{-h,--help}'[show help information]' \ + '1: :->cmds' \ + '*: :->args' && ret=0 -case $state in - cmds) - cmds=( - "version:Prints Gas's version" - "use:Uses author" - "show:Shows your current user" - "list:Lists your authors" - "import:Imports current user to gasconfig" - "help:Describe available tasks or one specific task" - "delete:Deletes author" - "add:Adds author to gasconfig" - ) - _describe -t commands 'gas command' cmds && ret=0 - ;; - args) - case $line[1] in - (use|delete) - _values -S , 'authors' $(cat ~/.gas | sed -n -e 's/^\[\(.*\)\]/\1/p') && ret=0 - ;; - esac - ;; +case "$state" in + (cmds) + cmds=( + "version:Prints Gas's version" + "use:Uses author" + "show:Shows your current user" + "list:Lists your authors" + "import:Imports current user to gasconfig" + "help:Describe available tasks or one specific task" + "delete:Deletes author" + "add:Adds author to gasconfig" + ) + _describe -t commands 'gas command' cmds && ret=0 + ;; + (args) + case "$line[1]" in + (use|delete) + _values -S , 'authors' $(cat ~/.gas | sed -n -e 's/^\[\(.*\)\]/\1/p') && ret=0 + ;; + esac + ;; esac return ret + diff --git a/plugins/github/_github b/plugins/github/_github index 83e1713c7..932ac5a6d 100644 --- a/plugins/github/_github +++ b/plugins/github/_github @@ -1,10 +1,10 @@ #compdef github #autoload -# in order to make this work, you will need to have the github gem installed +# The github-gem is neccessary for this completion to work. # http://github.com/defunkt/github-gem -# github zsh completion, based on homebrew completion +# This completion is based on the Homebrew completion. local -a _1st_arguments _1st_arguments=( @@ -38,3 +38,4 @@ if (( CURRENT == 1 )); then _describe -t commands "github subcommand" _1st_arguments return fi + diff --git a/plugins/github/github.plugin.zsh b/plugins/github/github.plugin.zsh index 1eb338113..3f327c3f3 100644 --- a/plugins/github/github.plugin.zsh +++ b/plugins/github/github.plugin.zsh @@ -1,6 +1,10 @@ -# hub alias from defunkt +# Aliases + +# Hub by defunkt # https://github.com/defunkt/hub -if [ "$commands[(I)hub]" ]; then - # eval `hub alias -s zsh` - function git(){hub "$@"} +if (( $+commands[hub] )); then + function git() { + hub "$@" + } fi + diff --git a/plugins/gpg-agent/gpg-agent.plugin.zsh b/plugins/gpg-agent/gpg-agent.plugin.zsh index 8cc71fd57..518a58ec5 100644 --- a/plugins/gpg-agent/gpg-agent.plugin.zsh +++ b/plugins/gpg-agent/gpg-agent.plugin.zsh @@ -1,21 +1,25 @@ -# Based on ssh-agent code +# Based on ssh-agent code. -local GPG_ENV=$HOME/.gnupg/gpg-agent.env +local GPG_ENV="$HOME/.gnupg/gpg-agent.env" -function start_agent { - /usr/bin/env gpg-agent --daemon --enable-ssh-support --write-env-file ${GPG_ENV} > /dev/null - chmod 600 ${GPG_ENV} - . ${GPG_ENV} > /dev/null +if (( ! $+commands[gpg-agent] )); then + return +fi + +function _gpg-agent-start() { + /usr/bin/env gpg-agent --daemon --enable-ssh-support --write-env-file "${GPG_ENV}" > /dev/null + chmod 600 "${GPG_ENV}" + source "${GPG_ENV}" > /dev/null } -# Source GPG agent settings, if applicable -if [ -f "${GPG_ENV}" ]; then - . ${GPG_ENV} > /dev/null - ps -ef | grep ${SSH_AGENT_PID} | grep gpg-agent > /dev/null || { - start_agent; +# Source GPG agent settings, if applicable. +if [[ -f "${GPG_ENV}" ]]; then + source "${GPG_ENV}" > /dev/null + ps -ef | grep "${SSH_AGENT_PID}" | grep gpg-agent > /dev/null || { + _gpg-agent-start; } else - start_agent; + _gpg-agent-start; fi export GPG_AGENT_INFO @@ -24,3 +28,4 @@ export SSH_AGENT_PID GPG_TTY=$(tty) export GPG_TTY + diff --git a/plugins/heroku/_heroku b/plugins/heroku/_heroku index dc899e2b2..f57d3d6a3 100644 --- a/plugins/heroku/_heroku +++ b/plugins/heroku/_heroku @@ -1,4 +1,5 @@ #compdef heroku +#autoload # Heroku Autocomplete plugin for Oh-My-Zsh # Requires: The Heroku client gem (https://github.com/heroku/heroku) diff --git a/plugins/history-substring-search/README b/plugins/history-substring-search/README index be11adf76..215677476 100644 --- a/plugins/history-substring-search/README +++ b/plugins/history-substring-search/README @@ -5,3 +5,4 @@ To activate this script, load it into an interactive ZSH session: See the "history-substring-search.zsh" file for more information: % sed -n '2,/^$/s/^#//p' history-substring-search.zsh | more + diff --git a/plugins/history-substring-search/history-substring-search.plugin.zsh b/plugins/history-substring-search/history-substring-search.plugin.zsh index 5d22b8a20..40687ff02 100644 --- a/plugins/history-substring-search/history-substring-search.plugin.zsh +++ b/plugins/history-substring-search/history-substring-search.plugin.zsh @@ -10,3 +10,4 @@ if test "$DISABLE_COLOR" = true; then unset HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND unset HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND fi + diff --git a/plugins/history-substring-search/history-substring-search.zsh b/plugins/history-substring-search/history-substring-search.zsh index 53f707c79..104045a20 100644 --- a/plugins/history-substring-search/history-substring-search.zsh +++ b/plugins/history-substring-search/history-substring-search.zsh @@ -1,95 +1,4 @@ #!/usr/bin/env zsh -# -# This is a clean-room implementation of the Fish[1] shell's history search -# feature, where you can type in any part of any previously entered command -# and press the UP and DOWN arrow keys to cycle through the matching commands. -# -#----------------------------------------------------------------------------- -# Usage -#----------------------------------------------------------------------------- -# -# 1. Load this script into your interactive ZSH session: -# -# % source history-substring-search.zsh -# -# If you want to use the zsh-syntax-highlighting[6] script along with this -# script, then make sure that you load it *before* you load this script: -# -# % source zsh-syntax-highlighting.zsh -# % source history-substring-search.zsh -# -# 2. Type any part of any previous command and then: -# -# * Press the UP arrow key to select the nearest command that (1) contains -# your query and (2) is older than the current command in the command -# history. -# -# * Press the DOWN arrow key to select the nearest command that (1) -# contains your query and (2) is newer than the current command in the -# command history. -# -# * Press ^U (the Control and U keys simultaneously) to abort the search. -# -# 3. If a matching command spans more than one line of text, press the LEFT -# arrow key to move the cursor away from the end of the command, and then: -# -# * Press the UP arrow key to move the cursor to the line above. When the -# cursor reaches the first line of the command, pressing the UP arrow -# key again will cause this script to perform another search. -# -# * Press the DOWN arrow key to move the cursor to the line below. When -# the cursor reaches the last line of the command, pressing the DOWN -# arrow key again will cause this script to perform another search. -# -#----------------------------------------------------------------------------- -# Configuration -#----------------------------------------------------------------------------- -# -# This script defines the following global variables. You may override their -# default values only after having loaded this script into your ZSH session. -# -# * HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND is a global variable that defines -# how the query should be highlighted inside a matching command. Its default -# value causes this script to highlight using bold, white text on a magenta -# background. See the "Character Highlighting" section in the zshzle(1) man -# page to learn about the kinds of values you may assign to this variable. -# -# * HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND is a global variable that -# defines how the query should be highlighted when no commands in the -# history match it. Its default value causes this script to highlight using -# bold, white text on a red background. See the "Character Highlighting" -# section in the zshzle(1) man page to learn about the kinds of values you -# may assign to this variable. -# -# * HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS is a global variable that defines -# how the command history will be searched for your query. Its default value -# causes this script to perform a case-insensitive search. See the "Globbing -# Flags" section in the zshexpn(1) man page to learn about the kinds of -# values you may assign to this variable. -# -#----------------------------------------------------------------------------- -# History -#----------------------------------------------------------------------------- -# -# This script was originally written by Peter Stephenson[2], who published it -# to the ZSH users mailing list (thereby making it public domain) in September -# 2009. It was later revised by Guido van Steen and released under the BSD -# license (see below) as part of the fizsh[3] project in January 2011. -# -# It was later extracted from fizsh[3] release 1.0.1, refactored heavily, and -# repackaged as both an oh-my-zsh plugin[4] and as an independently loadable -# ZSH script[5] by Suraj N. Kurapati in 2011. -# -# It was further developed[4] by Guido van Steen, Suraj N. Kurapati, Sorin -# Ionescu, and Vincent Guerci in 2011. -# -# [1]: http://fishshell.com -# [2]: http://www.zsh.org/mla/users/2009/msg00818.html -# [3]: http://sourceforge.net/projects/fizsh/ -# [4]: https://github.com/robbyrussell/oh-my-zsh/pull/215 -# [5]: https://github.com/sunaku/zsh-history-substring-search -# [6]: https://github.com/nicoulaj/zsh-syntax-highlighting -# ############################################################################## # # Copyright (c) 2009 Peter Stephenson @@ -170,7 +79,6 @@ bindkey '\e[B' history-substring-search-down # implementation details #----------------------------------------------------------------------------- -setopt extendedglob zmodload -F zsh/parameter # @@ -201,12 +109,9 @@ if [[ $+functions[_zsh_highlight] -eq 0 ]]; then zle -N self-insert ordinary-key-press # - # Override ZLE widgets to invoke _zsh_highlight() + # The following snippet was taken from the zsh-syntax-highlighting project: # - # https://github.com/nicoulaj/zsh-syntax-highlighting/blob/ - # bb7fcb79fad797a40077bebaf6f4e4a93c9d8163/zsh-syntax-highlighting.zsh#L121 - # - #--------------8<-------------------8<-------------------8<----------------- + # https://github.com/zsh-users/zsh-syntax-highlighting/blob/56b134f5d62ae3d4e66c7f52bd0cc2595f9b305b/zsh-syntax-highlighting.zsh#L126-161 # # Copyright (c) 2010-2011 zsh-syntax-highlighting contributors # All rights reserved. @@ -237,48 +142,52 @@ if [[ $+functions[_zsh_highlight] -eq 0 ]]; then # 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. + # + #--------------8<-------------------8<-------------------8<----------------- + # Rebind all ZLE widgets to make them invoke _zsh_highlights. + _zsh_highlight_bind_widgets() + { + # Load ZSH module zsh/zleparameter, needed to override user defined widgets. + zmodload zsh/zleparameter 2>/dev/null || { + echo 'zsh-syntax-highlighting: failed loading zsh/zleparameter.' >&2 + return 1 + } - # Load ZSH module zsh/zleparameter, needed to override user defined widgets. - zmodload zsh/zleparameter 2>/dev/null || { - echo 'zsh-syntax-highlighting: failed loading zsh/zleparameter, exiting.' >&2 - return -1 - } + # Override ZLE widgets to make them invoke _zsh_highlight. + local cur_widget + for cur_widget in ${${(f)"$(builtin zle -la)"}:#(.*|_*|orig-*|run-help|which-command|beep)}; do + case $widgets[$cur_widget] in - # Override ZLE widgets to make them invoke _zsh_highlight. - for event in ${${(f)"$(zle -la)"}:#(_*|orig-*|.run-help|.which-command)}; do - if [[ "$widgets[$event]" == completion:* ]]; then - eval "zle -C orig-$event ${${${widgets[$event]}#*:}/:/ } ; $event() { builtin zle orig-$event && _zsh_highlight } ; zle -N $event" - else - case $event in - accept-and-menu-complete) - eval "$event() { builtin zle .$event && _zsh_highlight } ; zle -N $event" - ;; + # Already rebound event: do nothing. + user:$cur_widget|user:_zsh_highlight_widget_*);; - # The following widgets should NOT remove any previously - # applied highlighting. Therefore we do not remap them. - .forward-char|.backward-char|.up-line-or-history|.down-line-or-history) - ;; + # User defined widget: override and rebind old one with prefix "orig-". + user:*) eval "zle -N orig-$cur_widget ${widgets[$cur_widget]#*:}; \ + _zsh_highlight_widget_$cur_widget() { builtin zle orig-$cur_widget -- \"\$@\" && _zsh_highlight }; \ + zle -N $cur_widget _zsh_highlight_widget_$cur_widget";; - .*) - clean_event=$event[2,${#event}] # Remove the leading dot in the event name - case ${widgets[$clean_event]-} in - (completion|user):*) - ;; - *) - eval "$clean_event() { builtin zle $event && _zsh_highlight } ; zle -N $clean_event" - ;; - esac - ;; - *) - ;; + # Completion widget: override and rebind old one with prefix "orig-". + completion:*) eval "zle -C orig-$cur_widget ${${widgets[$cur_widget]#*:}/:/ }; \ + _zsh_highlight_widget_$cur_widget() { builtin zle orig-$cur_widget -- \"\$@\" && _zsh_highlight }; \ + zle -N $cur_widget _zsh_highlight_widget_$cur_widget";; + + # Builtin widget: override and make it call the builtin ".widget". + builtin) eval "_zsh_highlight_widget_$cur_widget() { builtin zle .$cur_widget -- \"\$@\" && _zsh_highlight }; \ + zle -N $cur_widget _zsh_highlight_widget_$cur_widget";; + + # Default: unhandled case. + *) echo "zsh-syntax-highlighting: unhandled ZLE widget '$cur_widget'" >&2 ;; esac - fi - done - unset event clean_event + done + } #-------------->8------------------->8------------------->8----------------- + + _zsh_highlight_bind_widgets fi function _history-substring-search-begin() { + setopt localoptions extendedglob + _history_substring_search_move_cursor_eol=false _history_substring_search_query_highlight= @@ -345,6 +254,8 @@ function _history-substring-search-begin() { } function _history-substring-search-end() { + setopt localoptions extendedglob + _history_substring_search_result=$BUFFER # move the cursor to the end of the command line @@ -447,7 +358,7 @@ function _history-substring-search-up-history() { # going up from somewhere below the top of history else - zle up-history + zle up-line-or-history fi return true @@ -470,7 +381,7 @@ function _history-substring-search-down-history() { # going down from somewhere above the bottom of history else - zle down-history + zle down-line-or-history fi return true diff --git a/plugins/kate/kate.plugin.zsh b/plugins/kate/kate.plugin.zsh index eb16522ac..bacfcdce8 100644 --- a/plugins/kate/kate.plugin.zsh +++ b/plugins/kate/kate.plugin.zsh @@ -1,9 +1,9 @@ +# Aliases +alias kate='kate >/dev/null 2>&1' # Silent start. -# Kate -# Start kate always silent -alias kate='kate >/dev/null 2>&1' +# Functions +function kt() { + cd "$1" + kate "$1" +} -function kt () { - cd $1 - kate $1 -} \ No newline at end of file diff --git a/plugins/knife/_knife b/plugins/knife/_knife deleted file mode 100644 index 7f8c95ee5..000000000 --- a/plugins/knife/_knife +++ /dev/null @@ -1,174 +0,0 @@ -#compdef knife - -# These flags should be available everywhere according to man knife -knife_general_flags=( --help --server-url --key --config --editor --format --log_level --logfile --no-editor --user --print-after --version --yes ) - -# knife has a very special syntax, some example calls are: -# knife status -# knife cookbook list -# knife role show ROLENAME -# knife data bag show DATABAGNAME -# knife role show ROLENAME --attribute ATTRIBUTENAME -# knife cookbook show COOKBOOKNAME COOKBOOKVERSION recipes - -# The -Q switch in compadd allow for completions of things like "data bag" without having to go through two rounds of completion and avoids zsh inserting a \ for escaping spaces -_knife() { - local curcontext="$curcontext" state line - typeset -A opt_args - cloudproviders=(bluebox ec2 rackspace slicehost terremark) - _arguments \ - '1: :->knifecmd'\ - '2: :->knifesubcmd'\ - '3: :->knifesubcmd2' \ - '4: :->knifesubcmd3' \ - '5: :->knifesubcmd4' \ - '6: :->knifesubcmd5' - - case $state in - knifecmd) - compadd -Q "$@" bootstrap client configure cookbook "cookbook site" "data bag" exec index node recipe role search ssh status windows $cloudproviders - ;; - knifesubcmd) - case $words[2] in - (bluebox|ec2|rackspace|slicehost|terremark) - compadd "$@" server images - ;; - client) - compadd -Q "$@" "bulk delete" list create show delete edit reregister - ;; - configure) - compadd "$@" client - ;; - cookbook) - compadd -Q "$@" test list create download delete "metadata from" show "bulk delete" metadata upload - ;; - node) - compadd -Q "$@" "from file" create show edit delete list run_list "bulk delete" - ;; - recipe) - compadd "$@" list - ;; - role) - compadd -Q "$@" "bulk delete" create delete edit "from file" list show - ;; - windows) - compadd "$@" bootstrap - ;; - *) - _arguments '2:Subsubcommands:($(_knife_options1))' - esac - ;; - knifesubcmd2) - case $words[3] in - server) - compadd "$@" list create delete - ;; - images) - compadd "$@" list - ;; - site) - compadd "$@" vendor show share search download list unshare - ;; - (show|delete|edit) - _arguments '3:Subsubcommands:($(_chef_$words[2]s_remote))' - ;; - (upload|test) - _arguments '3:Subsubcommands:($(_chef_$words[2]s_local) --all)' - ;; - list) - compadd -a "$@" knife_general_flags - ;; - bag) - compadd -Q "$@" show edit list "from file" create delete - ;; - *) - _arguments '3:Subsubcommands:($(_knife_options2))' - esac - ;; - knifesubcmd3) - case $words[3] in - show) - case $words[2] in - cookbook) - versioncomp=1 - _arguments '4:Cookbookversions:($(_cookbook_versions) latest)' - ;; - (node|client|role) - compadd "$@" --attribute - esac - esac - case $words[4] in - (show|edit) - _arguments '4:Subsubsubcommands:($(_chef_$words[2]_$words[3]s_remote))' - ;; - file) - _arguments '*:file or directory:_files -g "*.(rb|json)"' - ;; - list) - compadd -a "$@" knife_general_flags - ;; - *) - _arguments '*:Subsubcommands:($(_knife_options3))' - esac - ;; - knifesubcmd4) - if (( versioncomp > 0 )); then - compadd "$@" attributes definitions files libraries providers recipes resources templates - else - _arguments '*:Subsubcommands:($(_knife_options2))' - fi - ;; - knifesubcmd5) - _arguments '*:Subsubcommands:($(_knife_options3))' - esac -} - -# Helper functions to provide the argument completion for several depths of commands -_knife_options1() { - ( for line in $( knife $words[2] --help | grep -v "^knife" ); do echo $line | grep "\-\-"; done ) -} - -_knife_options2() { - ( for line in $( knife $words[2] $words[3] --help | grep -v "^knife" ); do echo $line | grep "\-\-"; done ) -} - -_knife_options3() { - ( for line in $( knife $words[2] $words[3] $words[4] --help | grep -v "^knife" ); do echo $line | grep "\-\-"; done ) -} - -# The chef_x_remote functions use knife to get a list of objects of type x on the server -_chef_roles_remote() { - (knife role list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') -} - -_chef_clients_remote() { - (knife client list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') -} - -_chef_nodes_remote() { - (knife node list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') -} - -_chef_cookbooks_remote() { - (knife cookbook list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') -} - -_chef_sitecookbooks_remote() { - (knife cookbook site list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') -} - -_chef_data_bags_remote() { - (knife data bag list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') -} - -# The chef_x_local functions use the knife config to find the paths of relevant objects x to be uploaded to the server -_chef_cookbooks_local() { - (for i in $( grep cookbook_path $HOME/.chef/knife.rb | awk 'BEGIN {FS = "[" }; {print $2}' | sed 's/\,//g' | sed "s/'//g" | sed 's/\(.*\)]/\1/' ); do ls $i; done) -} - -# This function extracts the available cookbook versions on the chef server -_cookbook_versions() { - (knife cookbook show $words[4] | grep -v $words[4] | grep -v -E '\]|\[|\{|\}' | sed 's/ //g' | sed 's/"//g') -} - -_knife "$@" diff --git a/plugins/lein/lein.plugin.zsh b/plugins/lein/lein.plugin.zsh deleted file mode 100644 index 19af3556a..000000000 --- a/plugins/lein/lein.plugin.zsh +++ /dev/null @@ -1,27 +0,0 @@ -function _lein_commands() { - local ret=1 state - _arguments ':subcommand:->subcommand' && ret=0 - - case $state in - subcommand) - subcommands=( - "clean:remove compiled files and dependencies from project" - "compile:ahead-of-time compile the project" - "deps:download and install all dependencies" - "help:display a list of tasks or help for a given task" - "install:install the project and its dependencies in your local repository" - "jar:create a jar file containing the compiled .class files" - "new:create a new project skeleton" - "pom:write a pom.xml file to disk for maven interop" - "test:run the project's tests" - "uberjar:Create a jar including the contents of each of deps" - "upgrade:upgrade leiningen to the latest stable release" - "version:print leiningen's version" - ) - _describe -t subcommands 'leiningen subcommands' subcommands && ret=0 - esac - - return ret -} - -compdef _lein_commands lein diff --git a/plugins/leiningen/leiningen.plugin.zsh b/plugins/leiningen/leiningen.plugin.zsh new file mode 100644 index 000000000..ede545425 --- /dev/null +++ b/plugins/leiningen/leiningen.plugin.zsh @@ -0,0 +1,28 @@ +function _lein_commands() { + local ret=1 state + _arguments ':subcommand:->subcommand' && ret=0 + + case "$state" in + subcommand) + subcommands=( + "clean:remove compiled files and dependencies from project" + "compile:ahead-of-time compile the project" + "deps:download and install all dependencies" + "help:display a list of tasks or help for a given task" + "install:install the project and its dependencies in your local repository" + "jar:create a jar file containing the compiled .class files" + "new:create a new project skeleton" + "pom:write a pom.xml file to disk for maven interop" + "test:run the project's tests" + "uberjar:Create a jar including the contents of each of deps" + "upgrade:upgrade leiningen to the latest stable release" + "version:print leiningen's version" + ) + _describe -t subcommands 'leiningen subcommands' subcommands && ret=0 + esac + + return ret +} + +compdef _lein_commands lein + diff --git a/plugins/lighthouse/lighthouse.plugin.zsh b/plugins/lighthouse/lighthouse.plugin.zsh deleted file mode 100644 index 7661c6add..000000000 --- a/plugins/lighthouse/lighthouse.plugin.zsh +++ /dev/null @@ -1,16 +0,0 @@ -# To use: add a .lighthouse file into your directory with the URL to the -# individual project. For example: -# https://rails.lighthouseapp.com/projects/8994 -# Example usage: http://screencast.com/t/ZDgwNDUwNT -open_lighthouse_ticket () { - if [ ! -f .lighthouse-url ]; then - echo "There is no .lighthouse-url file in the current directory..." - return 0; - else - lighthouse_url=$(cat .lighthouse-url); - echo "Opening ticket #$1"; - `open $lighthouse_url/tickets/$1`; - fi -} - -alias lho='open_lighthouse_ticket' diff --git a/plugins/lol/lol.plugin.zsh b/plugins/lol/lol.plugin.zsh deleted file mode 100644 index a7153bb57..000000000 --- a/plugins/lol/lol.plugin.zsh +++ /dev/null @@ -1,26 +0,0 @@ -# LOL!!1 -# Source: http://aur.archlinux.org/packages/lolbash/lolbash/lolbash.sh - -alias wtf='dmesg' -alias onoz='cat /var/log/errors.log' -alias rtfm='man' - -alias visible='echo' -alias invisible='cat' -alias moar='more' - -alias icanhas='mkdir' -alias donotwant='rm' -alias dowant='cp' -alias gtfo='mv' - -alias hai='cd' -alias plz='pwd' - -alias inur='locate' - -alias nomz='ps -aux' -alias nomnom='killall' - -alias cya='reboot' -alias kthxbai='halt' diff --git a/plugins/macports/macports.plugin.zsh b/plugins/macports/macports.plugin.zsh index 277352e32..313686461 100644 --- a/plugins/macports/macports.plugin.zsh +++ b/plugins/macports/macports.plugin.zsh @@ -1,4 +1,4 @@ -#Aliases +# Aliases alias pc="sudo port clean --all installed" alias pi="sudo port install $1" alias psu="sudo port selfupdate" diff --git a/plugins/mysql-macports/mysql-macports.plugin.zsh b/plugins/mysql-macports/mysql-macports.plugin.zsh deleted file mode 100644 index c39563fe4..000000000 --- a/plugins/mysql-macports/mysql-macports.plugin.zsh +++ /dev/null @@ -1,8 +0,0 @@ -# commands to control local mysql-server installation -# paths are for osx installation via macports - -alias mysqlstart='sudo /opt/local/share/mysql5/mysql/mysql.server start' -alias mysqlstop='sudo /opt/local/share/mysql5/mysql/mysql.server stop' -alias mysqlrestart='sudo /opt/local/share/mysql5/mysql/mysql.server restart' - -alias mysqlstatus='mysqladmin5 -u root -p ping' diff --git a/plugins/node/node.plugin.zsh b/plugins/node/node.plugin.zsh index 442afa033..f7abed087 100644 --- a/plugins/node/node.plugin.zsh +++ b/plugins/node/node.plugin.zsh @@ -2,7 +2,7 @@ cache_file="${0:h}/cache.zsh" if [[ ! -f "$cache_file" ]] && (( $+commands[npm] )); then # npm is slow; cache its output. - npm completion >! "$cache_file" 2>/dev/null + npm completion >! "$cache_file" 2> /dev/null source "$cache_file" else source "$cache_file" diff --git a/plugins/osx/_man-preview b/plugins/osx/_man-preview index 698ae2656..6cc344ad4 100644 --- a/plugins/osx/_man-preview +++ b/plugins/osx/_man-preview @@ -2,3 +2,4 @@ #autoload _man + diff --git a/plugins/pacman/pacman.plugin.zsh b/plugins/pacman/pacman.plugin.zsh new file mode 100644 index 000000000..7dd0e840e --- /dev/null +++ b/plugins/pacman/pacman.plugin.zsh @@ -0,0 +1,82 @@ +# Archlinux ZSH Aliases and Functions +# +# Pacman Tips: +# https://wiki.archlinux.org/index.php/Pacman_Tips + +# Yaourt Aliases +if (( $+commands[yaourt] )); then + function arch-upgrade() { + yaourt -Syu + } + + alias yaconf='yaourt -C' # Fix all configuration files with vimdiff. + alias yaupg='yaourt -Syu' # Synchronize with repositories before upgrading packages that are out of date on the local system. + alias yain='yaourt -S' # Install specific package(s) from the repositories. + alias yains='yaourt -U' # Install specific package(s) not from the repositories but from a file . + alias yare='yaourt -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies. + alias yarem='yaourt -Rns' # Remove the specified package(s), its configuration(s) and unneeded dependencies. + alias yarep='yaourt -Si' # Display information about a given package in the repositories. + alias yareps='yaourt -Ss' # Search for package(s) in the repositories. + alias yaloc='yaourt -Qi' # Display information about a given package in the local database. + alias yalocs='yaourt -Qs' # Search for package(s) in the local database. + alias yamir='yaourt -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist + alias yainsd='yaourt -S --asdeps' # Install given package(s) as dependencies of another package + + # Update and refresh the local package and ABS databases against repositories. + if (( $+commands[abs] )); then + alias yaupd='yaourt -Sy && sudo abs' + else + alias yaupd='yaourt -Sy' + fi +else + function arch-upgrade() { + sudo pacman -Syu + } +fi + +# Pacman Aliaases +alias pacupg='sudo pacman -Syu' # Synchronize with repositories before upgrading packages that are out of date on the local system. +alias pacin='sudo pacman -S' # Install specific package(s) from the repositories. +alias pacins='sudo pacman -U' # Install specific package not from the repositories but from a file. +alias pacre='sudo pacman -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies. +alias pacrem='sudo pacman -Rns' # Remove the specified package(s), its configuration(s) and unneeded dependencies. +alias pacrep='pacman -Si' # Display information about a given package in the repositories. +alias pacreps='pacman -Ss' # Search for package(s) in the repositories. +alias pacloc='pacman -Qi' # Display information about a given package in the local database. +alias paclocs='pacman -Qs' # Search for package(s) in the local database. +alias pacinsd='sudo pacman -S --asdeps' # Install given package(s) as dependencies of another package. +alias pacmir='sudo pacman -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist. +alias paclsorphans='sudo pacman -Qdt' # List orphan packages(s). +alias pacrmorphans='sudo pacman -Rs $(pacman -Qtdq)' # Remove orphan package(s). + +# Update and refresh the local package and ABS databases against repositories. +if (( $+commands[abs] )); then + alias pacupd='sudo pacman -Sy && sudo abs' +else + alias pacupd='sudo pacman -Sy' +fi + +# List explicitly installed packages. +function paclist() { + sudo pacman -Qei $(pacman -Qu|cut -d" " -f 1) \ + | awk ' BEGIN {FS=":"}/^Name/{printf("\033[1;36m%s\033[1;37m", $2)}/^Description/{print $2}' +} + +# List disowned files. +function pacdisowned() { + tmp="${TMPDIR-/tmp}/pacman-disowned-$UID-$$" + db="$tmp/db" + fs="$tmp/fs" + + mkdir "$tmp" + trap 'rm -rf "$tmp"' EXIT + + pacman -Qlq | sort -u > "$db" + + find /bin /etc /lib /sbin /usr \ + ! -name lost+found \ + \( -type d -printf '%p/\n' -o -print \) | sort > "$fs" + + comm -23 "$fs" "$db" +} + diff --git a/plugins/phing/phing.plugin.zsh b/plugins/phing/phing.plugin.zsh index 8f4adca08..233352a5b 100644 --- a/plugins/phing/phing.plugin.zsh +++ b/plugins/phing/phing.plugin.zsh @@ -1,5 +1,6 @@ -_phing_does_target_list_need_generating () { - if [ ! -f .phing_targets ]; then return 0; +function _phing_does_target_list_need_generating() { + if [[ ! -f .phing_targets ]]; then + return 0 else accurate=$(stat -f%m .phing_targets) changed=$(stat -f%m build.xml) @@ -7,8 +8,8 @@ _phing_does_target_list_need_generating () { fi } -_phing () { - if [ -f build.xml ]; then +function _phing() { + if [[ -f build.xml ]]; then if _phing_does_target_list_need_generating; then phing -l |grep -v ":" |grep -v "^$"|grep -v "\-" > .phing_targets fi @@ -17,3 +18,4 @@ _phing () { } compdef _phing phing + diff --git a/plugins/pow/_pow b/plugins/pow/_pow new file mode 100644 index 000000000..7553fe45a --- /dev/null +++ b/plugins/pow/_pow @@ -0,0 +1,20 @@ +#compdef pow-add pow-remove pow-restart +#autoload + +local ret=1 + +case "$service" in + (pow-add) + _arguments "1:application:_files -/" && ret=0 + ;; + (pow-(remove|restart)) + _arguments "1: :->pow-app" && ret=0 + ;; +esac + +if [[ "$state" == 'pow-app' ]]; then + _arguments '1:application:($HOME/.pow/*(@N:t))' && ret=0 +fi + +return "$ret" + diff --git a/plugins/pow/pow.plugin.zsh b/plugins/pow/pow.plugin.zsh index 6b2a6f2be..5297b278c 100644 --- a/plugins/pow/pow.plugin.zsh +++ b/plugins/pow/pow.plugin.zsh @@ -1,10 +1,75 @@ -# Thanks to Christopher Sexton -# https://gist.github.com/965032 -function kapow { - touch ~/.pow/$1/tmp/restart.txt - if [ $? -eq 0 ]; then - echo "$fg[yellow]Pow restarting $1...$reset_color" - fi +# Inspired by Christopher Sexton's +# https://gist.github.com/1019777 +# +# Sorin Ionescu + +# Gets the root of the Rack application. +function _pow-rack-root() { + local rack_root="${PWD}" + + while [[ "${rack_root}" != '/' ]]; do + # Rack applictions must have a config.ru file in the root directory. + if [[ -f "${rack_root}/config.ru" ]]; then + echo "${rack_root}" + return 0 + else + rack_root="${rack_root:h}" + fi + done + + return 1 } -compctl -W ~/.pow -/ kapow +# Adds a Rack application to Pow. +function pow-add() { + local app="${${1:A}:-$(_pow-rack-root)}" + local vhost="${app:t}" + + if [[ ! -f "${app}/config.ru" ]]; then + echo "${0}: ${vhost:-$PWD:t}: not a Rack application or config.ru is missing" >&2 + return 1 + fi + + if [[ -L "${HOME}/.pow/${vhost}" ]]; then + echo "${0}: ${vhost}: already served at http://${vhost}.dev" + return 1 + fi + + ln -s "${app}" "${HOME}/.pow/${vhost}" + echo "Serving ${vhost} at http://${vhost}.dev" +} + +# Removes a Rack application from Pow. +function pow-remove() { + local symlink="${HOME}/.pow/${1}" + if [[ -L "${symlink}" ]]; then + unlink "${symlink}" + echo "Stopped serving ${1}" + else + echo "${0}: ${1}: no such application" >&2 + fi +} + +# Restarts a Rack application. +function pow-restart() { + local vhost="${${1}:-$(_pow-rack-root):t}" + local tmp="${HOME}/.pow/${vhost}/tmp" + + if [[ ! -L "${HOME}/.pow/${vhost}" ]]; then + echo "${0}: ${1}: no such application" >&2 + return 1 + fi + + if [[ ! -d "${tmp}" ]]; then + mkdir -p "${tmp}" + fi + + if touch "${tmp}/restart.txt"; then + echo "Restarted ${vhost}" + fi +} + +# Aliases +# View the standard out (puts) from any pow application. +alias pow-log="tail -f ${HOME}/Library/Logs/Pow/apps/*" + diff --git a/plugins/powder/_powder b/plugins/powder/_powder index 84e260a15..78bcd5d66 100644 --- a/plugins/powder/_powder +++ b/plugins/powder/_powder @@ -2,3 +2,4 @@ #autoload compadd `powder help | grep powder | cut -d " " -f 4` + diff --git a/plugins/rails/rails.plugin.zsh b/plugins/rails/rails.plugin.zsh index ac8119e83..1528345a3 100644 --- a/plugins/rails/rails.plugin.zsh +++ b/plugins/rails/rails.plugin.zsh @@ -1,13 +1,20 @@ -alias ss='thin --stats "/thin/stats" start' -alias sg='ruby script/generate' -alias sd='ruby script/destroy' -alias sp='ruby script/plugin' -alias ssp='ruby script/spec' -alias rdbm='rake db:migrate' -alias sc='ruby script/console' -alias sd='ruby script/server --debugger' +# Aliases (compatible with Rails 2) +alias rc='_rails-command console' +alias rd='_rails-command destroy' +alias rdb='_rails-command dbconsole' +alias rdbm='rake db:migrate db:test:clone' +alias rg='_rails-command generate' +alias rp='_rails-command plugin' +alias rs='_rails-command server' +alias rsd='_rails-command server --debugger' alias devlog='tail -f log/development.log' -function remote_console() { - /usr/bin/env ssh $1 "( cd $2 && ruby script/console production )" +# Functions +function _rails-command() { + if [[ -e "script/server" ]]; then + ruby script/"$@" + else + ruby script/rails "$@" + fi } + diff --git a/plugins/rails3/rails3.plugin.zsh b/plugins/rails3/rails3.plugin.zsh deleted file mode 100644 index f4ee637e6..000000000 --- a/plugins/rails3/rails3.plugin.zsh +++ /dev/null @@ -1,19 +0,0 @@ -# Rails 3 aliases, backwards-compatible with Rails 2. - -function _rails_command () { - if [ -e "script/server" ]; then - ruby script/$@ - else - ruby script/rails $@ - fi -} - -alias rc='_rails_command console' -alias rd='_rails_command destroy' -alias rdb='_rails_command dbconsole' -alias rdbm='rake db:migrate db:test:clone' -alias rg='_rails_command generate' -alias rp='_rails_command plugin' -alias rs='_rails_command server' -alias rsd='_rails_command server --debugger' -alias devlog='tail -f log/development.log' diff --git a/plugins/redis-cli/_redis-cli b/plugins/redis/_redis-cli similarity index 99% rename from plugins/redis-cli/_redis-cli rename to plugins/redis/_redis-cli index 135dd973e..81ebd8e73 100644 --- a/plugins/redis-cli/_redis-cli +++ b/plugins/redis/_redis-cli @@ -1,7 +1,7 @@ #compdef redis-cli rec #autoload -#redis cli completion, based off homebrew completion (ref. 2011-04-14) +# This completion is based on the Homebrew completion. local -a _1st_arguments _1st_arguments=( @@ -140,3 +140,4 @@ if (( CURRENT == 1 )); then _describe -t commands "redis-cli subcommand" _1st_arguments return fi + diff --git a/plugins/rsync/rsync.plugin.zsh b/plugins/rsync/rsync.plugin.zsh new file mode 100644 index 000000000..a9c1c0cf8 --- /dev/null +++ b/plugins/rsync/rsync.plugin.zsh @@ -0,0 +1,10 @@ +# Aliases +alias rsync-copy='rsync --verbose --progress --human-readable --compress --archive --hard-links' +compdef _rsync rsync-copy=rsync +alias rsync-move='rsync --verbose --progress --human-readable --compress --archive --hard-links --remove-source-files' +compdef _rsync rsync-move=rsync +alias rsync-update='rsync --verbose --progress --human-readable --compress --archive --hard-links --update' +compdef _rsync rsync-upate=rsync +alias rsync-synchronize='rsync --verbose --progress --human-readable --compress --archive --hard-links --update --delete' +compdef _rsync rsync-synchronize=rsync + diff --git a/plugins/ruby/.gitignore b/plugins/ruby/.gitignore new file mode 100644 index 000000000..6b71b1be2 --- /dev/null +++ b/plugins/ruby/.gitignore @@ -0,0 +1 @@ +_rvm diff --git a/plugins/ruby/_gem b/plugins/ruby/_gem index 8901492ae..55cf144da 100644 --- a/plugins/ruby/_gem +++ b/plugins/ruby/_gem @@ -53,13 +53,15 @@ if (( CURRENT == 1 )); then fi case "$words[1]" in - list) - if [[ "$state" == forms ]]; then - _gem-installed - _requested installed_gems expl 'installed gems' compadd -a installed_gems - fi ;; - uninstall|update) + (list) + if [[ "$state" == 'forms' ]]; then + _gem-installed + _requested installed_gems expl 'installed gems' compadd -a installed_gems + fi + ;; + (uninstall|update) _gem-installed - _wanted installed_gems expl 'installed gems' compadd -a installed_gems ;; + _wanted installed_gems expl 'installed gems' compadd -a installed_gems + ;; esac diff --git a/plugins/ruby/ruby.plugin.zsh b/plugins/ruby/ruby.plugin.zsh index 2b467b3ce..4c904f10e 100644 --- a/plugins/ruby/ruby.plugin.zsh +++ b/plugins/ruby/ruby.plugin.zsh @@ -14,3 +14,40 @@ if [[ "$OSTYPE" == darwin* ]]; then unset cache_file fi +# Loads RVM into the shell session. +completion_file="${0:h}/_rvm" +if [[ ! -e "$completion_file" ]] && [[ -L "$completion_file" ]]; then + unlink "$completion_file" 2> /dev/null +fi + +if [[ -s "$HOME/.rvm/scripts/rvm" ]]; then + # Auto adding variable-stored paths to ~ list conflicts with RVM. + unsetopt auto_name_dirs + + # Source RVM. + source "$HOME/.rvm/scripts/rvm" + + # Complete RVM. + if [[ ! -e "$completion_file" ]]; then + ln -s \ + "$rvm_path/scripts/zsh/Completion/_rvm" \ + "$completion_file" \ + 2> /dev/null + fi +fi +unset completion_file + +# Loads rbenv into the shell session. +if [[ -s "$HOME/.rbenv/bin/rbenv" ]]; then + path=("$HOME/.rbenv/bin" $path) + eval "$(rbenv init -)" +fi + +# Set environment variables for launchd processes. +if [[ "$OSTYPE" == darwin* ]]; then + for env_var in GEM_PATH GEM_HOME; do + launchctl setenv "$env_var" "${(P)env_var}" &! + done + unset env_var +fi + diff --git a/plugins/rvm/_rvm b/plugins/rvm/_rvm deleted file mode 100644 index 977e14a78..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 deleted file mode 100644 index 89244f503..000000000 --- a/plugins/rvm/rvm.plugin.zsh +++ /dev/null @@ -1,53 +0,0 @@ -# Get the name of the current branch. -function rvm_prompt_info() { - local ruby_version=$(~/.rvm/bin/rvm-prompt 2> /dev/null) - if [[ -n "$ruby_version" ]]; then - echo "($ruby_version)" - fi -} - -alias rubies='rvm list rubies' -alias gemsets='rvm gemset list' - -local ruby18='ruby-1.8.7-p334' -local ruby19='ruby-1.9.2-p180' - -function rb18 { - if [ -z "$1" ]; then - rvm use "$ruby18" - else - rvm use "$ruby18@$1" - fi -} - -_rb18() {compadd `ls -1 $rvm_path/gems | grep "^$ruby18@" | sed -e "s/^$ruby18@//" | awk '{print $1}'`} -compdef _rb18 rb18 - -function rb19 { - if [ -z "$1" ]; then - rvm use "$ruby19" - else - rvm use "$ruby19@$1" - fi -} - -_rb19() {compadd `ls -1 $rvm_path/gems | grep "^$ruby19@" | sed -e "s/^$ruby19@//" | awk '{print $1}'`} -compdef _rb19 rb19 - -function rvm-update { - rvm get head - rvm reload # TODO: Reload rvm completion? -} - -# TODO: Make this usable w/o rvm. -function gems { - local current_ruby=`rvm-prompt i v p` - local current_gemset=`rvm-prompt g` - - gem list $@ | sed \ - -Ee "s/\([0-9\.]+( .+)?\)/$fg[blue]&$reset_color/g" \ - -Ee "s|$(echo $rvm_path)|$fg[magenta]\$rvm_path$reset_color|g" \ - -Ee "s/$current_ruby@global/$fg[yellow]&$reset_color/g" \ - -Ee "s/$current_ruby$current_gemset$/$fg[green]&$reset_color/g" -} - diff --git a/plugins/ssh-agent/ssh-agent.plugin.zsh b/plugins/ssh-agent/ssh-agent.plugin.zsh index c4e92a1fe..cec0f8a23 100644 --- a/plugins/ssh-agent/ssh-agent.plugin.zsh +++ b/plugins/ssh-agent/ssh-agent.plugin.zsh @@ -1,12 +1,12 @@ # # INSTRUCTIONS # -# To enabled agent forwarding support add the following to +# To enabled agent forwarding support, add the following to # your .zshrc file: # # zstyle :omz:plugins:ssh-agent agent-forwarding on # -# To load multiple identies use the identities style, For +# To load multiple identies, use the identities style, For # example: # # zstyle :omz:plugins:ssh-agent id_rsa id_rsa2 id_github @@ -21,42 +21,40 @@ # Florent Thoumie and Jonas Pfenniger # -local _plugin__ssh_env=$HOME/.ssh/environment-$HOST -local _plugin__forwarding +_ssh_agent_env="$HOME/.ssh/environment-$HOST" +_ssh_agent_forwarding= -function _plugin__start_agent() -{ +function _ssh-agent-start() { local -a identities - # start ssh-agent and setup environment - /usr/bin/env ssh-agent | sed 's/^echo/#echo/' > ${_plugin__ssh_env} - chmod 600 ${_plugin__ssh_env} - . ${_plugin__ssh_env} > /dev/null + # Start ssh-agent and setup environment. + /usr/bin/env ssh-agent | sed 's/^echo/#echo/' > "${_ssh_agent_env}" + chmod 600 "${_ssh_agent_env}" + source "${_ssh_agent_env}" > /dev/null - # load identies - zstyle -a :omz:plugins:ssh-agent identities identities + # Load identies. + zstyle -a :omz:plugins:ssh-agent identities identities echo starting... - /usr/bin/ssh-add $HOME/.ssh/${^identities} + /usr/bin/ssh-add "$HOME/.ssh/${^identities}" } -# test if agent-forwarding is enabled -zstyle -b :omz:plugins:ssh-agent agent-forwarding _plugin__forwarding -if [[ ${_plugin__forwarding} == "yes" && -n "$SSH_AUTH_SOCK" ]]; then - # Add a nifty symlink for screen/tmux if agent forwarding - [[ -L $SSH_AUTH_SOCK ]] || ln -sf "$SSH_AUTH_SOCK" /tmp/ssh-agent-$USER-screen - -elif [ -f "${_plugin__ssh_env}" ]; then - # Source SSH settings, if applicable - . ${_plugin__ssh_env} > /dev/null - ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || { - _plugin__start_agent; +# Test if agent-forwarding is enabled. +zstyle -b :omz:plugins:ssh-agent agent-forwarding _ssh_agent_forwarding +if [[ "${_ssh_agent_forwarding}" == "yes" && -n "$SSH_AUTH_SOCK" ]]; then + # Add a nifty symlink for screen/tmux if agent forwarding. + [[ -L "$SSH_AUTH_SOCK" ]] || ln -sf "$SSH_AUTH_SOCK" /tmp/ssh-agent-$USER-screen +elif [ -f "${_ssh_agent_env}" ]; then + # Source SSH settings, if applicable. + source "${_ssh_agent_env}" > /dev/null + ps -ef | grep "${SSH_AGENT_PID}" | grep ssh-agent$ > /dev/null || { + _ssh-agent-start; } else - _plugin__start_agent; + _ssh-agent-start; fi -# tidy up after ourselves -unfunction _plugin__start_agent -unset _plugin__forwarding -unset _plugin__ssh_env +# Tidy up after ourselves. +unfunction _ssh-agent-start +unset _ssh_agent_forwarding +unset _ssh_agent_env diff --git a/plugins/svn/svn.plugin.zsh b/plugins/svn/svn.plugin.zsh deleted file mode 100644 index 53a8a513a..000000000 --- a/plugins/svn/svn.plugin.zsh +++ /dev/null @@ -1,42 +0,0 @@ -function svn_prompt_info { - 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 -} - - -function in_svn() { - if [[ -d .svn ]]; then - echo 1 - fi -} - -function svn_get_repo_name { - if [ in_svn ]; then - svn info | sed -n 's/Repository\ Root:\ .*\///p' | read SVN_ROOT - - svn info | sed -n "s/URL:\ .*$SVN_ROOT\///p" | sed "s/\/.*$//" - fi -} - -function svn_get_rev_nr { - if [ in_svn ]; then - svn info 2> /dev/null | sed -n s/Revision:\ //p - fi -} - -function svn_dirty_choose { - if [ in_svn ]; then - s=$(svn status|grep -E '^\s*[ACDIM!?L]' 2>/dev/null) - if [ $s ]; then - echo $1 - else - echo $2 - fi - fi -} - -function svn_dirty { - svn_dirty_choose $ZSH_THEME_SVN_PROMPT_DIRTY $ZSH_THEME_SVN_PROMPT_CLEAN -} diff --git a/plugins/taskwarrior/.gitignore b/plugins/taskwarrior/.gitignore new file mode 100644 index 000000000..ee21bc964 --- /dev/null +++ b/plugins/taskwarrior/.gitignore @@ -0,0 +1 @@ +_task diff --git a/plugins/taskwarrior/_task b/plugins/taskwarrior/_task deleted file mode 100644 index 5bffa9119..000000000 --- a/plugins/taskwarrior/_task +++ /dev/null @@ -1,280 +0,0 @@ -#compdef task -# -# zsh completion for taskwarrior -# -# Copyright 2010 - 2011 Johannes Schlatow -# Copyright 2009 P.C. Shyamshankar -# All rights reserved. -# -# This script is part of the taskwarrior project. -# -# This program is free software; you can redistribute it and/or modify it under -# the terms of the GNU General Public License as published by the Free Software -# Foundation; either version 2 of the License, or (at your option) any later -# version. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, write to the -# -# Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, -# Boston, MA -# 02110-1301 -# USA -# -typeset -g _task_cmds _task_projects _task_tags _task_config _task_modifiers -_task_projects=($(task _projects)) -_task_tags=($(task _tags)) -_task_ids=($(task _ids)) -_task_config=($(task _config)) -_task_modifiers=( - 'before' \ - 'after' \ - 'none' \ - 'any' \ - 'is' \ - 'isnt' \ - 'has' \ - 'hasnt' \ - 'startswith' \ - 'endswith' \ - 'word' \ - 'noword' -) -_task_cmds=($(task _commands)) -_task_zshcmds=( ${(f)"$(task _zshcommands)"} ) - - -_task_idCmds=( - 'append' \ - 'prepend' \ - 'annotate' \ - 'denotate' \ - 'edit' \ - 'duplicate' \ - 'info' \ - 'start' \ - 'stop' \ - 'done' -) - -_task_idCmdsDesc=( - 'append:Appends more description to an existing task.' \ - 'prepend:Prepends more description to an existing task.' \ - 'annotate:Adds an annotation to an existing task.' \ - 'denotate:Deletes an annotation of an existing task.' \ - 'edit:Launches an editor to let you modify a task directly.' \ - 'duplicate:Duplicates the specified task, and allows modifications.' \ - 'info:Shows all data, metadata for specified task.' \ - 'start:Marks specified task as started.' \ - 'stop:Removes the start time from a task.' \ - 'done:Marks the specified task as completed.' -) - -_task() { - _arguments -s -S \ - "*::task command:_task_commands" - return 0 -} - -local -a reply args word -word=$'[^\0]#\0' - -# priorities -local -a task_priorities -_regex_words values 'task priorities' \ - 'H:High' \ - 'M:Middle' \ - 'L:Low' -task_priorities=("$reply[@]") - -# projects -local -a task_projects -task_projects=( - /"$word"/ - ":values:task projects:compadd -a _task_projects" -) - -local -a _task_dates -_regex_words values 'task dates' \ - 'tod*ay:Today' \ - 'yes*terday:Yesterday' \ - 'tom*orrow:Tomorrow' \ - 'sow:Start of week' \ - 'soww:Start of work week' \ - 'socw:Start of calendar week' \ - 'som:Start of month' \ - 'soy:Start of year' \ - 'eow:End of week' \ - 'eoww:End of work week' \ - 'eocw:End of calendar week' \ - 'eom:End of month' \ - 'eoy:End of year' \ - 'mon:Monday' \ - 'tue:Tuesday'\ - 'wed:Wednesday' \ - 'thu:Thursday' \ - 'fri:Friday' \ - 'sat:Saturday' \ - 'sun:Sunday' -_task_dates=("$reply[@]") - -local -a _task_reldates -_regex_words values 'task reldates' \ - 'hrs:n hours' \ - 'day:n days' \ - '1st:first' \ - '2nd:second' \ - '3rd:third' \ - 'th:4th, 5th, etc.' \ - 'wks:weeks' -_task_reldates=("$reply[@]") - -task_dates=( - \( "$_task_dates[@]" \| - \( /$'[0-9][0-9]#'/- \( "$_task_reldates[@]" \) \) - \) -) - -_regex_words values 'task frequencies' \ - 'daily:Every day' \ - 'day:Every day' \ - 'weekdays:Every day skipping weekend days' \ - 'weekly:Every week' \ - 'biweekly:Every two weeks' \ - 'fortnight:Every two weeks' \ - 'quarterly:Every three months' \ - 'semiannual:Every six months' \ - 'annual:Every year' \ - 'yearly:Every year' \ - 'biannual:Every two years' \ - 'biyearly:Every two years' -_task_freqs=("$reply[@]") - -local -a _task_frequencies -_regex_words values 'task frequencies' \ - 'd:days' \ - 'w:weeks' \ - 'q:quarters' \ - 'y:years' -_task_frequencies=("$reply[@]") - -task_freqs=( - \( "$_task_freqs[@]" \| - \( /$'[0-9][0-9]#'/- \( "$_task_frequencies[@]" \) \) - \) -) - -# attributes -local -a task_attributes -_regex_words -t ':' default 'task attributes' \ - 'pro*ject:Project name:$task_projects' \ - 'du*e:Due date:$task_dates' \ - 'wa*it:Date until task becomes pending:$task_dates' \ - 're*cur:Recurrence frequency:$task_freqs' \ - 'pri*ority:priority:$task_priorities' \ - 'un*til:Recurrence end date:$task_dates' \ - 'fg:Foreground color' \ - 'bg:Background color' \ - 'li*mit:Desired number of rows in report' -task_attributes=("$reply[@]") - -args=( - \( "$task_attributes[@]" \| - \( /'(project|due|wait|recur|priority|until|fg|bg|limit).'/- \( /$'[^:]#:'/ ":default:modifiers:compadd -S ':' -a _task_modifiers" \) \) \| - \( /'(rc).'/- \( /$'[^:]#:'/ ":arguments:config:compadd -S ':' -a _task_config" \) \) \| - \( /'(+|-)'/- \( /"$word"/ ":values:remove tag:compadd -a _task_tags" \) \) \| - \( /"$word"/ \) - \) \# -) -_regex_arguments _task_attributes "${args[@]}" - -## task commands - -# default completion -(( $+functions[_task_default] )) || -_task_default() { - _task_attributes "$@" -} - -# commands expecting an ID -(( $+functions[_task_id] )) || -_task_id() { - if (( CURRENT < 3 )); then - # update IDs - _task_zshids=( ${(f)"$(task _zshids)"} ) - _describe -t values 'task IDs' _task_zshids - else - _task_attributes "$@" - fi -} - -# merge completion -(( $+functions[_task_merge] )) || -_task_merge() { - # TODO match URIs in .taskrc - _files -} - -# push completion -(( $+functions[_task_push] )) || -_task_push() { - # TODO match URIs in .taskrc - _files -} - -# pull completion -(( $+functions[_task_pull] )) || -_task_pull() { - # TODO match URIs in .taskrc - _files -} - - -# modify (task [0-9]* ...) completion -(( $+functions[_task_modify] )) || -_task_modify() { - _describe -t commands 'task command' _task_idCmdsDesc - _task_attributes "$@" -} - -## first level completion => task sub-command completion -(( $+functions[_task_commands] )) || -_task_commands() { - local cmd ret=1 - if (( CURRENT == 1 )); then - # update IDs - _task_zshids=( ${(f)"$(task _zshids)"} ) - - _describe -t commands 'task command' _task_zshcmds - _describe -t values 'task IDs' _task_zshids - # TODO match more than one ID - elif [[ $words[1] =~ ^[0-9]*$ ]] then - _call_function ret _task_modify - return ret - else -# local curcontext="${curcontext}" -# cmd="${_task_cmds[(r)$words[1]:*]%%:*}" - cmd="${_task_cmds[(r)$words[1]]}" - idCmd="${(M)_task_idCmds[@]:#$words[1]}" - if (( $#cmd )); then -# curcontext="${curcontext%:*:*}:task-${cmd}" - - if (( $#idCmd )); then - _call_function ret _task_id - else - _call_function ret _task_${cmd} || - _call_function ret _task_default || - _message "No command remaining." - fi - else - _message "Unknown subcommand ${cmd}" - fi - return ret - fi -} diff --git a/plugins/taskwarrior/taskwarrior.plugin.zsh b/plugins/taskwarrior/taskwarrior.plugin.zsh index c1830042e..040c74d35 100644 --- a/plugins/taskwarrior/taskwarrior.plugin.zsh +++ b/plugins/taskwarrior/taskwarrior.plugin.zsh @@ -1,21 +1,25 @@ -################################################################################ -# Author: Pete Clark -# Email: pete[dot]clark[at]gmail[dot]com -# Version: 0.1 (05/24/2011) -# License: WTFPL -# -# This oh-my-zsh plugin adds smart tab completion for -# TaskWarrior. It uses the zsh tab completion -# script (_task) distributed with TaskWarrior for the completion definitions. -# -# Typing task[tabtab] will give you a list of current tasks, task 66[tabtab] -# gives a list of available modifications for that task, etc. -################################################################################ +# Complete task. +completion_file="${0:h}/_task" +if [[ ! -e "$completion_file" ]] && ; then + if [[ -L "$completion_file" ]]; then + unlink "$completion_file" 2> /dev/null + fi + if (( $+commands[taskwarrior] )); then + ln -s \ + "${commands[task]:h:h}/share/doc/task/scripts/zsh/_task" \ + "$completion_file" \ + 2> /dev/null + fi +fi +unset completion_file + +# Style zstyle ':completion:*:*:task:*' verbose yes zstyle ':completion:*:*:task:*:descriptions' format '%U%B%d%b%u' - zstyle ':completion:*:*:task:*' group-name '' +# Aliases alias t=task compdef _task t=task + diff --git a/plugins/textmate/textmate.plugin.zsh b/plugins/textmate/textmate.plugin.zsh index aa2f75f4f..5370f63df 100644 --- a/plugins/textmate/textmate.plugin.zsh +++ b/plugins/textmate/textmate.plugin.zsh @@ -1,12 +1,15 @@ +# Aliases alias et='mate .' alias ett='mate app config lib db public spec test Rakefile Capfile Todo' -alias etp='mate app config lib db public spec test vendor/plugins vendor/gems Rakefile Capfile Todo' +alias etp='mate app config features lib db public spec test Gemfile Rakefile Capfile Todo' alias etts='mate app config lib db public script spec test vendor/plugins vendor/gems Rakefile Capfile Todo' -# Edit Ruby app in TextMate +# Edit Ruby app in TextMate. alias mr='mate CHANGELOG app config db lib public script spec test' +# Functions function tm() { cd $1 mate $1 } + diff --git a/plugins/thor/_thor b/plugins/thor/_thor index 9f7ed5aef..b62983083 100644 --- a/plugins/thor/_thor +++ b/plugins/thor/_thor @@ -2,3 +2,4 @@ #autoload compadd `thor list | grep thor | cut -d " " -f 2` + diff --git a/plugins/vagrant/_vagrant b/plugins/vagrant/_vagrant index 2e76d2ec2..34de22290 100644 --- a/plugins/vagrant/_vagrant +++ b/plugins/vagrant/_vagrant @@ -1,82 +1,75 @@ #compdef vagrant #autoload -# vagrant zsh completion - local -a _1st_arguments _1st_arguments=( - 'box:Box commands' - 'destroy:Destroys the vagrant environment' - 'halt:Halts the currently running vagrant environment' - 'help:[TASK] Describe available tasks or one specific task' - 'init:[box_name] [box_url] Initializes current folder for Vagrant usage' - 'package:Packages a vagrant environment for distribution' - 'provision:Run the provisioner' - 'reload:Reload the vagrant environment' - 'resume:Resumes a suspend vagrant environment' - 'ssh:SSH into the currently running environment' - 'ssh_config:outputs .ssh/config valid syntax for connecting to this environment via ssh.' - 'status:Shows the status of the current Vagrant environment.' - 'suspend:Suspends the currently running vagrant environment' - 'up:Creates the vagrant environment' - 'version:Prints the Vagrant version information' + 'box:Box commands' + 'destroy:Destroys the vagrant environment' + 'halt:Halts the currently running vagrant environment' + 'help:[TASK] Describe available tasks or one specific task' + 'init:[box_name] [box_url] Initializes current folder for Vagrant usage' + 'package:Packages a vagrant environment for distribution' + 'provision:Run the provisioner' + 'reload:Reload the vagrant environment' + 'resume:Resumes a suspend vagrant environment' + 'ssh:SSH into the currently running environment' + 'ssh_config:outputs .ssh/config valid syntax for connecting to this environment via ssh.' + 'status:Shows the status of the current Vagrant environment.' + 'suspend:Suspends the currently running vagrant environment' + 'up:Creates the vagrant environment' + 'version:Prints the Vagrant version information' ) local -a _box_arguments _box_arguments=( - 'add:NAME URI Add a box to the system' - 'help:COMMAND Describe subcommands or one specific subcommand' - 'list:Lists all installed boxes' - 'remove:NAME Remove a box from the system' - 'repackage:NAME Repackage an installed box into a `.box` file.' + 'add:NAME URI Add a box to the system' + 'help:COMMAND Describe subcommands or one specific subcommand' + 'list:Lists all installed boxes' + 'remove:NAME Remove a box from the system' + 'repackage:NAME Repackage an installed box into a `.box` file.' ) -__task_list () -{ - local expl - declare -a tasks +function __task_list() { + local expl + declare -a tasks - tasks=(box destroy halt init package provision reload resume ssh ssh_config status suspend up version) - - _wanted tasks expl 'help' compadd $tasks + tasks=(box destroy halt init package provision reload resume ssh ssh_config status suspend up version) + _wanted tasks expl 'help' compadd $tasks } -__box_list () -{ - _wanted application expl 'command' compadd $(command ls -1 $HOME/.vagrant/boxes 2>/dev/null| sed -e 's/ /\\ /g') +function __box_list() { + _wanted application expl 'command' compadd $(command ls -1 $HOME/.vagrant/boxes 2>/dev/null| sed -e 's/ /\\ /g') } -__vagrant-box () -{ - local curcontext="$curcontext" state line - typeset -A opt_args +function __vm_list () { + _wanted application expl 'command' compadd $(command grep Vagrantfile -oe '^[^#]*\.vm\.define *:\([a-zA-Z0-9]\+\)' 2>/dev/null | cut -d: -f2) +} - _arguments -C \ - ':command:->command' \ - '*::options:->options' +function __vagrant-box() { + local curcontext="$curcontext" state line + typeset -A opt_args - case $state in - (command) - _describe -t commands "gem subcommand" _box_arguments - return + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + _describe -t commands "gem subcommand" _box_arguments + return + ;; + (options) + case $line[1] in + (repackage|remove) + _arguments ':feature:__box_list' ;; - - (options) - case $line[1] in - (repackage|remove) - _arguments ':feature:__box_list' - ;; - esac - ;; - esac + esac + ;; + esac } - - - local expl local -a boxes installed_boxes - local curcontext="$curcontext" state line typeset -A opt_args @@ -86,19 +79,22 @@ _arguments -C \ case $state in (command) - _describe -t commands "gem subcommand" _1st_arguments - return + _describe -t commands "gem subcommand" _1st_arguments + return ;; (options) case $line[1] in (help) - _arguments ':feature:__task_list' + _arguments ':feature:__task_list' ;; (box) - __vagrant-box + __vagrant-box ;; + (up|provision|package|destroy|reload|ssh|halt|resume|status) + _arguments ':feature:__vm_list' esac ;; esac + diff --git a/plugins/wakeonlan/README b/plugins/wakeonlan/README new file mode 100644 index 000000000..c728aea4d --- /dev/null +++ b/plugins/wakeonlan/README @@ -0,0 +1,30 @@ +This plugin provides a wrapper around the "wakeonlan" tool available from most +distributions' package repositories, or from the following website: + +http://gsd.di.uminho.pt/jpo/software/wakeonlan/ + +In order to use this wrapper, create the ~/.wakeonlan directory, and place in +that directory one file for each device you would like to be able to wake. Give +the file a name that describes the device, such as its hostname. Each file +should contain a line with the mac address of the target device and the network +broadcast address. + +For instance, there might be a file ~/.wakeonlan/leto with the following +contents: + +00:11:22:33:44:55:66 192.168.0.255 + +To wake that device, use the following command: + +# wake leto + +The available device names will be autocompleted, so: + +# wake + +...will suggest "leto", along with any other configuration files that were +placed in the ~/.wakeonlan directory. + +For more information regarding the configuration file format, check the +wakeonlan man page. + diff --git a/plugins/wakeonlan/_wake b/plugins/wakeonlan/_wake new file mode 100644 index 000000000..fbf5e9ea8 --- /dev/null +++ b/plugins/wakeonlan/_wake @@ -0,0 +1,5 @@ +#compdef wake +#autoload + +_arguments "1:device to wake:_files -W '$HOME/.wakeonlan'" && return 0 + diff --git a/plugins/wakeonlan/wakeonlan.plugin.zsh b/plugins/wakeonlan/wakeonlan.plugin.zsh new file mode 100644 index 000000000..d91ba5923 --- /dev/null +++ b/plugins/wakeonlan/wakeonlan.plugin.zsh @@ -0,0 +1,15 @@ +function wake() { + local config_file="$HOME/.wakeonlan/$1" + if [[ ! -f "$config_file" ]]; then + echo "$0: $1: There is no such device file." >&2 + return 1 + fi + + if (( ! $+commands[wakeonlan] )); then + echo "$0: Can't find wakeonlan. Is it installed?" >&2 + return 1 + fi + + wakeonlan -f "$config_file" +} + diff --git a/plugins/yum/yum.plugin.zsh b/plugins/yum/yum.plugin.zsh index d6ba7ed62..d0ee236b4 100644 --- a/plugins/yum/yum.plugin.zsh +++ b/plugins/yum/yum.plugin.zsh @@ -1,12 +1,11 @@ -## Aliases +# Aliases +alias ys="yum search" # Search package. +alias yp="yum info" # Show package info. +alias yl="yum list" # List packages. +alias yli="yum list installed" # Print all installed packages. +alias yu="sudo yum update" # Upgrate packages. +alias yi="sudo yum install" # Install package. +alias yr="sudo yum remove" # Remove package. +alias yrl="sudo yum remove --remove-leaves" # Remove package and leaves. +alias yc="sudo yum clean all" # Clean cache. -alias ys="yum search" # search package -alias yp="yum info" # show package info -alias yl="yum list" # list packages -alias yli="yum list installed" # print all installed packages - -alias yu="sudo yum update" # upgrate packages -alias yi="sudo yum install" # install package -alias yr="sudo yum remove" # remove package -alias yrl="sudo yum remove --remove-leaves" # remove package and leaves -alias yc="sudo yum clean all" # clean cache From 4865f6c56aa086554fe22636efe135755d019a72 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Wed, 31 Aug 2011 00:02:50 -0400 Subject: [PATCH 503/614] Added z plugin. --- plugins/z/z.plugin.zsh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 plugins/z/z.plugin.zsh diff --git a/plugins/z/z.plugin.zsh b/plugins/z/z.plugin.zsh new file mode 100644 index 000000000..bcdc7387a --- /dev/null +++ b/plugins/z/z.plugin.zsh @@ -0,0 +1,29 @@ +# ------------------------------------------------------------------------------ +# FILE: z.plugin.zsh +# DESCRIPTION: oh-my-zsh plugin file. +# AUTHOR: Sorin Ionescu +# VERSION: 1.0.0 +# ------------------------------------------------------------------------------ + + +# z is the new j. +# https://github.com/rupa/z + +if [[ -f /etc/profile.d/z.zsh ]]; then + source /etc/profile.d/z.zsh +elif [[ -f /opt/local/etc/profile.d/z.zsh ]]; then + source /opt/local/etc/profile.d/z.zsh +elif [[ -f "$(brew --prefix 2> /dev/null)/etc/profile.d/z.sh" ]]; then + source "$(brew --prefix 2> /dev/null)/etc/profile.d/z.sh" +fi + +if (( $+functions[_z] )); then + alias z='nocorrect _z 2>&1' + alias j='z' + function z-precmd () { + z --add "$(pwd -P)" + } + autoload -Uz add-zsh-hook + add-zsh-hook precmd z-precmd +fi + From 574d856ae31fbac59975af98ef515b30864f6844 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Mon, 5 Sep 2011 00:22:23 -0400 Subject: [PATCH 504/614] Revert compiling all files to only zcompdump. --- oh-my-zsh.zsh | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/oh-my-zsh.zsh b/oh-my-zsh.zsh index 965bb90aa..27505ac3d 100644 --- a/oh-my-zsh.zsh +++ b/oh-my-zsh.zsh @@ -24,26 +24,8 @@ done # Load and run the prompt theming system. autoload -Uz promptinit && promptinit -i -# Load the automatic recompiler. -autoload -Uz zrecompile - -# Compile files. -for zsh_file in $HOME/.z{login,logout,profile,shenv,shrc,compdump}(N) $OMZ/*.zsh(N); do - zrecompile -q -p -U -z "$zsh_file" -done - -# Compile function directories. -for (( i=1; i <= $#fpath; i++ )); do - function_dir="$fpath[i]" - [[ "$function_dir" == (.|..) ]] \ - || [[ "$function_dir" == (.|..)/* ]] \ - || [[ ! -w "$function_dir:h" ]] && continue - function_files=($function_dir/^*(\.(rej|orig)|~|\#)(N-.)) - [[ -n "$function_files" ]] \ - && function_files=(${${(M)function_files%/*/*}#/}) \ - && ( cd "$function_dir:h" && zrecompile -q -p -U -z "${function_dir:t}.zwc" "$function_files[@]" ) \ - && fpath[i]="$fpath[i].zwc" -done -unset function_dir -unset function_files +# Compile zcompdump, if modified, to increase startup speed. +if [[ "$HOME/.zcompdump" -nt "$HOME/.zcompdump.zwc" ]] || [[ ! -f "$HOME/.zcompdump.zwc" ]]; then + zcompile "$HOME/.zcompdump" +fi From 448cda2a57a1a234aed84cda0937b7283f3ae181 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Mon, 5 Sep 2011 00:32:39 -0400 Subject: [PATCH 505/614] Set PATH for Mac OS X GUI applications. --- oh-my-zsh.zsh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/oh-my-zsh.zsh b/oh-my-zsh.zsh index 27505ac3d..5e4d19c59 100644 --- a/oh-my-zsh.zsh +++ b/oh-my-zsh.zsh @@ -21,6 +21,11 @@ for plugin in $plugins; do fi done +# Set PATH for Mac OS X GUI applications (requires re-login). +if [[ "$OSTYPE" == darwin* ]]; then + launchctl setenv PATH "$PATH" &! +fi + # Load and run the prompt theming system. autoload -Uz promptinit && promptinit -i From 225ea89e7452b1fed3d7a9a1f5493872b1974342 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Mon, 5 Sep 2011 00:37:36 -0400 Subject: [PATCH 506/614] Rewrote the Git plugin and Sorin theme. --- plugins/git/.gitignore | 1 + plugins/git/_git-info | 8 + plugins/git/alias.zsh | 241 ++++++++++++++++++++ plugins/git/completion.zsh | 15 ++ plugins/git/git.plugin.zsh | 379 +------------------------------- plugins/git/info.zsh | 357 ++++++++++++++++++++++++++++++ plugins/git/utility.zsh | 46 ++++ themes/sorin/prompt_sorin_setup | 47 ++-- 8 files changed, 708 insertions(+), 386 deletions(-) create mode 100644 plugins/git/.gitignore create mode 100644 plugins/git/_git-info create mode 100644 plugins/git/alias.zsh create mode 100644 plugins/git/completion.zsh create mode 100644 plugins/git/info.zsh create mode 100644 plugins/git/utility.zsh diff --git a/plugins/git/.gitignore b/plugins/git/.gitignore new file mode 100644 index 000000000..6c3310897 --- /dev/null +++ b/plugins/git/.gitignore @@ -0,0 +1 @@ +_git diff --git a/plugins/git/_git-info b/plugins/git/_git-info new file mode 100644 index 000000000..2cdbc2894 --- /dev/null +++ b/plugins/git/_git-info @@ -0,0 +1,8 @@ +#compdef git-info +#autoload + +_arguments "1:toggle:(( + on\:'Turn prompt Git status on for the current repository.' + off\:'Turn prompt Git status off for the current repository.' +))" && return 0 + diff --git a/plugins/git/alias.zsh b/plugins/git/alias.zsh new file mode 100644 index 000000000..67d6000c7 --- /dev/null +++ b/plugins/git/alias.zsh @@ -0,0 +1,241 @@ +# Git +alias g='git' +compdef g=git + +# Working Copy (w) +alias gws='git status --short' +compdef _git gws=git-status +alias gwS='git status' +compdef _git gwS=git-status +alias gwd='git diff --no-ext-diff' +compdef _git gwd=git-diff +function gwD() { git diff --no-ext-diff --ignore-all-space "$@" | view - } +compdef _git gwD=git-diff +alias gwr='git reset --soft' +compdef _git gwr=git-reset +alias gwR='git reset --hard' +compdef _git gwR=git-reset +alias gwc='git clean -n' +compdef _git gwc=git-clean +alias gwC='git clean -f' +compdef _git gwC=git-clean +alias gwx='git rm -r' +compdef _git gwx=git-rm +alias gwX='git rm -rf' +compdef _git gwX=git-rm +alias gwg='git grep' +compdef _git gwg=git-grep + +# Index +alias gia='git add' +compdef _git gia=git-add +alias giA='git add --patch' +compdef _git giA=git-add +alias giu='git add --update' +compdef _git giu=git-add +alias gid='git diff --no-ext-diff --cached' +compdef _git gid=git-diff +alias gir='git reset' +compdef _git gir=git-reset +alias giR='git reset --mixed' +compdef _git giR=git-reset +alias gix='git rm -r --cached' +compdef _git gix=git-rm +alias giX='git rm -rf --cached' +compdef _git giX=git-rm +alias gig='git grep --cached' +compdef _git gig=git-grep + +# Branah (b) +alias gb='git branch' +compdef _git gb=git-branch +alias gbc='git checkout -b' +compdef _git gbc=git-checkout +alias gbl='git branch -v' +compdef _git gbl=git-branch +alias gbL='git branch -av' +compdef _git gbL=git-branch +alias gbx='git branch -d' +compdef _git gbx=git-branch +alias gbX='git branch -D' +compdef _git gbX=git-branch +alias gbm='git branch -m' +compdef _git gbm=git-branch +alias gbM='git branch -M' +compdef _git gbM=git-branch + +# Commit (c) +alias gc='git commit' +compdef _git gc=git-commit +alias gca='git commit --all' +compdef _git gca=git-commit +alias gcm='git commit --message' +compdef _git gcm=git-commit +alias gco='git checkout' +compdef _git gco=git-checkout +alias gcO='git checkout HEAD --' +compdef _git gcO=git-checkout +alias gcf='git commit --amend --reuse-message HEAD' +compdef _git gcf=git-commit +alias gcp='git cherry-pick --ff' +compdef _git gcp=git-cherry-pick +alias gcP='git cherry-pick --no-commit' +compdef _git gcP=git-cherry-pick +alias gcr='git revert' +compdef _git gcr=git-revert +alias gcR='git reset "HEAD^"' +compdef _git gcR=git-reset +alias gcs='git show' +compdef _git gcs=git-show +alias gcv='git fsck | awk '\''/dangling commit/ {print $3}'\'' | git show --format="SHA1: %C(green)%h%C(reset) %f" --stdin | awk '\''/SHA1/ {sub("SHA1: ", ""); print}'\''' + +# Conflict (k) +alias gkl='git status | sed -n "s/^.*both [a-z]*ed: *//p"' +alias gka='git add $(gkl)' +compdef _git gka=git-add +alias gke='git mergetool $(gkl)' +alias gko='git checkout --ours --' +compdef _git gko=git-checkout +alias gkO='gko $(gkl)' +alias gkt='git checkout --theirs --' +compdef _git gkt=git-checkout +alias gkT='gkt $(gkl)' + +# File Data (d) +alias gd='git ls-files' +compdef _git gd=git-ls-files +alias gdc='git ls-files --cached' +compdef _git gdc=git-ls-files +alias gdx='git ls-files --deleted' +compdef _git gdx=git-ls-files +alias gdm='git ls-files --modified' +compdef _git gdm=git-ls-files +alias gdu='git ls-files --others' +compdef _git gdu=git-ls-files +alias gdk='git ls-files --killed' +compdef _git gdk=git-ls-files +alias gdi='git status --porcelain --short --ignored | sed -n "s/^!! //p"' + +# Merge (m) +alias gm='git merge' +compdef _git gm=git-merge +alias gmC='git merge --no-commit' +compdef _git gmC=git-merge +alias gmF='git merge --no-ff' +compdef _git gmF=git-merge +alias gma='git merge --abort' +compdef _git gma=git-merge +alias gmt='git mergetool' +compdef _git gmt=git-mergetool + +# Pull +alias gf='git fetch' +compdef _git gf=git-fetch +alias gfc='git clone' +compdef _git gfc=git-clone +alias gfm='git pull' +compdef _git gfm=git-pull +alias gfr='git pull --rebase' +compdef _git gfr=git-pull + +# Push +alias gp='git push' +compdef _git gp=git-push +alias gpf='git push --force' +compdef _git gpf=git-push +alias gpa='git push --all' +compdef _git gpa=git-push +alias gpA='git push --all && git push --tags' +compdef _git gpA=git-push +alias gpt='git push --tags' +compdef _git gpt=git-push +alias gpc='git push --set-upstream origin "$(git-branch)"' +compdef _git gpc=git-push +alias gpp='git pull origin "$(git-branch)" && git push origin "$(git-branch)"' + +# Rebase (r) +alias gr='git rebase' +compdef _git gr=git-rebase +alias gra='git rebase --abort' +compdef _git gra=git-rebase +alias grc='git rebase --continue' +compdef _git grc=git-rebase +alias gri='git rebase --interactive' +compdef _git gri=git-rebase +alias grs='git rebase --skip' +compdef _git grs=git-rebase + +# Remote Host (h) +alias gh='git remote' +compdef _git gh=git-remote +alias ghl='git remote --verbose' +compdef _git ghl=git-remote +alias gha='git remote add' +compdef _git gha=git-remote +alias ghx='git remote rm' +compdef _git ghx=git-remote +alias ghm='git remote rename' +compdef _git ghm=git-remote +alias ghu='git remote update' +compdef _git ghu=git-remote +alias ghc='git remote prune' +compdef _git ghc=git-remote +alias ghs='git remote show' +compdef _git ghs=git-remote + +# Stash (t) +alias gta='git stash apply' +compdef _git gta=git-stash +alias gtc='git stash clear' +compdef _git gtc=git-stash +alias gtx='git stash drop' +compdef _git gtx=git-stash +alias gtl='git stash list' +compdef _git gtl=git-stash +alias gtL='git stash show --patch --stat' +compdef _git gtL=git-stash +alias gtp='git stash pop' +compdef _git gtp=git-stash +alias gts='git stash save' +compdef _git gts=git-stash +alias gtS='git stash save --patch --no-keep-index' +compdef _git gtS=git-stash + +# Submodule (u) +alias gu='git submodule' +compdef _git gu=git-submodule +alias gua='git submodule add' +compdef _git gua=git-submodule +alias guf='git submodule foreach' +compdef _git guf=git-submodule +alias gui='git submodule init' +compdef _git gui=git-submodule +alias gul='git submodule status' +compdef _git gul=git-submodule +alias gus='git submodule sync' +compdef _git gus=git-submodule +alias guu='git submodule update' +compdef _git guu=git-submodule +alias guU='git submodule update --init --recursive' +compdef _git guU=git-submdoule + +# Git log (pretty). +git_log_format_oneline='--pretty=format:%C(green)%h%C(reset) %s%C(red)%d%C(reset)' +git_log_format_oneline_more='--pretty=format:%C(green)%h%C(reset) %C(blue)%ad%C(reset) %s%C(red)%d%C(reset) [%C(magenta)%an%C(reset)]' +git_log_format_medium='--pretty=format:%C(green)Commit: %H%C(red)%d%C(reset)%n%C(magenta)Author: %an <%ae>%C(reset)%n%C(blue)Date: %cd%C(reset)%n%+s%n%+b' + +alias gl='git log' +compdef _git gl=git-log +alias glo='git log --topo-order ${git_log_format_oneline}' +compdef _git glo=git-log +alias glO='git log --topo-order --date=short ${git_log_format_oneline_more}' +compdef _git glO=git-log +alias glg='git log --graph --topo-order ${git_log_format_medium}' +compdef _git glg=git-log +alias gls='git log --graph --topo-order --stat ${git_log_format_medium}' +compdef _git gls=git-log +alias gld='git log --graph --topo-order --stat --patch --full-diff ${git_log_format_medium}' +compdef _git gld=git-log +alias glc='git shortlog --summary --numbered' +compdef _git glc=git-shortlog + diff --git a/plugins/git/completion.zsh b/plugins/git/completion.zsh new file mode 100644 index 000000000..4bcf7e962 --- /dev/null +++ b/plugins/git/completion.zsh @@ -0,0 +1,15 @@ +# Get the latest Git completion. +completion_file="${0:h}/_git" +completion_file_url='http://zsh.git.sourceforge.net/git/gitweb.cgi?p=zsh/zsh;a=blob_plain;f=Completion/Unix/Command/_git;hb=HEAD' +if [[ ! -e "$completion_file" ]] && (( $+commands[git] )); then + if (( $+commands[curl] )); then + curl -L "$completion_file_url" -o "$completion_file" &> /dev/null &! + fi + + if (( $+commmands[wget] )); then + wget -C "$completion_file_url" -O "$completion_file" &> /dev/null &! + fi +fi +unset completion_file +unset completion_file_url + diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index c89ce016c..74cf94348 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -1,370 +1,13 @@ -# Set the default Git prompt theme. -ZSH_THEME_GIT_PROMPT_PREFIX="git:(" # Prefix before the branch name. -ZSH_THEME_GIT_PROMPT_SUFFIX=")" # Suffix after the branch name. -ZSH_THEME_GIT_PROMPT_SHA_BEFORE="" # Prefix before the SHA-1 hash. -ZSH_THEME_GIT_PROMPT_SHA_AFTER="" # Suffix after the SHA-1 hash. -ZSH_THEME_GIT_PROMPT_DIRTY="*" # Indicator to notify of dirty branch. -ZSH_THEME_GIT_PROMPT_CLEAN="" # Indicator to notify of clean branch. -ZSH_THEME_GIT_PROMPT_AHEAD="" # Indicator to notify of ahead branch -ZSH_THEME_GIT_PROMPT_UNTRACKED="" # Indicator to notify of untracked files. -ZSH_THEME_GIT_PROMPT_ADDED="" # Indicator to notify of added files. -ZSH_THEME_GIT_PROMPT_MODIFIED="" # Indicator to notify of modified files. -ZSH_THEME_GIT_PROMPT_RENAMED="" # Indicator to notify of renamed files. -ZSH_THEME_GIT_PROMPT_DELETED="" # Indicator to notify of deleted files. -ZSH_THEME_GIT_PROMPT_UNMERGED="" # Indicator to notify of unmerged files. +# ------------------------------------------------------------------------------ +# FILE: git.plugin.zsh +# DESCRIPTION: oh-my-zsh plugin file. +# AUTHOR: Sorin Ionescu +# VERSION: 1.0.0 +# ------------------------------------------------------------------------------ -# Checks if the working tree is dirty. -function __git-parse-dirty() { - if [[ -n "$(git status -s 2> /dev/null)" ]]; then - echo "$ZSH_THEME_GIT_PROMPT_DIRTY" - else - echo "$ZSH_THEME_GIT_PROMPT_CLEAN" - fi -} - -# Renders the name of the current branch. -function git-prompt-info() { - local branch="$(git-current-branch)" - if [[ -n "$branch" ]]; then - echo "${ZSH_THEME_GIT_PROMPT_PREFIX}${branch}$(__git-parse-dirty)${ZSH_THEME_GIT_PROMPT_SUFFIX}" - else - return 1 - fi -} - -# Gets the current branch. -function git-current-branch() { - local ref="$(git symbolic-ref HEAD 2> /dev/null)" - if [[ -n "$ref" ]]; then - echo "${ref#refs/heads/}" - else - return 1 - fi -} - -# Gets the repository root. -function git-root() { - git rev-parse --show-toplevel -} - -# Checks if there are commits ahead from remote. -function git-prompt-ahead() { - if $(echo "$(git log origin/$(git-current-branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then - echo "$ZSH_THEME_GIT_PROMPT_AHEAD" - else - return 1 - fi -} - -# Formats the prompt string for current git commit short SHA. -function git-prompt-short-sha() { - local sha="$(git rev-parse --short HEAD 2> /dev/null)" - if [[ -n "$sha" ]]; then - echo "${ZSH_THEME_GIT_PROMPT_SHA_BEFORE}${sha}${ZSH_THEME_GIT_PROMPT_SHA_AFTER}" - else - return 1 - fi -} - -# Formats the prompt string for current git commit long SHA. -function git-prompt-long-sha() { - local sha="$(git rev-parse HEAD 2> /dev/null)" - if [[ -n "$sha" ]]; then - echo "${ZSH_THEME_GIT_PROMPT_SHA_BEFORE}${sha}${ZSH_THEME_GIT_PROMPT_SHA_AFTER}" - else - return 1 - fi -} - -# Gets the status of the working tree. -function git-prompt-status() { - local indicators line untracked added modified renamed deleted unmerged - - if ! git rev-parse &>/dev/null; then - return 1 - fi - - while IFS=$'\n' read line; do - if [[ "$line" == \?\?\ * ]] && ! check-bool "$untracked"; then - untracked='yes' - indicators="${ZSH_THEME_GIT_PROMPT_UNTRACKED}${indicators}" - fi - if [[ "$line" == (((A|M|D|T) )|(AD|AM|AT|MM))\ * ]] && ! check-bool "$added"; then - added='yes' - indicators="${ZSH_THEME_GIT_PROMPT_ADDED}${indicators}" - fi - if [[ "$line" == (( (M|T))|(AM|AT|MM))\ * ]] && ! check-bool "$modified"; then - modified='yes' - indicators="${ZSH_THEME_GIT_PROMPT_MODIFIED}${indicators}" - fi - if [[ "$line" == R\ \ * ]] && ! check-bool "$renamed"; then - renamed='yes' - indicators="${ZSH_THEME_GIT_PROMPT_RENAMED}${indicators}" - fi - if [[ "$line" == ( D|AD)\ * ]] && ! check-bool "$deleted"; then - deleted='yes' - indicators="${ZSH_THEME_GIT_PROMPT_DELETED}${indicators}" - fi - if [[ "$line" == UU\ * ]] && ! check-bool "$unmerged"; then - unmerged='yes' - indicators="${ZSH_THEME_GIT_PROMPT_UNMERGED}${indicators}" - fi - done < <(git status --porcelain 2> /dev/null) - - if [[ -n "$indicators" ]]; then - echo $indicators - fi -} - -# Open the GitHub repository in the browser. -function git-hub() { - local url=$( - git config -l \ - | grep "remote.origin.url" \ - | sed -En "s/remote.origin.url=(git|https?)(@|:\/\/)github.com(:|\/)(.+)\/(.+).git/https:\/\/github.com\/\4\/\5/p" - ) - - if [[ -n "$url" ]]; then - url="${url}/tree/${$(git-current-branch):-master}" - - if (( $+commands[$BROWSER] )); then - "$BROWSER" "$url" - else - echo "fatal: Browser not set or set to a non-existent browser." >&2 - return 1 - fi - else - echo "fatal: Not a Git repository or origin remote not set." >&2 - return 1 - fi -} - -# Git -alias g='git' -compdef g=git - -# Working Copy (w) -alias gws='git status --short' -compdef _git gws=git-status -alias gwS='git status' -compdef _git gwS=git-status -alias gwd='git diff --no-ext-diff' -compdef _git gwd=git-diff -function gwD() { git diff --no-ext-diff --ignore-all-space "$@" | view - } -compdef _git gwD=git-diff -alias gwr='git reset --soft' -compdef _git gwr=git-reset -alias gwR='git reset --hard' -compdef _git gwR=git-reset -alias gwc='git clean -n' -compdef _git gwc=git-clean -alias gwC='git clean -f' -compdef _git gwC=git-clean -alias gwx='git rm -r' -compdef _git gwx=git-rm -alias gwX='git rm -rf' -compdef _git gwX=git-rm - -# Index -alias gia='git add' -compdef _git gia=git-add -alias giA='git add --patch' -compdef _git giA=git-add -alias giu='git add --update' -compdef _git giu=git-add -alias gid='git diff --no-ext-diff --cached' -compdef _git gid=git-diff -alias gir='git reset' -compdef _git gir=git-reset -alias giR='git reset --mixed' -compdef _git giR=git-reset -alias gix='git rm -r --cached' -compdef _git gix=git-rm -alias giX='git rm -rf --cached' -compdef _git giX=git-rm - -# Branah (b) -alias gb='git branch' -compdef _git gb=git-branch -alias gbc='git checkout -b' -compdef _git gbc=git-checkout -alias gbl='git branch -v' -compdef _git gbl=git-branch -alias gbL='git branch -av' -compdef _git gbL=git-branch -alias gbx='git branch -d' -compdef _git gbx=git-branch -alias gbX='git branch -D' -compdef _git gbX=git-branch -alias gbm='git branch -m' -compdef _git gbm=git-branch -alias gbM='git branch -M' -compdef _git gbM=git-branch - -# Commit (c) -alias gc='git commit' -compdef _git gc=git-commit -alias gca='git commit --all' -compdef _git gca=git-commit -alias gcm='git commit --message' -compdef _git gcm=git-commit -alias gco='git checkout' -compdef _git gco=git-checkout -alias gcO='git checkout HEAD --' -compdef _git gcO=git-checkout -alias gcf='git commit --amend --reuse-message HEAD' -compdef _git gcf=git-commit -alias gcp='git cherry-pick' -compdef _git gcp=git-cherry-pick -alias gcr='git revert' -compdef _git gcr=git-revert -alias gcR='git reset "HEAD^"' -compdef _git gcR=git-reset -alias gcs='git show' -compdef _git gcs=git-show -alias gcv='git fsck | awk '\''/dangling commit/ {print $3}'\'' | git show --format="SHA1: %C(green)%h%C(reset) %f" --stdin | awk '\''/SHA1/ {sub("SHA1: ", ""); print}'\''' - -# Conflict (k) -alias gkl='git status | sed -n "s/^.*both [a-z]*ed: *//p"' -alias gka='git add $(gkl)' -compdef _git gka=git-add -alias gke='git mergetool $(gkl)' -alias gko='git checkout --ours --' -compdef _git gko=git-checkout -alias gkO='gko $(gkl)' -alias gkt='git checkout --theirs --' -compdef _git gkt=git-checkout -alias gkT='gkt $(gkl)' - -# File Data (d) -alias gd='git ls-files' -compdef _git gd=git-ls-files -alias gdc='git ls-files --cached' -compdef _git gdc=git-ls-files -alias gdx='git ls-files --deleted' -compdef _git gdx=git-ls-files -alias gdm='git ls-files --modified' -compdef _git gdm=git-ls-files -alias gdu='git ls-files --others' -compdef _git gdu=git-ls-files -alias gdk='git ls-files --killed' -compdef _git gdk=git-ls-files -alias gdi='git status --porcelain --short --ignored | sed -n "s/^!! //p"' - -# Merge (m) -alias gm='git merge --no-ff' -compdef _git gm=git-merge -alias gmf='git merge --ff' -compdef _git gmf=git-merge -alias gma='git merge --abort' -compdef _git gma=git-merge - -# Pull -alias gf='git fetch' -compdef _git gf=git-fetch -alias gfc='git clone' -compdef _git gfc=git-clone -alias gfm='git pull' -compdef _git gfm=git-pull -alias gfr='git pull --rebase' -compdef _git gfr=git-pull - -# Push -alias gp='git push' -compdef _git gp=git-push -alias gpf='git push --force' -compdef _git gpf=git-push -alias gpa='git push --all' -compdef _git gpa=git-push -alias gpA='git push --all && git push --tags' -compdef _git gpA=git-push -alias gpt='git push --tags' -compdef _git gpt=git-push -alias gpc='git push --set-upstream origin $(git-current-branch)' -compdef _git gpc=git-push -alias gpp='git pull origin $(git-current-branch) && git push origin $(git-current-branch)' - -# Rebase (r) -alias gr='git rebase' -compdef _git gr=git-rebase -alias gra='git rebase --abort' -compdef _git gra=git-rebase -alias grc='git rebase --continue' -compdef _git grc=git-rebase -alias gri='git rebase --interactive' -compdef _git gri=git-rebase -alias grs='git rebase --skip' -compdef _git grs=git-rebase - -# Remote Host (h) -alias gh='git remote' -compdef _git gh=git-remote -alias ghl='git remote --verbose' -compdef _git ghl=git-remote -alias gha='git remote add' -compdef _git gha=git-remote -alias ghx='git remote rm' -compdef _git ghx=git-remote -alias ghm='git remote rename' -compdef _git ghm=git-remote -alias ghu='git remote update' -compdef _git ghu=git-remote -alias ghc='git remote prune' -compdef _git ghc=git-remote -alias ghs='git remote show' -compdef _git ghs=git-remote - -# Stash (t) -alias gta='git stash apply' -compdef _git gta=git-stash -alias gtc='git stash clear' -compdef _git gtc=git-stash -alias gtx='git stash drop' -compdef _git gtx=git-stash -alias gtl='git stash list' -compdef _git gtl=git-stash -alias gtL='git stash show --patch --stat' -compdef _git gtL=git-stash -alias gtp='git stash pop' -compdef _git gtp=git-stash -alias gts='git stash save' -compdef _git gts=git-stash - -# Submodule (u) -alias gu='git submodule' -compdef _git gu=git-submodule -alias gua='git submodule add' -compdef _git gua=git-submodule -alias guf='git submodule foreach' -compdef _git guf=git-submodule -alias gui='git submodule init' -compdef _git gui=git-submodule -alias gul='git submodule status' -compdef _git gul=git-submodule -alias gus='git submodule sync' -compdef _git gus=git-submodule -alias guu='git submodule update' -compdef _git guu=git-submodule -alias guU='git submodule update --init --recursive' -compdef _git guU=git-submdoule - -# Git log (pretty). -git_log_format_oneline='--pretty=format:%C(green)%h%C(reset) %s%C(red)%d%C(reset)' -git_log_format_oneline_more='--pretty=format:%C(green)%h%C(reset) %C(blue)%ad%C(reset) %s%C(red)%d%C(reset) [%C(magenta)%an%C(reset)]' -git_log_format_medium='--pretty=format:%C(green)Commit: %H%C(red)%d%C(reset)%n%C(magenta)Author: %an <%ae>%C(reset)%n%C(blue)Date: %cd%C(reset)%n%+s%n%+b' - -alias gl='git log' -compdef _git gl=git-log -alias glo='git log --topo-order ${git_log_format_oneline}' -compdef _git glo=git-log -alias glO='git log --topo-order --date=short ${git_log_format_oneline_more}' -compdef _git glO=git-log -alias glg='git log --graph --topo-order ${git_log_format_medium}' -compdef _git glg=git-log -alias gls='git log --graph --topo-order --stat ${git_log_format_medium}' -compdef _git gls=git-log -alias gld='git log --graph --topo-order --stat --patch --full-diff ${git_log_format_medium}' -compdef _git gld=git-log -alias glc='git shortlog --summary --numbered' -compdef _git glc=git-shortlog +# Source plugin files. +source "${0:h}/utility.zsh" +source "${0:h}/alias.zsh" +source "${0:h}/info.zsh" +source "${0:h}/completion.zsh" diff --git a/plugins/git/info.zsh b/plugins/git/info.zsh new file mode 100644 index 000000000..34e267bc1 --- /dev/null +++ b/plugins/git/info.zsh @@ -0,0 +1,357 @@ +# The default styles. +zstyle ':git-info:' action 'action:%s' # %s - Special action name (am, merge, rebase). +zstyle ':git-info:' added 'added:%a' # %a - Indicator to notify of added files. +zstyle ':git-info:' ahead 'ahead:%A' # %A - Indicator to notify of ahead branch. +zstyle ':git-info:' behind 'behind:%B' # %B - Indicator to notify of behind branch. +zstyle ':git-info:' branch '%b' # %b - Branch name. +zstyle ':git-info:' clean 'clean' # %C - Indicator to notify of clean branch. +zstyle ':git-info:' commit 'commit:%c' # %c - SHA-1 hash. +zstyle ':git-info:' deleted 'deleted:%d' # %d - Indicator to notify of deleted files. +zstyle ':git-info:' dirty 'dirty' # %D - Indicator to notify of dirty branch. +zstyle ':git-info:' modified 'modified:%m' # %m - Indicator to notify of modified files. +zstyle ':git-info:' remote '%R' # %R - Remote name. +zstyle ':git-info:' renamed 'renamed:%r' # %r - Indicator to notify of renamed files. +zstyle ':git-info:' stashed 'stashed:%S' # %S - Indicator to notify of stashed files. +zstyle ':git-info:' unmerged 'unmerged:%U' # %U - Indicator to notify of unmerged files. +zstyle ':git-info:' untracked 'untracked:%u' # %u - Indicator to notify of untracked files. +zstyle ':git-info:' prompt ' git:(%b %D%C)' # Left prompt. +zstyle ':git-info:' rprompt '' # Right prompt. + +# Gets the Git special action (am, merge, rebase, etc.). +# Borrowed from vcs_info and edited. +function _git-action() { + local action='' + local action_dir + local git_dir="$(git-root)/.git" + + for action_dir in \ + "${git_dir}/rebase-apply" \ + "${git_dir}/rebase" \ + "${git_dir}/../.dotest"; do + if [[ -d "$action_dir" ]] ; then + if [[ -f "${action_dir}/rebasing" ]] ; then + action='rebase' + elif [[ -f "${action_dir}/applying" ]] ; then + action='am' + else + action='am/rebase' + fi + echo "$action" + return 0 + fi + done + + for action_dir in \ + "${git_dir}/rebase-merge/interactive" \ + "${git_dir}/.dotest-merge/interactive"; do + if [[ -f "$action_dir" ]]; then + echo 'rebase-i' + return 0 + fi + done + + for action_dir in \ + "${git_dir}/rebase-merge" \ + "${git_dir}/.dotest-merge"; do + if [[ -d "$action_dir" ]]; then + echo 'rebase-m' + return 0 + fi + done + + if [[ -f "${git_dir}/MERGE_HEAD" ]]; then + echo 'merge' + return 0 + fi + + if [[ -f "${git_dir}/CHERRY_PICK_HEAD" ]]; then + echo 'cherry-pick' + return 0 + fi + + if [[ -f "${git_dir}/BISECT_LOG" ]]; then + echo 'bisect' + return 0 + fi + + return 1 +} + +# Turns off git-info for the current repository. +function _git-info-abort() { + if ! check-bool "$_git_info_executing"; then + return 1 + fi + + cat > /dev/stderr < /dev/null)"; then + return 1 + fi + + if (( $# > 0 )); then + if [[ "$1" == [Oo][Nn] ]]; then + git config --bool prompt.showinfo true + elif [[ "$1" == [Oo][Ff][Ff] ]]; then + git config --bool prompt.showinfo false + else + echo "Usage: $0 [ on | off ]" + fi + return 0 + fi + + # Return if git-info is disabled. + if ! check-bool "${$(git config --bool prompt.showinfo):-true}"; then + return 1 + fi + + # Used to abort and turn git-info off on SIGINT. + _git_info_executing=true + + # Get commit. + commit="$(git rev-parse HEAD 2> /dev/null)" + + # Format commit (short). + commit_short="$commit[1,7]" + zstyle -s ':git-info:' commit commit_format + zformat -f commit_formatted "$commit_format" "c:$commit_short" + + # Stashed + if [[ -f "$(git-root)/.git/refs/stash" ]]; then + stashed="$(git stash list 2>/dev/null | wc -l)" + zstyle -s ':git-info:' stashed stashed_format + zformat -f stashed_formatted "$stashed_format" "S:$stashed" + fi + + # Assume that the working copy is clean. + zstyle -s ':git-info:' clean clean_formatted + + while IFS=$'\n' read line; do + (( line_number++ )) + + if (( line_number == 1)) && [[ "$line" == *'(no branch)'* ]]; then + # Set branch to commit (short) when the branch is not found. + branch="$commit_short" + + # Get action. + action="$(_git-action)" + if [[ -n "$action" ]]; then + zstyle -s ':git-info:' action action_format + zformat -f action_formatted "$action_format" "s:$action" + fi + elif (( line_number == 1 )) \ + && [[ "$line" == (#b)'## Initial commit on '(?##) ]]; then + branch="$match[1]" + elif (( line_number == 1 )); then + # Split the line into an array for parsing. + branch_info=(${(s: :)line}) + + # Match: master...origin/master + if [[ $branch_info[2] == (#b)(?##)...(?##/?##) ]]; then + branch="$match[1]" + remote="$match[2]" + + # Match: [ahead or [behind + if [[ $branch_info[3] == (#b)\[(ahead|behind) ]]; then + ahead_or_behind="$match[1]" + if [[ "$ahead_or_behind" == 'behind' ]]; then + # Extract digits: 10] + behind="${branch_info[4]%\]}" + else + # Extract digits: 10] or 10, + ahead="${branch_info[4]%[,\]]}" + # Extract digits: 10] + behind="${branch_info[6]%\]}" + fi + fi + # Match: master + elif [[ $branch_info[2] == (#b)(?##) ]]; then + branch=$match[1] + fi + else + # Format dirty. + [[ -z "$dirty" ]] && zstyle -s ':git-info:' dirty dirty_formatted && unset clean_formatted + + # Count: added/deleted/modified/renamed/unmerged/untracked + [[ "$line" == (((A|M|D|T) )|(AD|AM|AT|MM))\ * ]] && (( added++ )) + [[ "$line" == ( D|AD)\ * ]] && (( deleted++ )) + [[ "$line" == (( (M|T))|(AM|AT|MM))\ * ]] && (( modified++ )) + [[ "$line" == R\ \ * ]] && (( renamed++ )) + [[ "$line" == UU\ * ]] && (( unmerged++ )) + [[ "$line" == \?\?\ * ]] && (( untracked++ )) + fi + done < <(git status --short --branch 2> /dev/null) + + # Format branch. + zstyle -s ':git-info:' branch branch_format + zformat -f branch_formatted "$branch_format" "b:$branch" + + # Format remote. + if [[ "$branch" != "$commit" ]]; then + [[ -z $remote ]] \ + && remote=${$(git rev-parse --verify ${branch}@{upstream} \ + --symbolic-full-name 2> /dev/null)#refs/remotes/} + zstyle -s ':git-info:' remote remote_format + zformat -f remote_formatted "$remote_format" "R:$remote" + fi + + # Format ahead. + if [[ -n "$ahead" ]]; then + zstyle -s ':git-info:' ahead ahead_format + zformat -f ahead_formatted "$ahead_format" "A:$ahead" + fi + + # Format behind. + if [[ -n "$behind" ]]; then + zstyle -s ':git-info:' behind behind_format + zformat -f behind_formatted "$behind_format" "B:$behind" + fi + + # Format added. + if (( $added > 0 )); then + zstyle -s ':git-info:' added added_format + zformat -f added_formatted "$added_format" "a:$added_format" + fi + + # Format deleted. + if (( $deleted > 0 )); then + zstyle -s ':git-info:' deleted deleted_format + zformat -f deleted_formatted "$deleted_format" "d:$deleted_format" + fi + + # Format modified. + if (( $modified > 0 )); then + zstyle -s ':git-info:' modified modified_format + zformat -f modified_formatted "$modified_format" "m:$modified" + fi + + # Format renamed. + if (( $renamed > 0 )); then + zstyle -s ':git-info:' renamed renamed_format + zformat -f renamed_formatted "$renamed_format" "r:$renamed" + fi + + # Format unmerged. + if (( $unmerged > 0 )); then + zstyle -s ':git-info:' unmerged unmerged_format + zformat -f unmerged_formatted "$unmerged_format" "U:$unmerged" + fi + + # Format untracked. + if (( $untracked > 0 )); then + zstyle -s ':git-info:' untracked untracked_format + zformat -f untracked_formatted "$untracked_format" "u:$untracked" + fi + + # Format prompts. + zstyle -s ':git-info:' prompt prompt_format + zstyle -s ':git-info:' rprompt rprompt_format + + git_info_vars=( + git_prompt_info "$prompt_format" + git_rprompt_info "$rprompt_format" + ) + + for git_info_var in ${(k)git_info_vars}; do + zformat -f $git_info_var $git_info_vars[$git_info_var] \ + "s:$action_formatted" \ + "a:$added_formatted" \ + "A:$ahead_formatted" \ + "B:$behind_formatted" \ + "b:$branch_formatted" \ + "C:$clean_formatted" \ + "c:$commit_formatted" \ + "d:$deleted_formatted" \ + "D:$dirty_formatted" \ + "m:$modified_formatted" \ + "R:$remote_formatted" \ + "r:$renamed_formatted" \ + "S:$stashed_formatted" \ + "U:$unmerged_formatted" \ + "u:$untracked_formatted" + done + + unset _git_info_executing + return 0 +} + diff --git a/plugins/git/utility.zsh b/plugins/git/utility.zsh new file mode 100644 index 000000000..c50fc55f1 --- /dev/null +++ b/plugins/git/utility.zsh @@ -0,0 +1,46 @@ +# Gets the current branch. +function git-branch() { + local ref="$(git symbolic-ref HEAD 2> /dev/null)" + if [[ -n "$ref" ]]; then + echo "${ref#refs/heads/}" + return 0 + else + return 1 + fi +} + +# Gets the repository root. +function git-root() { + local root="$(git rev-parse --show-toplevel 2> /dev/null)" + if [[ -n "$root" ]]; then + echo "$root" + return 0 + else + return 1 + fi +} + +# Open the GitHub repository in the browser. +function git-hub() { + local url=$( + git config -l \ + | grep "remote.origin.url" \ + | sed -En "s/remote.origin.url=(git|https?)(@|:\/\/)github.com(:|\/)(.+)\/(.+).git/https:\/\/github.com\/\4\/\5/p" + ) + + if [[ -n "$url" ]]; then + url="${url}/tree/${$(git-branch):-master}" + + if (( $+commands[$BROWSER] )); then + "$BROWSER" "$url" + return 0 + else + echo "fatal: Browser not set or set to a non-existent browser." >&2 + return 1 + fi + else + echo "fatal: Not a Git repository or origin remote not set." >&2 + return 1 + fi +} + diff --git a/themes/sorin/prompt_sorin_setup b/themes/sorin/prompt_sorin_setup index 72e8a96a9..e254a948e 100644 --- a/themes/sorin/prompt_sorin_setup +++ b/themes/sorin/prompt_sorin_setup @@ -2,32 +2,43 @@ # FILE: prompt_sorin_setup # DESCRIPTION: oh-my-zsh theme file. # AUTHOR: Sorin Ionescu -# VERSION: 1.0.4 +# VERSION: 1.0.5 # SCREENSHOT: http://i.imgur.com/aipDQ.png # ------------------------------------------------------------------------------ +function prompt_sorin_precmd () { + setopt noxtrace noksharrays localoptions + if (( $+functions[git-info] )); then + git-info + fi +} function prompt_sorin_setup() { setopt localoptions noxtrace noksharrays prompt_opts=(cr subst percent) - - MODE_INDICATOR="%B%F{red}❮%f%b%F{red}❮❮%f" - ZSH_THEME_GIT_PROMPT_SHA_BEFORE="" - ZSH_THEME_GIT_PROMPT_SHA_AFTER="" - ZSH_THEME_GIT_PROMPT_AHEAD="" - ZSH_THEME_GIT_PROMPT_DIRTY="" - ZSH_THEME_GIT_PROMPT_CLEAN="" - ZSH_THEME_GIT_PROMPT_PREFIX=" %F{blue}git%f:%F{red}" - ZSH_THEME_GIT_PROMPT_SUFFIX="%f" - ZSH_THEME_GIT_PROMPT_ADDED="%F{green} ✚%f" - ZSH_THEME_GIT_PROMPT_MODIFIED="%F{blue} ✹%f" - ZSH_THEME_GIT_PROMPT_DELETED="%F{red} ✖%f" - ZSH_THEME_GIT_PROMPT_RENAMED="%F{magenta} ➜%f" - ZSH_THEME_GIT_PROMPT_UNMERGED="%F{yellow} ═%f" - ZSH_THEME_GIT_PROMPT_UNTRACKED="%F{cyan} ✭%f" - PROMPT='%F{cyan}%~%f$(git-prompt-info) %(!.%B%F{red}#%f%b.%B%F{green}❯%f%b) ' - RPROMPT='%(?::%F{red}⏎%f)$(git-prompt-status)' + autoload -Uz add-zsh-hook + add-zsh-hook precmd prompt_sorin_precmd + + MODE_INDICATOR="%B%F{red}❮%f%b%F{red}❮❮%f" + zstyle ':git-info:' action ':%%B%F{yellow}%s%f%%b' + zstyle ':git-info:' added ' %%B%F{green}✚%f%%b' + zstyle ':git-info:' ahead ' %%B%F{yellow}⬆%f%%b' + zstyle ':git-info:' behind ' %%B%F{yellow}⬇%f%%b' + zstyle ':git-info:' branch ':%F{red}%b%f' + zstyle ':git-info:' deleted ' %%B%F{red}✖%f%%b' + zstyle ':git-info:' modified ' %%B%F{blue}✹%f%%b' + zstyle ':git-info:' renamed ' %%B%F{magenta}➜%f%%b' + zstyle ':git-info:' commit '%c' + zstyle ':git-info:' stashed ' %%B%F{white}✭%f%%b' + zstyle ':git-info:' unmerged ' %%B%F{yellow}═%f%%b' + zstyle ':git-info:' untracked ' %%B%F{cyan}•%f%%b' + zstyle ':git-info:' prompt ' %F{blue}git%f%b%s' + zstyle ':git-info:' rprompt '%A%B%S%a%d%m%r%U%u' + + PROMPT='%F{cyan}%1~%f${git_prompt_info} %(!.%B%F{red}#%f%b.%B%F{green}❯%f%b) ' + RPROMPT='%(?::%F{red}⏎%f)${git_rprompt_info}' + SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? ' } prompt_sorin_setup "$@" From 8619dd28bc50880625e9701d1c0dbd412029f2da Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Tue, 20 Sep 2011 23:15:50 -0400 Subject: [PATCH 507/614] Added screen and tmux plugins. --- functions/alias.zsh | 10 ---------- plugins/screen/screen.plugin.zsh | 23 +++++++++++++++++++++++ plugins/tmux/tmux.plugin.zsh | 22 ++++++++++++++++++++++ 3 files changed, 45 insertions(+), 10 deletions(-) create mode 100644 plugins/screen/screen.plugin.zsh create mode 100644 plugins/tmux/tmux.plugin.zsh diff --git a/functions/alias.zsh b/functions/alias.zsh index 436b80554..13a3d7f31 100644 --- a/functions/alias.zsh +++ b/functions/alias.zsh @@ -99,16 +99,6 @@ if ! check-bool "$DISABLE_COLOR"; then fi fi -# Terminal Multiplexer -alias sl="screen -list" -alias sn="screen -U -S" -alias sr="screen -a -A -U -D -R" - -if (( $+commands[tmux] )); then - alias ta="tmux attach-session" - alias tl="tmux list-sessions" -fi - # Miscellaneous (( $+commands[ack] )) && alias afind='ack -il' (( $+commands[ebuild] )) && alias ebuild='nocorrect ebuild' diff --git a/plugins/screen/screen.plugin.zsh b/plugins/screen/screen.plugin.zsh new file mode 100644 index 000000000..c0d533d96 --- /dev/null +++ b/plugins/screen/screen.plugin.zsh @@ -0,0 +1,23 @@ +# ------------------------------------------------------------------------------ +# FILE: screen.plugin.zsh +# DESCRIPTION: oh-my-zsh plugin file. +# AUTHOR: Sorin Ionescu +# VERSION: 1.0.0 +# ------------------------------------------------------------------------------ + +# Aliases +alias sl="screen -list" +alias sn="screen -U -S" +alias sr="screen -a -A -U -D -R" + +# Auto +if (( $SHLVL == 1 )) && ! check-bool "$DISABLE_AUTO_SCREEN"; then + (( SHLVL += 1 )) && export SHLVL + session="$(screen -list 2> /dev/null | sed '1d;$d' | awk '{print $1}' | head -1)" + if [[ -n "$session" ]]; then + exec screen -x "$session" + else + exec screen -a -A -U -D -R -m "$SHELL" -l + fi +fi + diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh new file mode 100644 index 000000000..8e1d19b53 --- /dev/null +++ b/plugins/tmux/tmux.plugin.zsh @@ -0,0 +1,22 @@ +# ------------------------------------------------------------------------------ +# FILE: tmux.plugin.zsh +# DESCRIPTION: oh-my-zsh plugin file. +# AUTHOR: Sorin Ionescu +# VERSION: 1.0.0 +# ------------------------------------------------------------------------------ + +# Aliases +alias ta="tmux attach-session" +alias tl="tmux list-sessions" + +# Auto +if (( $SHLVL == 1 )) && ! check-bool "$DISABLE_AUTO_TMUX"; then + (( SHLVL += 1 )) && export SHLVL + session="$(tmux list-sessions 2> /dev/null | cut -d':' -f1 | head -1)" + if [[ -n "$session" ]]; then + exec tmux attach-session -t "$session" + else + exec tmux new-session "$SHELL -l" + fi +fi + From 05c94e2dd502fb898f7cac76f430a464b65c2332 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Mon, 5 Sep 2011 15:39:37 -0400 Subject: [PATCH 508/614] Simplified option variables for greater flexibility. --- functions/alias.zsh | 4 ++-- functions/environment.zsh | 4 ++-- functions/keyboard.zsh | 8 ++++---- functions/terminal.zsh | 4 ++-- oh-my-zsh.zsh | 2 +- .../history-substring-search.plugin.zsh | 4 ++-- plugins/screen/screen.plugin.zsh | 2 +- plugins/ssh-agent/ssh-agent.plugin.zsh | 2 +- plugins/tmux/tmux.plugin.zsh | 2 +- templates/zshrc.template.zsh | 18 +++++++++--------- 10 files changed, 25 insertions(+), 25 deletions(-) diff --git a/functions/alias.zsh b/functions/alias.zsh index 13a3d7f31..22db95f49 100644 --- a/functions/alias.zsh +++ b/functions/alias.zsh @@ -2,7 +2,7 @@ setopt correct # Correct commands. setopt correct_all # Correct all arguments. # The 'ls' Family -if ! check-bool "$DISABLE_COLOR"; then +if check-bool "$COLOR"; then if [[ -f "$HOME/.dir_colors" ]] && ( (( $+commands[dircolors] )) || ( (( $+plugins[(er)gnu-utils] )) && (( $+commands[gdircolors] )) ) ); then eval $("${commands[dircolors]:-$commands[gdircolors]}" "$HOME/.dir_colors") alias ls='ls -hF --group-directories-first --color=auto' @@ -80,7 +80,7 @@ else fi # Diff/Make -if ! check-bool "$DISABLE_COLOR"; then +if check-bool "$COLOR"; then if (( $+commands[colordiff] )); then alias diff='colordiff -u' compdef colordiff=diff diff --git a/functions/environment.zsh b/functions/environment.zsh index ec725ffbf..0c9bb46df 100644 --- a/functions/environment.zsh +++ b/functions/environment.zsh @@ -64,7 +64,7 @@ export VISUAL="vim" export PAGER='less' # Grep -if ! check-bool "$DISABLE_COLOR"; then +if check-bool "$COLOR"; then export GREP_COLOR='37;45' export GREP_OPTIONS='--color=auto' fi @@ -89,7 +89,7 @@ if (( $+commands[lesspipe.sh] )); then fi # Termcap -if ! check-bool "$DISABLE_COLOR"; then +if check-bool "$COLOR"; then export LESS_TERMCAP_mb=$'\E[01;31m' # begin blinking export LESS_TERMCAP_md=$'\E[01;31m' # begin bold export LESS_TERMCAP_me=$'\E[0m' # end mode diff --git a/functions/keyboard.zsh b/functions/keyboard.zsh index e71fb1b45..50c9001d2 100644 --- a/functions/keyboard.zsh +++ b/functions/keyboard.zsh @@ -67,7 +67,7 @@ if [[ "$KEYMAP" == (emacs|) ]]; then bindkey "${keys[Control]}x${keys[Control]}e" edit-command-line # Expand .... to ../.. - if ! check-bool "$DISABLE_DOT_EXPANSION"; then + if check-bool "$DOT_EXPANSION"; then bindkey "." expand-dot-to-parent-directory-path fi @@ -132,7 +132,7 @@ elif [[ "$KEYMAP" == 'vi' ]]; then bindkey -M vicmd "${keys[Control]}r" redo # Expand .... to ../.. - if ! check-bool "$DISABLE_DOT_EXPANSION"; then + if check-bool "$DOT_EXPANSION"; then bindkey -M viins "." expand-dot-to-parent-directory-path fi @@ -233,7 +233,7 @@ bindkey '^[[Z' reverse-menu-complete bindkey "${keys[Control]}i" expand-or-complete-prefix # Convert .... to ../.. automatically. -if ! check-bool "$DISABLE_DOT_EXPANSION"; then +if check-bool "$DOT_EXPANSION"; then function expand-dot-to-parent-directory-path() { if [[ $LBUFFER = *.. ]]; then LBUFFER+=/.. @@ -247,7 +247,7 @@ if ! check-bool "$DISABLE_DOT_EXPANSION"; then fi # Display an indicator when completing. -if ! check-bool "$DISABLE_COMPLETION_INDICATOR"; then +if check-bool "$COMPLETION_INDICATOR"; then function expand-or-complete-prefix-with-indicator() { echo -n "\e[31m...\e[0m" zle expand-or-complete-prefix diff --git a/functions/terminal.zsh b/functions/terminal.zsh index 2c1a2b2bf..d59056ca5 100644 --- a/functions/terminal.zsh +++ b/functions/terminal.zsh @@ -69,7 +69,7 @@ autoload -Uz add-zsh-hook # Sets the tab and window titles before the prompt is displayed. function set-title-precmd { - if ! check-bool "$DISABLE_AUTO_TITLE"; then + if check-bool "$AUTO_TITLE"; then set-window-title "${(%):-%~}" for kind in tab screen; do # Left-truncate the current working directory to 15 characters. @@ -81,7 +81,7 @@ add-zsh-hook precmd set-title-precmd # Sets the tab and window titles before command execution. function set-title-preexec { - if ! check-bool "$DISABLE_AUTO_TITLE"; then + if check-bool "$AUTO_TITLE"; then set-title-by-command "$2" fi } diff --git a/oh-my-zsh.zsh b/oh-my-zsh.zsh index 5e4d19c59..7635683f0 100644 --- a/oh-my-zsh.zsh +++ b/oh-my-zsh.zsh @@ -2,7 +2,7 @@ # Disable color in dumb terminals. if [[ "$TERM" == 'dumb' ]]; then - DISABLE_COLOR='true' + COLOR='false' fi # Add functions to fpath. diff --git a/plugins/history-substring-search/history-substring-search.plugin.zsh b/plugins/history-substring-search/history-substring-search.plugin.zsh index 40687ff02..12d8dc52f 100644 --- a/plugins/history-substring-search/history-substring-search.plugin.zsh +++ b/plugins/history-substring-search/history-substring-search.plugin.zsh @@ -2,11 +2,11 @@ source "${0:r:r}.zsh" -if test "$CASE_SENSITIVE" = true; then +if check-bool "$CASE_SENSITIVE"; then unset HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS fi -if test "$DISABLE_COLOR" = true; then +if ! check-bool "$COLOR"; then unset HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND unset HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND fi diff --git a/plugins/screen/screen.plugin.zsh b/plugins/screen/screen.plugin.zsh index c0d533d96..9e45e2c22 100644 --- a/plugins/screen/screen.plugin.zsh +++ b/plugins/screen/screen.plugin.zsh @@ -11,7 +11,7 @@ alias sn="screen -U -S" alias sr="screen -a -A -U -D -R" # Auto -if (( $SHLVL == 1 )) && ! check-bool "$DISABLE_AUTO_SCREEN"; then +if (( $SHLVL == 1 )) && check-bool "$AUTO_SCREEN"; then (( SHLVL += 1 )) && export SHLVL session="$(screen -list 2> /dev/null | sed '1d;$d' | awk '{print $1}' | head -1)" if [[ -n "$session" ]]; then diff --git a/plugins/ssh-agent/ssh-agent.plugin.zsh b/plugins/ssh-agent/ssh-agent.plugin.zsh index cec0f8a23..6f309ce5d 100644 --- a/plugins/ssh-agent/ssh-agent.plugin.zsh +++ b/plugins/ssh-agent/ssh-agent.plugin.zsh @@ -40,7 +40,7 @@ function _ssh-agent-start() { # Test if agent-forwarding is enabled. zstyle -b :omz:plugins:ssh-agent agent-forwarding _ssh_agent_forwarding -if [[ "${_ssh_agent_forwarding}" == "yes" && -n "$SSH_AUTH_SOCK" ]]; then +if check-bool "${_ssh_agent_forwarding}" && [[ -n "$SSH_AUTH_SOCK" ]]; then # Add a nifty symlink for screen/tmux if agent forwarding. [[ -L "$SSH_AUTH_SOCK" ]] || ln -sf "$SSH_AUTH_SOCK" /tmp/ssh-agent-$USER-screen elif [ -f "${_ssh_agent_env}" ]; then diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index 8e1d19b53..3e54acff7 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -10,7 +10,7 @@ alias ta="tmux attach-session" alias tl="tmux list-sessions" # Auto -if (( $SHLVL == 1 )) && ! check-bool "$DISABLE_AUTO_TMUX"; then +if (( $SHLVL == 1 )) && check-bool "$AUTO_TMUX"; then (( SHLVL += 1 )) && export SHLVL session="$(tmux list-sessions 2> /dev/null | cut -d':' -f1 | head -1)" if [[ -n "$session" ]]; then diff --git a/templates/zshrc.template.zsh b/templates/zshrc.template.zsh index d630e9eae..1cc9130ea 100644 --- a/templates/zshrc.template.zsh +++ b/templates/zshrc.template.zsh @@ -4,20 +4,20 @@ OMZ="$HOME/.oh-my-zsh" # Set the key mapping style to 'emacs' or 'vi'. KEYMAP='emacs' -# Set to 'true' to enable case-sensitivity. +# Set case-sensitivity for completion, history lookup, etc. CASE_SENSITIVE='false' -# Set to 'true' to disable color (auto set on dumb terminals). -DISABLE_COLOR='false' +# Color output (auto set to 'false' on dumb terminals). +COLOR='true' -# Set to 'true' to disable auto setting the tab and window titles. -DISABLE_AUTO_TITLE='false' +# Auto set the tab and window titles. +AUTO_TITLE='true' -# Set to 'false' to enable converting .... to ../.. automatically. -DISABLE_DOT_EXPANSION='true' +# Auto convert .... to ../.. +DOT_EXPANSION='false' -# Set to 'false' to enable the completion indicator. -DISABLE_COMPLETION_INDICATOR='true' +# Indicate that completions are being generated. +COMPLETION_INDICATOR='false' # Set the plugins to load (see $OMZ/plugins/). # Example: plugins=(git lighthouse rails ruby textmate) From b65195156dd0e44ec179246452f29753034c06e3 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sun, 11 Sep 2011 01:02:10 -0400 Subject: [PATCH 509/614] Added missing FX and named colors to spectrum. --- functions/spectrum.zsh | 63 +++++++++++++++---- oh-my-zsh.zsh => init.zsh | 6 +- plugins/ant/{ant.plugin.zsh => init.zsh} | 0 .../archive/{archive.plugin.zsh => init.zsh} | 0 .../{autojump.plugin.zsh => init.zsh} | 0 plugins/brew/{brew.plugin.zsh => init.zsh} | 0 .../bundler/{bundler.plugin.zsh => init.zsh} | 0 plugins/cake/{cake.plugin.zsh => init.zsh} | 0 ...{command-not-found.plugin.zsh => init.zsh} | 0 .../{compleat.plugin.zsh => init.zsh} | 0 plugins/dpkg/{dpkg.plugin.zsh => init.zsh} | 0 .../{git-flow.plugin.zsh => init.zsh} | 0 plugins/git/{git.plugin.zsh => init.zsh} | 0 .../github/{github.plugin.zsh => init.zsh} | 0 .../{gnu-utils.plugin.zsh => init.zsh} | 0 .../{gpg-agent.plugin.zsh => init.zsh} | 0 ...y-substring-search.plugin.zsh => init.zsh} | 2 +- plugins/kate/{kate.plugin.zsh => init.zsh} | 0 .../{leiningen.plugin.zsh => init.zsh} | 0 .../{macports.plugin.zsh => init.zsh} | 0 plugins/node/{node.plugin.zsh => init.zsh} | 0 plugins/osx/{osx.plugin.zsh => init.zsh} | 0 .../pacman/{pacman.plugin.zsh => init.zsh} | 0 plugins/perl/{perl.plugin.zsh => init.zsh} | 0 plugins/phing/{phing.plugin.zsh => init.zsh} | 0 plugins/pow/{pow.plugin.zsh => init.zsh} | 0 .../python/{python.plugin.zsh => init.zsh} | 0 plugins/rails/{rails.plugin.zsh => init.zsh} | 0 plugins/rsync/{rsync.plugin.zsh => init.zsh} | 0 plugins/ruby/{ruby.plugin.zsh => init.zsh} | 0 .../screen/{screen.plugin.zsh => init.zsh} | 0 .../{ssh-agent.plugin.zsh => init.zsh} | 0 .../{taskwarrior.plugin.zsh => init.zsh} | 0 .../{textmate.plugin.zsh => init.zsh} | 0 plugins/tmux/{tmux.plugin.zsh => init.zsh} | 0 .../{wakeonlan.plugin.zsh => init.zsh} | 0 plugins/yum/{yum.plugin.zsh => init.zsh} | 0 plugins/z/{z.plugin.zsh => init.zsh} | 0 templates/{zshrc.template.zsh => zshrc.zsh} | 2 +- 39 files changed, 57 insertions(+), 16 deletions(-) rename oh-my-zsh.zsh => init.zsh (83%) rename plugins/ant/{ant.plugin.zsh => init.zsh} (100%) rename plugins/archive/{archive.plugin.zsh => init.zsh} (100%) rename plugins/autojump/{autojump.plugin.zsh => init.zsh} (100%) rename plugins/brew/{brew.plugin.zsh => init.zsh} (100%) rename plugins/bundler/{bundler.plugin.zsh => init.zsh} (100%) rename plugins/cake/{cake.plugin.zsh => init.zsh} (100%) rename plugins/command-not-found/{command-not-found.plugin.zsh => init.zsh} (100%) rename plugins/compleat/{compleat.plugin.zsh => init.zsh} (100%) rename plugins/dpkg/{dpkg.plugin.zsh => init.zsh} (100%) rename plugins/git-flow/{git-flow.plugin.zsh => init.zsh} (100%) rename plugins/git/{git.plugin.zsh => init.zsh} (100%) rename plugins/github/{github.plugin.zsh => init.zsh} (100%) rename plugins/gnu-utils/{gnu-utils.plugin.zsh => init.zsh} (100%) rename plugins/gpg-agent/{gpg-agent.plugin.zsh => init.zsh} (100%) rename plugins/history-substring-search/{history-substring-search.plugin.zsh => init.zsh} (87%) rename plugins/kate/{kate.plugin.zsh => init.zsh} (100%) rename plugins/leiningen/{leiningen.plugin.zsh => init.zsh} (100%) rename plugins/macports/{macports.plugin.zsh => init.zsh} (100%) rename plugins/node/{node.plugin.zsh => init.zsh} (100%) rename plugins/osx/{osx.plugin.zsh => init.zsh} (100%) rename plugins/pacman/{pacman.plugin.zsh => init.zsh} (100%) rename plugins/perl/{perl.plugin.zsh => init.zsh} (100%) rename plugins/phing/{phing.plugin.zsh => init.zsh} (100%) rename plugins/pow/{pow.plugin.zsh => init.zsh} (100%) rename plugins/python/{python.plugin.zsh => init.zsh} (100%) rename plugins/rails/{rails.plugin.zsh => init.zsh} (100%) rename plugins/rsync/{rsync.plugin.zsh => init.zsh} (100%) rename plugins/ruby/{ruby.plugin.zsh => init.zsh} (100%) rename plugins/screen/{screen.plugin.zsh => init.zsh} (100%) rename plugins/ssh-agent/{ssh-agent.plugin.zsh => init.zsh} (100%) rename plugins/taskwarrior/{taskwarrior.plugin.zsh => init.zsh} (100%) rename plugins/textmate/{textmate.plugin.zsh => init.zsh} (100%) rename plugins/tmux/{tmux.plugin.zsh => init.zsh} (100%) rename plugins/wakeonlan/{wakeonlan.plugin.zsh => init.zsh} (100%) rename plugins/yum/{yum.plugin.zsh => init.zsh} (100%) rename plugins/z/{z.plugin.zsh => init.zsh} (100%) rename templates/{zshrc.template.zsh => zshrc.zsh} (96%) diff --git a/functions/spectrum.zsh b/functions/spectrum.zsh index 43a013d78..67beeac7d 100644 --- a/functions/spectrum.zsh +++ b/functions/spectrum.zsh @@ -1,20 +1,61 @@ # A script to make using 256 colors in ZSH less painful. # P.C. Shyamshankar -# Copied from http://github.com/sykora/etc/blob/master/zsh/functions/spectrum/ +# Sorin Ionescu typeset -Ag FX FG BG FX=( - reset "%{%}" - bold "%{%}" no-bold "%{%}" - italic "%{%}" no-italic "%{%}" - underline "%{%}" no-underline "%{%}" - blink "%{%}" no-blink "%{%}" - reverse "%{%}" no-reverse "%{%}" + none "\e[00m" + normal "\e[22m" + bold "\e[01m" no-bold "\e[22m" + faint "\e[02m" no-faint "\e[22m" + standout "\e[03m" no-standout "\e[23m" + underline "\e[04m" no-underline "\e[24m" + blink "\e[05m" no-blink "\e[25m" + fast-blink "\e[06m" no-fast-blink "\e[25m" + reverse "\e[07m" no-reverse "\e[27m" + conceal "\e[08m" no-conceal "\e[28m" + strikethrough "\e[09m" no-strikethrough "\e[29m" + gothic "\e[20m" no-gothic "\e[22m" + double-underline "\e[21m" no-double-underline "\e[22m" + proportional "\e[26m" no-proportional "\e[50m" + overline "\e[53m" no-overline "\e[55m" + + no-border "\e[54m" + border-rectangle "\e[51m" no-border-rectangle "\e[54m" + border-circle "\e[52m" no-border-circle "\e[54m" + + no-ideogram-marking "\e[65m" + underline-or-right "\e[60m" no-underline-or-right "\e[65m" + double-underline-or-right "\e[61m" no-double-underline-or-right "\e[65m" + overline-or-left "\e[62m" no-overline-or-left "\e[65m" + double-overline-or-left "\e[63m" no-double-overline-or-left "\e[65m" + stress "\e[64m" no-stress "\e[65m" + + font-default "\e[10m" + font-first "\e[11m" no-font-first "\e[10m" + font-second "\e[12m" no-font-second "\e[10m" + font-third "\e[13m" no-font-third "\e[10m" + font-fourth "\e[14m" no-font-fourth "\e[10m" + font-fifth "\e[15m" no-font-fifth "\e[10m" + font-sixth "\e[16m" no-font-sixth "\e[10m" + font-seventh "\e[17m" no-font-seventh "\e[10m" + font-eigth "\e[18m" no-font-eigth "\e[10m" + font-ninth "\e[19m" no-font-ninth "\e[10m" ) -for color in {000..255}; do - FG[$color]="%{[38;5;${color}m%}" - BG[$color]="%{[48;5;${color}m%}" -done +FG[none]="$FX[none]" +BG[none]="$FX[none]" +colors=(black red green yellow blue magenta cyan white) +for color in {0..255}; do + if (( $color >= 0 )) && (( $color < $#colors )); then + index=$(( $color + 1 )) + FG[$colors[$index]]="\e[38;5;${color}m" + BG[$colors[$index]]="\e[48;5;${color}m" + fi + + FG[$color]="\e[38;5;${color}m" + BG[$color]="\e[48;5;${color}m" +done +unset colors color index diff --git a/oh-my-zsh.zsh b/init.zsh similarity index 83% rename from oh-my-zsh.zsh rename to init.zsh index 7635683f0..ab7b6d16a 100644 --- a/oh-my-zsh.zsh +++ b/init.zsh @@ -14,10 +14,10 @@ autoload -Uz compinit && compinit -i # Source function files. source "$OMZ/functions/init.zsh" -# Load all plugins defined in ~/.zshrc. +# Source plugins defined in ~/.zshrc. for plugin in $plugins; do - if [[ -f "$OMZ/plugins/$plugin/$plugin.plugin.zsh" ]]; then - source "$OMZ/plugins/$plugin/$plugin.plugin.zsh" + if [[ -f "$OMZ/plugins/$plugin/init.zsh" ]]; then + source "$OMZ/plugins/$plugin/init.zsh" fi done diff --git a/plugins/ant/ant.plugin.zsh b/plugins/ant/init.zsh similarity index 100% rename from plugins/ant/ant.plugin.zsh rename to plugins/ant/init.zsh diff --git a/plugins/archive/archive.plugin.zsh b/plugins/archive/init.zsh similarity index 100% rename from plugins/archive/archive.plugin.zsh rename to plugins/archive/init.zsh diff --git a/plugins/autojump/autojump.plugin.zsh b/plugins/autojump/init.zsh similarity index 100% rename from plugins/autojump/autojump.plugin.zsh rename to plugins/autojump/init.zsh diff --git a/plugins/brew/brew.plugin.zsh b/plugins/brew/init.zsh similarity index 100% rename from plugins/brew/brew.plugin.zsh rename to plugins/brew/init.zsh diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/init.zsh similarity index 100% rename from plugins/bundler/bundler.plugin.zsh rename to plugins/bundler/init.zsh diff --git a/plugins/cake/cake.plugin.zsh b/plugins/cake/init.zsh similarity index 100% rename from plugins/cake/cake.plugin.zsh rename to plugins/cake/init.zsh diff --git a/plugins/command-not-found/command-not-found.plugin.zsh b/plugins/command-not-found/init.zsh similarity index 100% rename from plugins/command-not-found/command-not-found.plugin.zsh rename to plugins/command-not-found/init.zsh diff --git a/plugins/compleat/compleat.plugin.zsh b/plugins/compleat/init.zsh similarity index 100% rename from plugins/compleat/compleat.plugin.zsh rename to plugins/compleat/init.zsh diff --git a/plugins/dpkg/dpkg.plugin.zsh b/plugins/dpkg/init.zsh similarity index 100% rename from plugins/dpkg/dpkg.plugin.zsh rename to plugins/dpkg/init.zsh diff --git a/plugins/git-flow/git-flow.plugin.zsh b/plugins/git-flow/init.zsh similarity index 100% rename from plugins/git-flow/git-flow.plugin.zsh rename to plugins/git-flow/init.zsh diff --git a/plugins/git/git.plugin.zsh b/plugins/git/init.zsh similarity index 100% rename from plugins/git/git.plugin.zsh rename to plugins/git/init.zsh diff --git a/plugins/github/github.plugin.zsh b/plugins/github/init.zsh similarity index 100% rename from plugins/github/github.plugin.zsh rename to plugins/github/init.zsh diff --git a/plugins/gnu-utils/gnu-utils.plugin.zsh b/plugins/gnu-utils/init.zsh similarity index 100% rename from plugins/gnu-utils/gnu-utils.plugin.zsh rename to plugins/gnu-utils/init.zsh diff --git a/plugins/gpg-agent/gpg-agent.plugin.zsh b/plugins/gpg-agent/init.zsh similarity index 100% rename from plugins/gpg-agent/gpg-agent.plugin.zsh rename to plugins/gpg-agent/init.zsh diff --git a/plugins/history-substring-search/history-substring-search.plugin.zsh b/plugins/history-substring-search/init.zsh similarity index 87% rename from plugins/history-substring-search/history-substring-search.plugin.zsh rename to plugins/history-substring-search/init.zsh index 12d8dc52f..e31eb17ff 100644 --- a/plugins/history-substring-search/history-substring-search.plugin.zsh +++ b/plugins/history-substring-search/init.zsh @@ -1,6 +1,6 @@ # This file integrates the history-substring-search script into oh-my-zsh. -source "${0:r:r}.zsh" +source "${0:h}/history-substring-search.zsh" if check-bool "$CASE_SENSITIVE"; then unset HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS diff --git a/plugins/kate/kate.plugin.zsh b/plugins/kate/init.zsh similarity index 100% rename from plugins/kate/kate.plugin.zsh rename to plugins/kate/init.zsh diff --git a/plugins/leiningen/leiningen.plugin.zsh b/plugins/leiningen/init.zsh similarity index 100% rename from plugins/leiningen/leiningen.plugin.zsh rename to plugins/leiningen/init.zsh diff --git a/plugins/macports/macports.plugin.zsh b/plugins/macports/init.zsh similarity index 100% rename from plugins/macports/macports.plugin.zsh rename to plugins/macports/init.zsh diff --git a/plugins/node/node.plugin.zsh b/plugins/node/init.zsh similarity index 100% rename from plugins/node/node.plugin.zsh rename to plugins/node/init.zsh diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/init.zsh similarity index 100% rename from plugins/osx/osx.plugin.zsh rename to plugins/osx/init.zsh diff --git a/plugins/pacman/pacman.plugin.zsh b/plugins/pacman/init.zsh similarity index 100% rename from plugins/pacman/pacman.plugin.zsh rename to plugins/pacman/init.zsh diff --git a/plugins/perl/perl.plugin.zsh b/plugins/perl/init.zsh similarity index 100% rename from plugins/perl/perl.plugin.zsh rename to plugins/perl/init.zsh diff --git a/plugins/phing/phing.plugin.zsh b/plugins/phing/init.zsh similarity index 100% rename from plugins/phing/phing.plugin.zsh rename to plugins/phing/init.zsh diff --git a/plugins/pow/pow.plugin.zsh b/plugins/pow/init.zsh similarity index 100% rename from plugins/pow/pow.plugin.zsh rename to plugins/pow/init.zsh diff --git a/plugins/python/python.plugin.zsh b/plugins/python/init.zsh similarity index 100% rename from plugins/python/python.plugin.zsh rename to plugins/python/init.zsh diff --git a/plugins/rails/rails.plugin.zsh b/plugins/rails/init.zsh similarity index 100% rename from plugins/rails/rails.plugin.zsh rename to plugins/rails/init.zsh diff --git a/plugins/rsync/rsync.plugin.zsh b/plugins/rsync/init.zsh similarity index 100% rename from plugins/rsync/rsync.plugin.zsh rename to plugins/rsync/init.zsh diff --git a/plugins/ruby/ruby.plugin.zsh b/plugins/ruby/init.zsh similarity index 100% rename from plugins/ruby/ruby.plugin.zsh rename to plugins/ruby/init.zsh diff --git a/plugins/screen/screen.plugin.zsh b/plugins/screen/init.zsh similarity index 100% rename from plugins/screen/screen.plugin.zsh rename to plugins/screen/init.zsh diff --git a/plugins/ssh-agent/ssh-agent.plugin.zsh b/plugins/ssh-agent/init.zsh similarity index 100% rename from plugins/ssh-agent/ssh-agent.plugin.zsh rename to plugins/ssh-agent/init.zsh diff --git a/plugins/taskwarrior/taskwarrior.plugin.zsh b/plugins/taskwarrior/init.zsh similarity index 100% rename from plugins/taskwarrior/taskwarrior.plugin.zsh rename to plugins/taskwarrior/init.zsh diff --git a/plugins/textmate/textmate.plugin.zsh b/plugins/textmate/init.zsh similarity index 100% rename from plugins/textmate/textmate.plugin.zsh rename to plugins/textmate/init.zsh diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/init.zsh similarity index 100% rename from plugins/tmux/tmux.plugin.zsh rename to plugins/tmux/init.zsh diff --git a/plugins/wakeonlan/wakeonlan.plugin.zsh b/plugins/wakeonlan/init.zsh similarity index 100% rename from plugins/wakeonlan/wakeonlan.plugin.zsh rename to plugins/wakeonlan/init.zsh diff --git a/plugins/yum/yum.plugin.zsh b/plugins/yum/init.zsh similarity index 100% rename from plugins/yum/yum.plugin.zsh rename to plugins/yum/init.zsh diff --git a/plugins/z/z.plugin.zsh b/plugins/z/init.zsh similarity index 100% rename from plugins/z/z.plugin.zsh rename to plugins/z/init.zsh diff --git a/templates/zshrc.template.zsh b/templates/zshrc.zsh similarity index 96% rename from templates/zshrc.template.zsh rename to templates/zshrc.zsh index 1cc9130ea..93b67fef0 100644 --- a/templates/zshrc.template.zsh +++ b/templates/zshrc.zsh @@ -24,7 +24,7 @@ COMPLETION_INDICATOR='false' plugins=(git) # This will make you scream: OH MY ZSH! -source "$OMZ/oh-my-zsh.zsh" +source "$OMZ/init.zsh" # Load the prompt theme (type prompt -l to list all themes). # Setting it to 'random' loads a random theme. From 7fa0d20d8c452acb8a7d81d6aad5ac7485653f95 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sat, 8 Oct 2011 22:29:26 -0400 Subject: [PATCH 510/614] Set Apple Terminal current working directory. --- functions/terminal.zsh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/functions/terminal.zsh b/functions/terminal.zsh index d59056ca5..2008e490d 100644 --- a/functions/terminal.zsh +++ b/functions/terminal.zsh @@ -31,6 +31,7 @@ function set-tab-title() { fi } +# Sets the tab and window titles with the command name. function set-title-by-command() { emulate -L zsh setopt localoptions extended_glob @@ -69,12 +70,15 @@ autoload -Uz add-zsh-hook # Sets the tab and window titles before the prompt is displayed. function set-title-precmd { - if check-bool "$AUTO_TITLE"; then + if [[ "$TERM_PROGRAM" != "Apple_Terminal" ]] && check-bool "$AUTO_TITLE"; then set-window-title "${(%):-%~}" for kind in tab screen; do # Left-truncate the current working directory to 15 characters. set-${kind}-title "${(%):-%15<...<%~%<<}" done + else + # Set Apple Terminal current working directory. + printf '\e]7;%s\a' "file://$HOST${PWD// /%20}" fi } add-zsh-hook precmd set-title-precmd From faeca828312951ae41d5faa7885d6190f0a537fa Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Fri, 23 Sep 2011 20:11:33 -0400 Subject: [PATCH 511/614] The functions directory should only hold functions. --- functions/alias.zsh => alias.zsh | 0 functions/completion.zsh => completion.zsh | 0 functions/directory.zsh => directory.zsh | 0 functions/environment.zsh => environment.zsh | 0 functions/init.zsh | 12 --------- functions/helper.zsh => helper.zsh | 0 functions/history.zsh => history.zsh | 0 init.zsh | 28 +++++++++++++++----- functions/keyboard.zsh => keyboard.zsh | 0 functions/spectrum.zsh => spectrum.zsh | 0 functions/terminal.zsh => terminal.zsh | 0 functions/utility.zsh => utility.zsh | 0 12 files changed, 22 insertions(+), 18 deletions(-) rename functions/alias.zsh => alias.zsh (100%) rename functions/completion.zsh => completion.zsh (100%) rename functions/directory.zsh => directory.zsh (100%) rename functions/environment.zsh => environment.zsh (100%) delete mode 100644 functions/init.zsh rename functions/helper.zsh => helper.zsh (100%) rename functions/history.zsh => history.zsh (100%) rename functions/keyboard.zsh => keyboard.zsh (100%) rename functions/spectrum.zsh => spectrum.zsh (100%) rename functions/terminal.zsh => terminal.zsh (100%) rename functions/utility.zsh => utility.zsh (100%) diff --git a/functions/alias.zsh b/alias.zsh similarity index 100% rename from functions/alias.zsh rename to alias.zsh diff --git a/functions/completion.zsh b/completion.zsh similarity index 100% rename from functions/completion.zsh rename to completion.zsh diff --git a/functions/directory.zsh b/directory.zsh similarity index 100% rename from functions/directory.zsh rename to directory.zsh diff --git a/functions/environment.zsh b/environment.zsh similarity index 100% rename from functions/environment.zsh rename to environment.zsh diff --git a/functions/init.zsh b/functions/init.zsh deleted file mode 100644 index 0c7765db4..000000000 --- a/functions/init.zsh +++ /dev/null @@ -1,12 +0,0 @@ -# Source function files (the order matters). -source "${0:h}/helper.zsh" -source "${0:h}/environment.zsh" -source "${0:h}/terminal.zsh" -source "${0:h}/keyboard.zsh" -source "${0:h}/completion.zsh" -source "${0:h}/history.zsh" -source "${0:h}/directory.zsh" -source "${0:h}/alias.zsh" -source "${0:h}/spectrum.zsh" -source "${0:h}/utility.zsh" - diff --git a/functions/helper.zsh b/helper.zsh similarity index 100% rename from functions/helper.zsh rename to helper.zsh diff --git a/functions/history.zsh b/history.zsh similarity index 100% rename from functions/history.zsh rename to history.zsh diff --git a/init.zsh b/init.zsh index ab7b6d16a..b95f536fc 100644 --- a/init.zsh +++ b/init.zsh @@ -6,13 +6,27 @@ if [[ "$TERM" == 'dumb' ]]; then fi # Add functions to fpath. -fpath=($OMZ/themes/*(/) $OMZ/plugins/${^plugins} $OMZ/functions $fpath) +fpath=( + $OMZ/themes/*(/N) + ${plugins:+$OMZ/plugins/${^plugins}} + $OMZ/functions + $fpath +) -# Load and initialize the completion system. +# Load and initialize the completion system ignoring insecure directories. autoload -Uz compinit && compinit -i -# Source function files. -source "$OMZ/functions/init.zsh" +# Source files (the order matters). +source "$OMZ/helper.zsh" +source "$OMZ/environment.zsh" +source "$OMZ/terminal.zsh" +source "$OMZ/keyboard.zsh" +source "$OMZ/completion.zsh" +source "$OMZ/history.zsh" +source "$OMZ/directory.zsh" +source "$OMZ/alias.zsh" +source "$OMZ/spectrum.zsh" +source "$OMZ/utility.zsh" # Source plugins defined in ~/.zshrc. for plugin in $plugins; do @@ -20,14 +34,16 @@ for plugin in $plugins; do source "$OMZ/plugins/$plugin/init.zsh" fi done +unset plugin +unset plugins -# Set PATH for Mac OS X GUI applications (requires re-login). +# Set environment variables for launchd processes. if [[ "$OSTYPE" == darwin* ]]; then launchctl setenv PATH "$PATH" &! fi # Load and run the prompt theming system. -autoload -Uz promptinit && promptinit -i +autoload -Uz promptinit && promptinit # Compile zcompdump, if modified, to increase startup speed. if [[ "$HOME/.zcompdump" -nt "$HOME/.zcompdump.zwc" ]] || [[ ! -f "$HOME/.zcompdump.zwc" ]]; then diff --git a/functions/keyboard.zsh b/keyboard.zsh similarity index 100% rename from functions/keyboard.zsh rename to keyboard.zsh diff --git a/functions/spectrum.zsh b/spectrum.zsh similarity index 100% rename from functions/spectrum.zsh rename to spectrum.zsh diff --git a/functions/terminal.zsh b/terminal.zsh similarity index 100% rename from functions/terminal.zsh rename to terminal.zsh diff --git a/functions/utility.zsh b/utility.zsh similarity index 100% rename from functions/utility.zsh rename to utility.zsh From cba6398e2496da04dbaf9567d707537e2bb79a5e Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Fri, 23 Sep 2011 20:22:41 -0400 Subject: [PATCH 512/614] Added zsh-completions. --- .gitmodules | 3 +++ completions | 1 + 2 files changed, 4 insertions(+) create mode 100644 .gitmodules create mode 160000 completions diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..7674c96f7 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "completions"] + path = completions + url = https://github.com/zsh-users/zsh-completions.git diff --git a/completions b/completions new file mode 160000 index 000000000..62436acb8 --- /dev/null +++ b/completions @@ -0,0 +1 @@ +Subproject commit 62436acb8acbc3db4993142e84b4e851ab744213 From 15ed7860f3ad8ee9e9108af7702b024f0815e19c Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Fri, 23 Sep 2011 20:24:19 -0400 Subject: [PATCH 513/614] Enabled zsh-completions. --- init.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/init.zsh b/init.zsh index b95f536fc..d64301026 100644 --- a/init.zsh +++ b/init.zsh @@ -10,6 +10,7 @@ fpath=( $OMZ/themes/*(/N) ${plugins:+$OMZ/plugins/${^plugins}} $OMZ/functions + $OMZ/completions $fpath ) From 3dbc808b96e959d220b102f7ccdc6c69ad6b1a1c Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Tue, 27 Sep 2011 18:51:56 -0400 Subject: [PATCH 514/614] Removed completions managed by zsh-completions. --- plugins/ant/init.zsh | 27 --- plugins/brew/.gitignore | 1 - plugins/brew/init.zsh | 19 -- plugins/cake/init.zsh | 33 ---- plugins/capistrano/_cap | 20 -- plugins/chef/_knife | 191 ------------------- plugins/cpanm/_cpanm | 67 ------- plugins/gas/_gas | 36 ---- plugins/git-flow/init.zsh | 332 --------------------------------- plugins/github/_github | 41 ---- plugins/heroku/_heroku | 159 ---------------- plugins/leiningen/init.zsh | 28 --- plugins/macports/_port | 89 --------- plugins/phing/init.zsh | 21 --- plugins/powder/_powder | 5 - plugins/python/_pip | 47 ----- plugins/redis/_redis-cli | 143 -------------- plugins/ruby/.gitignore | 1 - plugins/ruby/_gem | 67 ------- plugins/ruby/init.zsh | 14 -- plugins/taskwarrior/.gitignore | 1 - plugins/taskwarrior/init.zsh | 25 --- plugins/thor/_thor | 5 - plugins/vagrant/_vagrant | 100 ---------- 24 files changed, 1472 deletions(-) delete mode 100644 plugins/ant/init.zsh delete mode 100644 plugins/brew/.gitignore delete mode 100644 plugins/brew/init.zsh delete mode 100644 plugins/cake/init.zsh delete mode 100644 plugins/capistrano/_cap delete mode 100644 plugins/chef/_knife delete mode 100644 plugins/cpanm/_cpanm delete mode 100644 plugins/gas/_gas delete mode 100644 plugins/git-flow/init.zsh delete mode 100644 plugins/github/_github delete mode 100644 plugins/heroku/_heroku delete mode 100644 plugins/leiningen/init.zsh delete mode 100644 plugins/macports/_port delete mode 100644 plugins/phing/init.zsh delete mode 100644 plugins/powder/_powder delete mode 100644 plugins/python/_pip delete mode 100644 plugins/redis/_redis-cli delete mode 100644 plugins/ruby/.gitignore delete mode 100644 plugins/ruby/_gem delete mode 100644 plugins/taskwarrior/.gitignore delete mode 100644 plugins/taskwarrior/init.zsh delete mode 100644 plugins/thor/_thor delete mode 100644 plugins/vagrant/_vagrant diff --git a/plugins/ant/init.zsh b/plugins/ant/init.zsh deleted file mode 100644 index 3bdde6b79..000000000 --- a/plugins/ant/init.zsh +++ /dev/null @@ -1,27 +0,0 @@ -if stat -f%m . &> /dev/null; then - stat_cmd=(stat -f%m) -else - stat_cmd=(stat -L --format=%Y) -fi - -function _ant_does_target_list_need_generating() { - if [[ ! -f .ant_targets ]]; then - return 0 - else - accurate=$($stat_cmd .ant_targets) - changed=$($stat_cmd build.xml) - return $(expr $accurate '>=' $changed) - fi -} - -function _ant() { - if [[ -f build.xml ]]; then - if _ant_does_target_list_need_generating; then - sed -n '/ .ant_targets - fi - compadd `cat .ant_targets` - fi -} - -compdef _ant ant - diff --git a/plugins/brew/.gitignore b/plugins/brew/.gitignore deleted file mode 100644 index d5e2d21bb..000000000 --- a/plugins/brew/.gitignore +++ /dev/null @@ -1 +0,0 @@ -_brew diff --git a/plugins/brew/init.zsh b/plugins/brew/init.zsh deleted file mode 100644 index a2f63cefb..000000000 --- a/plugins/brew/init.zsh +++ /dev/null @@ -1,19 +0,0 @@ -# Complete brew. -completion_file="${0:h}/_brew" -if [[ ! -e "$completion_file" ]]; then - if [[ -L "$completion_file" ]]; then - unlink "$completion_file" 2> /dev/null - fi - - if (( $+commands[brew] )); then - ln -s \ - "$(brew --prefix)/Library/Contributions/brew_zsh_completion.zsh" \ - "$completion_file" \ - 2> /dev/null - fi -fi -unset completion_file - -# Aliases -alias brews='brew list -1' - diff --git a/plugins/cake/init.zsh b/plugins/cake/init.zsh deleted file mode 100644 index 590183402..000000000 --- a/plugins/cake/init.zsh +++ /dev/null @@ -1,33 +0,0 @@ -# Set this to 1 if you want to cache the tasks. -cache_task_list=1 - -# Cache filename. -cache_file='.cake_task_cache' - -function _cake_does_target_list_need_generating() { - if [[ $cache_task_list -eq 0 ]]; then - return 1 - fi - - if [[ ! -f $cache_file ]]; then - return 0 - else - accurate=$(stat -f%m $cache_file) - changed=$(stat -f%m Cakefile) - return $(expr $accurate '>=' $changed) - fi -} - -function _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` - else - compadd `cake | sed -e "s/cake \([^ ]*\) .*/\1/" | grep -v '^$'` - fi - fi -} - -compdef _cake cake - diff --git a/plugins/capistrano/_cap b/plugins/capistrano/_cap deleted file mode 100644 index afbdb431c..000000000 --- a/plugins/capistrano/_cap +++ /dev/null @@ -1,20 +0,0 @@ -#compdef cap -#autoload - -function _cap-does-task-list-need-generating() { - if [[ ! -f .cap_tasks~ ]]; then return 0; - else - accurate=$(stat -f%m .cap_tasks~) - changed=$(stat -f%m config/deploy.rb) - return $(expr $accurate '>=' $changed) - fi -} - -if [[ -f config/deploy.rb ]]; then - if _cap-does-task-list-need-generating; then - echo "\nGenerating .cap_tasks~..." > /dev/stderr - cap --tasks | grep '#' | cut -d " " -f 2 > .cap_tasks~ - fi - compadd $(cat .cap_tasks~) -fi - diff --git a/plugins/chef/_knife b/plugins/chef/_knife deleted file mode 100644 index 94d9cff24..000000000 --- a/plugins/chef/_knife +++ /dev/null @@ -1,191 +0,0 @@ -#compdef knife - -# These flags should be available everywhere according to the knife man page. -knife_general_flags=( - --help - --server-url - --key - --config - --editor - --format - --log_level - --logfile - --no-editor - --user - --print-after - --version - --yes -) - -# Knife has a very special syntax, some example calls are: -# knife status -# knife cookbook list -# knife role show ROLENAME -# knife data bag show DATABAGNAME -# knife role show ROLENAME --attribute ATTRIBUTENAME -# knife cookbook show COOKBOOKNAME COOKBOOKVERSION recipes - -# The -Q switch in compadd allows for completion of things like "data bag" without -# having to go through two rounds of completion and avoids ZSH inserting a '\' for -# escaping spaces. -function _knife() { - local curcontext="$curcontext" state line - typeset -A opt_args - cloudproviders=(bluebox ec2 rackspace slicehost terremark) - _arguments \ - '1: :->knifecmd'\ - '2: :->knifesubcmd'\ - '3: :->knifesubcmd2' \ - '4: :->knifesubcmd3' \ - '5: :->knifesubcmd4' \ - '6: :->knifesubcmd5' - - case $state in - (knifecmd) - compadd -Q "$@" bootstrap client configure cookbook "cookbook site" "data bag" exec index node recipe role search ssh status windows $cloudproviders - ;; - (knifesubcmd) - case $words[2] in - (bluebox|ec2|rackspace|slicehost|terremark) - compadd "$@" server images - ;; - (client) - compadd -Q "$@" "bulk delete" list create show delete edit reregister - ;; - (configure) - compadd "$@" client - ;; - (cookbook) - compadd -Q "$@" test list create download delete "metadata from" show "bulk delete" metadata upload - ;; - (node) - compadd -Q "$@" "from file" create show edit delete list run_list "bulk delete" - ;; - (recipe) - compadd "$@" list - ;; - (role) - compadd -Q "$@" "bulk delete" create delete edit "from file" list show - ;; - (windows) - compadd "$@" bootstrap - ;; - (*) - _arguments '2:Subsubcommands:($(_knife_options1))' - esac - ;; - (knifesubcmd2) - case $words[3] in - (server) - compadd "$@" list create delete - ;; - (images) - compadd "$@" list - ;; - (site) - compadd "$@" vendor show share search download list unshare - ;; - (show|delete|edit) - _arguments '3:Subsubcommands:($(_chef_$words[2]s_remote))' - ;; - (upload|test) - _arguments '3:Subsubcommands:($(_chef_$words[2]s_local) --all)' - ;; - (list) - compadd -a "$@" knife_general_flags - ;; - (bag) - compadd -Q "$@" show edit list "from file" create delete - ;; - (*) - _arguments '3:Subsubcommands:($(_knife_options2))' - esac - ;; - (knifesubcmd3) - case $words[3] in - (show) - case $words[2] in - (cookbook) - versioncomp=1 - _arguments '4:Cookbookversions:($(_cookbook_versions) latest)' - ;; - (node|client|role) - compadd "$@" --attribute - esac - esac - case $words[4] in - (show|edit) - _arguments '4:Subsubsubcommands:($(_chef_$words[2]_$words[3]s_remote))' - ;; - (file) - _arguments '*:file or directory:_files -g "*.(rb|json)"' - ;; - (list) - compadd -a "$@" knife_general_flags - ;; - (*) - _arguments '*:Subsubcommands:($(_knife_options3))' - esac - ;; - (knifesubcmd4) - if (( versioncomp > 0 )); then - compadd "$@" attributes definitions files libraries providers recipes resources templates - else - _arguments '*:Subsubcommands:($(_knife_options2))' - fi - ;; - (knifesubcmd5) - _arguments '*:Subsubcommands:($(_knife_options3))' - esac -} - -# Helper functions to provide the argument completion for several depths of commands -function _knife_options1() { - ( for line in $( knife $words[2] --help | grep -v "^knife" ); do echo $line | grep "\-\-"; done ) -} - -function _knife_options2() { - ( for line in $( knife $words[2] $words[3] --help | grep -v "^knife" ); do echo $line | grep "\-\-"; done ) -} - -function _knife_options3() { - ( for line in $( knife $words[2] $words[3] $words[4] --help | grep -v "^knife" ); do echo $line | grep "\-\-"; done ) -} - -# The chef_x_remote functions use knife to get a list of objects of type x on the server -function _chef_roles_remote() { - (knife role list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') -} - -function _chef_clients_remote() { - (knife client list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') -} - -function _chef_nodes_remote() { - (knife node list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') -} - -function _chef_cookbooks_remote() { - (knife cookbook list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') -} - -function _chef_sitecookbooks_remote() { - (knife cookbook site list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') -} - -function _chef_data_bags_remote() { - (knife data bag list | grep \" | awk '{print $1}' | awk -F"," '{print $1}' | awk -F"\"" '{print $2}') -} - -# The chef_x_local functions use the knife config to find the paths of relevant objects x to be uploaded to the server -function _chef_cookbooks_local() { - (for i in $( grep cookbook_path $HOME/.chef/knife.rb | awk 'BEGIN {FS = "[" }; {print $2}' | sed 's/\,//g' | sed "s/'//g" | sed 's/\(.*\)]/\1/' ); do ls $i; done) -} - -# This function extracts the available cookbook versions on the chef server -function _cookbook_versions() { - (knife cookbook show $words[4] | grep -v $words[4] | grep -v -E '\]|\[|\{|\}' | sed 's/ //g' | sed 's/"//g') -} - -function _knife "$@" - diff --git a/plugins/cpanm/_cpanm b/plugins/cpanm/_cpanm deleted file mode 100644 index 58451d35a..000000000 --- a/plugins/cpanm/_cpanm +++ /dev/null @@ -1,67 +0,0 @@ -#compdef cpanm - -## -# cpanminus Z Shell completion script -## -# -# Current supported cpanm version: 1.4000 (Tue Mar 8 01:00:49 PST 2011) -# -# The latest code is always located at: -# https://github.com/rshhh/cpanminus/blob/master/etc/_cpanm -# - -local arguments curcontext="$curcontext" -typeset -A opt_args - - -arguments=( - -# Commands -# '(--install -i)'{--install,-i}'[Installs the modules]' - '(- :)--self-upgrade[Upgrades itself]' - '(- :)--info[Displays distribution info on CPAN]' - '(--installdeps)--installdeps[Only install dependencies]' - '(--look)--look[Download/unpack the distribution and then open the directory with your shell]' - '(- :)'{--help,-h}'[Displays help information]' - '(- :)'{--version,-V}'[Displays software version]' - -# Options - {--force,-f}'[Force install]' - {--notest,-n}'[Do not run unit tests]' - {--sudo,-S}'[sudo to run install commands]' - '(-v --verbose --quiet -q)'{--verbose,-v}'[Turns on chatty output]' - '(-q --quiet --verbose -v)'{--quiet,-q}'[Turns off all output]' - {--local-lib,-l}'[Specify the install base to install modules]' - {--local-lib-contained,-L}'[Specify the install base to install all non-core modules]' - '--mirror[Specify the base URL for the mirror (e.g. http://cpan.cpantesters.org/)]:URLs:_urls' - '--mirror-only[Use the mirror\''s index file instead of the CPAN Meta DB]' - '--prompt[Prompt when configure/build/test fails]' - '--reinstall[Reinstall the distribution even if you already have the latest version installed]' - '--interactive[Turn on interactive configure]' - - '--scandeps[Scan the depencencies of given modules and output the tree in a text format]' - '--format[Specify what format to display the scanned dependency tree]:scandeps format:(tree json yaml dists)' - - '--save-dists[Specify the optional directory path to copy downloaded tarballs]' -# '--uninst-shadows[Uninstalls the shadow files of the distribution that you\''re installing]' - - '--auto-cleanup[Number of days that cpanm\''s work directories expire in. Defaults to 7]' - '(--no-man-pages)--man-pages[Generates man pages for executables (man1) and libraries (man3)]' - '(--man-pages)--no-man-pages[Do not generate man pages]' - - - # Note: Normally with "--lwp", "--wget" and "--curl" options set to true (which is the default) cpanm tries LWP, - # Wget, cURL and HTTP::Tiny (in that order) and uses the first one available. - # (So that the exclusions are not enabled here for the completion) - '(--lwp)--lwp[Use LWP module to download stuff]' - '(--wget)--wget[Use GNU Wget (if available) to download stuff]' - '(--curl)--curl[Use cURL (if available) to download stuff]' - -# Other completions - '*:Local directory or archive:_files -/ -g "*.(tar.gz|tgz|tar.bz2|zip)(-.)"' - # '*::args: _normal' # this looks for default files (any files) -) -_arguments -s $arguments \ - && return 0 - -return 1 diff --git a/plugins/gas/_gas b/plugins/gas/_gas deleted file mode 100644 index 7b642a331..000000000 --- a/plugins/gas/_gas +++ /dev/null @@ -1,36 +0,0 @@ -#compdef gas -#autoload - -local curcontext="$curcontext" state line cmds ret=1 - -_arguments -C \ - '(- 1 *)'{-v,--version}'[display version information]' \ - '(-h|--help)'{-h,--help}'[show help information]' \ - '1: :->cmds' \ - '*: :->args' && ret=0 - -case "$state" in - (cmds) - cmds=( - "version:Prints Gas's version" - "use:Uses author" - "show:Shows your current user" - "list:Lists your authors" - "import:Imports current user to gasconfig" - "help:Describe available tasks or one specific task" - "delete:Deletes author" - "add:Adds author to gasconfig" - ) - _describe -t commands 'gas command' cmds && ret=0 - ;; - (args) - case "$line[1]" in - (use|delete) - _values -S , 'authors' $(cat ~/.gas | sed -n -e 's/^\[\(.*\)\]/\1/p') && ret=0 - ;; - esac - ;; -esac - -return ret - diff --git a/plugins/git-flow/init.zsh b/plugins/git-flow/init.zsh deleted file mode 100644 index a889473e8..000000000 --- a/plugins/git-flow/init.zsh +++ /dev/null @@ -1,332 +0,0 @@ -#!zsh -# -# Installation -# ------------ -# -# To achieve git-flow completion nirvana: -# -# 0. Update your zsh's git-completion module to the newest verion. -# From here. http://zsh.git.sourceforge.net/git/gitweb.cgi?p=zsh/zsh;a=blob_plain;f=Completion/Unix/Command/_git;hb=HEAD -# -# 1. Install this file. Either: -# -# a. Place it in your .zshrc: -# -# b. Or, copy it somewhere (e.g. ~/.git-flow-completion.zsh) and put the following line in -# your .zshrc: -# -# source ~/.git-flow-completion.zsh -# -# c. Or, use this file as a oh-my-zsh plugin. -# - -_git-flow () -{ - local curcontext="$curcontext" state line - typeset -A opt_args - - _arguments -C \ - ':command:->command' \ - '*::options:->options' - - case $state in - (command) - - local -a subcommands - subcommands=( - 'init:Initialize a new git repo with support for the branching model.' - 'feature:Manage your feature branches.' - 'release:Manage your release branches.' - 'hotfix:Manage your hotfix branches.' - 'support:Manage your support branches.' - 'version:Shows version information.' - ) - _describe -t commands 'git flow' subcommands - ;; - - (options) - case $line[1] in - - (init) - _arguments \ - -f'[Force setting of gitflow branches, even if already configured]' - ;; - - (version) - ;; - - (hotfix) - __git-flow-hotfix - ;; - - (release) - __git-flow-release - ;; - - (feature) - __git-flow-feature - ;; - esac - ;; - esac -} - -__git-flow-release () -{ - local curcontext="$curcontext" state line - typeset -A opt_args - - _arguments -C \ - ':command:->command' \ - '*::options:->options' - - case $state in - (command) - - local -a subcommands - subcommands=( - 'start:Start a new release branch.' - 'finish:Finish a release branch.' - 'list:List all your release branches. (Alias to `git flow release`)' - ) - _describe -t commands 'git flow release' subcommands - _arguments \ - -v'[Verbose (more) output]' - ;; - - (options) - case $line[1] in - - (start) - _arguments \ - -F'[Fetch from origin before performing finish]'\ - ':version:__git_flow_version_list' - ;; - - (finish) - _arguments \ - -F'[Fetch from origin before performing finish]' \ - -s'[Sign the release tag cryptographically]'\ - -u'[Use the given GPG-key for the digital signature (implies -s)]'\ - -m'[Use the given tag message]'\ - -p'[Push to $ORIGIN after performing finish]'\ - ':version:__git_flow_version_list' - ;; - - *) - _arguments \ - -v'[Verbose (more) output]' - ;; - esac - ;; - esac -} - -__git-flow-hotfix () -{ - local curcontext="$curcontext" state line - typeset -A opt_args - - _arguments -C \ - ':command:->command' \ - '*::options:->options' - - case $state in - (command) - - local -a subcommands - subcommands=( - 'start:Start a new hotfix branch.' - 'finish:Finish a hotfix branch.' - 'list:List all your hotfix branches. (Alias to `git flow hotfix`)' - ) - _describe -t commands 'git flow hotfix' subcommands - _arguments \ - -v'[Verbose (more) output]' - ;; - - (options) - case $line[1] in - - (start) - _arguments \ - -F'[Fetch from origin before performing finish]'\ - ':hotfix:__git_flow_version_list'\ - ':branch-name:__git_branch_names' - ;; - - (finish) - _arguments \ - -F'[Fetch from origin before performing finish]' \ - -s'[Sign the release tag cryptographically]'\ - -u'[Use the given GPG-key for the digital signature (implies -s)]'\ - -m'[Use the given tag message]'\ - -p'[Push to $ORIGIN after performing finish]'\ - ':hotfix:__git_flow_hotfix_list' - ;; - - *) - _arguments \ - -v'[Verbose (more) output]' - ;; - esac - ;; - esac -} - -__git-flow-feature () -{ - local curcontext="$curcontext" state line - typeset -A opt_args - - _arguments -C \ - ':command:->command' \ - '*::options:->options' - - case $state in - (command) - - local -a subcommands - subcommands=( - 'start:Start a new feature branch.' - 'finish:Finish a feature branch.' - 'list:List all your feature branches. (Alias to `git flow feature`)' - 'publish: public' - 'track: track' - 'diff: diff' - 'rebase: rebase' - 'checkout: checkout' - 'pull: pull' - ) - _describe -t commands 'git flow feature' subcommands - _arguments \ - -v'[Verbose (more) output]' - ;; - - (options) - case $line[1] in - - (start) - _arguments \ - -F'[Fetch from origin before performing finish]'\ - ':feature:__git_flow_feature_list'\ - ':branch-name:__git_branch_names' - ;; - - (finish) - _arguments \ - -F'[Fetch from origin before performing finish]' \ - -r'[Rebase instead of merge]'\ - ':feature:__git_flow_feature_list' - ;; - - (publish) - _arguments \ - ':feature:__git_flow_feature_list'\ - ;; - - (track) - _arguments \ - ':feature:__git_flow_feature_list'\ - ;; - - (diff) - _arguments \ - ':branch:__git_branch_names'\ - ;; - - (rebase) - _arguments \ - -i'[Do an interactive rebase]' \ - ':branch:__git_branch_names' - ;; - - (checkout) - _arguments \ - ':branch:__git_flow_feature_list'\ - ;; - - (pull) - _arguments \ - ':remote:__git_remotes'\ - ':branch:__git_branch_names' - ;; - - *) - _arguments \ - -v'[Verbose (more) output]' - ;; - esac - ;; - esac -} - -__git_flow_version_list () -{ - local expl - declare -a versions - - versions=(${${(f)"$(_call_program versions git flow release list 2> /dev/null | tr -d ' |*')"}}) - __git_command_successful || return - - _wanted versions expl 'version' compadd $versions -} - -__git_flow_feature_list () -{ - local expl - declare -a features - - features=(${${(f)"$(_call_program features git flow feature list 2> /dev/null | tr -d ' |*')"}}) - __git_command_successful || return - - _wanted features expl 'feature' compadd $features -} - -__git_remotes () { - local expl gitdir remotes - - gitdir=$(_call_program gitdir git rev-parse --git-dir 2>/dev/null) - __git_command_successful || return - - remotes=(${${(f)"$(_call_program remotes git config --get-regexp '"^remote\..*\.url$"')"}//#(#b)remote.(*).url */$match[1]}) - __git_command_successful || return - - # TODO: Should combine the two instead of either or. - if (( $#remotes > 0 )); then - _wanted remotes expl remote compadd $* - $remotes - else - _wanted remotes expl remote _files $* - -W "($gitdir/remotes)" -g "$gitdir/remotes/*" - fi -} - -__git_flow_hotfix_list () -{ - local expl - declare -a hotfixes - - hotfixes=(${${(f)"$(_call_program hotfixes git flow hotfix list 2> /dev/null | tr -d ' |*')"}}) - __git_command_successful || return - - _wanted hotfixes expl 'hotfix' compadd $hotfixes -} - -__git_branch_names () { - local expl - declare -a branch_names - - branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/}) - __git_command_successful || return - - _wanted branch-names expl branch-name compadd $* - $branch_names -} - -__git_command_successful () { - if (( ${#pipestatus:#0} > 0 )); then - _message 'not a git repository' - return 1 - fi - return 0 -} - -zstyle ':completion:*:*:git:*' user-commands flow:'description for foo' diff --git a/plugins/github/_github b/plugins/github/_github deleted file mode 100644 index 932ac5a6d..000000000 --- a/plugins/github/_github +++ /dev/null @@ -1,41 +0,0 @@ -#compdef github -#autoload - -# The github-gem is neccessary for this completion to work. -# http://github.com/defunkt/github-gem - -# This completion is based on the Homebrew completion. - -local -a _1st_arguments -_1st_arguments=( - 'browse:Open this repo in a web browser' - 'clone:Clone a repo' - 'config:Automatically set configuration info, or pass args to specify' - 'create-from-local:Create a new GitHub repository from the current local repository' - 'create:Create a new empty GitHub repository' - 'fetch:Fetch from a remote to a local branch' - 'fetch_all:Fetch all refs from a user' - 'fork:Forks a GitHub repository' - 'home:Open this repos master branch in a web browser' - 'ignore:Ignore a SHA from github network commits' - 'info:Info about this project' - 'issues:Project issues tools' - 'network:Project network tools - sub-commands : web [user], list, fetch, commits' - 'open:Open the given user/project in a web browser' - 'pull-request:Generate the text for a pull request' - 'pull:Pull from a remote' - 'search:Search GitHub for the given repository name' - 'track:Track another users repository' -) - -local expl -local -a pkgs installed_pkgs - -_arguments \ - '*:: :->subcmds' && return 0 - -if (( CURRENT == 1 )); then - _describe -t commands "github subcommand" _1st_arguments - return -fi - diff --git a/plugins/heroku/_heroku b/plugins/heroku/_heroku deleted file mode 100644 index f57d3d6a3..000000000 --- a/plugins/heroku/_heroku +++ /dev/null @@ -1,159 +0,0 @@ -#compdef heroku -#autoload - -# Heroku Autocomplete plugin for Oh-My-Zsh -# Requires: The Heroku client gem (https://github.com/heroku/heroku) -# Author: Ali B. (http://awhitebox.com) - -local -a _1st_arguments -_1st_arguments=( - "account\:confirm_billing":"Confirm that your account can be billed at the end of the month" - "addons":"list installed addons" - "addons\:list":"list all available addons" - "addons\:add":"install an addon" - "addons\:upgrade":"upgrade an existing addon" - "addons\:downgrade":"downgrade an existing addon" - "addons\:remove":"uninstall an addon" - "addons\:open":"open an addon's dashboard in your browser" - "apps":"list your apps" - "apps\:info":"show detailed app information" - "apps\:create":"create a new app" - "apps\:rename":"rename the app" - "apps\:open":"open the app in a web browser" - "apps\:destroy":"permanently destroy an app" - "auth\:login":"log in with your heroku credentials" - "auth\:logout":"clear local authentication credentials" - "config":"display the config vars for an app" - "config\:add":"add one or more config vars" - "config\:remove":"remove a config var" - "db\:push":"push local data up to your app" - "db\:pull":"pull heroku data down into your local database" - "domains":"list custom domains for an app" - "domains\:add":"add a custom domain to an app" - "domains\:remove":"remove a custom domain from an app" - "domains\:clear":"remove all custom domains from an app" - "help":"list available commands or display help for a specific command" - "keys":"display keys for the current user" - "keys\:add":"add a key for the current user" - "keys\:remove":"remove a key from the current user" - "keys\:clear":"remove all authentication keys from the current user" - "logs":"display recent log output" - "logs\:cron":"DEPRECATED: display cron logs from legacy logging" - "logs\:drains":"manage syslog drains" - "maintenance\:on":"put the app into maintenance mode" - "maintenance\:off":"take the app out of maintenance mode" - "pg\:info":"display database information" - "pg\:ingress":"allow direct connections to the database from this IP for one minute" - "pg\:promote":"sets DATABASE as your DATABASE_URL" - "pg\:psql":"open a psql shell to the database" - "pg\:reset":"delete all data in DATABASE" - "pg\:unfollow":"stop a replica from following and make it a read/write database" - "pg\:wait":"monitor database creation, exit when complete" - "pgbackups":"list captured backups" - "pgbackups\:url":"get a temporary URL for a backup" - "pgbackups\:capture":"capture a backup from a database id" - "pgbackups\:restore":"restore a backup to a database" - "pgbackups\:destroy":"destroys a backup" - "plugins":"list installed plugins" - "plugins\:install":"install a plugin" - "plugins\:uninstall":"uninstall a plugin" - "ps\:dynos":"scale to QTY web processes" - "ps\:workers":"scale to QTY background processes" - "ps":"list processes for an app" - "ps\:restart":"restart an app process" - "ps\:scale":"scale processes by the given amount" - "releases":"list releases" - "releases\:info":"view detailed information for a release" - "rollback":"roll back to an older release" - "run":"run an attached process" - "run\:rake":"remotely execute a rake command" - "run\:console":"open a remote console session" - "sharing":"list collaborators on an app" - "sharing\:add":"add a collaborator to an app" - "sharing\:remove":"remove a collaborator from an app" - "sharing\:transfer":"transfer an app to a new owner" - "ssl":"list certificates for an app" - "ssl\:add":"add an ssl certificate to an app" - "ssl\:remove":"remove an ssl certificate from an app" - "ssl\:clear":"remove all ssl certificates from an app" - "stack":"show the list of available stacks" - "stack\:migrate":"prepare migration of this app to a new stack" - "version":"show heroku client version" -) - -_arguments '*:: :->command' - -if (( CURRENT == 1 )); then - _describe -t commands "heroku command" _1st_arguments - return -fi - -local -a _command_args -case "$words[1]" in - apps:info) - _command_args=( - '(-r|--raw)'{-r,--raw}'[output info as raw key/value pairs]' \ - ) - ;; - apps:create) - _command_args=( - '(-a|--addons)'{-a,--addons}'[a list of addons to install]' \ - '(-r|--remote)'{-r,--remote}'[the git remote to create, default "heroku"]' \ - '(-s|--stack)'{-s,--stack}'[the stack on which to create the app]' \ - ) - ;; - config) - _command_args=( - '(-s|--shell)'{-s,--shell}'[output config vars in shell format]' \ - ) - ;; - db:push) - _command_args=( - '(-c|--chunksize)'{-c,--chunksize}'[specify the number of rows to send in each batch]' \ - '(-d|--debug)'{-d,--debug}'[enable debugging output]' \ - '(-e|--exclude)'{-e,--exclude}'[exclude the specified tables from the push]' \ - '(-f|--filter)'{-f,--filter}'[only push certain tables]' \ - '(-r|--resume)'{-r,--resume}'[resume transfer described by a .dat file]' \ - '(-t|--tables)'{-t,--tables}'[only push the specified tables]' \ - ) - ;; - db:pull) - _command_args=( - '(-c|--chunksize)'{-c,--chunksize}'[specify the number of rows to send in each batch]' \ - '(-d|--debug)'{-d,--debug}'[enable debugging output]' \ - '(-e|--exclude)'{-e,--exclude}'[exclude the specified tables from the pull]' \ - '(-f|--filter)'{-f,--filter}'[only pull certain tables]' \ - '(-r|--resume)'{-r,--resume}'[resume transfer described by a .dat file]' \ - '(-t|--tables)'{-t,--tables}'[only pull the specified tables]' \ - ) - ;; - keys) - _command_args=( - '(-l|--long)'{-l,--long}'[display extended information for each key]' \ - ) - ;; - logs) - _command_args=( - '(-n|--num)'{-n,--num}'[the number of lines to display]' \ - '(-p|--ps)'{-p,--ps}'[only display logs from the given process]' \ - '(-s|--source)'{-s,--source}'[only display logs from the given source]' \ - '(-t|--tail)'{-t,--tail}'[continually stream logs]' \ - ) - ;; - pgbackups:capture) - _command_args=( - '(-e|--expire)'{-e,--expire}'[if no slots are available to capture, delete the oldest backup to make room]' \ - ) - ;; - stack) - _command_args=( - '(-a|--all)'{-a,--all}'[include deprecated stacks]' \ - ) - ;; - esac - -_arguments \ - $_command_args \ - '(--app)--app[the app name]' \ - && return 0 - diff --git a/plugins/leiningen/init.zsh b/plugins/leiningen/init.zsh deleted file mode 100644 index ede545425..000000000 --- a/plugins/leiningen/init.zsh +++ /dev/null @@ -1,28 +0,0 @@ -function _lein_commands() { - local ret=1 state - _arguments ':subcommand:->subcommand' && ret=0 - - case "$state" in - subcommand) - subcommands=( - "clean:remove compiled files and dependencies from project" - "compile:ahead-of-time compile the project" - "deps:download and install all dependencies" - "help:display a list of tasks or help for a given task" - "install:install the project and its dependencies in your local repository" - "jar:create a jar file containing the compiled .class files" - "new:create a new project skeleton" - "pom:write a pom.xml file to disk for maven interop" - "test:run the project's tests" - "uberjar:Create a jar including the contents of each of deps" - "upgrade:upgrade leiningen to the latest stable release" - "version:print leiningen's version" - ) - _describe -t subcommands 'leiningen subcommands' subcommands && ret=0 - esac - - return ret -} - -compdef _lein_commands lein - diff --git a/plugins/macports/_port b/plugins/macports/_port deleted file mode 100644 index c4de6eabb..000000000 --- a/plugins/macports/_port +++ /dev/null @@ -1,89 +0,0 @@ -#compdef port - -local subcmds - -# we cache the list of ports -# we shall use some cache policy to avoid problems with new ports -if (( ! $+portlist )); then - portlist=($(port echo all; echo "all current active inactive installed uninstalled outdated")) -fi - -subcmds=( -'activate' -'archive' -'build' -'cat' -'clean' -'configure' -'contents' -'deactivate' -'dependents' -'deps' -'destroot' -'dir' -'distcheck' -'distclean' -'dmg' -'echo' -'edit' -'extract' -'fetch' -'file' -'help' -'info' -'install' -'installed' -'list' -'livecheck' -'location' -'mpkg' -'outdated' -'patch' -'pkg' -'provides' -'rpmpackage' -'search' -'selfupdate' -'sync' -'test' -'unarchive' -'uninstall' -'upgrade' -'variants' -'version' -) - -_arguments -C \ -'-v[verbose mode (generate verbose messages)]' \ -'-d[debug mode (generate debugging messages)]' \ -'-q[quiet mode (suppress messages)]' \ -'-D[specify portdir]' \ -'-k[keep mode (do not autoclean after install)]' \ -'-n[dont follow dependencies in upgrade (only for upgrading)]' \ -'-a[upgrade all installed ports (only for upgrading)]' \ -'-u[uninstall non-active ports when upgrading and uninstalling]' \ -'-f[force mode (ignore state file)]' \ -'-s[source-only mode]' \ -'-b[binary-only mode]' \ -'-o[honor state files older than Portfile]' \ -'*::command:->command' \ -&& return 0 - -case $state in - command) - if ((CURRENT == 1)); then - state=subcommands - else - state=portname - fi - ;; -esac - -case $state in - subcommands) - _describe -t commands 'port commands' subcmds - ;; - portname) - _describe -t commands 'available ports' portlist - ;; -esac diff --git a/plugins/phing/init.zsh b/plugins/phing/init.zsh deleted file mode 100644 index 233352a5b..000000000 --- a/plugins/phing/init.zsh +++ /dev/null @@ -1,21 +0,0 @@ -function _phing_does_target_list_need_generating() { - if [[ ! -f .phing_targets ]]; then - return 0 - else - accurate=$(stat -f%m .phing_targets) - changed=$(stat -f%m build.xml) - return $(expr $accurate '>=' $changed) - fi -} - -function _phing() { - if [[ -f build.xml ]]; then - if _phing_does_target_list_need_generating; then - phing -l |grep -v ":" |grep -v "^$"|grep -v "\-" > .phing_targets - fi - compadd `cat .phing_targets` - fi -} - -compdef _phing phing - diff --git a/plugins/powder/_powder b/plugins/powder/_powder deleted file mode 100644 index 78bcd5d66..000000000 --- a/plugins/powder/_powder +++ /dev/null @@ -1,5 +0,0 @@ -#compdef powder -#autoload - -compadd `powder help | grep powder | cut -d " " -f 4` - diff --git a/plugins/python/_pip b/plugins/python/_pip deleted file mode 100644 index ea2b0c3ff..000000000 --- a/plugins/python/_pip +++ /dev/null @@ -1,47 +0,0 @@ -#compdef pip -#autoload - -# This completion is based on the Homebrew completion. - -function _pip-installed() { - installed_pkgs=(`pip freeze`) -} - -local -a _1st_arguments -_1st_arguments=( - 'bundle:Create pybundles (archives containing multiple packages)' - 'freeze:Output all currently installed packages (exact versions) to stdout' - 'help:Show available commands' - 'install:Install packages' - 'search:Search PyPI' - 'uninstall:Uninstall packages' - 'unzip:Unzip individual packages' - 'zip:Zip individual packages' -) - -local expl -local -a pkgs installed_pkgs - -_arguments \ - '(--version)--version[Show version number of program and exit]' \ - '(-v --verbose)'{-v,--verbose}'[Give more output]' \ - '(-q --quiet)'{-q,--quiet}'[Give less output]' \ - '(-h --help)'{-h,--help}'[Show help]' \ - '*:: :->subcmds' && return 0 - -if (( CURRENT == 1 )); then - _describe -t commands "pip subcommand" _1st_arguments - return -fi - -case "$words[1]" in - list) - if [[ "$state" == forms ]]; then - _pip-installed - _requested installed_pkgs expl 'installed packages' compadd -a installed_pkgs - fi ;; - uninstall) - _pip-installed - _wanted installed_pkgs expl 'installed packages' compadd -a installed_pkgs ;; -esac - diff --git a/plugins/redis/_redis-cli b/plugins/redis/_redis-cli deleted file mode 100644 index 81ebd8e73..000000000 --- a/plugins/redis/_redis-cli +++ /dev/null @@ -1,143 +0,0 @@ -#compdef redis-cli rec -#autoload - -# This completion is based on the Homebrew completion. - -local -a _1st_arguments -_1st_arguments=( - 'append:append a value to a key' - 'auth:authenticate to the server' - 'bgrewriteeaof:asynchronously rewrite the append-only file' - 'bgsave:asynchornously save the dataset to disk' - 'blpop:remove and get the first element in a list, or block until one is available' - 'brpop:remove and get the last element in a list, or block until one is available' - 'brpoplpush:pop a value from a list, push it to another list and return it; or block until one is available' - # 'config get:get the value of a configuration parameter' - # 'config set:set a configuration parameter to the given value' - # 'config resetstat: reset the stats returned by INFO' - 'dbsize:return the number of keys in the selected database' - # 'debug object:get debugging information about a key' - # 'debug setgfault:make the server crash' - 'decr:decrement the integer value of a key by one' - 'decrby:decrement the integet value of a key by the given number' - 'del:delete a key' - 'discard:discard all commands issued after MULTI' - 'echo:echo the given string' - 'exec:execute all commands issued after a MULTI' - 'exists:determine if a key exists' - 'expire:set the time to live for a key, in seconds' - 'expireat:set the expiration for a key as a UNIX timestamp' - 'flushall:remove all keys from all databases' - 'flushdb:remove all keys from the current database' - 'get:get the value of a key' - 'getbit:returns the bit value at offset in the string value stored at key' - 'getrange:get a substring of the string stored at a key' - 'getset:set the string value of a key and return its old value' - 'hdel:delete a hash field' - 'hexists:determine if a hash field exists' - 'hget:get the value of a hash field' - 'hgetall:get all the fields and values in a hash' - 'hincrby:increment the integer value of a hash field by the given number' - 'hkeys:get all the fields in a hash' - 'hlen:get the number of fields in a hash' - 'hmget:get the values of all the given hash fields' - 'hmset:set multiple hash fields to multiple values' - 'hset:set the string value of a hash field' - 'hsetnx:set the value of a hash field, only if the field does not exist' - 'hvals:get all the values in a hash' - 'incr:increment the integer value of a key by one' - 'incrby:increment the integer value of a key by the given number' - 'info:get information and statistics about the server' - 'keys:find all keys matching the given pattern' - 'lastsave:get the UNIX timestamp of the last successful save to disk' - 'lindex:get an element from a list by its index' - 'linsert:insert an element before or after another element in a list' - 'llen:get the length of a list' - 'lpop:remove and get the first element in a list' - 'lpush:prepend a value to a list' - 'lpushx:prepend a value to a list, only if the list exists' - 'lrange:get a range of elements from a list' - 'lrem:remove elements from a list' - 'lset:set the value of an element in a list by its index' - 'ltrim:trim a list to the specified range' - 'mget:get the values of all the given keys' - 'monitor:listen for all requests received by the server in real time' - 'move:move a key to another database' - 'mset:set multiple keys to muliple values' - 'msetnx:set multiple keys tom ultiple values, only if none of the keys exist' - 'multi:mark the start of a transaction block' - 'object:inspect the internals of Redis objects' - 'persist:remove the expiration from a key' - 'ping:ping the server' - 'psubscribe:listen for messages published to channels matching the given patterns' - 'publish:post a message to a channel' - 'punsubscribe:stop listening for messages posted to channels matching the given patterns' - 'quit:close the connection' - 'randomkey:return a random key from the keyspace' - 'rename:rename a key' - 'renamenx:rename a key, only if the new key does not exist' - 'rpop:remove and get the last element in a list' - 'rpoplpush:remove the last element in a list, append it to another list and return it' - 'rpush:append a value to a list' - 'rpushx:append a value to a list, only if the list exists' - 'sadd:add a member to a set' - 'save:synchronously save the dataset to disk' - 'scard:get the number of members in a set' - 'sdiff:subtract multiple sets' - 'sdiffstore:subtract multiple sets and store the resulting set in a key' - 'select:change the selected database for the current connection' - 'set:set the string value of a key' - 'setbit:sets or clears the bit at offset in the string value stored at key' - 'setex:set the value and expiration of a key' - 'setnx:set the value of a key, only if the key does not exist' - 'setrange:overwrite part of a string at key starting at the specified offset' - 'shutdown:synchronously save the dataset to disk and then shut down the server' - 'sinter:intersect multiple sets' - 'sinterstore:intersect multiple sets and store the resulting set in a key' - 'sismember:determine if a given value is a member of a set' - 'slaveof:make the server a slave of another instance, or promote it as master' - 'smembers:get all the members in a set' - 'smove:move a member from one set to another' - 'sort:sort the elements in a list, set or sorted set' - 'spop:remove and return a random member from a set' - 'srandmember:get a random member from a set' - 'srem:remove a member from a set' - 'strlen:get the length of the value stored in a key' - 'subscribe:listen for messages published to the given channels' - 'sunion:add multiple sets' - 'sunionstore:add multiple sets and store the resulting set in a key' - 'ttl:get the time to live for a key' - 'type:determine the type stored at key' - 'unsubscribe:stop listening for messages posted to the given channels' - 'unwatch:forget about all watched keys' - 'watch:watch the given keys to determine execution of the MULTI/EXEC block' - 'zadd:add a member to a sorted set, or update its score if it already exists' - 'zcard:get the number of members in a sorted set' - 'zcount:count the members in a sorted set with scores within the given values' - 'zincrby:increment the score of a member in a sorted set' - 'zinterstore:intersect multiple sorted sets and store the resulting sorted set in a new key' - 'zrange:return a range of members in a sorted set, by index' - 'zrangebyscore:return a range of members in a sorted set, by score' - 'zrank:determine the index of a member in a sorted set' - 'zrem:remove a member from a sorted set' - 'zremrangebyrank:remove all members in a sorted set within the given indexes' - 'zremrangebyscore:remove all members in a sorted set within the given scores' - 'zrevrange:return a range of membrs in a sorted set, by index, with scores ordered from high to low' - 'zrevrangebyscore:return a range of members in a sorted set, by score, with scores ordered from high to low' - 'zrevrank:determine the index of a member in a sorted set, with scores ordered from high to low' - 'zscore:get the score associated with the given member in a sorted set' - 'zunionstore:add multiple sorted sets and store te resulting sorted set in a new key' -) - -local expl - -_arguments \ - '(-v --version)'{-v,--version}'[show version]' \ - '(-h --help)'{-h,--help}'[show help]' \ - '*:: :->subcmds' && return 0 - -if (( CURRENT == 1 )); then - _describe -t commands "redis-cli subcommand" _1st_arguments - return -fi - diff --git a/plugins/ruby/.gitignore b/plugins/ruby/.gitignore deleted file mode 100644 index 6b71b1be2..000000000 --- a/plugins/ruby/.gitignore +++ /dev/null @@ -1 +0,0 @@ -_rvm diff --git a/plugins/ruby/_gem b/plugins/ruby/_gem deleted file mode 100644 index 55cf144da..000000000 --- a/plugins/ruby/_gem +++ /dev/null @@ -1,67 +0,0 @@ -#compdef gem -#autoload - -# This completion is based on the Homebrew completion. - -function _gem-installed() { - installed_gems=(`gem list --local --no-versions`) -} - -local -a _1st_arguments -_1st_arguments=( - 'cert:Manage RubyGems certificates and signing settings' - 'check:Check installed gems' - 'cleanup:Clean up old versions of installed gems in the local repository' - 'contents:Display the contents of the installed gems' - 'dependency:Show the dependencies of an installed gem' - 'environment:Display information about the RubyGems environment' - 'fetch:Download a gem and place it in the current directory' - 'generate_index:Generates the index files for a gem server directory' - 'help:Provide help on the `gem` command' - 'install:Install a gem into the local repository' - 'list:Display gems whose name starts with STRING' - 'lock:Generate a lockdown list of gems' - 'mirror:Mirror a gem repository' - 'outdated:Display all gems that need updates' - 'owner:Manage gem owners on RubyGems.org.' - 'pristine:Restores installed gems to pristine condition from files located in the gem cache' - 'push:Push a gem up to RubyGems.org' - 'query:Query gem information in local or remote repositories' - 'rdoc:Generates RDoc for pre-installed gems' - 'search:Display all gems whose name contains STRING' - 'server:Documentation and gem repository HTTP server' - 'sources:Manage the sources and cache file RubyGems uses to search for gems' - 'specification:Display gem specification (in yaml)' - 'stale:List gems along with access times' - 'uninstall:Uninstall gems from the local repository' - 'unpack:Unpack an installed gem to the current directory' - 'update:Update the named gems (or all installed gems) in the local repository' - 'which:Find the location of a library file you can require' -) - -local expl -local -a gems installed_gems - -_arguments \ - '(-v --version)'{-v,--version}'[show version]' \ - '(-h --help)'{-h,--help}'[show help]' \ - '*:: :->subcmds' && return 0 - -if (( CURRENT == 1 )); then - _describe -t commands "gem subcommand" _1st_arguments - return -fi - -case "$words[1]" in - (list) - if [[ "$state" == 'forms' ]]; then - _gem-installed - _requested installed_gems expl 'installed gems' compadd -a installed_gems - fi - ;; - (uninstall|update) - _gem-installed - _wanted installed_gems expl 'installed gems' compadd -a installed_gems - ;; -esac - diff --git a/plugins/ruby/init.zsh b/plugins/ruby/init.zsh index 4c904f10e..39ce03187 100644 --- a/plugins/ruby/init.zsh +++ b/plugins/ruby/init.zsh @@ -15,27 +15,13 @@ if [[ "$OSTYPE" == darwin* ]]; then fi # Loads RVM into the shell session. -completion_file="${0:h}/_rvm" -if [[ ! -e "$completion_file" ]] && [[ -L "$completion_file" ]]; then - unlink "$completion_file" 2> /dev/null -fi - if [[ -s "$HOME/.rvm/scripts/rvm" ]]; then # Auto adding variable-stored paths to ~ list conflicts with RVM. unsetopt auto_name_dirs # Source RVM. source "$HOME/.rvm/scripts/rvm" - - # Complete RVM. - if [[ ! -e "$completion_file" ]]; then - ln -s \ - "$rvm_path/scripts/zsh/Completion/_rvm" \ - "$completion_file" \ - 2> /dev/null - fi fi -unset completion_file # Loads rbenv into the shell session. if [[ -s "$HOME/.rbenv/bin/rbenv" ]]; then diff --git a/plugins/taskwarrior/.gitignore b/plugins/taskwarrior/.gitignore deleted file mode 100644 index ee21bc964..000000000 --- a/plugins/taskwarrior/.gitignore +++ /dev/null @@ -1 +0,0 @@ -_task diff --git a/plugins/taskwarrior/init.zsh b/plugins/taskwarrior/init.zsh deleted file mode 100644 index 040c74d35..000000000 --- a/plugins/taskwarrior/init.zsh +++ /dev/null @@ -1,25 +0,0 @@ -# Complete task. -completion_file="${0:h}/_task" -if [[ ! -e "$completion_file" ]] && ; then - if [[ -L "$completion_file" ]]; then - unlink "$completion_file" 2> /dev/null - fi - - if (( $+commands[taskwarrior] )); then - ln -s \ - "${commands[task]:h:h}/share/doc/task/scripts/zsh/_task" \ - "$completion_file" \ - 2> /dev/null - fi -fi -unset completion_file - -# Style -zstyle ':completion:*:*:task:*' verbose yes -zstyle ':completion:*:*:task:*:descriptions' format '%U%B%d%b%u' -zstyle ':completion:*:*:task:*' group-name '' - -# Aliases -alias t=task -compdef _task t=task - diff --git a/plugins/thor/_thor b/plugins/thor/_thor deleted file mode 100644 index b62983083..000000000 --- a/plugins/thor/_thor +++ /dev/null @@ -1,5 +0,0 @@ -#compdef thor -#autoload - -compadd `thor list | grep thor | cut -d " " -f 2` - diff --git a/plugins/vagrant/_vagrant b/plugins/vagrant/_vagrant deleted file mode 100644 index 34de22290..000000000 --- a/plugins/vagrant/_vagrant +++ /dev/null @@ -1,100 +0,0 @@ -#compdef vagrant -#autoload - -local -a _1st_arguments -_1st_arguments=( - 'box:Box commands' - 'destroy:Destroys the vagrant environment' - 'halt:Halts the currently running vagrant environment' - 'help:[TASK] Describe available tasks or one specific task' - 'init:[box_name] [box_url] Initializes current folder for Vagrant usage' - 'package:Packages a vagrant environment for distribution' - 'provision:Run the provisioner' - 'reload:Reload the vagrant environment' - 'resume:Resumes a suspend vagrant environment' - 'ssh:SSH into the currently running environment' - 'ssh_config:outputs .ssh/config valid syntax for connecting to this environment via ssh.' - 'status:Shows the status of the current Vagrant environment.' - 'suspend:Suspends the currently running vagrant environment' - 'up:Creates the vagrant environment' - 'version:Prints the Vagrant version information' -) - -local -a _box_arguments -_box_arguments=( - 'add:NAME URI Add a box to the system' - 'help:COMMAND Describe subcommands or one specific subcommand' - 'list:Lists all installed boxes' - 'remove:NAME Remove a box from the system' - 'repackage:NAME Repackage an installed box into a `.box` file.' -) - -function __task_list() { - local expl - declare -a tasks - - tasks=(box destroy halt init package provision reload resume ssh ssh_config status suspend up version) - _wanted tasks expl 'help' compadd $tasks -} - -function __box_list() { - _wanted application expl 'command' compadd $(command ls -1 $HOME/.vagrant/boxes 2>/dev/null| sed -e 's/ /\\ /g') -} - -function __vm_list () { - _wanted application expl 'command' compadd $(command grep Vagrantfile -oe '^[^#]*\.vm\.define *:\([a-zA-Z0-9]\+\)' 2>/dev/null | cut -d: -f2) -} - -function __vagrant-box() { - local curcontext="$curcontext" state line - typeset -A opt_args - - _arguments -C \ - ':command:->command' \ - '*::options:->options' - - case $state in - (command) - _describe -t commands "gem subcommand" _box_arguments - return - ;; - (options) - case $line[1] in - (repackage|remove) - _arguments ':feature:__box_list' - ;; - esac - ;; - esac -} - -local expl -local -a boxes installed_boxes -local curcontext="$curcontext" state line -typeset -A opt_args - -_arguments -C \ - ':command:->command' \ - '*::options:->options' - -case $state in - (command) - _describe -t commands "gem subcommand" _1st_arguments - return - ;; - - (options) - case $line[1] in - (help) - _arguments ':feature:__task_list' - ;; - - (box) - __vagrant-box - ;; - (up|provision|package|destroy|reload|ssh|halt|resume|status) - _arguments ':feature:__vm_list' - esac - ;; -esac - From 7754a18d136f351a5144824fc003553ce2efcf63 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Tue, 27 Sep 2011 22:00:28 -0400 Subject: [PATCH 515/614] Use zstyle for vicmd and completion indicators. --- keyboard.zsh | 13 ++++++++----- themes/sorin/prompt_sorin_setup | 11 ++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/keyboard.zsh b/keyboard.zsh index 50c9001d2..04a46ab4c 100644 --- a/keyboard.zsh +++ b/keyboard.zsh @@ -1,3 +1,7 @@ +# The default styles. +zstyle ':prompt:' vicmd '<<<' # Indicator to notify of vi command mode. +zstyle ':prompt:' completion "..." # Indicator to notify of generating completion. + # Beep on error in line editor. setopt beep @@ -84,9 +88,6 @@ elif [[ "$KEYMAP" == 'vi' ]]; then # Use vi key bindings. bindkey -v - # The default mode indicator. - MODE_INDICATOR="%B%F{red}❮%f%b%F{red}❮❮%f" - # Restores RPROMPT when exiting vicmd. function vi-restore-rprompt() { if (( $+RPROMPT_CACHED )); then @@ -103,7 +104,7 @@ elif [[ "$KEYMAP" == 'vi' ]]; then function zle-keymap-select() { if ! vi-restore-rprompt && [[ "$KEYMAP" == 'vicmd' ]]; then RPROMPT_CACHED="$RPROMPT" - RPROMPT="$MODE_INDICATOR" + zstyle -s ':prompt:' vicmd RPROMPT zle reset-prompt fi } @@ -249,7 +250,9 @@ fi # Display an indicator when completing. if check-bool "$COMPLETION_INDICATOR"; then function expand-or-complete-prefix-with-indicator() { - echo -n "\e[31m...\e[0m" + zstyle -s ':prompt:' completion indicator + print -Pn "$indicator" + unset indicator zle expand-or-complete-prefix zle redisplay } diff --git a/themes/sorin/prompt_sorin_setup b/themes/sorin/prompt_sorin_setup index e254a948e..dbd685eff 100644 --- a/themes/sorin/prompt_sorin_setup +++ b/themes/sorin/prompt_sorin_setup @@ -2,7 +2,7 @@ # FILE: prompt_sorin_setup # DESCRIPTION: oh-my-zsh theme file. # AUTHOR: Sorin Ionescu -# VERSION: 1.0.5 +# VERSION: 1.0.6 # SCREENSHOT: http://i.imgur.com/aipDQ.png # ------------------------------------------------------------------------------ function prompt_sorin_precmd () { @@ -20,19 +20,20 @@ function prompt_sorin_setup() { autoload -Uz add-zsh-hook add-zsh-hook precmd prompt_sorin_precmd - MODE_INDICATOR="%B%F{red}❮%f%b%F{red}❮❮%f" + zstyle ':prompt:' vicmd '%F{yellow}❮%f%B%F{red}❮%f%b%F{red}❮%f' + zstyle ':prompt:' completion '%B%F{red}...%f%b' zstyle ':git-info:' action ':%%B%F{yellow}%s%f%%b' zstyle ':git-info:' added ' %%B%F{green}✚%f%%b' zstyle ':git-info:' ahead ' %%B%F{yellow}⬆%f%%b' zstyle ':git-info:' behind ' %%B%F{yellow}⬇%f%%b' zstyle ':git-info:' branch ':%F{red}%b%f' zstyle ':git-info:' deleted ' %%B%F{red}✖%f%%b' - zstyle ':git-info:' modified ' %%B%F{blue}✹%f%%b' + zstyle ':git-info:' modified ' %%B%F{blue}✱%f%%b' zstyle ':git-info:' renamed ' %%B%F{magenta}➜%f%%b' zstyle ':git-info:' commit '%c' - zstyle ':git-info:' stashed ' %%B%F{white}✭%f%%b' + zstyle ':git-info:' stashed ' %%B%F{cyan}✭%f%%b' zstyle ':git-info:' unmerged ' %%B%F{yellow}═%f%%b' - zstyle ':git-info:' untracked ' %%B%F{cyan}•%f%%b' + zstyle ':git-info:' untracked ' %%B%F{white}◼%f%%b' zstyle ':git-info:' prompt ' %F{blue}git%f%b%s' zstyle ':git-info:' rprompt '%A%B%S%a%d%m%r%U%u' From d9774e1129e8e787e0f07e87bdb2517501600361 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Tue, 27 Sep 2011 22:08:29 -0400 Subject: [PATCH 516/614] Use terminfo for key bindings. --- keyboard.zsh | 51 ++++++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/keyboard.zsh b/keyboard.zsh index 04a46ab4c..3de6815fa 100644 --- a/keyboard.zsh +++ b/keyboard.zsh @@ -13,35 +13,36 @@ autoload -Uz edit-command-line zle -N edit-command-line # Use human-friendly identifiers. +zmodload zsh/terminfo typeset -g -A keys keys=( 'Control' '\C-' 'Escape' '\e' 'Meta' '\M-' - 'F1' '^[OP' - 'F2' '^[OQ' - 'F3' '^[OR' - 'F4' '^[OS' - 'F5' '^[[15~' - 'F6' '^[[17~' - 'F7' '^[[18~' - 'F8' '^[[19~' - 'F9' '^[[20~' - 'F10' '^[[21~' - 'F11' '^[[23~' - 'F12' '^[[24~' - 'Backspace' '^?' - 'Insert' '^[[2~' - 'Home' '^[[H' - 'PageUp' '^[[5~' - 'Delete' '^[[3~' - 'End' '^[[F' - 'PageDown' '^[[6~' - 'Up' '^[[A' - 'Left' '^[[D' - 'Down' '^[[B' - 'Right' '^[[C' - 'Menu' '^[[29~' + 'F1' "${terminfo[kf1]}" + 'F2' "${terminfo[kf2]}" + 'F3' "${terminfo[kf3]}" + 'F4' "${terminfo[kf4]}" + 'F5' "${terminfo[kf5]}" + 'F6' "${terminfo[kf6]}" + 'F7' "${terminfo[kf7]}" + 'F8' "${terminfo[kf8]}" + 'F9' "${terminfo[kf9]}" + 'F10' "${terminfo[kf10]}" + 'F11' "${terminfo[kf11]}" + 'F12' "${terminfo[kf12]}" + 'Backspace' "${terminfo[kbs]}" + 'Insert' "${terminfo[kich1]}" + 'Home' "${terminfo[khome]}" + 'PageUp' "${terminfo[kpp]}" + 'Delete' "${terminfo[kdch1]}" + 'End' "${terminfo[kend]}" + 'PageDown' "${terminfo[knp]}" + 'Up' "${terminfo[kcuu1]}" + 'Left' "${terminfo[kcub1]}" + 'Down' "${terminfo[kcud1]}" + 'Right' "${terminfo[kcuf1]}" + 'BackTab' "${terminfo[kcbt]}" ) if [[ "$KEYMAP" == (emacs|) ]]; then @@ -228,7 +229,7 @@ bindkey "${keys[Escape]}e" expand-cmd-path bindkey "${keys[Escape]}m" copy-prev-shell-word # Bind Shift + Tab to go to the previous menu item. -bindkey '^[[Z' reverse-menu-complete +bindkey "${keys[BackTab]}" reverse-menu-complete # Complete in the middle of word. bindkey "${keys[Control]}i" expand-or-complete-prefix From 7a37c48991b8d5fa9e73377bc1a0df623db678eb Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Tue, 27 Sep 2011 22:12:53 -0400 Subject: [PATCH 517/614] Renamed keys to keyinfo to prevent conflicts. --- keyboard.zsh | 116 +++++++++++++++++++++++++-------------------------- 1 file changed, 58 insertions(+), 58 deletions(-) diff --git a/keyboard.zsh b/keyboard.zsh index 3de6815fa..58a8061bb 100644 --- a/keyboard.zsh +++ b/keyboard.zsh @@ -14,8 +14,8 @@ zle -N edit-command-line # Use human-friendly identifiers. zmodload zsh/terminfo -typeset -g -A keys -keys=( +typeset -g -A keyinfo +keyinfo=( 'Control' '\C-' 'Escape' '\e' 'Meta' '\M-' @@ -49,27 +49,27 @@ if [[ "$KEYMAP" == (emacs|) ]]; then # Use Emacs key bindings. bindkey -e - bindkey "${keys[Escape]}b" emacs-backward-word - bindkey "${keys[Escape]}f" emacs-forward-word - bindkey "${keys[Escape]}${keys[Left]}" emacs-backward-word - bindkey "${keys[Escape]}${keys[Right]}" emacs-forward-word + bindkey "${keyinfo[Escape]}b" emacs-backward-word + bindkey "${keyinfo[Escape]}f" emacs-forward-word + bindkey "${keyinfo[Escape]}${keyinfo[Left]}" emacs-backward-word + bindkey "${keyinfo[Escape]}${keyinfo[Right]}" emacs-forward-word # Kill to the beginning of the line. - bindkey "${keys[Control]}u" backward-kill-line + bindkey "${keyinfo[Control]}u" backward-kill-line # Kill to the beginning of the word. - bindkey "${keys[Control]}w" backward-kill-word + bindkey "${keyinfo[Control]}w" backward-kill-word # Undo/Redo - bindkey "${keys[Control]}_" undo - bindkey "${keys[Escape]}_" redo + bindkey "${keyinfo[Control]}_" undo + bindkey "${keyinfo[Escape]}_" redo # Search character. - bindkey "${keys[Control]}]" vi-find-next-char - bindkey "${keys[Escape]}${keys[Control]}]" vi-find-prev-char + bindkey "${keyinfo[Control]}]" vi-find-next-char + bindkey "${keyinfo[Escape]}${keyinfo[Control]}]" vi-find-prev-char # Edit command in an external editor. - bindkey "${keys[Control]}x${keys[Control]}e" edit-command-line + bindkey "${keyinfo[Control]}x${keyinfo[Control]}e" edit-command-line # Expand .... to ../.. if check-bool "$DOT_EXPANSION"; then @@ -79,11 +79,11 @@ if [[ "$KEYMAP" == (emacs|) ]]; then # Bind to history substring search plugin if enabled; # otherwise, bind to built-in ZSH history search. if (( ${+widgets[history-incremental-pattern-search-backward]} )); then - bindkey "${keys[Control]}r" history-incremental-pattern-search-backward - bindkey "${keys[Control]}s" history-incremental-pattern-search-forward + bindkey "${keyinfo[Control]}r" history-incremental-pattern-search-backward + bindkey "${keyinfo[Control]}s" history-incremental-pattern-search-forward else - bindkey "${keys[Control]}r" history-incremental-search-backward - bindkey "${keys[Control]}s" history-incremental-search-forward + bindkey "${keyinfo[Control]}r" history-incremental-search-backward + bindkey "${keyinfo[Control]}s" history-incremental-search-forward fi elif [[ "$KEYMAP" == 'vi' ]]; then # Use vi key bindings. @@ -131,7 +131,7 @@ elif [[ "$KEYMAP" == 'vi' ]]; then # Undo/Redo bindkey -M vicmd "u" undo - bindkey -M vicmd "${keys[Control]}r" redo + bindkey -M vicmd "${keyinfo[Control]}r" redo # Expand .... to ../.. if check-bool "$DOT_EXPANSION"; then @@ -143,21 +143,21 @@ elif [[ "$KEYMAP" == 'vi' ]]; then bindkey -M viins "kj" vi-cmd-mode # Emacs key bindings in insert mode. - bindkey -M viins "${keys[Control]}a" beginning-of-line - bindkey -M viins "${keys[Control]}b" backward-char - bindkey -M viins "${keys[Escape]}b" emacs-backward-word - bindkey -M viins "${keys[Control]}d" delete-char-or-list - bindkey -M viins "${keys[Escape]}d" kill-word - bindkey -M viins "${keys[Control]}e" end-of-line - bindkey -M viins "${keys[Control]}f" forward-char - bindkey -M viins "${keys[Escape]}f" emacs-forward-word - bindkey -M viins "${keys[Control]}k" kill-line - bindkey -M viins "${keys[Control]}u" backward-kill-line - bindkey -M viins "${keys[Control]}w" backward-kill-word - bindkey -M viins "${keys[Escape]}w" copy-region-as-kill - bindkey -M viins "${keys[Escape]}h" run-help - bindkey -M viins "${keys[Escape]}${keys[Left]}" emacs-backward-word - bindkey -M viins "${keys[Escape]}${keys[Right]}" emacs-forward-word + bindkey -M viins "${keyinfo[Control]}a" beginning-of-line + bindkey -M viins "${keyinfo[Control]}b" backward-char + bindkey -M viins "${keyinfo[Escape]}b" emacs-backward-word + bindkey -M viins "${keyinfo[Control]}d" delete-char-or-list + bindkey -M viins "${keyinfo[Escape]}d" kill-word + bindkey -M viins "${keyinfo[Control]}e" end-of-line + bindkey -M viins "${keyinfo[Control]}f" forward-char + bindkey -M viins "${keyinfo[Escape]}f" emacs-forward-word + bindkey -M viins "${keyinfo[Control]}k" kill-line + bindkey -M viins "${keyinfo[Control]}u" backward-kill-line + bindkey -M viins "${keyinfo[Control]}w" backward-kill-word + bindkey -M viins "${keyinfo[Escape]}w" copy-region-as-kill + bindkey -M viins "${keyinfo[Escape]}h" run-help + bindkey -M viins "${keyinfo[Escape]}${keyinfo[Left]}" emacs-backward-word + bindkey -M viins "${keyinfo[Escape]}${keyinfo[Right]}" emacs-forward-word # History bindkey -M vicmd "gg" beginning-of-history @@ -178,15 +178,15 @@ elif [[ "$KEYMAP" == 'vi' ]]; then bindkey -M vicmd "/" history-incremental-pattern-search-forward # Emacs key bindings in insert mode. - bindkey -M viins "${keys[Control]}r" history-incremental-pattern-search-backward - bindkey -M viins "${keys[Control]}s" history-incremental-pattern-search-forward + bindkey -M viins "${keyinfo[Control]}r" history-incremental-pattern-search-backward + bindkey -M viins "${keyinfo[Control]}s" history-incremental-pattern-search-forward else bindkey -M vicmd "?" history-incremental-search-backward bindkey -M vicmd "/" history-incremental-search-forward # Emacs key bindings in insert mode. - bindkey -M viins "${keys[Control]}r" history-incremental-search-backward - bindkey -M viins "${keys[Control]}s" history-incremental-search-forward + bindkey -M viins "${keyinfo[Control]}r" history-incremental-search-backward + bindkey -M viins "${keyinfo[Control]}s" history-incremental-search-forward fi else echo "oh-my-zsh: KEYMAP must be set 'emacs' or 'vi' but is set to '$KEYMAP'" >&2 @@ -194,45 +194,45 @@ else fi # The next key bindings are for both Emacs and Vi. -bindkey "${keys[Home]}" beginning-of-line -bindkey "${keys[End]}" end-of-line +bindkey "${keyinfo[Home]}" beginning-of-line +bindkey "${keyinfo[End]}" end-of-line -bindkey "${keys[Insert]}" overwrite-mode -bindkey "${keys[Delete]}" delete-char -bindkey "${keys[Backspace]}" backward-delete-char +bindkey "${keyinfo[Insert]}" overwrite-mode +bindkey "${keyinfo[Delete]}" delete-char +bindkey "${keyinfo[Backspace]}" backward-delete-char -bindkey "${keys[Left]}" backward-char -bindkey "${keys[Right]}" forward-char +bindkey "${keyinfo[Left]}" backward-char +bindkey "${keyinfo[Right]}" forward-char # Expand history on space. bindkey ' ' magic-space if (( $+plugins[(er)history-substring-search] )); then - bindkey "${keys[Up]}" history-substring-search-up - bindkey "${keys[Down]}" history-substring-search-down - bindkey "${keys[Control]}p" history-substring-search-up - bindkey "${keys[Control]}n" history-substring-search-down + bindkey "${keyinfo[Up]}" history-substring-search-up + bindkey "${keyinfo[Down]}" history-substring-search-down + bindkey "${keyinfo[Control]}p" history-substring-search-up + bindkey "${keyinfo[Control]}n" history-substring-search-down else - bindkey "${keys[Up]}" up-line-or-history - bindkey "${keys[Down]}" down-line-or-history - bindkey "${keys[Control]}p" up-line-or-history - bindkey "${keys[Control]}n" down-line-or-history + bindkey "${keyinfo[Up]}" up-line-or-history + bindkey "${keyinfo[Down]}" down-line-or-history + bindkey "${keyinfo[Control]}p" up-line-or-history + bindkey "${keyinfo[Control]}n" down-line-or-history fi # Clear screen. -bindkey "${keys[Control]}l" clear-screen +bindkey "${keyinfo[Control]}l" clear-screen # Expand command name to full path. -bindkey "${keys[Escape]}e" expand-cmd-path +bindkey "${keyinfo[Escape]}e" expand-cmd-path # Duplicate the previous word. -bindkey "${keys[Escape]}m" copy-prev-shell-word +bindkey "${keyinfo[Escape]}m" copy-prev-shell-word # Bind Shift + Tab to go to the previous menu item. -bindkey "${keys[BackTab]}" reverse-menu-complete +bindkey "${keyinfo[BackTab]}" reverse-menu-complete # Complete in the middle of word. -bindkey "${keys[Control]}i" expand-or-complete-prefix +bindkey "${keyinfo[Control]}i" expand-or-complete-prefix # Convert .... to ../.. automatically. if check-bool "$DOT_EXPANSION"; then @@ -258,6 +258,6 @@ if check-bool "$COMPLETION_INDICATOR"; then zle redisplay } zle -N expand-or-complete-prefix-with-indicator - bindkey "${keys[Control]}i" expand-or-complete-prefix-with-indicator + bindkey "${keyinfo[Control]}i" expand-or-complete-prefix-with-indicator fi From b35b171c5da883146ed4a3daa21d4e4e1457926b Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Wed, 28 Sep 2011 15:44:32 -0400 Subject: [PATCH 518/614] Removed autojump in favour of z. --- plugins/autojump/init.zsh | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 plugins/autojump/init.zsh diff --git a/plugins/autojump/init.zsh b/plugins/autojump/init.zsh deleted file mode 100644 index aee4b6457..000000000 --- a/plugins/autojump/init.zsh +++ /dev/null @@ -1,8 +0,0 @@ -if [[ -f /etc/profile.d/autojump.zsh ]]; then - source /etc/profile.d/autojump.zsh -elif [[ -f /opt/local/etc/profile.d/autojump.zsh ]]; then - source /opt/local/etc/profile.d/autojump.zsh -elif [[ -f "$(brew --prefix 2> /dev/null)/etc/autojump.zsh" ]]; then - source "$(brew --prefix)/etc/autojump.zsh" -fi - From b2a9cad2e9cbc6f33adf523589a5fb8068fb0892 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Wed, 28 Sep 2011 15:44:53 -0400 Subject: [PATCH 519/614] Removed pow in favour of powder. --- plugins/pow/_pow | 20 ------------ plugins/pow/init.zsh | 75 -------------------------------------------- 2 files changed, 95 deletions(-) delete mode 100644 plugins/pow/_pow delete mode 100644 plugins/pow/init.zsh diff --git a/plugins/pow/_pow b/plugins/pow/_pow deleted file mode 100644 index 7553fe45a..000000000 --- a/plugins/pow/_pow +++ /dev/null @@ -1,20 +0,0 @@ -#compdef pow-add pow-remove pow-restart -#autoload - -local ret=1 - -case "$service" in - (pow-add) - _arguments "1:application:_files -/" && ret=0 - ;; - (pow-(remove|restart)) - _arguments "1: :->pow-app" && ret=0 - ;; -esac - -if [[ "$state" == 'pow-app' ]]; then - _arguments '1:application:($HOME/.pow/*(@N:t))' && ret=0 -fi - -return "$ret" - diff --git a/plugins/pow/init.zsh b/plugins/pow/init.zsh deleted file mode 100644 index 5297b278c..000000000 --- a/plugins/pow/init.zsh +++ /dev/null @@ -1,75 +0,0 @@ -# Inspired by Christopher Sexton's -# https://gist.github.com/1019777 -# -# Sorin Ionescu - -# Gets the root of the Rack application. -function _pow-rack-root() { - local rack_root="${PWD}" - - while [[ "${rack_root}" != '/' ]]; do - # Rack applictions must have a config.ru file in the root directory. - if [[ -f "${rack_root}/config.ru" ]]; then - echo "${rack_root}" - return 0 - else - rack_root="${rack_root:h}" - fi - done - - return 1 -} - -# Adds a Rack application to Pow. -function pow-add() { - local app="${${1:A}:-$(_pow-rack-root)}" - local vhost="${app:t}" - - if [[ ! -f "${app}/config.ru" ]]; then - echo "${0}: ${vhost:-$PWD:t}: not a Rack application or config.ru is missing" >&2 - return 1 - fi - - if [[ -L "${HOME}/.pow/${vhost}" ]]; then - echo "${0}: ${vhost}: already served at http://${vhost}.dev" - return 1 - fi - - ln -s "${app}" "${HOME}/.pow/${vhost}" - echo "Serving ${vhost} at http://${vhost}.dev" -} - -# Removes a Rack application from Pow. -function pow-remove() { - local symlink="${HOME}/.pow/${1}" - if [[ -L "${symlink}" ]]; then - unlink "${symlink}" - echo "Stopped serving ${1}" - else - echo "${0}: ${1}: no such application" >&2 - fi -} - -# Restarts a Rack application. -function pow-restart() { - local vhost="${${1}:-$(_pow-rack-root):t}" - local tmp="${HOME}/.pow/${vhost}/tmp" - - if [[ ! -L "${HOME}/.pow/${vhost}" ]]; then - echo "${0}: ${1}: no such application" >&2 - return 1 - fi - - if [[ ! -d "${tmp}" ]]; then - mkdir -p "${tmp}" - fi - - if touch "${tmp}/restart.txt"; then - echo "Restarted ${vhost}" - fi -} - -# Aliases -# View the standard out (puts) from any pow application. -alias pow-log="tail -f ${HOME}/Library/Logs/Pow/apps/*" - From 5e49591fb109be4b3c633c0f8b71987064810df0 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Mon, 10 Oct 2011 21:25:53 -0400 Subject: [PATCH 520/614] Do not bind keys on dumb terminals. --- keyboard.zsh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/keyboard.zsh b/keyboard.zsh index 58a8061bb..590ab7cdc 100644 --- a/keyboard.zsh +++ b/keyboard.zsh @@ -1,3 +1,8 @@ +# Dumb terminals lack support. +if [[ "$TERM" == 'dumb' ]]; then + return +fi + # The default styles. zstyle ':prompt:' vicmd '<<<' # Indicator to notify of vi command mode. zstyle ':prompt:' completion "..." # Indicator to notify of generating completion. From 9d52ede9fd4c8bb077a36fc66edd26bca2a35b2c Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Mon, 10 Oct 2011 21:31:18 -0400 Subject: [PATCH 521/614] Remove unnecessary curly brackets. --- keyboard.zsh | 164 +++++++++++++++++++++++++-------------------------- 1 file changed, 82 insertions(+), 82 deletions(-) diff --git a/keyboard.zsh b/keyboard.zsh index 590ab7cdc..cb583b019 100644 --- a/keyboard.zsh +++ b/keyboard.zsh @@ -24,57 +24,57 @@ keyinfo=( 'Control' '\C-' 'Escape' '\e' 'Meta' '\M-' - 'F1' "${terminfo[kf1]}" - 'F2' "${terminfo[kf2]}" - 'F3' "${terminfo[kf3]}" - 'F4' "${terminfo[kf4]}" - 'F5' "${terminfo[kf5]}" - 'F6' "${terminfo[kf6]}" - 'F7' "${terminfo[kf7]}" - 'F8' "${terminfo[kf8]}" - 'F9' "${terminfo[kf9]}" - 'F10' "${terminfo[kf10]}" - 'F11' "${terminfo[kf11]}" - 'F12' "${terminfo[kf12]}" - 'Backspace' "${terminfo[kbs]}" - 'Insert' "${terminfo[kich1]}" - 'Home' "${terminfo[khome]}" - 'PageUp' "${terminfo[kpp]}" - 'Delete' "${terminfo[kdch1]}" - 'End' "${terminfo[kend]}" - 'PageDown' "${terminfo[knp]}" - 'Up' "${terminfo[kcuu1]}" - 'Left' "${terminfo[kcub1]}" - 'Down' "${terminfo[kcud1]}" - 'Right' "${terminfo[kcuf1]}" - 'BackTab' "${terminfo[kcbt]}" + 'F1' "$terminfo[kf1]" + 'F2' "$terminfo[kf2]" + 'F3' "$terminfo[kf3]" + 'F4' "$terminfo[kf4]" + 'F5' "$terminfo[kf5]" + 'F6' "$terminfo[kf6]" + 'F7' "$terminfo[kf7]" + 'F8' "$terminfo[kf8]" + 'F9' "$terminfo[kf9]" + 'F10' "$terminfo[kf10]" + 'F11' "$terminfo[kf11]" + 'F12' "$terminfo[kf12]" + 'Backspace' "$terminfo[kbs]" + 'Insert' "$terminfo[kich1]" + 'Home' "$terminfo[khome]" + 'PageUp' "$terminfo[kpp]" + 'Delete' "$terminfo[kdch1]" + 'End' "$terminfo[kend]" + 'PageDown' "$terminfo[knp]" + 'Up' "$terminfo[kcuu1]" + 'Left' "$terminfo[kcub1]" + 'Down' "$terminfo[kcud1]" + 'Right' "$terminfo[kcuf1]" + 'BackTab' "$terminfo[kcbt]" ) if [[ "$KEYMAP" == (emacs|) ]]; then # Use Emacs key bindings. bindkey -e - bindkey "${keyinfo[Escape]}b" emacs-backward-word - bindkey "${keyinfo[Escape]}f" emacs-forward-word - bindkey "${keyinfo[Escape]}${keyinfo[Left]}" emacs-backward-word - bindkey "${keyinfo[Escape]}${keyinfo[Right]}" emacs-forward-word + bindkey "$keyinfo[Escape]b" emacs-backward-word + bindkey "$keyinfo[Escape]f" emacs-forward-word + bindkey "$keyinfo[Escape]$keyinfo[Left]" emacs-backward-word + bindkey "$keyinfo[Escape]$keyinfo[Right]" emacs-forward-word # Kill to the beginning of the line. - bindkey "${keyinfo[Control]}u" backward-kill-line + bindkey "$keyinfo[Control]u" backward-kill-line # Kill to the beginning of the word. - bindkey "${keyinfo[Control]}w" backward-kill-word + bindkey "$keyinfo[Control]w" backward-kill-word # Undo/Redo - bindkey "${keyinfo[Control]}_" undo - bindkey "${keyinfo[Escape]}_" redo + bindkey "$keyinfo[Control]_" undo + bindkey "$keyinfo[Escape]_" redo # Search character. - bindkey "${keyinfo[Control]}]" vi-find-next-char - bindkey "${keyinfo[Escape]}${keyinfo[Control]}]" vi-find-prev-char + bindkey "$keyinfo[Control]]" vi-find-next-char + bindkey "$keyinfo[Escape]$keyinfo[Control]]" vi-find-prev-char # Edit command in an external editor. - bindkey "${keyinfo[Control]}x${keyinfo[Control]}e" edit-command-line + bindkey "$keyinfo[Control]x$keyinfo[Control]e" edit-command-line # Expand .... to ../.. if check-bool "$DOT_EXPANSION"; then @@ -83,12 +83,12 @@ if [[ "$KEYMAP" == (emacs|) ]]; then # Bind to history substring search plugin if enabled; # otherwise, bind to built-in ZSH history search. - if (( ${+widgets[history-incremental-pattern-search-backward]} )); then - bindkey "${keyinfo[Control]}r" history-incremental-pattern-search-backward - bindkey "${keyinfo[Control]}s" history-incremental-pattern-search-forward + if (( $+widgets[history-incremental-pattern-search-backward] )); then + bindkey "$keyinfo[Control]r" history-incremental-pattern-search-backward + bindkey "$keyinfo[Control]s" history-incremental-pattern-search-forward else - bindkey "${keyinfo[Control]}r" history-incremental-search-backward - bindkey "${keyinfo[Control]}s" history-incremental-search-forward + bindkey "$keyinfo[Control]r" history-incremental-search-backward + bindkey "$keyinfo[Control]s" history-incremental-search-forward fi elif [[ "$KEYMAP" == 'vi' ]]; then # Use vi key bindings. @@ -136,7 +136,7 @@ elif [[ "$KEYMAP" == 'vi' ]]; then # Undo/Redo bindkey -M vicmd "u" undo - bindkey -M vicmd "${keyinfo[Control]}r" redo + bindkey -M vicmd "$keyinfo[Control]r" redo # Expand .... to ../.. if check-bool "$DOT_EXPANSION"; then @@ -148,21 +148,21 @@ elif [[ "$KEYMAP" == 'vi' ]]; then bindkey -M viins "kj" vi-cmd-mode # Emacs key bindings in insert mode. - bindkey -M viins "${keyinfo[Control]}a" beginning-of-line - bindkey -M viins "${keyinfo[Control]}b" backward-char - bindkey -M viins "${keyinfo[Escape]}b" emacs-backward-word - bindkey -M viins "${keyinfo[Control]}d" delete-char-or-list - bindkey -M viins "${keyinfo[Escape]}d" kill-word - bindkey -M viins "${keyinfo[Control]}e" end-of-line - bindkey -M viins "${keyinfo[Control]}f" forward-char - bindkey -M viins "${keyinfo[Escape]}f" emacs-forward-word - bindkey -M viins "${keyinfo[Control]}k" kill-line - bindkey -M viins "${keyinfo[Control]}u" backward-kill-line - bindkey -M viins "${keyinfo[Control]}w" backward-kill-word - bindkey -M viins "${keyinfo[Escape]}w" copy-region-as-kill - bindkey -M viins "${keyinfo[Escape]}h" run-help - bindkey -M viins "${keyinfo[Escape]}${keyinfo[Left]}" emacs-backward-word - bindkey -M viins "${keyinfo[Escape]}${keyinfo[Right]}" emacs-forward-word + bindkey -M viins "$keyinfo[Control]a" beginning-of-line + bindkey -M viins "$keyinfo[Control]b" backward-char + bindkey -M viins "$keyinfo[Escape]b" emacs-backward-word + bindkey -M viins "$keyinfo[Control]d" delete-char-or-list + bindkey -M viins "$keyinfo[Escape]d" kill-word + bindkey -M viins "$keyinfo[Control]e" end-of-line + bindkey -M viins "$keyinfo[Control]f" forward-char + bindkey -M viins "$keyinfo[Escape]f" emacs-forward-word + bindkey -M viins "$keyinfo[Control]k" kill-line + bindkey -M viins "$keyinfo[Control]u" backward-kill-line + bindkey -M viins "$keyinfo[Control]w" backward-kill-word + bindkey -M viins "$keyinfo[Escape]w" copy-region-as-kill + bindkey -M viins "$keyinfo[Escape]h" run-help + bindkey -M viins "$keyinfo[Escape]$keyinfo[Left]" emacs-backward-word + bindkey -M viins "$keyinfo[Escape]$keyinfo[Right]" emacs-forward-word # History bindkey -M vicmd "gg" beginning-of-history @@ -178,20 +178,20 @@ elif [[ "$KEYMAP" == 'vi' ]]; then bindkey -M vicmd "j" down-line-or-history fi - if (( ${+widgets[history-incremental-pattern-search-backward]} )); then + if (( $+widgets[history-incremental-pattern-search-backward] )); then bindkey -M vicmd "?" history-incremental-pattern-search-backward bindkey -M vicmd "/" history-incremental-pattern-search-forward # Emacs key bindings in insert mode. - bindkey -M viins "${keyinfo[Control]}r" history-incremental-pattern-search-backward - bindkey -M viins "${keyinfo[Control]}s" history-incremental-pattern-search-forward + bindkey -M viins "$keyinfo[Control]r" history-incremental-pattern-search-backward + bindkey -M viins "$keyinfo[Control]s" history-incremental-pattern-search-forward else bindkey -M vicmd "?" history-incremental-search-backward bindkey -M vicmd "/" history-incremental-search-forward # Emacs key bindings in insert mode. - bindkey -M viins "${keyinfo[Control]}r" history-incremental-search-backward - bindkey -M viins "${keyinfo[Control]}s" history-incremental-search-forward + bindkey -M viins "$keyinfo[Control]r" history-incremental-search-backward + bindkey -M viins "$keyinfo[Control]s" history-incremental-search-forward fi else echo "oh-my-zsh: KEYMAP must be set 'emacs' or 'vi' but is set to '$KEYMAP'" >&2 @@ -199,45 +199,45 @@ else fi # The next key bindings are for both Emacs and Vi. -bindkey "${keyinfo[Home]}" beginning-of-line -bindkey "${keyinfo[End]}" end-of-line +bindkey "$keyinfo[Home]" beginning-of-line +bindkey "$keyinfo[End]" end-of-line -bindkey "${keyinfo[Insert]}" overwrite-mode -bindkey "${keyinfo[Delete]}" delete-char -bindkey "${keyinfo[Backspace]}" backward-delete-char +bindkey "$keyinfo[Insert]" overwrite-mode +bindkey "$keyinfo[Delete]" delete-char +bindkey "$keyinfo[Backspace]" backward-delete-char -bindkey "${keyinfo[Left]}" backward-char -bindkey "${keyinfo[Right]}" forward-char +bindkey "$keyinfo[Left]" backward-char +bindkey "$keyinfo[Right]" forward-char # Expand history on space. bindkey ' ' magic-space if (( $+plugins[(er)history-substring-search] )); then - bindkey "${keyinfo[Up]}" history-substring-search-up - bindkey "${keyinfo[Down]}" history-substring-search-down - bindkey "${keyinfo[Control]}p" history-substring-search-up - bindkey "${keyinfo[Control]}n" history-substring-search-down + bindkey "$keyinfo[Up]" history-substring-search-up + bindkey "$keyinfo[Down]" history-substring-search-down + bindkey "$keyinfo[Control]p" history-substring-search-up + bindkey "$keyinfo[Control]n" history-substring-search-down else - bindkey "${keyinfo[Up]}" up-line-or-history - bindkey "${keyinfo[Down]}" down-line-or-history - bindkey "${keyinfo[Control]}p" up-line-or-history - bindkey "${keyinfo[Control]}n" down-line-or-history + bindkey "$keyinfo[Up]" up-line-or-history + bindkey "$keyinfo[Down]" down-line-or-history + bindkey "$keyinfo[Control]p" up-line-or-history + bindkey "$keyinfo[Control]n" down-line-or-history fi # Clear screen. -bindkey "${keyinfo[Control]}l" clear-screen +bindkey "$keyinfo[Control]l" clear-screen # Expand command name to full path. -bindkey "${keyinfo[Escape]}e" expand-cmd-path +bindkey "$keyinfo[Escape]e" expand-cmd-path # Duplicate the previous word. -bindkey "${keyinfo[Escape]}m" copy-prev-shell-word +bindkey "$keyinfo[Escape]m" copy-prev-shell-word # Bind Shift + Tab to go to the previous menu item. -bindkey "${keyinfo[BackTab]}" reverse-menu-complete +bindkey "$keyinfo[BackTab]" reverse-menu-complete # Complete in the middle of word. -bindkey "${keyinfo[Control]}i" expand-or-complete-prefix +bindkey "$keyinfo[Control]i" expand-or-complete-prefix # Convert .... to ../.. automatically. if check-bool "$DOT_EXPANSION"; then @@ -263,6 +263,6 @@ if check-bool "$COMPLETION_INDICATOR"; then zle redisplay } zle -N expand-or-complete-prefix-with-indicator - bindkey "${keyinfo[Control]}i" expand-or-complete-prefix-with-indicator + bindkey "$keyinfo[Control]i" expand-or-complete-prefix-with-indicator fi From 850eb8c637ffa9d00c9436b5a9e93619045d35bb Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Mon, 10 Oct 2011 21:49:47 -0400 Subject: [PATCH 522/614] Use relative path instead of OMZ variable. --- init.zsh | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/init.zsh b/init.zsh index d64301026..6eb497746 100644 --- a/init.zsh +++ b/init.zsh @@ -7,10 +7,10 @@ fi # Add functions to fpath. fpath=( - $OMZ/themes/*(/N) - ${plugins:+$OMZ/plugins/${^plugins}} - $OMZ/functions - $OMZ/completions + ${0:h}/themes/*(/N) + ${plugins:+${0:h}/plugins/${^plugins}} + ${0:h}/functions + ${0:h}/completions $fpath ) @@ -18,21 +18,21 @@ fpath=( autoload -Uz compinit && compinit -i # Source files (the order matters). -source "$OMZ/helper.zsh" -source "$OMZ/environment.zsh" -source "$OMZ/terminal.zsh" -source "$OMZ/keyboard.zsh" -source "$OMZ/completion.zsh" -source "$OMZ/history.zsh" -source "$OMZ/directory.zsh" -source "$OMZ/alias.zsh" -source "$OMZ/spectrum.zsh" -source "$OMZ/utility.zsh" +source "${0:h}/helper.zsh" +source "${0:h}/environment.zsh" +source "${0:h}/terminal.zsh" +source "${0:h}/keyboard.zsh" +source "${0:h}/completion.zsh" +source "${0:h}/history.zsh" +source "${0:h}/directory.zsh" +source "${0:h}/alias.zsh" +source "${0:h}/spectrum.zsh" +source "${0:h}/utility.zsh" # Source plugins defined in ~/.zshrc. for plugin in $plugins; do - if [[ -f "$OMZ/plugins/$plugin/init.zsh" ]]; then - source "$OMZ/plugins/$plugin/init.zsh" + if [[ -f "${0:h}/plugins/$plugin/init.zsh" ]]; then + source "${0:h}/plugins/$plugin/init.zsh" fi done unset plugin From 9d27df20500593136dea27143b06ca4eeb2c0f29 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Mon, 10 Oct 2011 22:16:06 -0400 Subject: [PATCH 523/614] Tradition dictates that options are uppercase. --- alias.zsh | 4 +-- completion.zsh | 20 ++++++------- directory.zsh | 22 +++++++-------- environment.zsh | 16 +++++------ history.zsh | 28 +++++++++---------- keyboard.zsh | 2 +- plugins/git/info.zsh | 4 +-- .../history-substring-search.zsh | 4 +-- plugins/ruby/init.zsh | 2 +- terminal.zsh | 2 +- themes/minimal/prompt_minimal_setup | 4 +-- themes/nicoulaj/prompt_nicoulaj_setup | 2 +- themes/sorin/prompt_sorin_setup | 4 +-- themes/steeef/prompt_steeef_setup | 2 +- 14 files changed, 58 insertions(+), 58 deletions(-) diff --git a/alias.zsh b/alias.zsh index 22db95f49..d5842d5d7 100644 --- a/alias.zsh +++ b/alias.zsh @@ -1,5 +1,5 @@ -setopt correct # Correct commands. -setopt correct_all # Correct all arguments. +setopt CORRECT # Correct commands. +setopt CORRECT_ALL # Correct all arguments. # The 'ls' Family if check-bool "$COLOR"; then diff --git a/completion.zsh b/completion.zsh index c0ae21d19..b670b21d1 100644 --- a/completion.zsh +++ b/completion.zsh @@ -3,14 +3,14 @@ if [[ "$TERM" == 'dumb' ]]; then return fi -setopt complete_in_word # Complete from both ends of a word. -setopt always_to_end # Move cursor to the end of a completed word. -setopt path_dirs # Perform path search even on command names with slashes. -setopt auto_menu # Show completion menu on a succesive tab press. -setopt auto_list # Automatically list choices on ambiguous completion. -setopt auto_param_slash # If completed parameter is a directory, add a trailing slash. -unsetopt menu_complete # Do not autoselect the first completion entry. -unsetopt flow_control # Disable start/stop characters in shell editor. +setopt COMPLETE_IN_WORD # Complete from both ends of a word. +setopt ALWAYS_TO_END # Move cursor to the end of a completed word. +setopt PATH_DIRS # Perform path search even on command names with slashes. +setopt AUTO_MENU # Show completion menu on a succesive tab press. +setopt AUTO_LIST # Automatically list choices on ambiguous completion. +setopt AUTO_PARAM_SLASH # If completed parameter is a directory, add a trailing slash. +unsetopt MENU_COMPLETE # Do not autoselect the first completion entry. +unsetopt FLOW_CONTROL # Disable start/stop characters in shell editor. # Treat these characters as part of a word. WORDCHARS='*?_-.[]~&;!#$%^(){}<>' @@ -22,10 +22,10 @@ zstyle ':completion::complete:*' cache-path "$HOME/.zcache" # Case-insensitive (all), partial-word, and then substring completion. if check-bool "$CASE_SENSITIVE"; then zstyle ':completion:*' matcher-list 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' - setopt case_glob + setopt CASE_GLOB else zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' - unsetopt case_glob + unsetopt CASE_GLOB fi # Group matches and describe. diff --git a/directory.zsh b/directory.zsh index eb7e0571a..88c1a1d34 100644 --- a/directory.zsh +++ b/directory.zsh @@ -1,14 +1,14 @@ -setopt auto_cd # Auto cd to a directory without typing cd. -setopt auto_pushd # Push the old directory onto the stack on cd. -setopt pushd_ignore_dups # Don't store duplicates in the stack. -setopt pushd_silent # Do not print the directory stack after pushd or popd. -setopt pushd_to_home # Push to home directory when no argument is given. -setopt pushd_minus # Use +/-n to specify a directory in the stack. -setopt cdable_vars # Change directory to a path stored in a variable. -setopt auto_name_dirs # Auto add variable-stored paths to ~ list. -setopt multios # Write to multiple descriptors. -setopt extended_glob # Use extended globbing syntax. -unsetopt clobber # Don't overwrite existing files with > and >>. +setopt AUTO_CD # Auto cd to a directory without typing cd. +setopt AUTO_PUSHD # Push the old directory onto the stack on cd. +setopt PUSHD_IGNORE_DUPS # Don't store duplicates in the stack. +setopt PUSHD_SILENT # Do not print the directory stack after pushd or popd. +setopt PUSHD_TO_HOME # Push to home directory when no argument is given. +setopt PUSHD_MINUS # Use +/-n to specify a directory in the stack. +setopt CDABLE_VARS # Change directory to a path stored in a variable. +setopt AUTO_NAME_DIRS # Auto add variable-stored paths to ~ list. +setopt MULTIOS # Write to multiple descriptors. +setopt EXTENDED_GLOB # Use extended globbing syntax. +unsetopt CLOBBER # Don't overwrite existing files with > and >>. # Use >! and >>! to bypass. alias 1='cd -' diff --git a/environment.zsh b/environment.zsh index 0c9bb46df..a4b690605 100644 --- a/environment.zsh +++ b/environment.zsh @@ -3,16 +3,16 @@ autoload -Uz url-quote-magic zle -N self-insert url-quote-magic # General -setopt rc_quotes # Allow 'Henry''s Garage' instead of 'Henry'\''s Garage'. -unsetopt mail_warning # Don't print a warning message if a mail file has been accessed +setopt RC_QUOTES # Allow 'Henry''s Garage' instead of 'Henry'\''s Garage'. +unsetopt MAIL_WARNING # Don't print a warning message if a mail file has been accessed # Jobs -setopt long_list_jobs # List jobs in the long format by default. -setopt auto_resume # Attempt to resume existing job before creating a new process. -setopt notify # Report status of background jobs immediately. -unsetopt bg_nice # Don't run all background jobs at a lower priority. -unsetopt hup # Don't kill jobs on shell exit. -unsetopt check_jobs # Don't report on jobs when shell exit. +setopt LONG_LIST_JOBS # List jobs in the long format by default. +setopt AUTO_RESUME # Attempt to resume existing job before creating a new process. +setopt NOTIFY # Report status of background jobs immediately. +unsetopt BG_NICE # Don't run all background jobs at a lower priority. +unsetopt HUP # Don't kill jobs on shell exit. +unsetopt CHECK_JOBS # Don't report on jobs when shell exit. # PATH typeset -U path manpath cdpath fpath diff --git a/history.zsh b/history.zsh index 314735e3d..8816a9347 100644 --- a/history.zsh +++ b/history.zsh @@ -2,18 +2,18 @@ HISTFILE="$HOME/.zhistory" HISTSIZE=10000 SAVEHIST=10000 -setopt bang_hist # Treat the '!' character specially during expansion. -setopt extended_history # Write the history file in the ":start:elapsed;command" format. -setopt append_history # Append to the history file, don't replace it. -setopt inc_append_history # Write to the history file immediately, not when the shell exits. -setopt share_history # Share history between all sessions. -setopt hist_expire_dups_first # Expire duplicate entries first when trimming history. -setopt hist_ignore_dups # Don't record an entry that was just recorded again. -setopt hist_ignore_all_dups # Delete old recorded entry if new entry is a duplicate. -setopt hist_find_no_dups # Do not display a line previously found. -setopt hist_ignore_space # Don't record an entry starting with a space. -setopt hist_save_no_dups # Don't write duplicate entries in the history file. -setopt hist_reduce_blanks # Remove superfluous blanks before recording entry. -setopt hist_verify # Don't execute immediately upon history expansion. -setopt hist_beep # Beep when accessing nonexistent history. +setopt BANG_HIST # Treat the '!' character specially during expansion. +setopt EXTENDED_HISTORY # Write the history file in the ":start:elapsed;command" format. +setopt APPEND_HISTORY # Append to the history file, don't replace it. +setopt INC_APPEND_HISTORY # Write to the history file immediately, not when the shell exits. +setopt SHARE_HISTORY # Share history between all sessions. +setopt HIST_EXPIRE_DUPS_FIRST # Expire duplicate entries first when trimming history. +setopt HIST_IGNORE_DUPS # Don't record an entry that was just recorded again. +setopt HIST_IGNORE_ALL_DUPS # Delete old recorded entry if new entry is a duplicate. +setopt HIST_FIND_NO_DUPS # Do not display a line previously found. +setopt HIST_IGNORE_SPACE # Don't record an entry starting with a space. +setopt HIST_SAVE_NO_DUPS # Don't write duplicate entries in the history file. +setopt HIST_REDUCE_BLANKS # Remove superfluous blanks before recording entry. +setopt HIST_VERIFY # Don't execute immediately upon history expansion. +setopt HIST_BEEP # Beep when accessing nonexistent history. diff --git a/keyboard.zsh b/keyboard.zsh index cb583b019..6cb7c50e2 100644 --- a/keyboard.zsh +++ b/keyboard.zsh @@ -8,7 +8,7 @@ zstyle ':prompt:' vicmd '<<<' # Indicator to notify of vi command mode. zstyle ':prompt:' completion "..." # Indicator to notify of generating completion. # Beep on error in line editor. -setopt beep +setopt BEEP # Reset to default key bindings. bindkey -d diff --git a/plugins/git/info.zsh b/plugins/git/info.zsh index 34e267bc1..bd2d6cdd9 100644 --- a/plugins/git/info.zsh +++ b/plugins/git/info.zsh @@ -105,8 +105,8 @@ add-zsh-trap INT _git-info-abort # Gets the Git status information. function git-info() { # Extended globbing is needed to parse repository status. - setopt local_options - setopt extended_glob + setopt LOCAL_OPTIONS + setopt EXTENDED_GLOB local action local action_format diff --git a/plugins/history-substring-search/history-substring-search.zsh b/plugins/history-substring-search/history-substring-search.zsh index 104045a20..336d35906 100644 --- a/plugins/history-substring-search/history-substring-search.zsh +++ b/plugins/history-substring-search/history-substring-search.zsh @@ -186,7 +186,7 @@ if [[ $+functions[_zsh_highlight] -eq 0 ]]; then fi function _history-substring-search-begin() { - setopt localoptions extendedglob + setopt LOCAL_OPTIONS EXTENDED_GLOB _history_substring_search_move_cursor_eol=false _history_substring_search_query_highlight= @@ -254,7 +254,7 @@ function _history-substring-search-begin() { } function _history-substring-search-end() { - setopt localoptions extendedglob + setopt LOCAL_OPTIONS EXTENDED_GLOB _history_substring_search_result=$BUFFER diff --git a/plugins/ruby/init.zsh b/plugins/ruby/init.zsh index 39ce03187..2776b5bc2 100644 --- a/plugins/ruby/init.zsh +++ b/plugins/ruby/init.zsh @@ -17,7 +17,7 @@ fi # Loads RVM into the shell session. if [[ -s "$HOME/.rvm/scripts/rvm" ]]; then # Auto adding variable-stored paths to ~ list conflicts with RVM. - unsetopt auto_name_dirs + unsetopt AUTO_NAME_DIRS # Source RVM. source "$HOME/.rvm/scripts/rvm" diff --git a/terminal.zsh b/terminal.zsh index 2008e490d..353a89650 100644 --- a/terminal.zsh +++ b/terminal.zsh @@ -34,7 +34,7 @@ function set-tab-title() { # Sets the tab and window titles with the command name. function set-title-by-command() { emulate -L zsh - setopt localoptions extended_glob + setopt LOCAL_OPTIONS EXTENDED_GLOB # Get the command name that is under job control. if [[ "${1[(w)1]}" == (fg|%*)(\;|) ]]; then diff --git a/themes/minimal/prompt_minimal_setup b/themes/minimal/prompt_minimal_setup index 765d2fac5..b8fb33f2e 100644 --- a/themes/minimal/prompt_minimal_setup +++ b/themes/minimal/prompt_minimal_setup @@ -6,12 +6,12 @@ function +vi-git-status() { } function prompt_minimal_precmd () { - setopt noxtrace noksharrays localoptions + setopt NO_XTRACE NO_KSHARRAYS LOCAL_OPTIONS vcs_info } function prompt_minimal_setup() { - setopt noxtrace noksharrays localoptions + setopt NO_XTRACE NO_KSHARRAYS LOCAL_OPTIONS prompt_opts=(cr subst percent) autoload -Uz add-zsh-hook diff --git a/themes/nicoulaj/prompt_nicoulaj_setup b/themes/nicoulaj/prompt_nicoulaj_setup index 71bbad3d4..bf82325c6 100644 --- a/themes/nicoulaj/prompt_nicoulaj_setup +++ b/themes/nicoulaj/prompt_nicoulaj_setup @@ -11,7 +11,7 @@ # ------------------------------------------------------------------------------ function prompt_nicoulaj_setup() { - setopt noxtrace noksharrays localoptions + setopt NO_XTRACE NO_KSHARRAYS LOCAL_OPTIONS prompt_opts=(cr subst percent) # Load required modules. diff --git a/themes/sorin/prompt_sorin_setup b/themes/sorin/prompt_sorin_setup index dbd685eff..fa63dcc4b 100644 --- a/themes/sorin/prompt_sorin_setup +++ b/themes/sorin/prompt_sorin_setup @@ -6,7 +6,7 @@ # SCREENSHOT: http://i.imgur.com/aipDQ.png # ------------------------------------------------------------------------------ function prompt_sorin_precmd () { - setopt noxtrace noksharrays localoptions + setopt NO_XTRACE NO_KSHARRAYS LOCAL_OPTIONS if (( $+functions[git-info] )); then git-info @@ -14,7 +14,7 @@ function prompt_sorin_precmd () { } function prompt_sorin_setup() { - setopt localoptions noxtrace noksharrays + setopt NO_XTRACE NO_KSHARRAYS LOCAL_OPTIONS prompt_opts=(cr subst percent) autoload -Uz add-zsh-hook diff --git a/themes/steeef/prompt_steeef_setup b/themes/steeef/prompt_steeef_setup index 96ee7b01b..b8cfcc9e5 100644 --- a/themes/steeef/prompt_steeef_setup +++ b/themes/steeef/prompt_steeef_setup @@ -45,7 +45,7 @@ function prompt_steeef_chpwd() { } function prompt_steeef_setup() { - setopt localoptions noxtrace noksharrays + setopt NO_XTRACE NO_KSHARRAYS LOCAL_OPTIONS prompt_opts=(cr subst percent) autoload -Uz add-zsh-hook From 62fc8d802e75f57faf0046e526c3710ffb672d7b Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Mon, 10 Oct 2011 22:16:12 -0400 Subject: [PATCH 524/614] Separate unsetopt from setopt for clarity. --- themes/minimal/prompt_minimal_setup | 6 +++--- themes/nicoulaj/prompt_nicoulaj_setup | 5 +++-- themes/sorin/prompt_sorin_setup | 8 +++++--- themes/steeef/prompt_steeef_setup | 5 +++-- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/themes/minimal/prompt_minimal_setup b/themes/minimal/prompt_minimal_setup index b8fb33f2e..35b4343cf 100644 --- a/themes/minimal/prompt_minimal_setup +++ b/themes/minimal/prompt_minimal_setup @@ -6,13 +6,13 @@ function +vi-git-status() { } function prompt_minimal_precmd () { - setopt NO_XTRACE NO_KSHARRAYS LOCAL_OPTIONS vcs_info } function prompt_minimal_setup() { - setopt NO_XTRACE NO_KSHARRAYS LOCAL_OPTIONS - prompt_opts=(cr subst percent) + setopt LOCAL_OPTIONS + unsetopt XTRACE KSH_ARRAYS + prompt_opts=(cr percent subst) autoload -Uz add-zsh-hook autoload -Uz vcs_info diff --git a/themes/nicoulaj/prompt_nicoulaj_setup b/themes/nicoulaj/prompt_nicoulaj_setup index bf82325c6..26a0783af 100644 --- a/themes/nicoulaj/prompt_nicoulaj_setup +++ b/themes/nicoulaj/prompt_nicoulaj_setup @@ -11,8 +11,9 @@ # ------------------------------------------------------------------------------ function prompt_nicoulaj_setup() { - setopt NO_XTRACE NO_KSHARRAYS LOCAL_OPTIONS - prompt_opts=(cr subst percent) + setopt LOCAL_OPTIONS + unsetopt XTRACE KSH_ARRAYS + prompt_opts=(cr percent subst) # Load required modules. autoload -Uz add-zsh-hook diff --git a/themes/sorin/prompt_sorin_setup b/themes/sorin/prompt_sorin_setup index fa63dcc4b..c04e533a9 100644 --- a/themes/sorin/prompt_sorin_setup +++ b/themes/sorin/prompt_sorin_setup @@ -6,7 +6,8 @@ # SCREENSHOT: http://i.imgur.com/aipDQ.png # ------------------------------------------------------------------------------ function prompt_sorin_precmd () { - setopt NO_XTRACE NO_KSHARRAYS LOCAL_OPTIONS + setopt LOCAL_OPTIONS + unsetopt XTRACE KSH_ARRAYS if (( $+functions[git-info] )); then git-info @@ -14,8 +15,9 @@ function prompt_sorin_precmd () { } function prompt_sorin_setup() { - setopt NO_XTRACE NO_KSHARRAYS LOCAL_OPTIONS - prompt_opts=(cr subst percent) + setopt LOCAL_OPTIONS + unsetopt XTRACE KSH_ARRAYS + prompt_opts=(cr percent subst) autoload -Uz add-zsh-hook add-zsh-hook precmd prompt_sorin_precmd diff --git a/themes/steeef/prompt_steeef_setup b/themes/steeef/prompt_steeef_setup index b8cfcc9e5..28b2a91c1 100644 --- a/themes/steeef/prompt_steeef_setup +++ b/themes/steeef/prompt_steeef_setup @@ -45,8 +45,9 @@ function prompt_steeef_chpwd() { } function prompt_steeef_setup() { - setopt NO_XTRACE NO_KSHARRAYS LOCAL_OPTIONS - prompt_opts=(cr subst percent) + setopt LOCAL_OPTIONS + unsetopt XTRACE KSH_ARRAYS + prompt_opts=(cr percent subst) autoload -Uz add-zsh-hook autoload -Uz vcs_info From 60f39d8d91ced59ad631485784bbde4a9c2e102a Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Tue, 11 Oct 2011 23:13:58 -0400 Subject: [PATCH 525/614] Moved hub into the git plugin. --- README.md | 14 +- functions/duh | 13 ++ functions/reload | 7 + helper.zsh | 6 +- init.zsh | 36 +++-- keyboard.zsh | 6 +- plugins/archive/{ => completions}/_extract | 0 plugins/archive/{ => completions}/_ls-archive | 0 plugins/archive/functions/extract | 68 +++++++++ plugins/archive/functions/ls-archive | 45 ++++++ plugins/archive/init.zsh | 125 ---------------- plugins/bundler/init.zsh | 2 +- plugins/command-not-found/init.zsh | 2 +- plugins/dpkg/functions/apt-copy | 9 ++ plugins/dpkg/functions/dbb-build | 10 ++ plugins/dpkg/init.zsh | 27 ---- plugins/git/completion.zsh | 17 ++- plugins/git/{ => completions}/_git-info | 0 plugins/git/functions/git-branch | 9 ++ plugins/git/functions/git-hub | 22 +++ plugins/git/{info.zsh => functions/git-info} | 35 ++--- plugins/git/functions/git-root | 9 ++ plugins/{github/init.zsh => git/hub.zsh} | 2 - plugins/git/init.zsh | 4 +- plugins/git/style.zsh | 18 +++ plugins/git/utility.zsh | 46 ------ plugins/history-substring-search/README | 2 +- .../history-substring-search.zsh | 10 +- plugins/kate/init.zsh | 3 +- plugins/node/functions/node-docs | 4 + plugins/node/init.zsh | 6 - plugins/osx/README.md | 10 ++ plugins/osx/_man-preview | 5 - plugins/osx/functions/pfd | 6 + plugins/osx/functions/pfs | 11 ++ plugins/osx/functions/tab | 34 +++++ plugins/osx/functions/trash | 13 ++ plugins/osx/init.zsh | 108 ++------------ plugins/pacman/functions/pacdisowned | 16 +++ plugins/pacman/functions/paclist | 4 + plugins/pacman/init.zsh | 136 ++++++++++-------- plugins/perl/functions/pgs | 12 ++ plugins/perl/functions/prep | 11 ++ plugins/perl/init.zsh | 27 ---- plugins/ruby/init.zsh | 2 +- plugins/ssh-agent/init.zsh | 4 +- plugins/textmate/init.zsh | 3 +- plugins/wakeonlan/{ => completions}/_wake | 0 plugins/wakeonlan/functions/wake | 13 ++ plugins/wakeonlan/init.zsh | 15 -- spectrum.zsh | 2 +- templates/zshrc.zsh | 4 +- themes/nicoulaj/prompt_nicoulaj_setup | 2 +- themes/steeef/prompt_steeef_setup | 4 +- utility.zsh | 60 ++------ 55 files changed, 531 insertions(+), 528 deletions(-) create mode 100644 functions/duh create mode 100644 functions/reload rename plugins/archive/{ => completions}/_extract (100%) rename plugins/archive/{ => completions}/_ls-archive (100%) create mode 100644 plugins/archive/functions/extract create mode 100644 plugins/archive/functions/ls-archive delete mode 100644 plugins/archive/init.zsh create mode 100644 plugins/dpkg/functions/apt-copy create mode 100644 plugins/dpkg/functions/dbb-build rename plugins/git/{ => completions}/_git-info (100%) create mode 100644 plugins/git/functions/git-branch create mode 100644 plugins/git/functions/git-hub rename plugins/git/{info.zsh => functions/git-info} (84%) create mode 100644 plugins/git/functions/git-root rename plugins/{github/init.zsh => git/hub.zsh} (91%) create mode 100644 plugins/git/style.zsh delete mode 100644 plugins/git/utility.zsh create mode 100644 plugins/node/functions/node-docs create mode 100644 plugins/osx/README.md delete mode 100644 plugins/osx/_man-preview create mode 100644 plugins/osx/functions/pfd create mode 100644 plugins/osx/functions/pfs create mode 100644 plugins/osx/functions/tab create mode 100644 plugins/osx/functions/trash create mode 100644 plugins/pacman/functions/pacdisowned create mode 100644 plugins/pacman/functions/paclist create mode 100644 plugins/perl/functions/pgs create mode 100644 plugins/perl/functions/prep rename plugins/wakeonlan/{ => completions}/_wake (100%) create mode 100644 plugins/wakeonlan/functions/wake delete mode 100644 plugins/wakeonlan/init.zsh diff --git a/README.md b/README.md index 38d65e946..1bab17dc8 100644 --- a/README.md +++ b/README.md @@ -4,29 +4,29 @@ A handful of functions, auto-complete helpers, and stuff that makes you shout... ## Setup -`oh-my-zsh` should work with any recent release of [ZSH](http://www.zsh.org), but the +`oh-my-zsh` should work with any recent release of [Zsh](http://www.zsh.org), but the minimum recommended version is 4.3.9. 1. Clone the repository. `git clone git://github.com/sorin-ionescu/oh-my-zsh.git ~/.oh-my-zsh` -2. Create a new ZSH configuration by copying the ZSH template provided. +2. Create a new Zsh configuration by copying the Zsh template provided. **NOTE**: If you already have a `~/.zshrc` file, you should back it up with `cp ~/.zshrc{,.orig}` in case you want to go back to your original settings. cp ~/.oh-my-zsh/templates/zshrc.template.zsh ~/.zshrc -3. Set ZSH as your default shell: +3. Set Zsh as your default shell: `chsh -s /bin/zsh` -4. Start / restart ZSH by opening a new terminal window or tab. +4. Start / restart Zsh by opening a new terminal window or tab. ### Problems? -If you are not able to find certain commands after switching to *Oh My ZSH*, you need +If you are not able to find certain commands after switching to *Oh My Zsh*, you need to modify `PATH` in `~/.zshrc`, or better yet, in `~/functions/02.environment.zsh` (may be subject to merge conflicts). @@ -42,7 +42,7 @@ to modify `PATH` in `~/.zshrc`, or better yet, in `~/functions/02.environment.zs ## Useful -The [ZSH Reference Card](http://www.bash2zsh.com/zsh_refcard/refcard.pdf) is tasty. +The [Zsh Reference Card](http://www.bash2zsh.com/zsh_refcard/refcard.pdf) is tasty. ### Customization @@ -51,7 +51,7 @@ If you have many related functions, you can organise them in a file in the ## Help out! -I am not a ZSH expert and suspect that there are improvements to be made. If you have +I am not a Zsh expert and suspect that there are improvements to be made. If you have ideas on how to make the configuration easier to maintain or improve the performance, do not hesitate to fork and send pull requests! diff --git a/functions/duh b/functions/duh new file mode 100644 index 000000000..b01f14210 --- /dev/null +++ b/functions/duh @@ -0,0 +1,13 @@ +# Displays human readable disk usage statistics. +function duh() { + (( $# == 0 )) && set -- * + if [[ "$OSTYPE" == linux* ]]; then + du -khsc "$@" | sort -h -r + else + du -kcs "$@" | awk '{ printf "%9.1fM %s\n", $1 / 1024, $2 } ' | sort -n -r + fi +} +compdef _du duh + +duh "$@" + diff --git a/functions/reload b/functions/reload new file mode 100644 index 000000000..9b7563919 --- /dev/null +++ b/functions/reload @@ -0,0 +1,7 @@ +# Reloads ~/.zshrc. +local zshrc="$HOME/.zshrc" +if [[ -n "$1" ]]; then + zshrc="$1" +fi +source "$zshrc" + diff --git a/helper.zsh b/helper.zsh index 89e751405..f4153ce34 100644 --- a/helper.zsh +++ b/helper.zsh @@ -9,7 +9,7 @@ function check-bool { } # Trap signals were generated with 'kill -l'. -# DEBUG, EXIT, and ZERR are ZSH signals. +# DEBUG, EXIT, and ZERR are Zsh signals. TRAP_SIGNALS=( ABRT ALRM BUS CHLD CONT EMT FPE HUP ILL INFO INT IO KILL PIPE PROF QUIT SEGV STOP SYS TERM TRAP TSTP TTIN TTOU URG USR1 USR2 VTALRM WINCH XCPU XFSZ @@ -19,12 +19,12 @@ TRAP_SIGNALS=( # Adds a function to a list to be called when a trap is triggered. function add-zsh-trap { if (( $# < 2 )); then - echo "Usage: $0 type function" + print "Usage: $0 type function" return 1 fi if [[ -z "$TRAP_SIGNALS[(r)$1]" ]]; then - echo "$0: unknown signal: $1" + print "$0: unknown signal: $1" return 1 fi diff --git a/init.zsh b/init.zsh index 6eb497746..7af5d88e2 100644 --- a/init.zsh +++ b/init.zsh @@ -1,4 +1,11 @@ -# Initializes OH MY ZSH. +# Initializes Oh My Zsh. + +# Check for the minimum supported version. +min_zsh_version=4.3.9 +if ! autoload -Uz is-at-least || ! is-at-least "$min_zsh_version"; then + print "oh-my-zsh: The minimum supported Zsh version is $min_zsh_version." +fi +unset min_zsh_version # Disable color in dumb terminals. if [[ "$TERM" == 'dumb' ]]; then @@ -7,10 +14,9 @@ fi # Add functions to fpath. fpath=( - ${0:h}/themes/*(/N) - ${plugins:+${0:h}/plugins/${^plugins}} - ${0:h}/functions - ${0:h}/completions + ${0:h}/themes/*(/FN) + ${plugins:+${0:h}/plugins/${^plugins}/{functions,completions}(/FN)} + ${0:h}/{functions,completions}(/FN) $fpath ) @@ -29,14 +35,28 @@ source "${0:h}/alias.zsh" source "${0:h}/spectrum.zsh" source "${0:h}/utility.zsh" +# Autoload Zsh function builtins. +autoload -Uz age +autoload -Uz zargs +autoload -Uz zcalc +autoload -Uz zmv + # Source plugins defined in ~/.zshrc. -for plugin in $plugins; do +for plugin in "$plugins[@]"; do if [[ -f "${0:h}/plugins/$plugin/init.zsh" ]]; then source "${0:h}/plugins/$plugin/init.zsh" fi done -unset plugin -unset plugins +unset plugin plugins + +# Autoload Oh My Zsh functions. +for fdir in "$fpath[@]"; do + if [[ "$fdir" == ${0:h}/(|*/)functions ]]; then + for afunction in $fdir/[^_.]*(N.:t); do + autoload -Uz $afunction + done + fi +done # Set environment variables for launchd processes. if [[ "$OSTYPE" == darwin* ]]; then diff --git a/keyboard.zsh b/keyboard.zsh index 6cb7c50e2..e481cba68 100644 --- a/keyboard.zsh +++ b/keyboard.zsh @@ -82,7 +82,7 @@ if [[ "$KEYMAP" == (emacs|) ]]; then fi # Bind to history substring search plugin if enabled; - # otherwise, bind to built-in ZSH history search. + # otherwise, bind to built-in Zsh history search. if (( $+widgets[history-incremental-pattern-search-backward] )); then bindkey "$keyinfo[Control]r" history-incremental-pattern-search-backward bindkey "$keyinfo[Control]s" history-incremental-pattern-search-forward @@ -169,7 +169,7 @@ elif [[ "$KEYMAP" == 'vi' ]]; then bindkey -M vicmd "G" end-of-history # Bind to history substring search plugin if enabled; - # otherwise, bind to built-in ZSH history search. + # otherwise, bind to built-in Zsh history search. if (( $+plugins[(er)history-substring-search] )); then bindkey -M vicmd "k" history-substring-search-up bindkey -M vicmd "j" history-substring-search-down @@ -194,7 +194,7 @@ elif [[ "$KEYMAP" == 'vi' ]]; then bindkey -M viins "$keyinfo[Control]s" history-incremental-search-forward fi else - echo "oh-my-zsh: KEYMAP must be set 'emacs' or 'vi' but is set to '$KEYMAP'" >&2 + print "oh-my-zsh: KEYMAP must be set 'emacs' or 'vi' but is set to '$KEYMAP'" >&2 return 1 fi diff --git a/plugins/archive/_extract b/plugins/archive/completions/_extract similarity index 100% rename from plugins/archive/_extract rename to plugins/archive/completions/_extract diff --git a/plugins/archive/_ls-archive b/plugins/archive/completions/_ls-archive similarity index 100% rename from plugins/archive/_ls-archive rename to plugins/archive/completions/_ls-archive diff --git a/plugins/archive/functions/extract b/plugins/archive/functions/extract new file mode 100644 index 000000000..2271fab23 --- /dev/null +++ b/plugins/archive/functions/extract @@ -0,0 +1,68 @@ +local remove_archive +local success +local file_name +local extract_dir + +if (( $# == 0 )); then + print "Usage: extract [-option] [file ...]" + print + print "Options:" + print " -r, --remove Remove archive." + print + print "Report bugs to ." +fi + +remove_archive=1 +if [[ "$1" == "-r" ]] || [[ "$1" == "--remove" ]]; then + remove_archive=0 + shift +fi + +while (( $# > 0 )); do + if [[ ! -f "$1" ]]; then + print "extract: '$1' is not a valid file" 1>&2 + shift + continue + fi + + success=0 + file_name="${1:t}" + extract_dir="${file_name:r}" + case "$1" in + (*.tar.gz|*.tgz) tar xvzf "$1" ;; + (*.tar.bz2|*.tbz|*.tbz2) tar xvjf "$1" ;; + (*.tar.xz|*.txz) tar --xz --help &> /dev/null \ + && tar --xz -xvf "$1" \ + || xzcat "$1" | tar xvf - ;; + (*.tar.zma|*.tlz) tar --lzma --help &> /dev/null \ + && tar --lzma -xvf "$1" \ + || lzcat "$1" | tar xvf - ;; + (*.tar) tar xvf "$1" ;; + (*.gz) gunzip "$1" ;; + (*.bz2) bunzip2 "$1" ;; + (*.xz) unxz "$1" ;; + (*.lzma) unlzma "$1" ;; + (*.Z) uncompress "$1" ;; + (*.zip) unzip "$1" -d $extract_dir ;; + (*.rar) unrar e -ad "$1" ;; + (*.7z) 7za x "$1" ;; + (*.deb) + mkdir -p "$extract_dir/control" + mkdir -p "$extract_dir/data" + cd "$extract_dir"; ar vx "../${1}" > /dev/null + cd control; tar xzvf ../control.tar.gz + cd ../data; tar xzvf ../data.tar.gz + cd ..; rm *.tar.gz debian-binary + cd .. + ;; + (*) + print "extract: '$1' cannot be extracted" 1>&2 + success=1 + ;; + esac + + (( success = $success > 0 ? $success : $? )) + (( $success == 0 )) && (( $remove_archive == 0 )) && rm "$1" + shift +done + diff --git a/plugins/archive/functions/ls-archive b/plugins/archive/functions/ls-archive new file mode 100644 index 000000000..589b2450b --- /dev/null +++ b/plugins/archive/functions/ls-archive @@ -0,0 +1,45 @@ +local verbose + +if (( $# == 0 )); then + print "Usage: extract [-option] [file ...]" + print + print "Options:" + print " -v, --verbose Verbose archive listing." + print + print "Report bugs to ." +fi + +if [[ "$1" == "-v" ]] || [[ "$1" == "--verbose" ]]; then + verbose=0 + shift +fi + +while (( $# > 0 )); do + if [[ ! -f "$1" ]]; then + print "extract: '$1' is not a valid file" 1>&2 + shift + continue + fi + + case "$1" in + (*.tar.gz|*.tgz) tar t${verbose:+v}vzf "$1" ;; + (*.tar.bz2|*.tbz|*.tbz2) tar t${verbose:+v}jf "$1" ;; + (*.tar.xz|*.txz) tar --xz --help &> /dev/null \ + && tar --xz -t${verbose:+v}f "$1" \ + || xzcat "$1" | tar t${verbose:+v}f - ;; + (*.tar.zma|*.tlz) tar --lzma --help &> /dev/null \ + && tar --lzma -t${verbose:+v}f "$1" \ + || lzcat "$1" | tar x${verbose:+v}f - ;; + (*.tar) tar t${verbose:+v}f "$1" ;; + (*.zip) unzip -l${verbose:+v} "$1" ;; + (*.rar) unrar ${${verbose:+v}:-l} "$1" ;; + (*.7z) 7za l "$1" ;; + (*) + print "ls-archive: '$1' cannot be listed" 1>&2 + success=1 + ;; + esac + + shift +done + diff --git a/plugins/archive/init.zsh b/plugins/archive/init.zsh deleted file mode 100644 index 006afad55..000000000 --- a/plugins/archive/init.zsh +++ /dev/null @@ -1,125 +0,0 @@ -# ------------------------------------------------------------------------------ -# FILE: extract.plugin.zsh -# DESCRIPTION: oh-my-zsh plugin file. -# AUTHOR: Sorin Ionescu -# VERSION: 1.0.2 -# ------------------------------------------------------------------------------ - - -function extract() { - local remove_archive - local success - local file_name - local extract_dir - - if (( $# == 0 )); then - echo "Usage: extract [-option] [file ...]" - echo - echo "Options:" - echo " -r, --remove Remove archive." - echo - echo "Report bugs to ." - fi - - remove_archive=1 - if [[ "$1" == "-r" ]] || [[ "$1" == "--remove" ]]; then - remove_archive=0 - shift - fi - - while (( $# > 0 )); do - if [[ ! -f "$1" ]]; then - echo "extract: '$1' is not a valid file" 1>&2 - shift - continue - fi - - success=0 - file_name="$( basename "$1" )" - extract_dir="$( echo "$file_name" | sed "s/\.${1##*.}//g" )" - case "$1" in - (*.tar.gz|*.tgz) tar xvzf "$1" ;; - (*.tar.bz2|*.tbz|*.tbz2) tar xvjf "$1" ;; - (*.tar.xz|*.txz) tar --xz --help &> /dev/null \ - && tar --xz -xvf "$1" \ - || xzcat "$1" | tar xvf - ;; - (*.tar.zma|*.tlz) tar --lzma --help &> /dev/null \ - && tar --lzma -xvf "$1" \ - || lzcat "$1" | tar xvf - ;; - (*.tar) tar xvf "$1" ;; - (*.gz) gunzip "$1" ;; - (*.bz2) bunzip2 "$1" ;; - (*.xz) unxz "$1" ;; - (*.lzma) unlzma "$1" ;; - (*.Z) uncompress "$1" ;; - (*.zip) unzip "$1" -d $extract_dir ;; - (*.rar) unrar e -ad "$1" ;; - (*.7z) 7za x "$1" ;; - (*.deb) - mkdir -p "$extract_dir/control" - mkdir -p "$extract_dir/data" - cd "$extract_dir"; ar vx "../${1}" > /dev/null - cd control; tar xzvf ../control.tar.gz - cd ../data; tar xzvf ../data.tar.gz - cd ..; rm *.tar.gz debian-binary - cd .. - ;; - (*) - echo "extract: '$1' cannot be extracted" 1>&2 - success=1 - ;; - esac - - (( success = $success > 0 ? $success : $? )) - (( $success == 0 )) && (( $remove_archive == 0 )) && rm "$1" - shift - done -} - -function ls-archive() { - local verbose - - if (( $# == 0 )); then - echo "Usage: extract [-option] [file ...]" - echo - echo "Options:" - echo " -v, --verbose Verbose archive listing." - echo - echo "Report bugs to ." - fi - - if [[ "$1" == "-v" ]] || [[ "$1" == "--verbose" ]]; then - verbose=0 - shift - fi - - while (( $# > 0 )); do - if [[ ! -f "$1" ]]; then - echo "extract: '$1' is not a valid file" 1>&2 - shift - continue - fi - - case "$1" in - (*.tar.gz|*.tgz) tar t${verbose:+v}vzf "$1" ;; - (*.tar.bz2|*.tbz|*.tbz2) tar t${verbose:+v}jf "$1" ;; - (*.tar.xz|*.txz) tar --xz --help &> /dev/null \ - && tar --xz -t${verbose:+v}f "$1" \ - || xzcat "$1" | tar t${verbose:+v}f - ;; - (*.tar.zma|*.tlz) tar --lzma --help &> /dev/null \ - && tar --lzma -t${verbose:+v}f "$1" \ - || lzcat "$1" | tar x${verbose:+v}f - ;; - (*.tar) tar t${verbose:+v}f "$1" ;; - (*.zip) unzip -l${verbose:+v} "$1" ;; - (*.rar) unrar ${${verbose:+v}:-l} "$1" ;; - (*.7z) 7za l "$1" ;; - (*) - echo "ls-archive: '$1' cannot be listed" 1>&2 - success=1 - ;; - esac - - shift - done -} - diff --git a/plugins/bundler/init.zsh b/plugins/bundler/init.zsh index cb3841562..c3377d435 100644 --- a/plugins/bundler/init.zsh +++ b/plugins/bundler/init.zsh @@ -6,5 +6,5 @@ alias bl='b list' alias bo='b open' alias bp='b package' alias bu='b update' -alias binit="bi && b package && echo '\nvendor/ruby' >>! .gitignore" +alias binit="bi && b package && print '\nvendor/ruby' >>! .gitignore" diff --git a/plugins/command-not-found/init.zsh b/plugins/command-not-found/init.zsh index b8f3fe9c9..e94b8f28f 100644 --- a/plugins/command-not-found/init.zsh +++ b/plugins/command-not-found/init.zsh @@ -1,4 +1,4 @@ -# Uses the command-not-found package ZSH support as seen in +# Uses the command-not-found package Zsh support as seen in # http://www.porcheron.info/command-not-found-for-zsh/ and # installed in Ubuntu. diff --git a/plugins/dpkg/functions/apt-copy b/plugins/dpkg/functions/apt-copy new file mode 100644 index 000000000..2f2e2839a --- /dev/null +++ b/plugins/dpkg/functions/apt-copy @@ -0,0 +1,9 @@ +# Create a simple script that can be used to 'duplicate' a system. +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;') + +print 'aptitude install '"$list\n" >> apt-copy.sh + +chmod +x apt-copy.sh + diff --git a/plugins/dpkg/functions/dbb-build b/plugins/dpkg/functions/dbb-build new file mode 100644 index 000000000..7576e2eae --- /dev/null +++ b/plugins/dpkg/functions/dbb-build @@ -0,0 +1,10 @@ +# Kernel-package building shortcut. +MAKEFLAGS='' # Temporarily unset MAKEFLAGS ( '-j3' will fail ). +appendage='-custom' # This shows up in $ (uname -r ). +revision=$(date +"%Y%m%d") # This shows up in the .deb file name. + +make-kpkg clean + +time fakeroot make-kpkg --append-to-version "$appendage" --revision \ + "$revision" kernel_image kernel_headers + diff --git a/plugins/dpkg/init.zsh b/plugins/dpkg/init.zsh index 0b6f440a3..a653768d1 100644 --- a/plugins/dpkg/init.zsh +++ b/plugins/dpkg/init.zsh @@ -1,5 +1,3 @@ -# Debian ZSH Aliases and Functions - # 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. @@ -22,28 +20,3 @@ alias debc='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' -# Functions - -# Create a simple script that can be used to 'duplicate' a system. -function apt-copy() { - 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;') - - print 'aptitude install '"$list\n" >> apt-copy.sh - - chmod +x apt-copy.sh -} - -# Kernel-package building shortcut. -function dbb-build() { - MAKEFLAGS='' # Temporarily unset MAKEFLAGS ( '-j3' will fail ). - appendage='-custom' # This shows up in $ (uname -r ). - revision=$(date +"%Y%m%d") # This shows up in the .deb file name. - - make-kpkg clean - - time fakeroot make-kpkg --append-to-version "$appendage" --revision \ - "$revision" kernel_image kernel_headers -} - diff --git a/plugins/git/completion.zsh b/plugins/git/completion.zsh index 4bcf7e962..b9867452c 100644 --- a/plugins/git/completion.zsh +++ b/plugins/git/completion.zsh @@ -1,13 +1,20 @@ # Get the latest Git completion. -completion_file="${0:h}/_git" +completion_file="${0:h}/completions/_git" completion_file_url='http://zsh.git.sourceforge.net/git/gitweb.cgi?p=zsh/zsh;a=blob_plain;f=Completion/Unix/Command/_git;hb=HEAD' if [[ ! -e "$completion_file" ]] && (( $+commands[git] )); then - if (( $+commands[curl] )); then - curl -L "$completion_file_url" -o "$completion_file" &> /dev/null &! + # Remove empty completions directory. + if [[ -d "${completion_file:h}"(/^F) ]]; then + rmdir "${completion_file:h}" 2> /dev/null fi - if (( $+commmands[wget] )); then - wget -C "$completion_file_url" -O "$completion_file" &> /dev/null &! + if mkdir -p "${completion_file:h}" > /dev/null; then + if (( $+commands[curl] )); then + curl -L "$completion_file_url" -o "$completion_file" &> /dev/null &! + fi + + if (( $+commmands[wget] )); then + wget -C "$completion_file_url" -O "$completion_file" &> /dev/null &! + fi fi fi unset completion_file diff --git a/plugins/git/_git-info b/plugins/git/completions/_git-info similarity index 100% rename from plugins/git/_git-info rename to plugins/git/completions/_git-info diff --git a/plugins/git/functions/git-branch b/plugins/git/functions/git-branch new file mode 100644 index 000000000..b38618a31 --- /dev/null +++ b/plugins/git/functions/git-branch @@ -0,0 +1,9 @@ +# Gets the current branch. +local ref="$(git symbolic-ref HEAD 2> /dev/null)" +if [[ -n "$ref" ]]; then + print "${ref#refs/heads/}" + return 0 +else + return 1 +fi + diff --git a/plugins/git/functions/git-hub b/plugins/git/functions/git-hub new file mode 100644 index 000000000..6bfbb9ae9 --- /dev/null +++ b/plugins/git/functions/git-hub @@ -0,0 +1,22 @@ +# Open the GitHub repository in the browser. +local url=$( + git config -l \ + | grep "remote.origin.url" \ + | sed -En "s/remote.origin.url=(git|https?)(@|:\/\/)github.com(:|\/)(.+)\/(.+).git/https:\/\/github.com\/\4\/\5/p" +) + +if [[ -n "$url" ]]; then + url="${url}/tree/${$(git-branch):-master}" + + if (( $+commands[$BROWSER] )); then + "$BROWSER" "$url" + return 0 + else + print "fatal: Browser not set or set to a non-existent browser." >&2 + return 1 + fi +else + print "fatal: Not a Git repository or origin remote not set." >&2 + return 1 +fi + diff --git a/plugins/git/info.zsh b/plugins/git/functions/git-info similarity index 84% rename from plugins/git/info.zsh rename to plugins/git/functions/git-info index bd2d6cdd9..84e239110 100644 --- a/plugins/git/info.zsh +++ b/plugins/git/functions/git-info @@ -1,22 +1,3 @@ -# The default styles. -zstyle ':git-info:' action 'action:%s' # %s - Special action name (am, merge, rebase). -zstyle ':git-info:' added 'added:%a' # %a - Indicator to notify of added files. -zstyle ':git-info:' ahead 'ahead:%A' # %A - Indicator to notify of ahead branch. -zstyle ':git-info:' behind 'behind:%B' # %B - Indicator to notify of behind branch. -zstyle ':git-info:' branch '%b' # %b - Branch name. -zstyle ':git-info:' clean 'clean' # %C - Indicator to notify of clean branch. -zstyle ':git-info:' commit 'commit:%c' # %c - SHA-1 hash. -zstyle ':git-info:' deleted 'deleted:%d' # %d - Indicator to notify of deleted files. -zstyle ':git-info:' dirty 'dirty' # %D - Indicator to notify of dirty branch. -zstyle ':git-info:' modified 'modified:%m' # %m - Indicator to notify of modified files. -zstyle ':git-info:' remote '%R' # %R - Remote name. -zstyle ':git-info:' renamed 'renamed:%r' # %r - Indicator to notify of renamed files. -zstyle ':git-info:' stashed 'stashed:%S' # %S - Indicator to notify of stashed files. -zstyle ':git-info:' unmerged 'unmerged:%U' # %U - Indicator to notify of unmerged files. -zstyle ':git-info:' untracked 'untracked:%u' # %u - Indicator to notify of untracked files. -zstyle ':git-info:' prompt ' git:(%b %D%C)' # Left prompt. -zstyle ':git-info:' rprompt '' # Right prompt. - # Gets the Git special action (am, merge, rebase, etc.). # Borrowed from vcs_info and edited. function _git-action() { @@ -36,7 +17,7 @@ function _git-action() { else action='am/rebase' fi - echo "$action" + print "$action" return 0 fi done @@ -45,7 +26,7 @@ function _git-action() { "${git_dir}/rebase-merge/interactive" \ "${git_dir}/.dotest-merge/interactive"; do if [[ -f "$action_dir" ]]; then - echo 'rebase-i' + print 'rebase-i' return 0 fi done @@ -54,23 +35,23 @@ function _git-action() { "${git_dir}/rebase-merge" \ "${git_dir}/.dotest-merge"; do if [[ -d "$action_dir" ]]; then - echo 'rebase-m' + print 'rebase-m' return 0 fi done if [[ -f "${git_dir}/MERGE_HEAD" ]]; then - echo 'merge' + print 'merge' return 0 fi if [[ -f "${git_dir}/CHERRY_PICK_HEAD" ]]; then - echo 'cherry-pick' + print 'cherry-pick' return 0 fi if [[ -f "${git_dir}/BISECT_LOG" ]]; then - echo 'bisect' + print 'bisect' return 0 fi @@ -175,7 +156,7 @@ function git-info() { elif [[ "$1" == [Oo][Ff][Ff] ]]; then git config --bool prompt.showinfo false else - echo "Usage: $0 [ on | off ]" + print "Usage: $0 [ on | off ]" fi return 0 fi @@ -355,3 +336,5 @@ function git-info() { return 0 } +git-info "$@" + diff --git a/plugins/git/functions/git-root b/plugins/git/functions/git-root new file mode 100644 index 000000000..e86ce70df --- /dev/null +++ b/plugins/git/functions/git-root @@ -0,0 +1,9 @@ +# Gets the repository root. +local root="$(git rev-parse --show-toplevel 2> /dev/null)" +if [[ -n "$root" ]]; then + print "$root" + return 0 +else + return 1 +fi + diff --git a/plugins/github/init.zsh b/plugins/git/hub.zsh similarity index 91% rename from plugins/github/init.zsh rename to plugins/git/hub.zsh index 3f327c3f3..8586e0a58 100644 --- a/plugins/github/init.zsh +++ b/plugins/git/hub.zsh @@ -1,5 +1,3 @@ -# Aliases - # Hub by defunkt # https://github.com/defunkt/hub if (( $+commands[hub] )); then diff --git a/plugins/git/init.zsh b/plugins/git/init.zsh index 74cf94348..1a3034931 100644 --- a/plugins/git/init.zsh +++ b/plugins/git/init.zsh @@ -6,8 +6,8 @@ # ------------------------------------------------------------------------------ # Source plugin files. -source "${0:h}/utility.zsh" source "${0:h}/alias.zsh" -source "${0:h}/info.zsh" +source "${0:h}/hub.zsh" +source "${0:h}/style.zsh" source "${0:h}/completion.zsh" diff --git a/plugins/git/style.zsh b/plugins/git/style.zsh new file mode 100644 index 000000000..c0ad0531e --- /dev/null +++ b/plugins/git/style.zsh @@ -0,0 +1,18 @@ +# The default styles. +zstyle ':git-info:' action 'action:%s' # %s - Special action name (am, merge, rebase). +zstyle ':git-info:' added 'added:%a' # %a - Indicator to notify of added files. +zstyle ':git-info:' ahead 'ahead:%A' # %A - Indicator to notify of ahead branch. +zstyle ':git-info:' behind 'behind:%B' # %B - Indicator to notify of behind branch. +zstyle ':git-info:' branch '%b' # %b - Branch name. +zstyle ':git-info:' clean 'clean' # %C - Indicator to notify of clean branch. +zstyle ':git-info:' commit 'commit:%c' # %c - SHA-1 hash. +zstyle ':git-info:' deleted 'deleted:%d' # %d - Indicator to notify of deleted files. +zstyle ':git-info:' dirty 'dirty' # %D - Indicator to notify of dirty branch. +zstyle ':git-info:' modified 'modified:%m' # %m - Indicator to notify of modified files. +zstyle ':git-info:' remote '%R' # %R - Remote name. +zstyle ':git-info:' renamed 'renamed:%r' # %r - Indicator to notify of renamed files. +zstyle ':git-info:' stashed 'stashed:%S' # %S - Indicator to notify of stashed files. +zstyle ':git-info:' unmerged 'unmerged:%U' # %U - Indicator to notify of unmerged files. +zstyle ':git-info:' untracked 'untracked:%u' # %u - Indicator to notify of untracked files. +zstyle ':git-info:' prompt ' git:(%b %D%C)' # Left prompt. +zstyle ':git-info:' rprompt '' # Right prompt. diff --git a/plugins/git/utility.zsh b/plugins/git/utility.zsh deleted file mode 100644 index c50fc55f1..000000000 --- a/plugins/git/utility.zsh +++ /dev/null @@ -1,46 +0,0 @@ -# Gets the current branch. -function git-branch() { - local ref="$(git symbolic-ref HEAD 2> /dev/null)" - if [[ -n "$ref" ]]; then - echo "${ref#refs/heads/}" - return 0 - else - return 1 - fi -} - -# Gets the repository root. -function git-root() { - local root="$(git rev-parse --show-toplevel 2> /dev/null)" - if [[ -n "$root" ]]; then - echo "$root" - return 0 - else - return 1 - fi -} - -# Open the GitHub repository in the browser. -function git-hub() { - local url=$( - git config -l \ - | grep "remote.origin.url" \ - | sed -En "s/remote.origin.url=(git|https?)(@|:\/\/)github.com(:|\/)(.+)\/(.+).git/https:\/\/github.com\/\4\/\5/p" - ) - - if [[ -n "$url" ]]; then - url="${url}/tree/${$(git-branch):-master}" - - if (( $+commands[$BROWSER] )); then - "$BROWSER" "$url" - return 0 - else - echo "fatal: Browser not set or set to a non-existent browser." >&2 - return 1 - fi - else - echo "fatal: Not a Git repository or origin remote not set." >&2 - return 1 - fi -} - diff --git a/plugins/history-substring-search/README b/plugins/history-substring-search/README index 215677476..0726ccffe 100644 --- a/plugins/history-substring-search/README +++ b/plugins/history-substring-search/README @@ -1,4 +1,4 @@ -To activate this script, load it into an interactive ZSH session: +To activate this script, load it into an interactive Zsh session: % source history-substring-search.zsh diff --git a/plugins/history-substring-search/history-substring-search.zsh b/plugins/history-substring-search/history-substring-search.zsh index 336d35906..85771303b 100644 --- a/plugins/history-substring-search/history-substring-search.zsh +++ b/plugins/history-substring-search/history-substring-search.zsh @@ -147,9 +147,9 @@ if [[ $+functions[_zsh_highlight] -eq 0 ]]; then # Rebind all ZLE widgets to make them invoke _zsh_highlights. _zsh_highlight_bind_widgets() { - # Load ZSH module zsh/zleparameter, needed to override user defined widgets. + # Load Zsh module zsh/zleparameter, needed to override user defined widgets. zmodload zsh/zleparameter 2>/dev/null || { - echo 'zsh-syntax-highlighting: failed loading zsh/zleparameter.' >&2 + print 'zsh-syntax-highlighting: failed loading zsh/zleparameter.' >&2 return 1 } @@ -176,7 +176,7 @@ if [[ $+functions[_zsh_highlight] -eq 0 ]]; then zle -N $cur_widget _zsh_highlight_widget_$cur_widget";; # Default: unhandled case. - *) echo "zsh-syntax-highlighting: unhandled ZLE widget '$cur_widget'" >&2 ;; + *) print "zsh-syntax-highlighting: unhandled ZLE widget '$cur_widget'" >&2 ;; esac done } @@ -347,7 +347,7 @@ function _history-substring-search-down-buffer() { function _history-substring-search-up-history() { # - # Behave like up in ZSH, except clear the $BUFFER + # Behave like up in Zsh, except clear the $BUFFER # when beginning of history is reached like in Fish. # if [[ -z $_history_substring_search_query ]]; then @@ -369,7 +369,7 @@ function _history-substring-search-up-history() { function _history-substring-search-down-history() { # - # Behave like down-history in ZSH, except clear the + # Behave like down-history in Zsh, except clear the # $BUFFER when end of history is reached like in Fish. # if [[ -z $_history_substring_search_query ]]; then diff --git a/plugins/kate/init.zsh b/plugins/kate/init.zsh index bacfcdce8..b3b064290 100644 --- a/plugins/kate/init.zsh +++ b/plugins/kate/init.zsh @@ -3,7 +3,6 @@ alias kate='kate >/dev/null 2>&1' # Silent start. # Functions function kt() { - cd "$1" - kate "$1" + cd "$1" && kate . } diff --git a/plugins/node/functions/node-docs b/plugins/node/functions/node-docs new file mode 100644 index 000000000..8dfd49c92 --- /dev/null +++ b/plugins/node/functions/node-docs @@ -0,0 +1,4 @@ +# Open the node api for your current version to the optional section. +# TODO: Make the sections easier to use. +open "http://nodejs.org/docs/$(node --version)/api/all.html#${1}" + diff --git a/plugins/node/init.zsh b/plugins/node/init.zsh index f7abed087..69333e3a8 100644 --- a/plugins/node/init.zsh +++ b/plugins/node/init.zsh @@ -9,9 +9,3 @@ else fi unset cache_file -# Open the node api for your current version to the optional section. -# TODO: Make the sections easier to use. -function node-docs() { - open "http://nodejs.org/docs/$(node --version)/api/all.html#$1" -} - diff --git a/plugins/osx/README.md b/plugins/osx/README.md new file mode 100644 index 000000000..750b5f16b --- /dev/null +++ b/plugins/osx/README.md @@ -0,0 +1,10 @@ +Provides the following commands. + +- `tab` create a new tab (works in both _Terminal_ and _iTerm_). +- `pfd` print current _Finder_ directory. +- `pfs` print current _Finder_ selection. +- `cdf` cd to current _Finder_ directory. +- `pushdf` pushd to current _Finder_ directory. +- `ql` quick look at files. +- `manp` Open MAN pages in _Preview.app_. +- `trash` Move files and folders to _Trash_. diff --git a/plugins/osx/_man-preview b/plugins/osx/_man-preview deleted file mode 100644 index 6cc344ad4..000000000 --- a/plugins/osx/_man-preview +++ /dev/null @@ -1,5 +0,0 @@ -#compdef man-preview -#autoload - -_man - diff --git a/plugins/osx/functions/pfd b/plugins/osx/functions/pfd new file mode 100644 index 000000000..5df7d2743 --- /dev/null +++ b/plugins/osx/functions/pfd @@ -0,0 +1,6 @@ +osascript 2>/dev/null </dev/null < 0 )) && command="${command}; $*" + +the_app=$( + osascript 2>/dev/null </dev/null </dev/null < -# VERSION: 1.0.2 -# ------------------------------------------------------------------------------ +# Sorin Ionescu +# Change directory to the current Finder directory. +alias cdf='cd "$(pfd)"' -function tab() { - local command="cd \\\"$PWD\\\"" - (( $# > 0 )) && command="${command}; $*" +# Push directory to the current Finder directory. +alias pushdf='pushd "$(pfd)"' - the_app=$( - osascript 2>/dev/null </dev/null </dev/null < 0 )) && qlmanage -p "$@" &> /dev/null } -function pfd() { - osascript 2>/dev/null </dev/null < 0 )) && qlmanage -p $* &>/dev/null & -} - -function man-preview() { - man -t "$@" | open -f -a Preview -} - -function trash() { - local trash_dir="${HOME}/.Trash" - local temp_ifs=$IFS - IFS=$'\n' - for item in "$@"; do - if [[ -e "$item" ]]; then - item_name="$(basename $item)" - if [[ -e "${trash_dir}/${item_name}" ]]; then - mv -f "$item" "${trash_dir}/${item_name} $(date "+%H-%M-%S")" - else - mv -f "$item" "${trash_dir}/" - fi - fi - done - IFS=$temp_ifs +# Open man pages in Preview. +function manp() { + (( $# > 0 )) && man -t "$@" | open -f -a Preview } +compdef _man manp +# Delete .DS_Store and __MACOSX directories. function rm-osx-cruft() { - find ${@:-$PWD} \( -type f -name ".DS_Store" \) -o \( -type d -name '__MACOSX' \) -delete + find "${@:-$PWD}" \( -type f -name '.DS_Store' \) -o \( -type d -name '__MACOSX' \) -print0 | xargs rm -rf } - diff --git a/plugins/pacman/functions/pacdisowned b/plugins/pacman/functions/pacdisowned new file mode 100644 index 000000000..d46c0ee1f --- /dev/null +++ b/plugins/pacman/functions/pacdisowned @@ -0,0 +1,16 @@ +# List disowned files. +tmp="${TMPDIR-/tmp}/pacman-disowned-$UID-$$" +db="$tmp/db" +fs="$tmp/fs" + +mkdir "$tmp" +trap 'rm -rf "$tmp"' EXIT + +pacman -Qlq | sort -u > "$db" + +find /bin /etc /lib /sbin /usr \ + ! -name lost+found \ + \( -type d -printf '%p/\n' -o -print \) | sort > "$fs" + +comm -23 "$fs" "$db" + diff --git a/plugins/pacman/functions/paclist b/plugins/pacman/functions/paclist new file mode 100644 index 000000000..648fbbf86 --- /dev/null +++ b/plugins/pacman/functions/paclist @@ -0,0 +1,4 @@ +# List explicitly installed packages. +sudo pacman -Qei $(pacman -Qu|cut -d" " -f 1) \ + | awk ' BEGIN {FS=":"}/^Name/{printf("\033[1;36m%s\033[1;37m", $2)}/^Description/{print $2}' + diff --git a/plugins/pacman/init.zsh b/plugins/pacman/init.zsh index 7dd0e840e..8f221768f 100644 --- a/plugins/pacman/init.zsh +++ b/plugins/pacman/init.zsh @@ -1,26 +1,48 @@ -# Archlinux ZSH Aliases and Functions +# Arch Linux Zsh Aliases and Functions # # Pacman Tips: # https://wiki.archlinux.org/index.php/Pacman_Tips # Yaourt Aliases if (( $+commands[yaourt] )); then - function arch-upgrade() { - yaourt -Syu - } + # Upgrade Arch Linux. + alias arch-upgrade='yaourt -Syu' - alias yaconf='yaourt -C' # Fix all configuration files with vimdiff. - alias yaupg='yaourt -Syu' # Synchronize with repositories before upgrading packages that are out of date on the local system. - alias yain='yaourt -S' # Install specific package(s) from the repositories. - alias yains='yaourt -U' # Install specific package(s) not from the repositories but from a file . - alias yare='yaourt -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies. - alias yarem='yaourt -Rns' # Remove the specified package(s), its configuration(s) and unneeded dependencies. - alias yarep='yaourt -Si' # Display information about a given package in the repositories. - alias yareps='yaourt -Ss' # Search for package(s) in the repositories. - alias yaloc='yaourt -Qi' # Display information about a given package in the local database. - alias yalocs='yaourt -Qs' # Search for package(s) in the local database. - alias yamir='yaourt -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist - alias yainsd='yaourt -S --asdeps' # Install given package(s) as dependencies of another package + # Fix all configuration files with vimdiff. + alias yaconf='yaourt -C' + + # Synchronize with repositories before upgrading packages that are out of date on the local system. + alias yaupg='yaourt -Syu' + + # Install specific package(s) from the repositories. + alias yain='yaourt -S' + + # Install specific package(s) not from the repositories but from a file . + alias yains='yaourt -U' + + # Remove the specified package(s), retaining its configuration(s) and required dependencies. + alias yare='yaourt -R' + + # Remove the specified package(s), its configuration(s) and unneeded dependencies. + alias yarem='yaourt -Rns' + + # Display information about a given package in the repositories. + alias yarep='yaourt -Si' + + # Search for package(s) in the repositories. + alias yareps='yaourt -Ss' + + # Display information about a given package in the local database. + alias yaloc='yaourt -Qi' + + # Search for package(s) in the local database. + alias yalocs='yaourt -Qs' + + # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist + alias yamir='yaourt -Syy' + + # Install given package(s) as dependencies of another package + alias yainsd='yaourt -S --asdeps' # Update and refresh the local package and ABS databases against repositories. if (( $+commands[abs] )); then @@ -29,25 +51,49 @@ if (( $+commands[yaourt] )); then alias yaupd='yaourt -Sy' fi else - function arch-upgrade() { - sudo pacman -Syu - } + # Upgrade Arch Linux. + alias arch-upgrade='sudo pacman -Syu' fi -# Pacman Aliaases -alias pacupg='sudo pacman -Syu' # Synchronize with repositories before upgrading packages that are out of date on the local system. -alias pacin='sudo pacman -S' # Install specific package(s) from the repositories. -alias pacins='sudo pacman -U' # Install specific package not from the repositories but from a file. -alias pacre='sudo pacman -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies. -alias pacrem='sudo pacman -Rns' # Remove the specified package(s), its configuration(s) and unneeded dependencies. -alias pacrep='pacman -Si' # Display information about a given package in the repositories. -alias pacreps='pacman -Ss' # Search for package(s) in the repositories. -alias pacloc='pacman -Qi' # Display information about a given package in the local database. -alias paclocs='pacman -Qs' # Search for package(s) in the local database. -alias pacinsd='sudo pacman -S --asdeps' # Install given package(s) as dependencies of another package. -alias pacmir='sudo pacman -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist. -alias paclsorphans='sudo pacman -Qdt' # List orphan packages(s). -alias pacrmorphans='sudo pacman -Rs $(pacman -Qtdq)' # Remove orphan package(s). +# Pacman Aliases +# Synchronize with repositories before upgrading packages that are out of date on the local system. +alias pacupg='sudo pacman -Syu' + +# Install specific package(s) from the repositories. +alias pacin='sudo pacman -S' + +# Install specific package not from the repositories but from a file. +alias pacins='sudo pacman -U' + +# Remove the specified package(s), retaining its configuration(s) and required dependencies. +alias pacre='sudo pacman -R' + +# Remove the specified package(s), its configuration(s) and unneeded dependencies. +alias pacrem='sudo pacman -Rns' + +# Display information about a given package in the repositories. +alias pacrep='pacman -Si' + +# Search for package(s) in the repositories. +alias pacreps='pacman -Ss' + +# Display information about a given package in the local database. +alias pacloc='pacman -Qi' + +# Search for package(s) in the local database. +alias paclocs='pacman -Qs' + +# Install given package(s) as dependencies of another package. +alias pacinsd='sudo pacman -S --asdeps' + +# Force refresh of all package lists after updating /etc/pacman.d/mirrorlist. +alias pacmir='sudo pacman -Syy' + +# List orphan packages(s). +alias paclsorphans='sudo pacman -Qdt' + +# Remove orphan package(s). +alias pacrmorphans='sudo pacman -Rs $(pacman -Qtdq)' # Update and refresh the local package and ABS databases against repositories. if (( $+commands[abs] )); then @@ -56,27 +102,3 @@ else alias pacupd='sudo pacman -Sy' fi -# List explicitly installed packages. -function paclist() { - sudo pacman -Qei $(pacman -Qu|cut -d" " -f 1) \ - | awk ' BEGIN {FS=":"}/^Name/{printf("\033[1;36m%s\033[1;37m", $2)}/^Description/{print $2}' -} - -# List disowned files. -function pacdisowned() { - tmp="${TMPDIR-/tmp}/pacman-disowned-$UID-$$" - db="$tmp/db" - fs="$tmp/fs" - - mkdir "$tmp" - trap 'rm -rf "$tmp"' EXIT - - pacman -Qlq | sort -u > "$db" - - find /bin /etc /lib /sbin /usr \ - ! -name lost+found \ - \( -type d -printf '%p/\n' -o -print \) | sort > "$fs" - - comm -23 "$fs" "$db" -} - diff --git a/plugins/perl/functions/pgs b/plugins/perl/functions/pgs new file mode 100644 index 000000000..99a375cfc --- /dev/null +++ b/plugins/perl/functions/pgs @@ -0,0 +1,12 @@ +# Perl Global Substitution +if (( $# < 2 )); then + print "Usage: $0 find replace [file ...]" >&2 + return 1 +fi + +local find="$1" +local replace="$2" +repeat 2 shift + +perl -i.orig -pe 's/'"$find"'/'"$replace"'/g' "$@" + diff --git a/plugins/perl/functions/prep b/plugins/perl/functions/prep new file mode 100644 index 000000000..ef9118e71 --- /dev/null +++ b/plugins/perl/functions/prep @@ -0,0 +1,11 @@ +# Perl grep since 'grep -P' is terrible. +if (( $# < 1 )) ; then + print "Usage: $0 pattern [file ...]" >&2 + return 1 +fi + +local pattern="$1" +shift + +perl -nle 'print if /'"$pattern"'/;' "$@" + diff --git a/plugins/perl/init.zsh b/plugins/perl/init.zsh index 7adad86f5..450a8e048 100644 --- a/plugins/perl/init.zsh +++ b/plugins/perl/init.zsh @@ -42,30 +42,3 @@ alias pbu='perlbrew use' alias ple='perl -wlne' alias pd='perldoc' -# Perl Global Substitution -function pgs() { - if (( $# < 2 )) ; then - echo "Usage: $0 find replace [file ...]" >&2 - return 1 - fi - - local find="$1" - local replace="$2" - repeat 2 shift - - perl -i.orig -pe 's/'"$find"'/'"$replace"'/g' "$@" -} - -# Perl grep since 'grep -P' is terrible. -function prep() { - if (( $# < 1 )) ; then - echo "Usage: $0 pattern [file ...]" >&2 - return 1 - fi - - local pattern="$1" - shift - - perl -nle 'print if /'"$pattern"'/;' "$@" -} - diff --git a/plugins/ruby/init.zsh b/plugins/ruby/init.zsh index 2776b5bc2..bca092cb4 100644 --- a/plugins/ruby/init.zsh +++ b/plugins/ruby/init.zsh @@ -6,7 +6,7 @@ if [[ "$OSTYPE" == darwin* ]]; then # gem is slow; cache its output. cache_file="${0:h}/cache.zsh" if [[ ! -f "$cache_file" ]]; then - echo export GEM_PATH=$GEM_HOME:$(gem env gempath) >! "$cache_file" + print export GEM_PATH=$GEM_HOME:$(gem env gempath) >! "$cache_file" source "$cache_file" else source "$cache_file" diff --git a/plugins/ssh-agent/init.zsh b/plugins/ssh-agent/init.zsh index 6f309ce5d..89ad7f56b 100644 --- a/plugins/ssh-agent/init.zsh +++ b/plugins/ssh-agent/init.zsh @@ -28,13 +28,13 @@ function _ssh-agent-start() { local -a identities # Start ssh-agent and setup environment. - /usr/bin/env ssh-agent | sed 's/^echo/#echo/' > "${_ssh_agent_env}" + /usr/bin/env ssh-agent | sed 's/^print/#print/' > "${_ssh_agent_env}" chmod 600 "${_ssh_agent_env}" source "${_ssh_agent_env}" > /dev/null # Load identies. zstyle -a :omz:plugins:ssh-agent identities identities - echo starting... + print starting... /usr/bin/ssh-add "$HOME/.ssh/${^identities}" } diff --git a/plugins/textmate/init.zsh b/plugins/textmate/init.zsh index 5370f63df..80564b1cc 100644 --- a/plugins/textmate/init.zsh +++ b/plugins/textmate/init.zsh @@ -9,7 +9,6 @@ alias mr='mate CHANGELOG app config db lib public script spec test' # Functions function tm() { - cd $1 - mate $1 + cd "$1" && mate . } diff --git a/plugins/wakeonlan/_wake b/plugins/wakeonlan/completions/_wake similarity index 100% rename from plugins/wakeonlan/_wake rename to plugins/wakeonlan/completions/_wake diff --git a/plugins/wakeonlan/functions/wake b/plugins/wakeonlan/functions/wake new file mode 100644 index 000000000..83410c71d --- /dev/null +++ b/plugins/wakeonlan/functions/wake @@ -0,0 +1,13 @@ +local config_file="$HOME/.wakeonlan/$1" +if [[ ! -f "$config_file" ]]; then + print "$0: $1: There is no such device file." >&2 + return 1 +fi + +if (( ! $+commands[wakeonlan] )); then + print "$0: Can't find wakeonlan. Is it installed?" >&2 + return 1 +fi + +wakeonlan -f "$config_file" + diff --git a/plugins/wakeonlan/init.zsh b/plugins/wakeonlan/init.zsh deleted file mode 100644 index d91ba5923..000000000 --- a/plugins/wakeonlan/init.zsh +++ /dev/null @@ -1,15 +0,0 @@ -function wake() { - local config_file="$HOME/.wakeonlan/$1" - if [[ ! -f "$config_file" ]]; then - echo "$0: $1: There is no such device file." >&2 - return 1 - fi - - if (( ! $+commands[wakeonlan] )); then - echo "$0: Can't find wakeonlan. Is it installed?" >&2 - return 1 - fi - - wakeonlan -f "$config_file" -} - diff --git a/spectrum.zsh b/spectrum.zsh index 67beeac7d..629e04140 100644 --- a/spectrum.zsh +++ b/spectrum.zsh @@ -1,4 +1,4 @@ -# A script to make using 256 colors in ZSH less painful. +# A script to make using 256 colors in Zsh less painful. # P.C. Shyamshankar # Sorin Ionescu diff --git a/templates/zshrc.zsh b/templates/zshrc.zsh index 93b67fef0..903e27b4a 100644 --- a/templates/zshrc.zsh +++ b/templates/zshrc.zsh @@ -1,4 +1,4 @@ -# Path to oh-my-zsh. +# Set the path to Oh My Zsh. OMZ="$HOME/.oh-my-zsh" # Set the key mapping style to 'emacs' or 'vi'. @@ -23,7 +23,7 @@ COMPLETION_INDICATOR='false' # Example: plugins=(git lighthouse rails ruby textmate) plugins=(git) -# This will make you scream: OH MY ZSH! +# This will make you shout: OH MY ZSHELL! source "$OMZ/init.zsh" # Load the prompt theme (type prompt -l to list all themes). diff --git a/themes/nicoulaj/prompt_nicoulaj_setup b/themes/nicoulaj/prompt_nicoulaj_setup index 26a0783af..84061fd17 100644 --- a/themes/nicoulaj/prompt_nicoulaj_setup +++ b/themes/nicoulaj/prompt_nicoulaj_setup @@ -1,5 +1,5 @@ # ------------------------------------------------------------------------------ -# Prompt for ZSH: +# Prompt for Zsh: # * One line. # * VCS info on the right prompt. # * Only shows the path on the left prompt by default. diff --git a/themes/steeef/prompt_steeef_setup b/themes/steeef/prompt_steeef_setup index 28b2a91c1..6584125f0 100644 --- a/themes/steeef/prompt_steeef_setup +++ b/themes/steeef/prompt_steeef_setup @@ -1,7 +1,7 @@ # Prompt style and colors based on Steve Losh's Prose theme: # http://github.com/sjl/oh-my-zsh/blob/master/themes/prose.zsh-theme # -# vcs_info modifications from Bart Trojanowski's zsh prompt: +# vcs_info modifications from Bart Trojanowski's Zsh prompt: # http://www.jukie.net/bart/blog/pimping-out-zsh-prompt # # Git untracked files modification from Brian Carper: @@ -9,7 +9,7 @@ function virtualenv_info() { if [[ -n "$VIRTUAL_ENV" ]]; then - echo '('`basename $VIRTUAL_ENV`') ' + print "(${VIRTUAL_ENV:t}) " fi } diff --git a/utility.zsh b/utility.zsh index 1af39029b..20178cc2c 100644 --- a/utility.zsh +++ b/utility.zsh @@ -1,84 +1,46 @@ # Lists the ten most used commands. -function history-stat() { - history | awk '{print $2}' | sort | uniq -c | sort -n -r | head -} +alias history-stat="history | awk '{print \$2}' | sort | uniq -c | sort -n -r | head" + +# Serves a directory via HTTP. +alias http-serve='python -m SimpleHTTPServer' # Makes a directory and changes to it. function mkdcd() { - mkdir -p "$@" - cd "$argv[-1]" + [[ -n "$1" ]] && mkdir -p "$1" && cd "$1" } compdef _mkdir mkdcd # Changes to a directory and lists its contents. function cdll() { - builtin cd "$@" - ll + builtin cd "$1" && ll } compdef _cd cdll # Pushes an entry onto the directory stack and lists its contents. function pushdll() { - builtin pushd "$@" - ll + builtin pushd "$1" && ll } compdef _cd pushdll # Pops an entry off the directory stack and lists its contents. function popdll() { - builtin popd "$@" - ll + builtin popd "$1" && ll } compdef _cd popdll -# Gets ownership. -function gown() { - sudo chown -R "${USER}" "${1:-.}" -} - -# Reloads ~/.zshrc. -function reload() { - local zshrc="$HOME/.zshrc" - if [[ -n "$1" ]]; then - zshrc="$1" - fi - source "$zshrc" -} - -# Provides a simple calculator. -function calc() { - echo "scale=4; $@" | bc -l -} - -# Displays human readable disk usage statistics. -function duh() { - (( $# == 0 )) && set -- * - if [[ "$OSTYPE" == linux* ]]; then - du -khsc "$@" | sort -h -r - else - du -kcs "$@" | awk '{ printf "%9.1fM %s\n", $1 / 1024, $2 } ' | sort -n -r - fi -} -compdef _du duh - # Prints columns 1 2 3 ... n. function slit() { - awk "{ print $(for n; do echo -n "\$$n,"; done | sed 's/,$//') }" + awk "{ print $(for n; do print -n "\$$n,"; done | sed 's/,$//') }" } # Displays user owned process status. function pmine() { - ps "$@" -u "$USER" -o pid,%cpu,%mem,command + ps "$@" -U "$USER" -o pid,%cpu,%mem,command } compdef _ps pmine # Finds files and executes a command on them. -function findexec() { +function find-exec() { find . -type f -iname "*${1:-}*" -exec "${2:-file}" '{}' \; } -# Serves a directory via HTTP. -function httpserve() { - python -m SimpleHTTPServer "$@" -} - From f0499b76c3235785f76b5eaa1ae55334181922fa Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Mon, 26 Dec 2011 13:37:53 -0500 Subject: [PATCH 526/614] Use zstyle instead of variables for configuration. --- alias.zsh | 8 +-- completion.zsh | 2 +- environment.zsh | 4 +- init.zsh | 16 +++++- keyboard.zsh | 26 +++++---- plugins/git/functions/git-info | 34 +++++------ plugins/git/style.zsh | 69 +++++++++++++++++------ plugins/gnu-utils/init.zsh | 12 +++- plugins/history-substring-search/init.zsh | 4 +- plugins/ssh-agent/init.zsh | 8 +-- templates/zshrc.zsh | 40 ++++++------- terminal.zsh | 4 +- themes/sorin/prompt_sorin_setup | 32 +++++------ 13 files changed, 156 insertions(+), 103 deletions(-) diff --git a/alias.zsh b/alias.zsh index d5842d5d7..3585c10fc 100644 --- a/alias.zsh +++ b/alias.zsh @@ -2,9 +2,9 @@ setopt CORRECT # Correct commands. setopt CORRECT_ALL # Correct all arguments. # The 'ls' Family -if check-bool "$COLOR"; then - if [[ -f "$HOME/.dir_colors" ]] && ( (( $+commands[dircolors] )) || ( (( $+plugins[(er)gnu-utils] )) && (( $+commands[gdircolors] )) ) ); then - eval $("${commands[dircolors]:-$commands[gdircolors]}" "$HOME/.dir_colors") +if zstyle -t ':omz:alias:ls' color; then + if [[ -f "$HOME/.dir_colors" ]] && (( $+commands[dircolors] )); then + eval $(dircolors "$HOME/.dir_colors") alias ls='ls -hF --group-directories-first --color=auto' else export CLICOLOR=1 @@ -80,7 +80,7 @@ else fi # Diff/Make -if check-bool "$COLOR"; then +if zstyle -t ':omz:alias:diff' color; then if (( $+commands[colordiff] )); then alias diff='colordiff -u' compdef colordiff=diff diff --git a/completion.zsh b/completion.zsh index b670b21d1..374f6fc92 100644 --- a/completion.zsh +++ b/completion.zsh @@ -20,7 +20,7 @@ zstyle ':completion::complete:*' use-cache on zstyle ':completion::complete:*' cache-path "$HOME/.zcache" # Case-insensitive (all), partial-word, and then substring completion. -if check-bool "$CASE_SENSITIVE"; then +if zstyle -t ':omz:completion:*' case-sensitive; then zstyle ':completion:*' matcher-list 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' setopt CASE_GLOB else diff --git a/environment.zsh b/environment.zsh index a4b690605..08a73b6eb 100644 --- a/environment.zsh +++ b/environment.zsh @@ -64,7 +64,7 @@ export VISUAL="vim" export PAGER='less' # Grep -if check-bool "$COLOR"; then +if zstyle -t ':omz:environment:grep' color; then export GREP_COLOR='37;45' export GREP_OPTIONS='--color=auto' fi @@ -89,7 +89,7 @@ if (( $+commands[lesspipe.sh] )); then fi # Termcap -if check-bool "$COLOR"; then +if zstyle -t ':omz:environment:termcap' color; then export LESS_TERMCAP_mb=$'\E[01;31m' # begin blinking export LESS_TERMCAP_md=$'\E[01;31m' # begin bold export LESS_TERMCAP_me=$'\E[0m' # end mode diff --git a/init.zsh b/init.zsh index 7af5d88e2..0e4c5d3de 100644 --- a/init.zsh +++ b/init.zsh @@ -3,15 +3,19 @@ # Check for the minimum supported version. min_zsh_version=4.3.9 if ! autoload -Uz is-at-least || ! is-at-least "$min_zsh_version"; then - print "oh-my-zsh: The minimum supported Zsh version is $min_zsh_version." + print "omz: The minimum supported Zsh version is $min_zsh_version." fi unset min_zsh_version -# Disable color in dumb terminals. +# Disable color and theme in dumb terminals. if [[ "$TERM" == 'dumb' ]]; then - COLOR='false' + zstyle ':omz:*:*' color 'no' + zstyle ':omz:prompt' theme 'off' fi +# Get enabled plugins. +zstyle -a ':omz:load' plugin 'plugins' + # Add functions to fpath. fpath=( ${0:h}/themes/*(/FN) @@ -43,6 +47,7 @@ autoload -Uz zmv # Source plugins defined in ~/.zshrc. for plugin in "$plugins[@]"; do + zstyle ":omz:plugin:$plugin" enable 'yes' if [[ -f "${0:h}/plugins/$plugin/init.zsh" ]]; then source "${0:h}/plugins/$plugin/init.zsh" fi @@ -66,6 +71,11 @@ fi # Load and run the prompt theming system. autoload -Uz promptinit && promptinit +# Load the prompt theme. +zstyle -a ':omz:prompt' theme 'prompt_argv' +prompt "$prompt_argv[@]" +unset prompt_argv + # Compile zcompdump, if modified, to increase startup speed. if [[ "$HOME/.zcompdump" -nt "$HOME/.zcompdump.zwc" ]] || [[ ! -f "$HOME/.zcompdump.zwc" ]]; then zcompile "$HOME/.zcompdump" diff --git a/keyboard.zsh b/keyboard.zsh index e481cba68..8867e7cdd 100644 --- a/keyboard.zsh +++ b/keyboard.zsh @@ -4,8 +4,12 @@ if [[ "$TERM" == 'dumb' ]]; then fi # The default styles. -zstyle ':prompt:' vicmd '<<<' # Indicator to notify of vi command mode. -zstyle ':prompt:' completion "..." # Indicator to notify of generating completion. + +# Indicator to notify of vi command mode. +zstyle ':omz:prompt' vicmd '<<<' + +# Indicator to notify of generating completion. +zstyle ':omz:completion:indicator' format "..." # Beep on error in line editor. setopt BEEP @@ -50,7 +54,7 @@ keyinfo=( 'BackTab' "$terminfo[kcbt]" ) -if [[ "$KEYMAP" == (emacs|) ]]; then +if zstyle -m ':omz:editor' keymap 'emacs'; then # Use Emacs key bindings. bindkey -e @@ -77,7 +81,7 @@ if [[ "$KEYMAP" == (emacs|) ]]; then bindkey "$keyinfo[Control]x$keyinfo[Control]e" edit-command-line # Expand .... to ../.. - if check-bool "$DOT_EXPANSION"; then + if zstyle -t ':omz:editor' dot-expansion; then bindkey "." expand-dot-to-parent-directory-path fi @@ -90,7 +94,7 @@ if [[ "$KEYMAP" == (emacs|) ]]; then bindkey "$keyinfo[Control]r" history-incremental-search-backward bindkey "$keyinfo[Control]s" history-incremental-search-forward fi -elif [[ "$KEYMAP" == 'vi' ]]; then +elif zstyle -m ':omz:editor' keymap 'vi'; then # Use vi key bindings. bindkey -v @@ -110,7 +114,7 @@ elif [[ "$KEYMAP" == 'vi' ]]; then function zle-keymap-select() { if ! vi-restore-rprompt && [[ "$KEYMAP" == 'vicmd' ]]; then RPROMPT_CACHED="$RPROMPT" - zstyle -s ':prompt:' vicmd RPROMPT + zstyle -s ':omz:prompt' vicmd RPROMPT zle reset-prompt fi } @@ -139,7 +143,7 @@ elif [[ "$KEYMAP" == 'vi' ]]; then bindkey -M vicmd "$keyinfo[Control]r" redo # Expand .... to ../.. - if check-bool "$DOT_EXPANSION"; then + if zstyle -t ':omz:editor' dot-expansion; then bindkey -M viins "." expand-dot-to-parent-directory-path fi @@ -194,7 +198,7 @@ elif [[ "$KEYMAP" == 'vi' ]]; then bindkey -M viins "$keyinfo[Control]s" history-incremental-search-forward fi else - print "oh-my-zsh: KEYMAP must be set 'emacs' or 'vi' but is set to '$KEYMAP'" >&2 + print "omz: \`zstyle ':omz:editor' keymap\` must be set to 'emacs' or 'vi'" >&2 return 1 fi @@ -240,7 +244,7 @@ bindkey "$keyinfo[BackTab]" reverse-menu-complete bindkey "$keyinfo[Control]i" expand-or-complete-prefix # Convert .... to ../.. automatically. -if check-bool "$DOT_EXPANSION"; then +if zstyle -t ':omz:editor' dot-expansion; then function expand-dot-to-parent-directory-path() { if [[ $LBUFFER = *.. ]]; then LBUFFER+=/.. @@ -254,9 +258,9 @@ if check-bool "$DOT_EXPANSION"; then fi # Display an indicator when completing. -if check-bool "$COMPLETION_INDICATOR"; then +if zstyle -t ':omz:completion:indicator' enable; then function expand-or-complete-prefix-with-indicator() { - zstyle -s ':prompt:' completion indicator + zstyle -s ':omz:completion:indicator' format indicator print -Pn "$indicator" unset indicator zle expand-or-complete-prefix diff --git a/plugins/git/functions/git-info b/plugins/git/functions/git-info index 84e239110..e3069c836 100644 --- a/plugins/git/functions/git-info +++ b/plugins/git/functions/git-info @@ -174,18 +174,18 @@ function git-info() { # Format commit (short). commit_short="$commit[1,7]" - zstyle -s ':git-info:' commit commit_format + zstyle -s ':omz:plugin:git:prompt' commit commit_format zformat -f commit_formatted "$commit_format" "c:$commit_short" # Stashed if [[ -f "$(git-root)/.git/refs/stash" ]]; then stashed="$(git stash list 2>/dev/null | wc -l)" - zstyle -s ':git-info:' stashed stashed_format + zstyle -s ':omz:plugin:git:prompt' stashed stashed_format zformat -f stashed_formatted "$stashed_format" "S:$stashed" fi # Assume that the working copy is clean. - zstyle -s ':git-info:' clean clean_formatted + zstyle -s ':omz:plugin:git:prompt' clean clean_formatted while IFS=$'\n' read line; do (( line_number++ )) @@ -197,7 +197,7 @@ function git-info() { # Get action. action="$(_git-action)" if [[ -n "$action" ]]; then - zstyle -s ':git-info:' action action_format + zstyle -s ':omz:plugin:git:prompt' action action_format zformat -f action_formatted "$action_format" "s:$action" fi elif (( line_number == 1 )) \ @@ -231,7 +231,7 @@ function git-info() { fi else # Format dirty. - [[ -z "$dirty" ]] && zstyle -s ':git-info:' dirty dirty_formatted && unset clean_formatted + [[ -z "$dirty" ]] && zstyle -s ':omz:plugin:git:prompt' dirty dirty_formatted && unset clean_formatted # Count: added/deleted/modified/renamed/unmerged/untracked [[ "$line" == (((A|M|D|T) )|(AD|AM|AT|MM))\ * ]] && (( added++ )) @@ -244,7 +244,7 @@ function git-info() { done < <(git status --short --branch 2> /dev/null) # Format branch. - zstyle -s ':git-info:' branch branch_format + zstyle -s ':omz:plugin:git:prompt' branch branch_format zformat -f branch_formatted "$branch_format" "b:$branch" # Format remote. @@ -252,61 +252,61 @@ function git-info() { [[ -z $remote ]] \ && remote=${$(git rev-parse --verify ${branch}@{upstream} \ --symbolic-full-name 2> /dev/null)#refs/remotes/} - zstyle -s ':git-info:' remote remote_format + zstyle -s ':omz:plugin:git:prompt' remote remote_format zformat -f remote_formatted "$remote_format" "R:$remote" fi # Format ahead. if [[ -n "$ahead" ]]; then - zstyle -s ':git-info:' ahead ahead_format + zstyle -s ':omz:plugin:git:prompt' ahead ahead_format zformat -f ahead_formatted "$ahead_format" "A:$ahead" fi # Format behind. if [[ -n "$behind" ]]; then - zstyle -s ':git-info:' behind behind_format + zstyle -s ':omz:plugin:git:prompt' behind behind_format zformat -f behind_formatted "$behind_format" "B:$behind" fi # Format added. if (( $added > 0 )); then - zstyle -s ':git-info:' added added_format + zstyle -s ':omz:plugin:git:prompt' added added_format zformat -f added_formatted "$added_format" "a:$added_format" fi # Format deleted. if (( $deleted > 0 )); then - zstyle -s ':git-info:' deleted deleted_format + zstyle -s ':omz:plugin:git:prompt' deleted deleted_format zformat -f deleted_formatted "$deleted_format" "d:$deleted_format" fi # Format modified. if (( $modified > 0 )); then - zstyle -s ':git-info:' modified modified_format + zstyle -s ':omz:plugin:git:prompt' modified modified_format zformat -f modified_formatted "$modified_format" "m:$modified" fi # Format renamed. if (( $renamed > 0 )); then - zstyle -s ':git-info:' renamed renamed_format + zstyle -s ':omz:plugin:git:prompt' renamed renamed_format zformat -f renamed_formatted "$renamed_format" "r:$renamed" fi # Format unmerged. if (( $unmerged > 0 )); then - zstyle -s ':git-info:' unmerged unmerged_format + zstyle -s ':omz:plugin:git:prompt' unmerged unmerged_format zformat -f unmerged_formatted "$unmerged_format" "U:$unmerged" fi # Format untracked. if (( $untracked > 0 )); then - zstyle -s ':git-info:' untracked untracked_format + zstyle -s ':omz:plugin:git:prompt' untracked untracked_format zformat -f untracked_formatted "$untracked_format" "u:$untracked" fi # Format prompts. - zstyle -s ':git-info:' prompt prompt_format - zstyle -s ':git-info:' rprompt rprompt_format + zstyle -s ':omz:plugin:git:prompt' prompt prompt_format + zstyle -s ':omz:plugin:git:prompt' rprompt rprompt_format git_info_vars=( git_prompt_info "$prompt_format" diff --git a/plugins/git/style.zsh b/plugins/git/style.zsh index c0ad0531e..6eae19abb 100644 --- a/plugins/git/style.zsh +++ b/plugins/git/style.zsh @@ -1,18 +1,53 @@ # The default styles. -zstyle ':git-info:' action 'action:%s' # %s - Special action name (am, merge, rebase). -zstyle ':git-info:' added 'added:%a' # %a - Indicator to notify of added files. -zstyle ':git-info:' ahead 'ahead:%A' # %A - Indicator to notify of ahead branch. -zstyle ':git-info:' behind 'behind:%B' # %B - Indicator to notify of behind branch. -zstyle ':git-info:' branch '%b' # %b - Branch name. -zstyle ':git-info:' clean 'clean' # %C - Indicator to notify of clean branch. -zstyle ':git-info:' commit 'commit:%c' # %c - SHA-1 hash. -zstyle ':git-info:' deleted 'deleted:%d' # %d - Indicator to notify of deleted files. -zstyle ':git-info:' dirty 'dirty' # %D - Indicator to notify of dirty branch. -zstyle ':git-info:' modified 'modified:%m' # %m - Indicator to notify of modified files. -zstyle ':git-info:' remote '%R' # %R - Remote name. -zstyle ':git-info:' renamed 'renamed:%r' # %r - Indicator to notify of renamed files. -zstyle ':git-info:' stashed 'stashed:%S' # %S - Indicator to notify of stashed files. -zstyle ':git-info:' unmerged 'unmerged:%U' # %U - Indicator to notify of unmerged files. -zstyle ':git-info:' untracked 'untracked:%u' # %u - Indicator to notify of untracked files. -zstyle ':git-info:' prompt ' git:(%b %D%C)' # Left prompt. -zstyle ':git-info:' rprompt '' # Right prompt. + +# %s - Special action name (am, merge, rebase). +zstyle ':omz:plugin:git:prompt' action 'action:%s' + +# %a - Indicator to notify of added files. +zstyle ':omz:plugin:git:prompt' added 'added:%a' + +# %A - Indicator to notify of ahead branch. +zstyle ':omz:plugin:git:prompt' ahead 'ahead:%A' + +# %B - Indicator to notify of behind branch. +zstyle ':omz:plugin:git:prompt' behind 'behind:%B' + +# %b - Branch name. +zstyle ':omz:plugin:git:prompt' branch '%b' + +# %C - Indicator to notify of clean branch. +zstyle ':omz:plugin:git:prompt' clean 'clean' + +# %c - SHA-1 hash. +zstyle ':omz:plugin:git:prompt' commit 'commit:%c' + +# %d - Indicator to notify of deleted files. +zstyle ':omz:plugin:git:prompt' deleted 'deleted:%d' + +# %D - Indicator to notify of dirty branch. +zstyle ':omz:plugin:git:prompt' dirty 'dirty' + +# %m - Indicator to notify of modified files. +zstyle ':omz:plugin:git:prompt' modified 'modified:%m' + +# %R - Remote name. +zstyle ':omz:plugin:git:prompt' remote '%R' + +# %r - Indicator to notify of renamed files. +zstyle ':omz:plugin:git:prompt' renamed 'renamed:%r' + +# %S - Indicator to notify of stashed files. +zstyle ':omz:plugin:git:prompt' stashed 'stashed:%S' + +# %U - Indicator to notify of unmerged files. +zstyle ':omz:plugin:git:prompt' unmerged 'unmerged:%U' + +# %u - Indicator to notify of untracked files. +zstyle ':omz:plugin:git:prompt' untracked 'untracked:%u' + +# Left prompt. +zstyle ':omz:plugin:git:prompt' prompt ' git:(%b %D%C)' + +# Right prompt. +zstyle ':omz:plugin:git:prompt' rprompt '' + diff --git a/plugins/gnu-utils/init.zsh b/plugins/gnu-utils/init.zsh index 23a9b8d2d..70ec00712 100644 --- a/plugins/gnu-utils/init.zsh +++ b/plugins/gnu-utils/init.zsh @@ -2,11 +2,11 @@ # FILE: gnu-utils.plugin.zsh # DESCRIPTION: oh-my-zsh plugin file. # AUTHOR: Sorin Ionescu -# VERSION: 1.0.1 +# VERSION: 1.0.2 # ------------------------------------------------------------------------------ -if (( $+commands[gwhoami] )); then +if (( $+commands[gdircolors] )); then function __gnu_utils() { emulate -L zsh local gcmds @@ -59,5 +59,13 @@ if (( $+commands[gwhoami] )); then function rehash() { hash -r "$@" } + + # A sensible default for ls. + if zstyle -t ':omz:alias:ls' color && [[ -f "$HOME/.dir_colors" ]]; then + eval $(gdircolors "$HOME/.dir_colors") + alias ls='ls -hF --group-directories-first --color=auto' + else + alias ls='ls -hF --group-directories-first' + fi fi diff --git a/plugins/history-substring-search/init.zsh b/plugins/history-substring-search/init.zsh index e31eb17ff..4ff38025e 100644 --- a/plugins/history-substring-search/init.zsh +++ b/plugins/history-substring-search/init.zsh @@ -2,11 +2,11 @@ source "${0:h}/history-substring-search.zsh" -if check-bool "$CASE_SENSITIVE"; then +if zstyle -t ':omz:plugin:history-substring-search' case-sensitive; then unset HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS fi -if ! check-bool "$COLOR"; then +if ! zstyle -t ':omz:plugin:history-substring-search' color; then unset HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND unset HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND fi diff --git a/plugins/ssh-agent/init.zsh b/plugins/ssh-agent/init.zsh index 89ad7f56b..b92dcd78f 100644 --- a/plugins/ssh-agent/init.zsh +++ b/plugins/ssh-agent/init.zsh @@ -4,12 +4,12 @@ # To enabled agent forwarding support, add the following to # your .zshrc file: # -# zstyle :omz:plugins:ssh-agent agent-forwarding on +# zstyle ':omz:plugin:ssh-agent' forwarding 'on' # # To load multiple identies, use the identities style, For # example: # -# zstyle :omz:plugins:ssh-agent id_rsa id_rsa2 id_github +# zstyle ':omz:plugin:ssh-agent' identities 'id_rsa' 'id_rsa2' 'id_github' # # # CREDITS @@ -33,13 +33,13 @@ function _ssh-agent-start() { source "${_ssh_agent_env}" > /dev/null # Load identies. - zstyle -a :omz:plugins:ssh-agent identities identities + zstyle -a ':omz:plugin:ssh-agent' identities 'identities' print starting... /usr/bin/ssh-add "$HOME/.ssh/${^identities}" } # Test if agent-forwarding is enabled. -zstyle -b :omz:plugins:ssh-agent agent-forwarding _ssh_agent_forwarding +zstyle -b ':omz:plugin:ssh-agent' forwarding '_ssh_agent_forwarding' if check-bool "${_ssh_agent_forwarding}" && [[ -n "$SSH_AUTH_SOCK" ]]; then # Add a nifty symlink for screen/tmux if agent forwarding. [[ -L "$SSH_AUTH_SOCK" ]] || ln -sf "$SSH_AUTH_SOCK" /tmp/ssh-agent-$USER-screen diff --git a/templates/zshrc.zsh b/templates/zshrc.zsh index 903e27b4a..be3885c4b 100644 --- a/templates/zshrc.zsh +++ b/templates/zshrc.zsh @@ -1,34 +1,30 @@ -# Set the path to Oh My Zsh. -OMZ="$HOME/.oh-my-zsh" - # Set the key mapping style to 'emacs' or 'vi'. -KEYMAP='emacs' - -# Set case-sensitivity for completion, history lookup, etc. -CASE_SENSITIVE='false' - -# Color output (auto set to 'false' on dumb terminals). -COLOR='true' - -# Auto set the tab and window titles. -AUTO_TITLE='true' +zstyle ':omz:editor' keymap 'emacs' # Auto convert .... to ../.. -DOT_EXPANSION='false' +zstyle ':omz:editor' dot-expansion 'no' + +# Set case-sensitivity for completion, history lookup, etc. +zstyle ':omz:*:*' case-sensitive 'no' + +# Color output (auto set to 'no' on dumb terminals). +zstyle ':omz:*:*' color 'yes' + +# Auto set the tab and window titles. +zstyle ':omz:terminal' auto-title 'yes' # Indicate that completions are being generated. -COMPLETION_INDICATOR='false' +zstyle ':omz:completion:indicator' enable 'no' # Set the plugins to load (see $OMZ/plugins/). -# Example: plugins=(git lighthouse rails ruby textmate) -plugins=(git) +zstyle ':omz:load' plugin 'archive' 'git' + +# Setting it to 'random' loads a random theme. +# Auto set to 'off' on dumb terminals. +zstyle ':omz:prompt' theme 'sorin' # This will make you shout: OH MY ZSHELL! -source "$OMZ/init.zsh" - -# Load the prompt theme (type prompt -l to list all themes). -# Setting it to 'random' loads a random theme. -[[ "$TERM" != 'dumb' ]] && prompt sorin || prompt off +source "$HOME/.oh-my-zsh/init.zsh" # Customize to your needs... diff --git a/terminal.zsh b/terminal.zsh index 353a89650..570307f80 100644 --- a/terminal.zsh +++ b/terminal.zsh @@ -70,7 +70,7 @@ autoload -Uz add-zsh-hook # Sets the tab and window titles before the prompt is displayed. function set-title-precmd { - if [[ "$TERM_PROGRAM" != "Apple_Terminal" ]] && check-bool "$AUTO_TITLE"; then + if [[ "$TERM_PROGRAM" != "Apple_Terminal" ]] && zstyle -t ':omz:terminal' auto-title; then set-window-title "${(%):-%~}" for kind in tab screen; do # Left-truncate the current working directory to 15 characters. @@ -85,7 +85,7 @@ add-zsh-hook precmd set-title-precmd # Sets the tab and window titles before command execution. function set-title-preexec { - if check-bool "$AUTO_TITLE"; then + if zstyle -t ':omz:terminal' auto-title; then set-title-by-command "$2" fi } diff --git a/themes/sorin/prompt_sorin_setup b/themes/sorin/prompt_sorin_setup index c04e533a9..9120b4e40 100644 --- a/themes/sorin/prompt_sorin_setup +++ b/themes/sorin/prompt_sorin_setup @@ -22,22 +22,22 @@ function prompt_sorin_setup() { autoload -Uz add-zsh-hook add-zsh-hook precmd prompt_sorin_precmd - zstyle ':prompt:' vicmd '%F{yellow}❮%f%B%F{red}❮%f%b%F{red}❮%f' - zstyle ':prompt:' completion '%B%F{red}...%f%b' - zstyle ':git-info:' action ':%%B%F{yellow}%s%f%%b' - zstyle ':git-info:' added ' %%B%F{green}✚%f%%b' - zstyle ':git-info:' ahead ' %%B%F{yellow}⬆%f%%b' - zstyle ':git-info:' behind ' %%B%F{yellow}⬇%f%%b' - zstyle ':git-info:' branch ':%F{red}%b%f' - zstyle ':git-info:' deleted ' %%B%F{red}✖%f%%b' - zstyle ':git-info:' modified ' %%B%F{blue}✱%f%%b' - zstyle ':git-info:' renamed ' %%B%F{magenta}➜%f%%b' - zstyle ':git-info:' commit '%c' - zstyle ':git-info:' stashed ' %%B%F{cyan}✭%f%%b' - zstyle ':git-info:' unmerged ' %%B%F{yellow}═%f%%b' - zstyle ':git-info:' untracked ' %%B%F{white}◼%f%%b' - zstyle ':git-info:' prompt ' %F{blue}git%f%b%s' - zstyle ':git-info:' rprompt '%A%B%S%a%d%m%r%U%u' + zstyle ':omz:completion:indicator' format '%B%F{red}...%f%b' + zstyle ':omz:prompt' vicmd '%F{yellow}❮%f%B%F{red}❮%f%b%F{red}❮%f' + zstyle ':omz:plugin:git:prompt' action ':%%B%F{yellow}%s%f%%b' + zstyle ':omz:plugin:git:prompt' added ' %%B%F{green}✚%f%%b' + zstyle ':omz:plugin:git:prompt' ahead ' %%B%F{yellow}⬆%f%%b' + zstyle ':omz:plugin:git:prompt' behind ' %%B%F{yellow}⬇%f%%b' + zstyle ':omz:plugin:git:prompt' branch ':%F{red}%b%f' + zstyle ':omz:plugin:git:prompt' deleted ' %%B%F{red}✖%f%%b' + zstyle ':omz:plugin:git:prompt' modified ' %%B%F{blue}✱%f%%b' + zstyle ':omz:plugin:git:prompt' renamed ' %%B%F{magenta}➜%f%%b' + zstyle ':omz:plugin:git:prompt' commit '%c' + zstyle ':omz:plugin:git:prompt' stashed ' %%B%F{cyan}✭%f%%b' + zstyle ':omz:plugin:git:prompt' unmerged ' %%B%F{yellow}═%f%%b' + zstyle ':omz:plugin:git:prompt' untracked ' %%B%F{white}◼%f%%b' + zstyle ':omz:plugin:git:prompt' prompt ' %F{blue}git%f%b%s' + zstyle ':omz:plugin:git:prompt' rprompt '%A%B%S%a%d%m%r%U%u' PROMPT='%F{cyan}%1~%f${git_prompt_info} %(!.%B%F{red}#%f%b.%B%F{green}❯%f%b) ' RPROMPT='%(?::%F{red}⏎%f)${git_rprompt_info}' From 1fc1b459eefa8fcb862a79a90cf9543aa18d9fc4 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Mon, 26 Dec 2011 13:37:54 -0500 Subject: [PATCH 527/614] The theme should manage the completion indicator. --- keyboard.zsh | 22 ++++++++++------------ templates/zshrc.zsh | 3 --- themes/sorin/prompt_sorin_setup | 2 +- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/keyboard.zsh b/keyboard.zsh index 8867e7cdd..2eaa68c06 100644 --- a/keyboard.zsh +++ b/keyboard.zsh @@ -9,7 +9,7 @@ fi zstyle ':omz:prompt' vicmd '<<<' # Indicator to notify of generating completion. -zstyle ':omz:completion:indicator' format "..." +zstyle ':omz:completion' indicator '...' # Beep on error in line editor. setopt BEEP @@ -258,15 +258,13 @@ if zstyle -t ':omz:editor' dot-expansion; then fi # Display an indicator when completing. -if zstyle -t ':omz:completion:indicator' enable; then - function expand-or-complete-prefix-with-indicator() { - zstyle -s ':omz:completion:indicator' format indicator - print -Pn "$indicator" - unset indicator - zle expand-or-complete-prefix - zle redisplay - } - zle -N expand-or-complete-prefix-with-indicator - bindkey "$keyinfo[Control]i" expand-or-complete-prefix-with-indicator -fi +function expand-or-complete-prefix-with-indicator() { + local indicator + zstyle -s ':omz:completion' indicator 'indicator' + print -Pn "$indicator" + zle expand-or-complete-prefix + zle redisplay +} +zle -N expand-or-complete-prefix-with-indicator +bindkey "$keyinfo[Control]i" expand-or-complete-prefix-with-indicator diff --git a/templates/zshrc.zsh b/templates/zshrc.zsh index be3885c4b..3ec7ea020 100644 --- a/templates/zshrc.zsh +++ b/templates/zshrc.zsh @@ -13,9 +13,6 @@ zstyle ':omz:*:*' color 'yes' # Auto set the tab and window titles. zstyle ':omz:terminal' auto-title 'yes' -# Indicate that completions are being generated. -zstyle ':omz:completion:indicator' enable 'no' - # Set the plugins to load (see $OMZ/plugins/). zstyle ':omz:load' plugin 'archive' 'git' diff --git a/themes/sorin/prompt_sorin_setup b/themes/sorin/prompt_sorin_setup index 9120b4e40..b77c988cb 100644 --- a/themes/sorin/prompt_sorin_setup +++ b/themes/sorin/prompt_sorin_setup @@ -22,7 +22,7 @@ function prompt_sorin_setup() { autoload -Uz add-zsh-hook add-zsh-hook precmd prompt_sorin_precmd - zstyle ':omz:completion:indicator' format '%B%F{red}...%f%b' + zstyle ':omz:completion' indicator '%B%F{red}...%f%b' zstyle ':omz:prompt' vicmd '%F{yellow}❮%f%B%F{red}❮%f%b%F{red}❮%f' zstyle ':omz:plugin:git:prompt' action ':%%B%F{yellow}%s%f%%b' zstyle ':omz:plugin:git:prompt' added ' %%B%F{green}✚%f%%b' From 99176daaee341f1fb69843b1d3ee80fc0627fd3c Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Tue, 27 Dec 2011 02:27:34 -0500 Subject: [PATCH 528/614] Do not bind empty key entries. --- keyboard.zsh | 168 ++++++++++++++++++++++++++++++++++----------------- 1 file changed, 112 insertions(+), 56 deletions(-) diff --git a/keyboard.zsh b/keyboard.zsh index 2eaa68c06..eca51a95a 100644 --- a/keyboard.zsh +++ b/keyboard.zsh @@ -58,27 +58,38 @@ if zstyle -m ':omz:editor' keymap 'emacs'; then # Use Emacs key bindings. bindkey -e - bindkey "$keyinfo[Escape]b" emacs-backward-word - bindkey "$keyinfo[Escape]f" emacs-forward-word - bindkey "$keyinfo[Escape]$keyinfo[Left]" emacs-backward-word - bindkey "$keyinfo[Escape]$keyinfo[Right]" emacs-forward-word + [[ -n "$keyinfo[Escape]" ]] && \ + bindkey "$keyinfo[Escape]b" emacs-backward-word + [[ -n "$keyinfo[Escape]" ]] && \ + bindkey "$keyinfo[Escape]f" emacs-forward-word + [[ -n "$keyinfo[Escape]" ]] && [[ -n "$keyinfo[Left]" ]] && \ + bindkey "$keyinfo[Escape]$keyinfo[Left]" emacs-backward-word + [[ -n "$keyinfo[Escape]" ]] && [[ -n "$keyinfo[Right]" ]] && \ + bindkey "$keyinfo[Escape]$keyinfo[Right]" emacs-forward-word # Kill to the beginning of the line. - bindkey "$keyinfo[Control]u" backward-kill-line + [[ -n "$keyinfo[Control]" ]] && \ + bindkey "$keyinfo[Control]u" backward-kill-line # Kill to the beginning of the word. - bindkey "$keyinfo[Control]w" backward-kill-word + [[ -n "$keyinfo[Control]" ]] && \ + bindkey "$keyinfo[Control]w" backward-kill-word # Undo/Redo - bindkey "$keyinfo[Control]_" undo - bindkey "$keyinfo[Escape]_" redo + [[ -n "$keyinfo[Control]" ]] && \ + bindkey "$keyinfo[Control]_" undo + [[ -n "$keyinfo[Escape]" ]] && \ + bindkey "$keyinfo[Escape]_" redo # Search character. - bindkey "$keyinfo[Control]]" vi-find-next-char - bindkey "$keyinfo[Escape]$keyinfo[Control]]" vi-find-prev-char + [[ -n "$keyinfo[Control]" ]] && \ + bindkey "$keyinfo[Control]]" vi-find-next-char + [[ -n "$keyinfo[Escape]" ]] && [[ -n "$keyinfo[Control]" ]] && \ + bindkey "$keyinfo[Escape]$keyinfo[Control]]" vi-find-prev-char # Edit command in an external editor. - bindkey "$keyinfo[Control]x$keyinfo[Control]e" edit-command-line + [[ -n "$keyinfo[Control]" ]] && \ + bindkey "$keyinfo[Control]x$keyinfo[Control]e" edit-command-line # Expand .... to ../.. if zstyle -t ':omz:editor' dot-expansion; then @@ -88,11 +99,15 @@ if zstyle -m ':omz:editor' keymap 'emacs'; then # Bind to history substring search plugin if enabled; # otherwise, bind to built-in Zsh history search. if (( $+widgets[history-incremental-pattern-search-backward] )); then - bindkey "$keyinfo[Control]r" history-incremental-pattern-search-backward - bindkey "$keyinfo[Control]s" history-incremental-pattern-search-forward + [[ -n "$keyinfo[Control]" ]] && \ + bindkey "$keyinfo[Control]r" history-incremental-pattern-search-backward + [[ -n "$keyinfo[Control]" ]] && \ + bindkey "$keyinfo[Control]s" history-incremental-pattern-search-forward else - bindkey "$keyinfo[Control]r" history-incremental-search-backward - bindkey "$keyinfo[Control]s" history-incremental-search-forward + [[ -n "$keyinfo[Control]" ]] && \ + bindkey "$keyinfo[Control]r" history-incremental-search-backward + [[ -n "$keyinfo[Control]" ]] && \ + bindkey "$keyinfo[Control]s" history-incremental-search-forward fi elif zstyle -m ':omz:editor' keymap 'vi'; then # Use vi key bindings. @@ -140,7 +155,8 @@ elif zstyle -m ':omz:editor' keymap 'vi'; then # Undo/Redo bindkey -M vicmd "u" undo - bindkey -M vicmd "$keyinfo[Control]r" redo + [[ -n "$keyinfo[Control]" ]] && \ + bindkey -M vicmd "$keyinfo[Control]r" redo # Expand .... to ../.. if zstyle -t ':omz:editor' dot-expansion; then @@ -152,21 +168,36 @@ elif zstyle -m ':omz:editor' keymap 'vi'; then bindkey -M viins "kj" vi-cmd-mode # Emacs key bindings in insert mode. - bindkey -M viins "$keyinfo[Control]a" beginning-of-line - bindkey -M viins "$keyinfo[Control]b" backward-char - bindkey -M viins "$keyinfo[Escape]b" emacs-backward-word - bindkey -M viins "$keyinfo[Control]d" delete-char-or-list - bindkey -M viins "$keyinfo[Escape]d" kill-word - bindkey -M viins "$keyinfo[Control]e" end-of-line - bindkey -M viins "$keyinfo[Control]f" forward-char - bindkey -M viins "$keyinfo[Escape]f" emacs-forward-word - bindkey -M viins "$keyinfo[Control]k" kill-line - bindkey -M viins "$keyinfo[Control]u" backward-kill-line - bindkey -M viins "$keyinfo[Control]w" backward-kill-word - bindkey -M viins "$keyinfo[Escape]w" copy-region-as-kill - bindkey -M viins "$keyinfo[Escape]h" run-help - bindkey -M viins "$keyinfo[Escape]$keyinfo[Left]" emacs-backward-word - bindkey -M viins "$keyinfo[Escape]$keyinfo[Right]" emacs-forward-word + [[ -n "$keyinfo[Control]" ]] && \ + bindkey -M viins "$keyinfo[Control]a" beginning-of-line + [[ -n "$keyinfo[Control]" ]] && \ + bindkey -M viins "$keyinfo[Control]b" backward-char + [[ -n "$keyinfo[Escape]" ]] && \ + bindkey -M viins "$keyinfo[Escape]b" emacs-backward-word + [[ -n "$keyinfo[Control]" ]] && \ + bindkey -M viins "$keyinfo[Control]d" delete-char-or-list + [[ -n "$keyinfo[Escape]" ]] && \ + bindkey -M viins "$keyinfo[Escape]d" kill-word + [[ -n "$keyinfo[Control]" ]] && \ + bindkey -M viins "$keyinfo[Control]e" end-of-line + [[ -n "$keyinfo[Control]" ]] && \ + bindkey -M viins "$keyinfo[Control]f" forward-char + [[ -n "$keyinfo[Escape]" ]] && \ + bindkey -M viins "$keyinfo[Escape]f" emacs-forward-word + [[ -n "$keyinfo[Control]" ]] && \ + bindkey -M viins "$keyinfo[Control]k" kill-line + [[ -n "$keyinfo[Control]" ]] && \ + bindkey -M viins "$keyinfo[Control]u" backward-kill-line + [[ -n "$keyinfo[Control]" ]] && \ + bindkey -M viins "$keyinfo[Control]w" backward-kill-word + [[ -n "$keyinfo[Escape]" ]] && \ + bindkey -M viins "$keyinfo[Escape]w" copy-region-as-kill + [[ -n "$keyinfo[Escape]" ]] && \ + bindkey -M viins "$keyinfo[Escape]h" run-help + [[ -n "$keyinfo[Escape]" ]] && [[ -n "$keyinfo[Left]" ]] && \ + bindkey -M viins "$keyinfo[Escape]$keyinfo[Left]" emacs-backward-word + [[ -n "$keyinfo[Escape]" ]] && [[ -n "$keyinfo[Right]" ]] && \ + bindkey -M viins "$keyinfo[Escape]$keyinfo[Right]" emacs-forward-word # History bindkey -M vicmd "gg" beginning-of-history @@ -187,15 +218,19 @@ elif zstyle -m ':omz:editor' keymap 'vi'; then bindkey -M vicmd "/" history-incremental-pattern-search-forward # Emacs key bindings in insert mode. - bindkey -M viins "$keyinfo[Control]r" history-incremental-pattern-search-backward - bindkey -M viins "$keyinfo[Control]s" history-incremental-pattern-search-forward + [[ -n "$keyinfo[Control]" ]] && \ + bindkey -M viins "$keyinfo[Control]r" history-incremental-pattern-search-backward + [[ -n "$keyinfo[Control]" ]] && \ + bindkey -M viins "$keyinfo[Control]s" history-incremental-pattern-search-forward else bindkey -M vicmd "?" history-incremental-search-backward bindkey -M vicmd "/" history-incremental-search-forward # Emacs key bindings in insert mode. - bindkey -M viins "$keyinfo[Control]r" history-incremental-search-backward - bindkey -M viins "$keyinfo[Control]s" history-incremental-search-forward + [[ -n "$keyinfo[Control]" ]] && \ + bindkey -M viins "$keyinfo[Control]r" history-incremental-search-backward + [[ -n "$keyinfo[Control]" ]] && \ + bindkey -M viins "$keyinfo[Control]s" history-incremental-search-forward fi else print "omz: \`zstyle ':omz:editor' keymap\` must be set to 'emacs' or 'vi'" >&2 @@ -203,45 +238,65 @@ else fi # The next key bindings are for both Emacs and Vi. -bindkey "$keyinfo[Home]" beginning-of-line -bindkey "$keyinfo[End]" end-of-line +[[ -n "$keyinfo[Home]" ]] && \ + bindkey "$keyinfo[Home]" beginning-of-line +[[ -n "$keyinfo[End]" ]] && \ + bindkey "$keyinfo[End]" end-of-line -bindkey "$keyinfo[Insert]" overwrite-mode -bindkey "$keyinfo[Delete]" delete-char -bindkey "$keyinfo[Backspace]" backward-delete-char +[[ -n "$keyinfo[Insert]" ]] && \ + bindkey "$keyinfo[Insert]" overwrite-mode +[[ -n "$keyinfo[Delete]" ]] && \ + bindkey "$keyinfo[Delete]" delete-char +[[ -n "$keyinfo[Backspace]" ]] && \ + bindkey "$keyinfo[Backspace]" backward-delete-char -bindkey "$keyinfo[Left]" backward-char -bindkey "$keyinfo[Right]" forward-char +[[ -n "$keyinfo[Left]" ]] && \ + bindkey "$keyinfo[Left]" backward-char +[[ -n "$keyinfo[Right]" ]] && \ + bindkey "$keyinfo[Right]" forward-char # Expand history on space. bindkey ' ' magic-space if (( $+plugins[(er)history-substring-search] )); then - bindkey "$keyinfo[Up]" history-substring-search-up - bindkey "$keyinfo[Down]" history-substring-search-down - bindkey "$keyinfo[Control]p" history-substring-search-up - bindkey "$keyinfo[Control]n" history-substring-search-down + [[ -n "$keyinfo[Up]" ]] && \ + bindkey "$keyinfo[Up]" history-substring-search-up + [[ -n "$keyinfo[Down]" ]] && \ + bindkey "$keyinfo[Down]" history-substring-search-down + [[ -n "$keyinfo[Control]" ]] && \ + bindkey "$keyinfo[Control]p" history-substring-search-up + [[ -n "$keyinfo[Control]" ]] && \ + bindkey "$keyinfo[Control]n" history-substring-search-down else - bindkey "$keyinfo[Up]" up-line-or-history - bindkey "$keyinfo[Down]" down-line-or-history - bindkey "$keyinfo[Control]p" up-line-or-history - bindkey "$keyinfo[Control]n" down-line-or-history + [[ -n "$keyinfo[Up]" ]] && \ + bindkey "$keyinfo[Up]" up-line-or-history + [[ -n "$keyinfo[Down]" ]] && \ + bindkey "$keyinfo[Down]" down-line-or-history + [[ -n "$keyinfo[Control]" ]] && \ + bindkey "$keyinfo[Control]p" up-line-or-history + [[ -n "$keyinfo[Control]" ]] && \ + bindkey "$keyinfo[Control]n" down-line-or-history fi # Clear screen. -bindkey "$keyinfo[Control]l" clear-screen +[[ -n "$keyinfo[Control]" ]] && \ + bindkey "$keyinfo[Control]l" clear-screen # Expand command name to full path. -bindkey "$keyinfo[Escape]e" expand-cmd-path +[[ -n "$keyinfo[Escape]" ]] && \ + bindkey "$keyinfo[Escape]e" expand-cmd-path # Duplicate the previous word. -bindkey "$keyinfo[Escape]m" copy-prev-shell-word +[[ -n "$keyinfo[Escape]" ]] && \ + bindkey "$keyinfo[Escape]m" copy-prev-shell-word # Bind Shift + Tab to go to the previous menu item. -bindkey "$keyinfo[BackTab]" reverse-menu-complete +[[ -n "$keyinfo[BackTab]" ]] && \ + bindkey "$keyinfo[BackTab]" reverse-menu-complete # Complete in the middle of word. -bindkey "$keyinfo[Control]i" expand-or-complete-prefix +[[ -n "$keyinfo[Control]" ]] && \ + bindkey "$keyinfo[Control]i" expand-or-complete-prefix # Convert .... to ../.. automatically. if zstyle -t ':omz:editor' dot-expansion; then @@ -266,5 +321,6 @@ function expand-or-complete-prefix-with-indicator() { zle redisplay } zle -N expand-or-complete-prefix-with-indicator -bindkey "$keyinfo[Control]i" expand-or-complete-prefix-with-indicator +[[ -n "$keyinfo[Control]" ]] && \ + bindkey "$keyinfo[Control]i" expand-or-complete-prefix-with-indicator From 2679db1ffbe3af52db7968d3f1a2c23f6bd587e5 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Wed, 28 Dec 2011 01:20:46 -0500 Subject: [PATCH 529/614] Removed the duplicate history alias (built-in). --- alias.zsh | 1 - 1 file changed, 1 deletion(-) diff --git a/alias.zsh b/alias.zsh index 3585c10fc..3bcd21e88 100644 --- a/alias.zsh +++ b/alias.zsh @@ -35,7 +35,6 @@ alias du='du -kh' alias e="$EDITOR" alias find='noglob find' alias gcc='nocorrect gcc' -alias history='fc -l 1' alias ln='nocorrect ln -i' alias locate='noglob locate' alias man='nocorrect man' From fb26ff880cb1e7461b5adcfbcea972dc658b59bf Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Wed, 28 Dec 2011 10:34:23 -0500 Subject: [PATCH 530/614] Improved handling of color diff. --- alias.zsh | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/alias.zsh b/alias.zsh index 3bcd21e88..3ac3c0c71 100644 --- a/alias.zsh +++ b/alias.zsh @@ -80,17 +80,27 @@ fi # Diff/Make if zstyle -t ':omz:alias:diff' color; then - if (( $+commands[colordiff] )); then - alias diff='colordiff -u' - compdef colordiff=diff - elif (( $+commands[git] )); then - function diff() { - git --no-pager diff --color=always --no-ext-diff --no-index "$@"; - } - compdef _git diff=git-diff - else - alias diff='diff -u' - fi + function diff() { + if (( $+commands[colordiff] )); then + "$commands[diff]" --unified "$@" | colordiff --difftype diffu + elif (( $+commands[git] )); then + git --no-pager diff --color=auto --no-ext-diff --no-index "$@" + else + "$commands[diff]" --unified "$@" + fi + } + + function wdiff() { + if (( $+commands[wdiff] )) && (( $+commands[colordiff] )); then + "$commands[diff]" --unified "$@" | "$commands[wdiff]" --diff-input --avoid-wraps | colordiff --difftype wdiff + elif (( $+commands[git] )); then + git --no-pager diff --color=auto --no-ext-diff --no-index --word-diff "$@" + elif (( $+commands[wdiff] )); then + "$commands[diff]" --unified "$@" | "$commands[wdiff]" --diff-input --avoid-wraps + else + print "zsh: command not found: $0" >&2 + fi + } if (( $+commands[colormake] )); then alias make='colormake' From 2c68dfe11a1b4675b2acb0615603bacf1bdde5d9 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Wed, 28 Dec 2011 10:34:26 -0500 Subject: [PATCH 531/614] Filter brackets in wdiff highlights. --- alias.zsh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/alias.zsh b/alias.zsh index 3ac3c0c71..68f7a3b17 100644 --- a/alias.zsh +++ b/alias.zsh @@ -91,12 +91,17 @@ if zstyle -t ':omz:alias:diff' color; then } function wdiff() { - if (( $+commands[wdiff] )) && (( $+commands[colordiff] )); then - "$commands[diff]" --unified "$@" | "$commands[wdiff]" --diff-input --avoid-wraps | colordiff --difftype wdiff + if (( $+commands[wdiff] )); then + "$commands[wdiff]" \ + --avoid-wraps \ + --start-delete="$(print -n $FG[red])" \ + --end-delete="$(print -n $FG[none])" \ + --start-insert="$(print -n $FG[green])" \ + --end-insert="$(print -n $FG[none])" \ + "$@" \ + | sed 's/^\(@@\( [+-][[:digit:]]*,[[:digit:]]*\)\{2\} @@\)$/;5;6m\10m/g' elif (( $+commands[git] )); then - git --no-pager diff --color=auto --no-ext-diff --no-index --word-diff "$@" - elif (( $+commands[wdiff] )); then - "$commands[diff]" --unified "$@" | "$commands[wdiff]" --diff-input --avoid-wraps + git --no-pager diff --color=auto --no-ext-diff --no-index --color-words "$@" else print "zsh: command not found: $0" >&2 fi From f1be5d3ace6d32154b73e66f454113575268b900 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Wed, 28 Dec 2011 11:12:29 -0500 Subject: [PATCH 532/614] Removed the hpodder alias since it's no longer maintained. --- alias.zsh | 1 - 1 file changed, 1 deletion(-) diff --git a/alias.zsh b/alias.zsh index 68f7a3b17..8af4d5d26 100644 --- a/alias.zsh +++ b/alias.zsh @@ -118,6 +118,5 @@ fi (( $+commands[ebuild] )) && alias ebuild='nocorrect ebuild' (( $+commands[gist] )) && alias gist='nocorrect gist' (( $+commands[heroku] )) && alias heroku='nocorrect heroku' -(( $+commands[hpodder] )) && alias hpodder='nocorrect hpodder' (( $+commands[mysql] )) && alias mysql='nocorrect mysql' From 97f6134cdd3ba32a47313a290d8e3f4023ef0fd9 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Wed, 28 Dec 2011 11:14:29 -0500 Subject: [PATCH 533/614] Fixed the ack alias. --- alias.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/alias.zsh b/alias.zsh index 8af4d5d26..b0be699c4 100644 --- a/alias.zsh +++ b/alias.zsh @@ -114,7 +114,7 @@ if zstyle -t ':omz:alias:diff' color; then fi # Miscellaneous -(( $+commands[ack] )) && alias afind='ack -il' +(( $+commands[ack] )) && alias afind='nocorrect ack' (( $+commands[ebuild] )) && alias ebuild='nocorrect ebuild' (( $+commands[gist] )) && alias gist='nocorrect gist' (( $+commands[heroku] )) && alias heroku='nocorrect heroku' From fad255805aec0ee9da53f68e86daeb33ebf77d95 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Wed, 28 Dec 2011 11:19:17 -0500 Subject: [PATCH 534/614] Support pre-release node version documentation. --- plugins/node/functions/node-docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/node/functions/node-docs b/plugins/node/functions/node-docs index 8dfd49c92..cbf4bac6b 100644 --- a/plugins/node/functions/node-docs +++ b/plugins/node/functions/node-docs @@ -1,4 +1,4 @@ # Open the node api for your current version to the optional section. # TODO: Make the sections easier to use. -open "http://nodejs.org/docs/$(node --version)/api/all.html#${1}" +open "http://nodejs.org/docs/$(node --version | sed 's/-.*//')/api/all.html#${1}" From 2f1565e2720fd49e5bd6b34c464b2a57b2f2f807 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Wed, 28 Dec 2011 11:21:18 -0500 Subject: [PATCH 535/614] Added rails runner alias. --- plugins/rails/init.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/rails/init.zsh b/plugins/rails/init.zsh index 1528345a3..490cdeaef 100644 --- a/plugins/rails/init.zsh +++ b/plugins/rails/init.zsh @@ -5,6 +5,7 @@ alias rdb='_rails-command dbconsole' alias rdbm='rake db:migrate db:test:clone' alias rg='_rails-command generate' alias rp='_rails-command plugin' +alias rr='_rails-command runner' alias rs='_rails-command server' alias rsd='_rails-command server --debugger' alias devlog='tail -f log/development.log' From db31957cd7aab24cb1ea12c140970c7dad39f949 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Wed, 28 Dec 2011 11:42:41 -0500 Subject: [PATCH 536/614] Easily open files and directories in TextMate. --- plugins/textmate/init.zsh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/textmate/init.zsh b/plugins/textmate/init.zsh index 80564b1cc..6a66820fd 100644 --- a/plugins/textmate/init.zsh +++ b/plugins/textmate/init.zsh @@ -9,6 +9,10 @@ alias mr='mate CHANGELOG app config db lib public script spec test' # Functions function tm() { - cd "$1" && mate . + if [[ -z "$1" ]]; then + mate . + else + ( [[ -d "$1" ]] && cd "$1" && mate . ) + fi } From b308a94c91bad63afefa18341c6b31688a496ae8 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Wed, 28 Dec 2011 11:49:26 -0500 Subject: [PATCH 537/614] Removed useless aliases in TextMate plugin. --- plugins/textmate/init.zsh | 9 --------- 1 file changed, 9 deletions(-) diff --git a/plugins/textmate/init.zsh b/plugins/textmate/init.zsh index 6a66820fd..20608a1b1 100644 --- a/plugins/textmate/init.zsh +++ b/plugins/textmate/init.zsh @@ -1,12 +1,3 @@ -# Aliases -alias et='mate .' -alias ett='mate app config lib db public spec test Rakefile Capfile Todo' -alias etp='mate app config features lib db public spec test Gemfile Rakefile Capfile Todo' -alias etts='mate app config lib db public script spec test vendor/plugins vendor/gems Rakefile Capfile Todo' - -# Edit Ruby app in TextMate. -alias mr='mate CHANGELOG app config db lib public script spec test' - # Functions function tm() { if [[ -z "$1" ]]; then From cf9c37d2b4d7bb70f5460c22020df736bb6d4ca9 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Wed, 28 Dec 2011 11:50:21 -0500 Subject: [PATCH 538/614] Easily open files and directories in Kate. --- plugins/kate/init.zsh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/kate/init.zsh b/plugins/kate/init.zsh index b3b064290..7fbf3d97a 100644 --- a/plugins/kate/init.zsh +++ b/plugins/kate/init.zsh @@ -3,6 +3,10 @@ alias kate='kate >/dev/null 2>&1' # Silent start. # Functions function kt() { - cd "$1" && kate . + if [[ -z "$1" ]]; then + kate . + else + ( [[ -d "$1" ]] && cd "$1" && kate . ) + fi } From 3f5bcafb46c10d96c84244f7a56d32e4c11bfdb7 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Wed, 28 Dec 2011 14:54:19 -0500 Subject: [PATCH 539/614] Improved the launching of man pages in Preview.app. --- plugins/osx/functions/manp | 14 ++++++++++++++ plugins/osx/init.zsh | 7 +------ 2 files changed, 15 insertions(+), 6 deletions(-) create mode 100644 plugins/osx/functions/manp diff --git a/plugins/osx/functions/manp b/plugins/osx/functions/manp new file mode 100644 index 000000000..35c1d95bf --- /dev/null +++ b/plugins/osx/functions/manp @@ -0,0 +1,14 @@ +# Open man pages in Preview. +function manp() { + local page + if (( $# > 0 )); then + for page in "$@"; do + man -t "$page" | open -f -a Preview + done + else + print 'What manual page do you want?' >&2 + fi +} +compdef _man manp +manp "$@" + diff --git a/plugins/osx/init.zsh b/plugins/osx/init.zsh index f85b67956..73b20e319 100644 --- a/plugins/osx/init.zsh +++ b/plugins/osx/init.zsh @@ -11,13 +11,8 @@ function ql() { (( $# > 0 )) && qlmanage -p "$@" &> /dev/null } -# Open man pages in Preview. -function manp() { - (( $# > 0 )) && man -t "$@" | open -f -a Preview -} -compdef _man manp - # Delete .DS_Store and __MACOSX directories. function rm-osx-cruft() { find "${@:-$PWD}" \( -type f -name '.DS_Store' \) -o \( -type d -name '__MACOSX' \) -print0 | xargs rm -rf } + From daf6f78f14a608e65e0c1c331dd673772bf83f10 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Wed, 28 Dec 2011 15:06:21 -0500 Subject: [PATCH 540/614] Added Bwana to OS X plugin. --- init.zsh | 4 +++- plugins/osx/functions/manb | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 plugins/osx/functions/manb diff --git a/init.zsh b/init.zsh index 0e4c5d3de..eed79b74f 100644 --- a/init.zsh +++ b/init.zsh @@ -65,7 +65,9 @@ done # Set environment variables for launchd processes. if [[ "$OSTYPE" == darwin* ]]; then - launchctl setenv PATH "$PATH" &! + for env_var in PATH MANPATH; do + launchctl setenv "$env_var" "${(P)env_var}" &! + done fi # Load and run the prompt theming system. diff --git a/plugins/osx/functions/manb b/plugins/osx/functions/manb new file mode 100644 index 000000000..5dfb4c5de --- /dev/null +++ b/plugins/osx/functions/manb @@ -0,0 +1,18 @@ +# Open man pages in Bwana. +function manb() { + local page + if (( $# > 0 )); then + for page in "$@"; do + open "man:$page" 2>/dev/null + if (( $? != 0 )); then + print "$0: Bwana is not installed" >&2 + break + fi + done + else + print 'What manual page do you want?' >&2 + fi +} +compdef _man manb +manb "$@" + From 7043b0c03f1b43fce29a8192b20dc69f0f2e49f5 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Wed, 28 Dec 2011 15:16:37 -0500 Subject: [PATCH 541/614] Use shell option CORRECT instead of noisy CORRECT_ALL. --- alias.zsh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/alias.zsh b/alias.zsh index b0be699c4..05c8a9cc9 100644 --- a/alias.zsh +++ b/alias.zsh @@ -1,5 +1,4 @@ -setopt CORRECT # Correct commands. -setopt CORRECT_ALL # Correct all arguments. +setopt CORRECT # Correct commands. # The 'ls' Family if zstyle -t ':omz:alias:ls' color; then From c8b88614188c6c8541fed9afe35fedab9de10bc2 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Wed, 28 Dec 2011 15:16:41 -0500 Subject: [PATCH 542/614] Removed redundant APPEND_HISTORY option. --- history.zsh | 1 - 1 file changed, 1 deletion(-) diff --git a/history.zsh b/history.zsh index 8816a9347..3f9fa0f3a 100644 --- a/history.zsh +++ b/history.zsh @@ -4,7 +4,6 @@ SAVEHIST=10000 setopt BANG_HIST # Treat the '!' character specially during expansion. setopt EXTENDED_HISTORY # Write the history file in the ":start:elapsed;command" format. -setopt APPEND_HISTORY # Append to the history file, don't replace it. setopt INC_APPEND_HISTORY # Write to the history file immediately, not when the shell exits. setopt SHARE_HISTORY # Share history between all sessions. setopt HIST_EXPIRE_DUPS_FIRST # Expire duplicate entries first when trimming history. From a5783e12560aa1681f01b5bfdf912351d687a5ae Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Wed, 28 Dec 2011 16:13:08 -0500 Subject: [PATCH 543/614] Cleaned up minor cruft in the Perl plugin. Use path helpers where appropriate. Removed an unnecessary if statement. --- plugins/perl/init.zsh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/plugins/perl/init.zsh b/plugins/perl/init.zsh index 450a8e048..784118131 100644 --- a/plugins/perl/init.zsh +++ b/plugins/perl/init.zsh @@ -13,7 +13,7 @@ if [[ "$OSTYPE" == darwin* ]]; then cache_file="${0:h}/cache.zsh" perl_path="$HOME/Library/Perl/5.12" if [[ -f "$perl_path/lib/perl5/local/lib.pm" ]]; then - export MANPATH="$perl_path/man:$MANPATH" + manpath=("$perl_path/man" $manpath) if [[ ! -f "$cache_file" ]]; then perl -I$perl_path/lib/perl5 -Mlocal::lib=$perl_path >! "$cache_file" source "$cache_file" @@ -23,10 +23,8 @@ if [[ "$OSTYPE" == darwin* ]]; then fi unset perl_path unset cache_file -fi -# Set environment variables for launchd processes. -if [[ "$OSTYPE" == darwin* ]]; then + # Set environment variables for launchd processes. for env_var in PERL_LOCAL_LIB_ROOT PERL_MB_OPT PERL_MM_OPT PERL5LIB; do launchctl setenv "$env_var" "${(P)env_var}" &! done From 7849948ead481897fd21e458e43c203b4893b8cd Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Wed, 28 Dec 2011 16:33:44 -0500 Subject: [PATCH 544/614] Cleaned up minor cruft in the Ruby plugin. Use path helpers where appropriate. Removed an unnecessary if statement. --- plugins/ruby/init.zsh | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/plugins/ruby/init.zsh b/plugins/ruby/init.zsh index bca092cb4..bf7f4695d 100644 --- a/plugins/ruby/init.zsh +++ b/plugins/ruby/init.zsh @@ -1,7 +1,7 @@ # Install local gems according to Mac OS X conventions. if [[ "$OSTYPE" == darwin* ]]; then export GEM_HOME=$HOME/Library/Ruby/Gems/1.8 - export PATH=$GEM_HOME/bin:$PATH + path=("$GEM_HOME/bin" $path) # gem is slow; cache its output. cache_file="${0:h}/cache.zsh" @@ -12,6 +12,12 @@ if [[ "$OSTYPE" == darwin* ]]; then source "$cache_file" fi unset cache_file + + # Set environment variables for launchd processes. + for env_var in GEM_PATH GEM_HOME; do + launchctl setenv "$env_var" "${(P)env_var}" &! + done + unset env_var fi # Loads RVM into the shell session. @@ -29,11 +35,3 @@ if [[ -s "$HOME/.rbenv/bin/rbenv" ]]; then eval "$(rbenv init -)" fi -# Set environment variables for launchd processes. -if [[ "$OSTYPE" == darwin* ]]; then - for env_var in GEM_PATH GEM_HOME; do - launchctl setenv "$env_var" "${(P)env_var}" &! - done - unset env_var -fi - From fadea4fe43eb1d0b1568410eb2b059cd096a6c59 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Wed, 28 Dec 2011 16:35:41 -0500 Subject: [PATCH 545/614] RubyGems GEM_PATH is not necessary to export. --- plugins/ruby/init.zsh | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/plugins/ruby/init.zsh b/plugins/ruby/init.zsh index bf7f4695d..44114f9d4 100644 --- a/plugins/ruby/init.zsh +++ b/plugins/ruby/init.zsh @@ -3,21 +3,8 @@ if [[ "$OSTYPE" == darwin* ]]; then export GEM_HOME=$HOME/Library/Ruby/Gems/1.8 path=("$GEM_HOME/bin" $path) - # gem is slow; cache its output. - cache_file="${0:h}/cache.zsh" - if [[ ! -f "$cache_file" ]]; then - print export GEM_PATH=$GEM_HOME:$(gem env gempath) >! "$cache_file" - source "$cache_file" - else - source "$cache_file" - fi - unset cache_file - # Set environment variables for launchd processes. - for env_var in GEM_PATH GEM_HOME; do - launchctl setenv "$env_var" "${(P)env_var}" &! - done - unset env_var + launchctl setenv GEM_HOME "$GEM_HOME" &! fi # Loads RVM into the shell session. From b0d47546fe920ac6a91c31078f399f947a36a9d9 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Wed, 28 Dec 2011 16:48:25 -0500 Subject: [PATCH 546/614] Do not assume a specific Ruby version. --- plugins/ruby/init.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/ruby/init.zsh b/plugins/ruby/init.zsh index 44114f9d4..936a38c38 100644 --- a/plugins/ruby/init.zsh +++ b/plugins/ruby/init.zsh @@ -1,6 +1,6 @@ # Install local gems according to Mac OS X conventions. if [[ "$OSTYPE" == darwin* ]]; then - export GEM_HOME=$HOME/Library/Ruby/Gems/1.8 + export GEM_HOME="$HOME/Library/Ruby/Gems/${$(ruby --version)[6,8]}" path=("$GEM_HOME/bin" $path) # Set environment variables for launchd processes. From d1d82c2189559d43052898239f6c21fecec587b2 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Wed, 28 Dec 2011 17:04:43 -0500 Subject: [PATCH 547/614] Added the MIT license. --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/README.md b/README.md index 1bab17dc8..08c4fd298 100644 --- a/README.md +++ b/README.md @@ -64,3 +64,26 @@ This project would not exist without all of our awesome users and contributors. Thank you so much! +## License + +(The MIT License) + +Copyright (c) 2011 Robby Russell, Sorin Ionescu, and contributors. + +Permission is hereby granted, free of charge, to any person obtaining a copy of this +software and associated documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights to use, copy, modify, +merge, publish, distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be included in all copies +or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR +A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE +OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + From f000d7e39f86dca9aed72891db93ba40e149e792 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Wed, 28 Dec 2011 17:32:20 -0500 Subject: [PATCH 548/614] Added missing parenthesis to a few functions. --- helper.zsh | 4 ++-- terminal.zsh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/helper.zsh b/helper.zsh index f4153ce34..1df159a67 100644 --- a/helper.zsh +++ b/helper.zsh @@ -4,7 +4,7 @@ function autoloadable() { } # Checks boolean variable for "true" (case insensitive "1", "y", "yes", "t", "true", "o", and "on"). -function check-bool { +function check-bool() { [[ -n "$1" && "$1" == (1|[Yy]([Ee][Ss]|)|[Tt]([Rr][Uu][Ee]|)|[Oo]([Nn]|)) ]] } @@ -17,7 +17,7 @@ TRAP_SIGNALS=( ) # Adds a function to a list to be called when a trap is triggered. -function add-zsh-trap { +function add-zsh-trap() { if (( $# < 2 )); then print "Usage: $0 type function" return 1 diff --git a/terminal.zsh b/terminal.zsh index 570307f80..440875640 100644 --- a/terminal.zsh +++ b/terminal.zsh @@ -69,7 +69,7 @@ function set-title-by-command() { autoload -Uz add-zsh-hook # Sets the tab and window titles before the prompt is displayed. -function set-title-precmd { +function set-title-precmd() { if [[ "$TERM_PROGRAM" != "Apple_Terminal" ]] && zstyle -t ':omz:terminal' auto-title; then set-window-title "${(%):-%~}" for kind in tab screen; do @@ -84,7 +84,7 @@ function set-title-precmd { add-zsh-hook precmd set-title-precmd # Sets the tab and window titles before command execution. -function set-title-preexec { +function set-title-preexec() { if zstyle -t ':omz:terminal' auto-title; then set-title-by-command "$2" fi From 0fee3c09e3f9e38212f797f01672ce70b78fd576 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 29 Dec 2011 22:52:44 -0500 Subject: [PATCH 549/614] Alias p to PAGER since v is reserved for Vim. --- alias.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/alias.zsh b/alias.zsh index 05c8a9cc9..302dac4ed 100644 --- a/alias.zsh +++ b/alias.zsh @@ -39,13 +39,13 @@ alias locate='noglob locate' alias man='nocorrect man' alias mkdir='nocorrect mkdir -p' alias mv='nocorrect mv -i' +alias p="$PAGER" alias po='popd' alias pu='pushd' alias rake='noglob rake' alias rm='nocorrect rm -i' alias scp='nocorrect scp' alias type='type -a' -alias v="$PAGER" # Mac OS X if [[ "$OSTYPE" != darwin* ]]; then From 30f8aef2a1f1495189c602c7b679c4721647f641 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Wed, 18 Jan 2012 22:33:53 -0500 Subject: [PATCH 550/614] Export INFOPATH for GNU info documentation. --- environment.zsh | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/environment.zsh b/environment.zsh index 08a73b6eb..47727f1f1 100644 --- a/environment.zsh +++ b/environment.zsh @@ -15,7 +15,30 @@ unsetopt HUP # Don't kill jobs on shell exit. unsetopt CHECK_JOBS # Don't report on jobs when shell exit. # PATH -typeset -U path manpath cdpath fpath +typeset -U cdpath fpath infopath manpath path + +cdpath=( + $HOME + $HOME/Developer +) + +infopath=( + $HOME/.tilde/share/info + $HOME/.tilde/opt/share/info + /usr/local/share/info + /usr/share/info +) + +manpath=( + $HOME/.tilde/share/man + $HOME/.tilde/opt/share/man + /usr/local/share/man + /usr/share/man +) + +for path_file in /etc/manpaths.d/*; do + manpath+=($(<$path_file)) +done path=( $HOME/.tilde/bin @@ -32,22 +55,6 @@ for path_file in /etc/paths.d/*; do path+=($(<$path_file)) done -manpath=( - $HOME/.tilde/share/man - $HOME/.tilde/opt/share/man - /usr/local/share/man - /usr/share/man -) - -for path_file in /etc/manpaths.d/*; do - manpath+=($(<$path_file)) -done - -cdpath=( - $HOME - $HOME/Developer -) - # Language export LANG="en_AU.UTF-8" export LC_ALL="$LANG" From 5bb9a3e4b5d53c82277330bcd5ccb2a0287d33bc Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 29 Dec 2011 23:19:16 -0500 Subject: [PATCH 551/614] Print an error when a plugin is not found. --- init.zsh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/init.zsh b/init.zsh index eed79b74f..82f2e2145 100644 --- a/init.zsh +++ b/init.zsh @@ -48,6 +48,11 @@ autoload -Uz zmv # Source plugins defined in ~/.zshrc. for plugin in "$plugins[@]"; do zstyle ":omz:plugin:$plugin" enable 'yes' + + if [[ ! -d "${0:h}/plugins/$plugin" ]]; then + print "omz: no such plugin: $plugin" >&2 + fi + if [[ -f "${0:h}/plugins/$plugin/init.zsh" ]]; then source "${0:h}/plugins/$plugin/init.zsh" fi From 66c4aae59e223c030c6176950b80c7db8b7ffbca Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 19 Jan 2012 17:32:27 -0500 Subject: [PATCH 552/614] Support the browsing of other Git remotes/branches. --- plugins/git/alias.zsh | 2 ++ plugins/git/completions/_git-hub | 29 +++++++++++++++++++++++++++++ plugins/git/functions/git-hub | 26 ++++++++++++++++++++++---- 3 files changed, 53 insertions(+), 4 deletions(-) create mode 100644 plugins/git/completions/_git-hub diff --git a/plugins/git/alias.zsh b/plugins/git/alias.zsh index 67d6000c7..e266a3981 100644 --- a/plugins/git/alias.zsh +++ b/plugins/git/alias.zsh @@ -182,6 +182,8 @@ alias ghc='git remote prune' compdef _git ghc=git-remote alias ghs='git remote show' compdef _git ghs=git-remote +alias ghb='git-hub' +compdef _git-hub ghb=git-hub # Stash (t) alias gta='git stash apply' diff --git a/plugins/git/completions/_git-hub b/plugins/git/completions/_git-hub new file mode 100644 index 000000000..3a9c6e5af --- /dev/null +++ b/plugins/git/completions/_git-hub @@ -0,0 +1,29 @@ +#compdef git-hub +#autoload + +local state remotes remote branches ret=1 + +_arguments -C -s -S \ + '1::args:->remote' \ + '2::args:->branch' && ret=0 + +case "$state" in + (remote) + remotes=($( + git config -l \ + | grep 'remote\.[^.]*\.url' \ + | cut -d'.' -f2)) + _describe -t branch 'remotes' remotes && ret=0 + ;; + (branch) + remote="$words[(($CURRENT - 1))]" + branches=($( + git branch -a \ + | grep "remotes/${remote}" \ + | sed -e 's/[ \*]*//g' -e "s:remotes/${remote}/::g" + )) + _describe -t branch 'branches' branches && ret=0 + ;; +esac + +return $ret diff --git a/plugins/git/functions/git-hub b/plugins/git/functions/git-hub index 6bfbb9ae9..e9d18aed6 100644 --- a/plugins/git/functions/git-hub +++ b/plugins/git/functions/git-hub @@ -1,12 +1,30 @@ # Open the GitHub repository in the browser. -local url=$( +local remote branches branch current_branch url + +remote="${1:-origin}" +url=$( git config -l \ - | grep "remote.origin.url" \ - | sed -En "s/remote.origin.url=(git|https?)(@|:\/\/)github.com(:|\/)(.+)\/(.+).git/https:\/\/github.com\/\4\/\5/p" + | grep "remote.${remote}.url" \ + | sed -En "s/remote.${remote}.url=(git|https?)(@|:\/\/)github.com(:|\/)(.+)\/(.+).git/https:\/\/github.com\/\4\/\5/p" ) +branches=($( + git branch -a \ + | grep "remotes/${remote}" \ + | sed -e 's/[ \*]*//g' -e "s:remotes/${remote}/::g" +)) +current_branch="$(git-branch)" +branch="${2:-master}" + +if [[ -z "$2" ]]; then + if (( $branches[(I)$current_branch] != 0 )); then + branch="$current_branch" + else + branch='master' + fi +fi if [[ -n "$url" ]]; then - url="${url}/tree/${$(git-branch):-master}" + url="${url}/tree/${branch}" if (( $+commands[$BROWSER] )); then "$BROWSER" "$url" From 5f81b5ba1e88aba71eb7963a253b692b57d201b8 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 19 Jan 2012 17:33:55 -0500 Subject: [PATCH 553/614] View Git index diffs in Vim. --- plugins/git/alias.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/git/alias.zsh b/plugins/git/alias.zsh index e266a3981..35f4c1239 100644 --- a/plugins/git/alias.zsh +++ b/plugins/git/alias.zsh @@ -35,6 +35,8 @@ alias giu='git add --update' compdef _git giu=git-add alias gid='git diff --no-ext-diff --cached' compdef _git gid=git-diff +function giD() { git diff --no-ext-diff --cached --ignore-all-space "$@" | view - } +compdef _git giD=git-diff alias gir='git reset' compdef _git gir=git-reset alias giR='git reset --mixed' From 5b15f3ab1e1d955baf3ee7f22e8fa3e406562b2e Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 19 Jan 2012 18:16:11 -0500 Subject: [PATCH 554/614] Fixed Git graph log aliases. --- plugins/git/alias.zsh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/git/alias.zsh b/plugins/git/alias.zsh index 35f4c1239..4fcdfd5e5 100644 --- a/plugins/git/alias.zsh +++ b/plugins/git/alias.zsh @@ -234,11 +234,13 @@ alias glo='git log --topo-order ${git_log_format_oneline}' compdef _git glo=git-log alias glO='git log --topo-order --date=short ${git_log_format_oneline_more}' compdef _git glO=git-log -alias glg='git log --graph --topo-order ${git_log_format_medium}' +alias glg='git log --topo-order --all --graph ${git_log_format_oneline}' compdef _git glg=git-log -alias gls='git log --graph --topo-order --stat ${git_log_format_medium}' +alias glG='git log --topo-order --all --graph --date=short ${git_log_format_oneline_more}' +compdef _git glG=git-log +alias gls='git log --topo-order --stat ${git_log_format_medium}' compdef _git gls=git-log -alias gld='git log --graph --topo-order --stat --patch --full-diff ${git_log_format_medium}' +alias gld='git log --topo-order --stat --patch --full-diff ${git_log_format_medium}' compdef _git gld=git-log alias glc='git shortlog --summary --numbered' compdef _git glc=git-shortlog From 8d00173fd2b677f0ccc6f4793590d332a12f4ad8 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 19 Jan 2012 23:39:21 -0500 Subject: [PATCH 555/614] Clarified git-info completion descriptions. --- plugins/git/completions/_git-info | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/git/completions/_git-info b/plugins/git/completions/_git-info index 2cdbc2894..1708fae4f 100644 --- a/plugins/git/completions/_git-info +++ b/plugins/git/completions/_git-info @@ -2,7 +2,7 @@ #autoload _arguments "1:toggle:(( - on\:'Turn prompt Git status on for the current repository.' - off\:'Turn prompt Git status off for the current repository.' + on\:'enable in-prompt information for the current repository' + off\:'disable in-prompt information for the current repository' ))" && return 0 From 28da8f916b3e237f90e9536e299e353247d0930d Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Wed, 18 Jan 2012 22:02:23 -0500 Subject: [PATCH 556/614] Use Finder to trash files to enable Put Back. Though AppleScript is slow, Put Back data is stored in ~/.Trash/.DS_Store, and there is no way to write to it from the shell at this time. The minimum Zsh version has been incremented to 4.3.10 to use the 'a' modifier to convert a relative path into a full path. --- init.zsh | 2 +- plugins/osx/functions/trash | 31 +++++++++++++++++++------------ 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/init.zsh b/init.zsh index 82f2e2145..20d38abbc 100644 --- a/init.zsh +++ b/init.zsh @@ -1,7 +1,7 @@ # Initializes Oh My Zsh. # Check for the minimum supported version. -min_zsh_version=4.3.9 +min_zsh_version='4.3.10' if ! autoload -Uz is-at-least || ! is-at-least "$min_zsh_version"; then print "omz: The minimum supported Zsh version is $min_zsh_version." fi diff --git a/plugins/osx/functions/trash b/plugins/osx/functions/trash index 9a7bf5878..33c0f6d54 100644 --- a/plugins/osx/functions/trash +++ b/plugins/osx/functions/trash @@ -1,13 +1,20 @@ -local trash_dir="${HOME}/.Trash" -local trash_item -local item -for item in "${@}"; do - if [[ -e "${item}" ]] || [[ -L "${item}" ]]; then - trash_item="${trash_dir}/${item:t}" - if [[ -e "${trash_item}" ]] || [[ -L "${trash_item}" ]]; then - trash_item="${trash_item} $(date "+%H-%M-%S")" - fi - mv -f "${item}" "${trash_item}" - fi -done +print -N "${@:a}" | xargs -0 osascript -e ' + on run theFilePaths + tell application "Finder" + set thePOSIXFiles to {} + repeat with aFilePath in theFilePaths + set aPOSIXFile to aFilePath as POSIX file + if exists aPOSIXFile + set end of thePOSIXFiles to aPOSIXFile + end if + end repeat + move every item of thePOSIXFiles to trash + end tell + end run +' &>/dev/null + +if (( $? != 0)); then + print "$0: failed to move one or more items" >&2 + return 1 +fi From 95c29bada8a8918228fddd0989561bb639284870 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 19 Jan 2012 02:28:01 -0500 Subject: [PATCH 557/614] Standardized error messages. --- helper.zsh | 2 +- init.zsh | 2 +- plugins/archive/functions/extract | 18 ++++++++++-------- plugins/archive/functions/ls-archive | 18 ++++++++++-------- plugins/git/functions/git-hub | 4 ++-- plugins/git/functions/git-info | 6 +++--- .../history-substring-search.zsh | 4 ++-- plugins/perl/functions/pgs | 2 +- plugins/perl/functions/prep | 2 +- plugins/wakeonlan/functions/wake | 4 ++-- 10 files changed, 33 insertions(+), 29 deletions(-) diff --git a/helper.zsh b/helper.zsh index 1df159a67..cf28d0766 100644 --- a/helper.zsh +++ b/helper.zsh @@ -19,7 +19,7 @@ TRAP_SIGNALS=( # Adds a function to a list to be called when a trap is triggered. function add-zsh-trap() { if (( $# < 2 )); then - print "Usage: $0 type function" + print "usage: $0 type function" return 1 fi diff --git a/init.zsh b/init.zsh index 20d38abbc..46545ae7c 100644 --- a/init.zsh +++ b/init.zsh @@ -3,7 +3,7 @@ # Check for the minimum supported version. min_zsh_version='4.3.10' if ! autoload -Uz is-at-least || ! is-at-least "$min_zsh_version"; then - print "omz: The minimum supported Zsh version is $min_zsh_version." + print "omz: too old shell version detected, minimum required: $min_zsh_version" fi unset min_zsh_version diff --git a/plugins/archive/functions/extract b/plugins/archive/functions/extract index 2271fab23..40fe5cfe9 100644 --- a/plugins/archive/functions/extract +++ b/plugins/archive/functions/extract @@ -4,12 +4,14 @@ local file_name local extract_dir if (( $# == 0 )); then - print "Usage: extract [-option] [file ...]" - print - print "Options:" - print " -r, --remove Remove archive." - print - print "Report bugs to ." + cat >&2 <. +EOF fi remove_archive=1 @@ -20,7 +22,7 @@ fi while (( $# > 0 )); do if [[ ! -f "$1" ]]; then - print "extract: '$1' is not a valid file" 1>&2 + print "$0: file not valid: $1" >&2 shift continue fi @@ -56,7 +58,7 @@ while (( $# > 0 )); do cd .. ;; (*) - print "extract: '$1' cannot be extracted" 1>&2 + print "$0: cannot extract: $1" >&2 success=1 ;; esac diff --git a/plugins/archive/functions/ls-archive b/plugins/archive/functions/ls-archive index 589b2450b..2e8cdc5b4 100644 --- a/plugins/archive/functions/ls-archive +++ b/plugins/archive/functions/ls-archive @@ -1,12 +1,14 @@ local verbose if (( $# == 0 )); then - print "Usage: extract [-option] [file ...]" - print - print "Options:" - print " -v, --verbose Verbose archive listing." - print - print "Report bugs to ." + cat >&2 <. +EOF fi if [[ "$1" == "-v" ]] || [[ "$1" == "--verbose" ]]; then @@ -16,7 +18,7 @@ fi while (( $# > 0 )); do if [[ ! -f "$1" ]]; then - print "extract: '$1' is not a valid file" 1>&2 + print "$0: file not valid: $1" >&2 shift continue fi @@ -35,7 +37,7 @@ while (( $# > 0 )); do (*.rar) unrar ${${verbose:+v}:-l} "$1" ;; (*.7z) 7za l "$1" ;; (*) - print "ls-archive: '$1' cannot be listed" 1>&2 + print "$0: cannot list: $1" >&2 success=1 ;; esac diff --git a/plugins/git/functions/git-hub b/plugins/git/functions/git-hub index e9d18aed6..2ef84ee30 100644 --- a/plugins/git/functions/git-hub +++ b/plugins/git/functions/git-hub @@ -30,11 +30,11 @@ if [[ -n "$url" ]]; then "$BROWSER" "$url" return 0 else - print "fatal: Browser not set or set to a non-existent browser." >&2 + print "$0: browser not set or set to a non-existent browser" >&2 return 1 fi else - print "fatal: Not a Git repository or origin remote not set." >&2 + print "$0: not a Git repository or remote origin not set" >&2 return 1 fi diff --git a/plugins/git/functions/git-info b/plugins/git/functions/git-info index e3069c836..0d2f931af 100644 --- a/plugins/git/functions/git-info +++ b/plugins/git/functions/git-info @@ -64,7 +64,7 @@ function _git-info-abort() { return 1 fi - cat > /dev/stderr <&2 <&2 fi return 0 fi diff --git a/plugins/history-substring-search/history-substring-search.zsh b/plugins/history-substring-search/history-substring-search.zsh index 85771303b..980c74fde 100644 --- a/plugins/history-substring-search/history-substring-search.zsh +++ b/plugins/history-substring-search/history-substring-search.zsh @@ -149,7 +149,7 @@ if [[ $+functions[_zsh_highlight] -eq 0 ]]; then { # Load Zsh module zsh/zleparameter, needed to override user defined widgets. zmodload zsh/zleparameter 2>/dev/null || { - print 'zsh-syntax-highlighting: failed loading zsh/zleparameter.' >&2 + print 'history-substring-search: failed loading: zsh/zleparameter' >&2 return 1 } @@ -176,7 +176,7 @@ if [[ $+functions[_zsh_highlight] -eq 0 ]]; then zle -N $cur_widget _zsh_highlight_widget_$cur_widget";; # Default: unhandled case. - *) print "zsh-syntax-highlighting: unhandled ZLE widget '$cur_widget'" >&2 ;; + *) print "history-substring-search: unhandled ZLE widget: $cur_widget" >&2 ;; esac done } diff --git a/plugins/perl/functions/pgs b/plugins/perl/functions/pgs index 99a375cfc..bff559e7e 100644 --- a/plugins/perl/functions/pgs +++ b/plugins/perl/functions/pgs @@ -1,6 +1,6 @@ # Perl Global Substitution if (( $# < 2 )); then - print "Usage: $0 find replace [file ...]" >&2 + print "usage: $0 find replace [file ...]" >&2 return 1 fi diff --git a/plugins/perl/functions/prep b/plugins/perl/functions/prep index ef9118e71..4832629b8 100644 --- a/plugins/perl/functions/prep +++ b/plugins/perl/functions/prep @@ -1,6 +1,6 @@ # Perl grep since 'grep -P' is terrible. if (( $# < 1 )) ; then - print "Usage: $0 pattern [file ...]" >&2 + print "usage: $0 pattern [file ...]" >&2 return 1 fi diff --git a/plugins/wakeonlan/functions/wake b/plugins/wakeonlan/functions/wake index 83410c71d..c4cba48bf 100644 --- a/plugins/wakeonlan/functions/wake +++ b/plugins/wakeonlan/functions/wake @@ -1,11 +1,11 @@ local config_file="$HOME/.wakeonlan/$1" if [[ ! -f "$config_file" ]]; then - print "$0: $1: There is no such device file." >&2 + print "$0: no such device file: $1" >&2 return 1 fi if (( ! $+commands[wakeonlan] )); then - print "$0: Can't find wakeonlan. Is it installed?" >&2 + print "$0: command not found: wakeonlan" >&2 return 1 fi From 9c0afec0c88aeb1ebbb14c4d08df3d98884c8416 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Fri, 20 Jan 2012 08:55:13 -0500 Subject: [PATCH 558/614] Fixed the PUSHD_MINUS comment. --- directory.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/directory.zsh b/directory.zsh index 88c1a1d34..482a0547b 100644 --- a/directory.zsh +++ b/directory.zsh @@ -3,7 +3,7 @@ setopt AUTO_PUSHD # Push the old directory onto the stack on cd. setopt PUSHD_IGNORE_DUPS # Don't store duplicates in the stack. setopt PUSHD_SILENT # Do not print the directory stack after pushd or popd. setopt PUSHD_TO_HOME # Push to home directory when no argument is given. -setopt PUSHD_MINUS # Use +/-n to specify a directory in the stack. +setopt PUSHD_MINUS # Swap the meaning of + and - when specifing a stack directory. setopt CDABLE_VARS # Change directory to a path stored in a variable. setopt AUTO_NAME_DIRS # Auto add variable-stored paths to ~ list. setopt MULTIOS # Write to multiple descriptors. From af531ac49202afdad90189d3b8b050b572930ca5 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Fri, 20 Jan 2012 08:57:22 -0500 Subject: [PATCH 559/614] Removed the PUSHD_MINUS option; it's confusing. --- directory.zsh | 1 - 1 file changed, 1 deletion(-) diff --git a/directory.zsh b/directory.zsh index 482a0547b..7717a053c 100644 --- a/directory.zsh +++ b/directory.zsh @@ -3,7 +3,6 @@ setopt AUTO_PUSHD # Push the old directory onto the stack on cd. setopt PUSHD_IGNORE_DUPS # Don't store duplicates in the stack. setopt PUSHD_SILENT # Do not print the directory stack after pushd or popd. setopt PUSHD_TO_HOME # Push to home directory when no argument is given. -setopt PUSHD_MINUS # Swap the meaning of + and - when specifing a stack directory. setopt CDABLE_VARS # Change directory to a path stored in a variable. setopt AUTO_NAME_DIRS # Auto add variable-stored paths to ~ list. setopt MULTIOS # Write to multiple descriptors. From 9e88fdb30e2f4a505b0efcf2c3a2fa88b9131741 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Fri, 20 Jan 2012 13:35:31 -0500 Subject: [PATCH 560/614] Fixed the Git list untracked files alias. --- plugins/git/alias.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/git/alias.zsh b/plugins/git/alias.zsh index 4fcdfd5e5..a095315d1 100644 --- a/plugins/git/alias.zsh +++ b/plugins/git/alias.zsh @@ -112,7 +112,7 @@ alias gdx='git ls-files --deleted' compdef _git gdx=git-ls-files alias gdm='git ls-files --modified' compdef _git gdm=git-ls-files -alias gdu='git ls-files --others' +alias gdu='git ls-files --other --exclude-standard' compdef _git gdu=git-ls-files alias gdk='git ls-files --killed' compdef _git gdk=git-ls-files From 902edfdd61f66cf0deaa47da995b39ba1fa16924 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Fri, 20 Jan 2012 19:48:24 -0500 Subject: [PATCH 561/614] Added missing new lines at end of files. --- plugins/git/completions/_git-hub | 1 + plugins/history-substring-search/history-substring-search.zsh | 1 + plugins/osx/README.md | 1 + plugins/osx/functions/tab | 1 + 4 files changed, 4 insertions(+) diff --git a/plugins/git/completions/_git-hub b/plugins/git/completions/_git-hub index 3a9c6e5af..da1f355fa 100644 --- a/plugins/git/completions/_git-hub +++ b/plugins/git/completions/_git-hub @@ -27,3 +27,4 @@ case "$state" in esac return $ret + diff --git a/plugins/history-substring-search/history-substring-search.zsh b/plugins/history-substring-search/history-substring-search.zsh index 980c74fde..d0854b199 100644 --- a/plugins/history-substring-search/history-substring-search.zsh +++ b/plugins/history-substring-search/history-substring-search.zsh @@ -551,3 +551,4 @@ function _history-substring-search-down-search() { # -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- # vim: ft=zsh sw=2 ts=2 et + diff --git a/plugins/osx/README.md b/plugins/osx/README.md index 750b5f16b..766d233a6 100644 --- a/plugins/osx/README.md +++ b/plugins/osx/README.md @@ -8,3 +8,4 @@ Provides the following commands. - `ql` quick look at files. - `manp` Open MAN pages in _Preview.app_. - `trash` Move files and folders to _Trash_. + diff --git a/plugins/osx/functions/tab b/plugins/osx/functions/tab index 8f667c471..317b5c4d3 100644 --- a/plugins/osx/functions/tab +++ b/plugins/osx/functions/tab @@ -32,3 +32,4 @@ EOF end tell EOF } + From 60f7ab8f801a415aedca783dc37ba3b0bd55a03e Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Fri, 20 Jan 2012 19:52:08 -0500 Subject: [PATCH 562/614] Fixed rm-osx-cruft and updated the plugin README. --- plugins/osx/README.md | 8 +++++--- plugins/osx/init.zsh | 5 ++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/plugins/osx/README.md b/plugins/osx/README.md index 766d233a6..3c12b4d15 100644 --- a/plugins/osx/README.md +++ b/plugins/osx/README.md @@ -1,4 +1,4 @@ -Provides the following commands. +Provides the following commands: - `tab` create a new tab (works in both _Terminal_ and _iTerm_). - `pfd` print current _Finder_ directory. @@ -6,6 +6,8 @@ Provides the following commands. - `cdf` cd to current _Finder_ directory. - `pushdf` pushd to current _Finder_ directory. - `ql` quick look at files. -- `manp` Open MAN pages in _Preview.app_. -- `trash` Move files and folders to _Trash_. +- `manp` open MAN pages in _Preview.app_. +- `manb` open MAN pages in _Bwana.app_. +- `trash` move files and folders to _Trash_. +- `rm-osx-cruft` delete .DS_Store, \__MACOSX cruft. diff --git a/plugins/osx/init.zsh b/plugins/osx/init.zsh index 73b20e319..da60837fd 100644 --- a/plugins/osx/init.zsh +++ b/plugins/osx/init.zsh @@ -13,6 +13,9 @@ function ql() { # Delete .DS_Store and __MACOSX directories. function rm-osx-cruft() { - find "${@:-$PWD}" \( -type f -name '.DS_Store' \) -o \( -type d -name '__MACOSX' \) -print0 | xargs rm -rf + find "${@:-$PWD}" \( \ + -type f -name '.DS_Store' -o \ + -type d -name '__MACOSX' \ + \) -print0 | xargs -0 rm -rf } From 6de821b70d75345d6669d893fb6ec54822c16d51 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Fri, 20 Jan 2012 19:55:55 -0500 Subject: [PATCH 563/614] Improved the rsync plugin for OS X. --- plugins/rsync/init.zsh | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/plugins/rsync/init.zsh b/plugins/rsync/init.zsh index a9c1c0cf8..0ec369308 100644 --- a/plugins/rsync/init.zsh +++ b/plugins/rsync/init.zsh @@ -1,10 +1,20 @@ # Aliases -alias rsync-copy='rsync --verbose --progress --human-readable --compress --archive --hard-links' +rsync_cmd='rsync --verbose --progress --human-readable --compress --archive --hard-links --one-file-system' + +# Mac OS X and HFS+ Enhancements +# http://www.bombich.com/rsync.html +if [[ "$OSTYPE" == darwin* ]] && grep -q 'file-flags' <(rsync --help 2>&1); then + rsync_cmd="${rsync_cmd} --crtimes --acls --xattrs --fileflags --protect-decmpfs --force-change" +fi + +alias rsync-copy="${rsync_cmd}" compdef _rsync rsync-copy=rsync -alias rsync-move='rsync --verbose --progress --human-readable --compress --archive --hard-links --remove-source-files' +alias rsync-move="${rsync_cmd} --remove-source-files" compdef _rsync rsync-move=rsync -alias rsync-update='rsync --verbose --progress --human-readable --compress --archive --hard-links --update' +alias rsync-update="${rsync_cmd} --update" compdef _rsync rsync-upate=rsync -alias rsync-synchronize='rsync --verbose --progress --human-readable --compress --archive --hard-links --update --delete' +alias rsync-synchronize="${rsync_cmd} --update --delete" compdef _rsync rsync-synchronize=rsync +unset rsync_cmd + From 5a190792078120e1c27508d6130419a019cae680 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Fri, 20 Jan 2012 20:17:12 -0500 Subject: [PATCH 564/614] Generate the directory stack aliases with a loop. --- directory.zsh | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/directory.zsh b/directory.zsh index 7717a053c..c082c469c 100644 --- a/directory.zsh +++ b/directory.zsh @@ -10,13 +10,9 @@ setopt EXTENDED_GLOB # Use extended globbing syntax. unsetopt CLOBBER # Don't overwrite existing files with > and >>. # Use >! and >>! to bypass. -alias 1='cd -' -alias 2='cd +2' -alias 3='cd +3' -alias 4='cd +4' -alias 5='cd +5' -alias 6='cd +6' -alias 7='cd +7' -alias 8='cd +8' -alias 9='cd +9' +# Aliases +for index in {1..9}; do + alias "$index"="cd +${index}" +done +unset index From 84ce0f42b5bef0c7e9f358990c3ba9af431a97b2 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 29 Dec 2011 22:55:45 -0500 Subject: [PATCH 565/614] Simplified the README. --- README.md | 114 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 63 insertions(+), 51 deletions(-) diff --git a/README.md b/README.md index 08c4fd298..1f190f18b 100644 --- a/README.md +++ b/README.md @@ -1,68 +1,79 @@ -A handful of functions, auto-complete helpers, and stuff that makes you shout... +# Oh My Zsh -> “OH MY ZSHELL!” +OMZ is a configuration framework for [Zsh](http://www.zsh.org) that enriches +the command line interface environment with sane defaults, aliases, functions, +auto completion, and prompt themes. -## Setup +## Installation -`oh-my-zsh` should work with any recent release of [Zsh](http://www.zsh.org), but the -minimum recommended version is 4.3.9. +Oh My Zsh will work with any recent release of Zsh, but the minimum recommended +version is 4.3.10. -1. Clone the repository. +1. Clone the repository: - `git clone git://github.com/sorin-ionescu/oh-my-zsh.git ~/.oh-my-zsh` + `git clone https://github.com/sorin-ionescu/oh-my-zsh.git ~/.oh-my-zsh` -2. Create a new Zsh configuration by copying the Zsh template provided. +2. Create a new Zsh configuration by copying the Zsh template provided: -**NOTE**: If you already have a `~/.zshrc` file, you should back it up with `cp -~/.zshrc{,.orig}` in case you want to go back to your original settings. - - cp ~/.oh-my-zsh/templates/zshrc.template.zsh ~/.zshrc + `cp ~/.oh-my-zsh/templates/zshrc.zsh ~/.zshrc` 3. Set Zsh as your default shell: `chsh -s /bin/zsh` -4. Start / restart Zsh by opening a new terminal window or tab. +4. Open a new Zsh terminal window or tab. -### Problems? +### Mac OS X -If you are not able to find certain commands after switching to *Oh My Zsh*, you need -to modify `PATH` in `~/.zshrc`, or better yet, in `~/functions/02.environment.zsh` -(may be subject to merge conflicts). +If you have administrator privileges, you must fix an Apple miss configuration +in Mac OS X 10.7 Lion by renaming `/etc/zshenv` to `/etc/zprofile`, or Zsh will +have the wrong `PATH` when executed non-interactively by scripts. + +### Troubleshooting + +If you are not able to find certain commands after switching to *Oh My Zsh*, +modify the `PATH` variable in `environment.zsh` then open a new Zsh terminal +window or tab. ## Usage -- Enable the plugins you want in `~/.zshrc`. - - Browse `plugins/` to see what is available. - - Populate the plugins array `plugins=(git osx ruby)`. +Oh My Zsh has many features disabled by default. Read the source code and +accompanying README files to learn of what is available. -- Change the prompt in `~/.zshrc`. - - For a list of themes, type `prompt -l`. - - To preview a theme, type `prompt -p name`. +### Plugins -## Useful +1. Browse `plugins/` to see what is available. +2. Load the plugins you need in `~/.zshrc` then open a new Zsh terminal window + or tab. -The [Zsh Reference Card](http://www.bash2zsh.com/zsh_refcard/refcard.pdf) is tasty. +### Themes + +1. For a list of themes, type `prompt -l`. +2. To preview a theme, type `prompt -p name`. +3. Load the theme you like in `~/.zshrc` then open a new Zsh terminal window or + tab. + ![sorin theme](http://i.imgur.com/aipDQ.png "sorin theme") ### Customization -If you have many related functions, you can organise them in a file in the -`functions/` directory. +The project is managed via [Git](http://git-scm.com). It is highly recommend +that you commit your changes and push them to [GitHub](http://github.com) to +not lose them. If you do not know how to use Git, follow this +[tutorial](http://gitimmersion.com) and bookmark this +[reference](http://gitref.org). -## Help out! +## Resources -I am not a Zsh expert and suspect that there are improvements to be made. If you have -ideas on how to make the configuration easier to maintain or improve the performance, -do not hesitate to fork and send pull requests! +The [Zsh Reference Card](http://www.bash2zsh.com/zsh_refcard/refcard.pdf) is +indispensable. -## Contributors +## Contribute -This project would not exist without all of our awesome users and contributors. +This project would not exist without all of its users and +[contributors](https://github.com/sorin-ionescu/oh-my-zsh/contributors). -- View the growing [list](https://github.com/robbyrussell/oh-my-zsh/contributors) of - contributors. - -Thank you so much! +If you have ideas on how to make the configuration easier to maintain or +improve its performance, do not hesitate to fork and send pull requests. ## License @@ -70,20 +81,21 @@ Thank you so much! Copyright (c) 2011 Robby Russell, Sorin Ionescu, and contributors. -Permission is hereby granted, free of charge, to any person obtaining a copy of this -software and associated documentation files (the "Software"), to deal in the Software -without restriction, including without limitation the rights to use, copy, modify, -merge, publish, distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to the following -conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in all copies -or substantial portions of the Software. +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR -A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF -CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE -OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. From b2fcfc684c1aa9a26418c41a7eebaa9cc4a66bf9 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Fri, 20 Jan 2012 22:03:17 -0500 Subject: [PATCH 566/614] Renamed check-bool to is-true. --- helper.zsh | 2 +- plugins/git/functions/git-info | 6 +++--- plugins/screen/init.zsh | 2 +- plugins/ssh-agent/init.zsh | 2 +- plugins/tmux/init.zsh | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/helper.zsh b/helper.zsh index cf28d0766..dc25281e2 100644 --- a/helper.zsh +++ b/helper.zsh @@ -4,7 +4,7 @@ function autoloadable() { } # Checks boolean variable for "true" (case insensitive "1", "y", "yes", "t", "true", "o", and "on"). -function check-bool() { +function is-true() { [[ -n "$1" && "$1" == (1|[Yy]([Ee][Ss]|)|[Tt]([Rr][Uu][Ee]|)|[Oo]([Nn]|)) ]] } diff --git a/plugins/git/functions/git-info b/plugins/git/functions/git-info index 0d2f931af..c0854c4a9 100644 --- a/plugins/git/functions/git-info +++ b/plugins/git/functions/git-info @@ -60,7 +60,7 @@ function _git-action() { # Turns off git-info for the current repository. function _git-info-abort() { - if ! check-bool "$_git_info_executing"; then + if ! is-true "$_git_info_executing"; then return 1 fi @@ -146,7 +146,7 @@ function git-info() { unset git_rprompt_info # Return if not inside a Git repository work tree. - if ! check-bool "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then + if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then return 1 fi @@ -162,7 +162,7 @@ function git-info() { fi # Return if git-info is disabled. - if ! check-bool "${$(git config --bool prompt.showinfo):-true}"; then + if ! is-true "${$(git config --bool prompt.showinfo):-true}"; then return 1 fi diff --git a/plugins/screen/init.zsh b/plugins/screen/init.zsh index 9e45e2c22..e46283b80 100644 --- a/plugins/screen/init.zsh +++ b/plugins/screen/init.zsh @@ -11,7 +11,7 @@ alias sn="screen -U -S" alias sr="screen -a -A -U -D -R" # Auto -if (( $SHLVL == 1 )) && check-bool "$AUTO_SCREEN"; then +if (( $SHLVL == 1 )) && is-true "$AUTO_SCREEN"; then (( SHLVL += 1 )) && export SHLVL session="$(screen -list 2> /dev/null | sed '1d;$d' | awk '{print $1}' | head -1)" if [[ -n "$session" ]]; then diff --git a/plugins/ssh-agent/init.zsh b/plugins/ssh-agent/init.zsh index b92dcd78f..3f7a5266c 100644 --- a/plugins/ssh-agent/init.zsh +++ b/plugins/ssh-agent/init.zsh @@ -40,7 +40,7 @@ function _ssh-agent-start() { # Test if agent-forwarding is enabled. zstyle -b ':omz:plugin:ssh-agent' forwarding '_ssh_agent_forwarding' -if check-bool "${_ssh_agent_forwarding}" && [[ -n "$SSH_AUTH_SOCK" ]]; then +if is-true "${_ssh_agent_forwarding}" && [[ -n "$SSH_AUTH_SOCK" ]]; then # Add a nifty symlink for screen/tmux if agent forwarding. [[ -L "$SSH_AUTH_SOCK" ]] || ln -sf "$SSH_AUTH_SOCK" /tmp/ssh-agent-$USER-screen elif [ -f "${_ssh_agent_env}" ]; then diff --git a/plugins/tmux/init.zsh b/plugins/tmux/init.zsh index 3e54acff7..8e213358d 100644 --- a/plugins/tmux/init.zsh +++ b/plugins/tmux/init.zsh @@ -10,7 +10,7 @@ alias ta="tmux attach-session" alias tl="tmux list-sessions" # Auto -if (( $SHLVL == 1 )) && check-bool "$AUTO_TMUX"; then +if (( $SHLVL == 1 )) && is-true "$AUTO_TMUX"; then (( SHLVL += 1 )) && export SHLVL session="$(tmux list-sessions 2> /dev/null | cut -d':' -f1 | head -1)" if [[ -n "$session" ]]; then From 3bc0c9f4225b4d9ebe189c10990c2fe941981aa5 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sun, 22 Jan 2012 00:13:29 -0500 Subject: [PATCH 567/614] Edited archive plugin completion descriptions. --- plugins/archive/completions/_extract | 2 +- plugins/archive/completions/_ls-archive | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/archive/completions/_extract b/plugins/archive/completions/_extract index 5756cd7f0..3e28cfd79 100644 --- a/plugins/archive/completions/_extract +++ b/plugins/archive/completions/_extract @@ -2,6 +2,6 @@ #autoload _arguments \ - '(-r --remove)'{-r,--remove}'[Remove archive.]' \ + '(-r --remove)'{-r,--remove}'[remove archive]' \ "*::archive file:_files -g '(#i)*.(tar|tgz|tbz|tbz2|txz|tlz|gz|bz2|xz|lzma|Z|zip|rar|7z|deb)(-.)'" && return 0 diff --git a/plugins/archive/completions/_ls-archive b/plugins/archive/completions/_ls-archive index 370d37b91..1931649d6 100644 --- a/plugins/archive/completions/_ls-archive +++ b/plugins/archive/completions/_ls-archive @@ -2,6 +2,6 @@ #autoload _arguments \ - '(-v --verbose)'{-v,--remove}'[Verbose archive listing.]' \ + '(-v --verbose)'{-v,--remove}'[verbose archive listing]' \ "*::archive file:_files -g '(#i)*.(tar|tgz|tbz|tbz2|txz|tlz|gz|bz2|xz|lzma|Z|zip|rar|7z)(-.)'" && return 0 From e7c72ac02a123af122adc24115443626bd51eca7 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Fri, 20 Jan 2012 22:32:17 -0500 Subject: [PATCH 568/614] Reorganized Git aliases. --- plugins/git/alias.zsh | 290 +++++++++++++++++++++--------------------- 1 file changed, 146 insertions(+), 144 deletions(-) diff --git a/plugins/git/alias.zsh b/plugins/git/alias.zsh index a095315d1..02c117d8a 100644 --- a/plugins/git/alias.zsh +++ b/plugins/git/alias.zsh @@ -2,53 +2,7 @@ alias g='git' compdef g=git -# Working Copy (w) -alias gws='git status --short' -compdef _git gws=git-status -alias gwS='git status' -compdef _git gwS=git-status -alias gwd='git diff --no-ext-diff' -compdef _git gwd=git-diff -function gwD() { git diff --no-ext-diff --ignore-all-space "$@" | view - } -compdef _git gwD=git-diff -alias gwr='git reset --soft' -compdef _git gwr=git-reset -alias gwR='git reset --hard' -compdef _git gwR=git-reset -alias gwc='git clean -n' -compdef _git gwc=git-clean -alias gwC='git clean -f' -compdef _git gwC=git-clean -alias gwx='git rm -r' -compdef _git gwx=git-rm -alias gwX='git rm -rf' -compdef _git gwX=git-rm -alias gwg='git grep' -compdef _git gwg=git-grep - -# Index -alias gia='git add' -compdef _git gia=git-add -alias giA='git add --patch' -compdef _git giA=git-add -alias giu='git add --update' -compdef _git giu=git-add -alias gid='git diff --no-ext-diff --cached' -compdef _git gid=git-diff -function giD() { git diff --no-ext-diff --cached --ignore-all-space "$@" | view - } -compdef _git giD=git-diff -alias gir='git reset' -compdef _git gir=git-reset -alias giR='git reset --mixed' -compdef _git giR=git-reset -alias gix='git rm -r --cached' -compdef _git gix=git-rm -alias giX='git rm -rf --cached' -compdef _git giX=git-rm -alias gig='git grep --cached' -compdef _git gig=git-grep - -# Branah (b) +# Branch (b) alias gb='git branch' compdef _git gb=git-branch alias gbc='git checkout -b' @@ -91,19 +45,7 @@ alias gcs='git show' compdef _git gcs=git-show alias gcv='git fsck | awk '\''/dangling commit/ {print $3}'\'' | git show --format="SHA1: %C(green)%h%C(reset) %f" --stdin | awk '\''/SHA1/ {sub("SHA1: ", ""); print}'\''' -# Conflict (k) -alias gkl='git status | sed -n "s/^.*both [a-z]*ed: *//p"' -alias gka='git add $(gkl)' -compdef _git gka=git-add -alias gke='git mergetool $(gkl)' -alias gko='git checkout --ours --' -compdef _git gko=git-checkout -alias gkO='gko $(gkl)' -alias gkt='git checkout --theirs --' -compdef _git gkt=git-checkout -alias gkT='gkt $(gkl)' - -# File Data (d) +# Data (d) alias gd='git ls-files' compdef _git gd=git-ls-files alias gdc='git ls-files --cached' @@ -118,6 +60,72 @@ alias gdk='git ls-files --killed' compdef _git gdk=git-ls-files alias gdi='git status --porcelain --short --ignored | sed -n "s/^!! //p"' +# Fetch (f) +alias gf='git fetch' +compdef _git gf=git-fetch +alias gfc='git clone' +compdef _git gfc=git-clone +alias gfm='git pull' +compdef _git gfm=git-pull +alias gfr='git pull --rebase' +compdef _git gfr=git-pull + +# Index (i) +alias gia='git add' +compdef _git gia=git-add +alias giA='git add --patch' +compdef _git giA=git-add +alias giu='git add --update' +compdef _git giu=git-add +alias gid='git diff --no-ext-diff --cached' +compdef _git gid=git-diff +function giD() { git diff --no-ext-diff --cached --ignore-all-space "$@" | view - } +compdef _git giD=git-diff +alias gir='git reset' +compdef _git gir=git-reset +alias giR='git reset --mixed' +compdef _git giR=git-reset +alias gix='git rm -r --cached' +compdef _git gix=git-rm +alias giX='git rm -rf --cached' +compdef _git giX=git-rm +alias gig='git grep --cached' +compdef _git gig=git-grep + +# Konflict (k) +alias gkl='git status | sed -n "s/^.*both [a-z]*ed: *//p"' +alias gka='git add $(gkl)' +compdef _git gka=git-add +alias gke='git mergetool $(gkl)' +alias gko='git checkout --ours --' +compdef _git gko=git-checkout +alias gkO='gko $(gkl)' +alias gkt='git checkout --theirs --' +compdef _git gkt=git-checkout +alias gkT='gkt $(gkl)' + +# Log (l) +git_log_format_oneline='--pretty=format:%C(green)%h%C(reset) %s%C(red)%d%C(reset)' +git_log_format_oneline_more='--pretty=format:%C(green)%h%C(reset) %C(blue)%ad%C(reset) %s%C(red)%d%C(reset) [%C(magenta)%an%C(reset)]' +git_log_format_medium='--pretty=format:%C(green)Commit: %H%C(red)%d%C(reset)%n%C(magenta)Author: %an <%ae>%C(reset)%n%C(blue)Date: %cd%C(reset)%n%+s%n%+b' + +alias gl='git log' +compdef _git gl=git-log +alias glo='git log --topo-order ${git_log_format_oneline}' +compdef _git glo=git-log +alias glO='git log --topo-order --date=short ${git_log_format_oneline_more}' +compdef _git glO=git-log +alias glg='git log --topo-order --all --graph ${git_log_format_oneline}' +compdef _git glg=git-log +alias glG='git log --topo-order --all --graph --date=short ${git_log_format_oneline_more}' +compdef _git glG=git-log +alias gls='git log --topo-order --stat ${git_log_format_medium}' +compdef _git gls=git-log +alias gld='git log --topo-order --stat --patch --full-diff ${git_log_format_medium}' +compdef _git gld=git-log +alias glc='git shortlog --summary --numbered' +compdef _git glc=git-shortlog + # Merge (m) alias gm='git merge' compdef _git gm=git-merge @@ -130,17 +138,7 @@ compdef _git gma=git-merge alias gmt='git mergetool' compdef _git gmt=git-mergetool -# Pull -alias gf='git fetch' -compdef _git gf=git-fetch -alias gfc='git clone' -compdef _git gfc=git-clone -alias gfm='git pull' -compdef _git gfm=git-pull -alias gfr='git pull --rebase' -compdef _git gfr=git-pull - -# Push +# Push (p) alias gp='git push' compdef _git gp=git-push alias gpf='git push --force' @@ -167,81 +165,85 @@ compdef _git gri=git-rebase alias grs='git rebase --skip' compdef _git grs=git-rebase -# Remote Host (h) -alias gh='git remote' +# Remote (R) +alias gR='git remote' compdef _git gh=git-remote -alias ghl='git remote --verbose' -compdef _git ghl=git-remote -alias gha='git remote add' -compdef _git gha=git-remote -alias ghx='git remote rm' -compdef _git ghx=git-remote -alias ghm='git remote rename' -compdef _git ghm=git-remote -alias ghu='git remote update' -compdef _git ghu=git-remote -alias ghc='git remote prune' -compdef _git ghc=git-remote -alias ghs='git remote show' -compdef _git ghs=git-remote -alias ghb='git-hub' -compdef _git-hub ghb=git-hub +alias gRl='git remote --verbose' +compdef _git gRl=git-remote +alias gRa='git remote add' +compdef _git gRa=git-remote +alias gRx='git remote rm' +compdef _git gRx=git-remote +alias gRm='git remote rename' +compdef _git gRm=git-remote +alias gRu='git remote update' +compdef _git gRu=git-remote +alias gRc='git remote prune' +compdef _git gRc=git-remote +alias gRs='git remote show' +compdef _git gRs=git-remote +alias gRb='git-hub' +compdef _git-hub gRb=git-hub -# Stash (t) -alias gta='git stash apply' -compdef _git gta=git-stash -alias gtc='git stash clear' -compdef _git gtc=git-stash -alias gtx='git stash drop' -compdef _git gtx=git-stash -alias gtl='git stash list' -compdef _git gtl=git-stash -alias gtL='git stash show --patch --stat' -compdef _git gtL=git-stash -alias gtp='git stash pop' -compdef _git gtp=git-stash -alias gts='git stash save' -compdef _git gts=git-stash -alias gtS='git stash save --patch --no-keep-index' -compdef _git gtS=git-stash +# Stash (s) +alias gs='git stash' +compdef _git gs=git-stash +alias gsa='git stash apply' +compdef _git gsa=git-stash +alias gsc='git stash clear' +compdef _git gsc=git-stash +alias gsx='git stash drop' +compdef _git gsx=git-stash +alias gsl='git stash list' +compdef _git gsl=git-stash +alias gsL='git stash show --patch --stat' +compdef _git gsL=git-stash +alias gsp='git stash pop' +compdef _git gsp=git-stash +alias gss='git stash save' +compdef _git gss=git-stash +alias gsS='git stash save --patch --no-keep-index' +compdef _git gsS=git-stash -# Submodule (u) -alias gu='git submodule' -compdef _git gu=git-submodule -alias gua='git submodule add' -compdef _git gua=git-submodule -alias guf='git submodule foreach' -compdef _git guf=git-submodule -alias gui='git submodule init' -compdef _git gui=git-submodule -alias gul='git submodule status' -compdef _git gul=git-submodule -alias gus='git submodule sync' -compdef _git gus=git-submodule -alias guu='git submodule update' -compdef _git guu=git-submodule -alias guU='git submodule update --init --recursive' -compdef _git guU=git-submdoule +# Submodule (S) +alias gS='git submodule' +compdef _git gS=git-submodule +alias gSa='git submodule add' +compdef _git gSa=git-submodule +alias gSf='git submodule foreach' +compdef _git gSf=git-submodule +alias gSi='git submodule init' +compdef _git gSi=git-submodule +alias gSl='git submodule status' +compdef _git gSl=git-submodule +alias gSs='git submodule sync' +compdef _git gSs=git-submodule +alias gSu='git submodule update' +compdef _git gSu=git-submodule +alias gSU='git submodule update --init --recursive' +compdef _git gSU=git-submdoule -# Git log (pretty). -git_log_format_oneline='--pretty=format:%C(green)%h%C(reset) %s%C(red)%d%C(reset)' -git_log_format_oneline_more='--pretty=format:%C(green)%h%C(reset) %C(blue)%ad%C(reset) %s%C(red)%d%C(reset) [%C(magenta)%an%C(reset)]' -git_log_format_medium='--pretty=format:%C(green)Commit: %H%C(red)%d%C(reset)%n%C(magenta)Author: %an <%ae>%C(reset)%n%C(blue)Date: %cd%C(reset)%n%+s%n%+b' - -alias gl='git log' -compdef _git gl=git-log -alias glo='git log --topo-order ${git_log_format_oneline}' -compdef _git glo=git-log -alias glO='git log --topo-order --date=short ${git_log_format_oneline_more}' -compdef _git glO=git-log -alias glg='git log --topo-order --all --graph ${git_log_format_oneline}' -compdef _git glg=git-log -alias glG='git log --topo-order --all --graph --date=short ${git_log_format_oneline_more}' -compdef _git glG=git-log -alias gls='git log --topo-order --stat ${git_log_format_medium}' -compdef _git gls=git-log -alias gld='git log --topo-order --stat --patch --full-diff ${git_log_format_medium}' -compdef _git gld=git-log -alias glc='git shortlog --summary --numbered' -compdef _git glc=git-shortlog +# Working Copy (w) +alias gws='git status --short' +compdef _git gws=git-status +alias gwS='git status' +compdef _git gwS=git-status +alias gwd='git diff --no-ext-diff' +compdef _git gwd=git-diff +function gwD() { git diff --no-ext-diff --ignore-all-space "$@" | view - } +compdef _git gwD=git-diff +alias gwr='git reset --soft' +compdef _git gwr=git-reset +alias gwR='git reset --hard' +compdef _git gwR=git-reset +alias gwc='git clean -n' +compdef _git gwc=git-clean +alias gwC='git clean -f' +compdef _git gwC=git-clean +alias gwx='git rm -r' +compdef _git gwx=git-rm +alias gwX='git rm -rf' +compdef _git gwX=git-rm +alias gwg='git grep' +compdef _git gwg=git-grep From ad731e483019afd802660d976a8f5227f12ddf58 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 29 Dec 2011 23:13:44 -0500 Subject: [PATCH 569/614] Use the emacs keymap by default. Since keymaps emacs and viins are aliases to main, it is not necessary to define emacs keys twice. --- keyboard.zsh | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/keyboard.zsh b/keyboard.zsh index eca51a95a..ff4b20d87 100644 --- a/keyboard.zsh +++ b/keyboard.zsh @@ -54,6 +54,17 @@ keyinfo=( 'BackTab' "$terminfo[kcbt]" ) +# Use Emacs bindings by default. +if ! zstyle -m ':omz:editor' keymap ' *'; then + zstyle ':omz:editor' keymap 'emacs' +fi + +# Stop binding on an invalid keymap. +if ! zstyle -m ':omz:editor' keymap 'emacs|vi'; then + print "omz: \`zstyle ':omz:editor' keymap\` must be set to 'emacs' or 'vi'" >&2 + return 1 +fi + if zstyle -m ':omz:editor' keymap 'emacs'; then # Use Emacs key bindings. bindkey -e @@ -109,7 +120,9 @@ if zstyle -m ':omz:editor' keymap 'emacs'; then [[ -n "$keyinfo[Control]" ]] && \ bindkey "$keyinfo[Control]s" history-incremental-search-forward fi -elif zstyle -m ':omz:editor' keymap 'vi'; then +fi + +if zstyle -m ':omz:editor' keymap 'vi'; then # Use vi key bindings. bindkey -v @@ -232,9 +245,6 @@ elif zstyle -m ':omz:editor' keymap 'vi'; then [[ -n "$keyinfo[Control]" ]] && \ bindkey -M viins "$keyinfo[Control]s" history-incremental-search-forward fi -else - print "omz: \`zstyle ':omz:editor' keymap\` must be set to 'emacs' or 'vi'" >&2 - return 1 fi # The next key bindings are for both Emacs and Vi. From 9ad18fe7a70959991da7b7209407c3a7d43ee521 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Mon, 23 Jan 2012 22:59:41 -0500 Subject: [PATCH 570/614] Bind to the emacs keymap, not main. --- keyboard.zsh | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/keyboard.zsh b/keyboard.zsh index ff4b20d87..fac062a1e 100644 --- a/keyboard.zsh +++ b/keyboard.zsh @@ -70,55 +70,55 @@ if zstyle -m ':omz:editor' keymap 'emacs'; then bindkey -e [[ -n "$keyinfo[Escape]" ]] && \ - bindkey "$keyinfo[Escape]b" emacs-backward-word + bindkey -M emacs "$keyinfo[Escape]b" emacs-backward-word [[ -n "$keyinfo[Escape]" ]] && \ - bindkey "$keyinfo[Escape]f" emacs-forward-word + bindkey -M emacs "$keyinfo[Escape]f" emacs-forward-word [[ -n "$keyinfo[Escape]" ]] && [[ -n "$keyinfo[Left]" ]] && \ - bindkey "$keyinfo[Escape]$keyinfo[Left]" emacs-backward-word + bindkey -M emacs "$keyinfo[Escape]$keyinfo[Left]" emacs-backward-word [[ -n "$keyinfo[Escape]" ]] && [[ -n "$keyinfo[Right]" ]] && \ - bindkey "$keyinfo[Escape]$keyinfo[Right]" emacs-forward-word + bindkey -M emacs "$keyinfo[Escape]$keyinfo[Right]" emacs-forward-word # Kill to the beginning of the line. [[ -n "$keyinfo[Control]" ]] && \ - bindkey "$keyinfo[Control]u" backward-kill-line + bindkey -M emacs "$keyinfo[Control]u" backward-kill-line # Kill to the beginning of the word. [[ -n "$keyinfo[Control]" ]] && \ - bindkey "$keyinfo[Control]w" backward-kill-word + bindkey -M emacs "$keyinfo[Control]w" backward-kill-word # Undo/Redo [[ -n "$keyinfo[Control]" ]] && \ - bindkey "$keyinfo[Control]_" undo + bindkey -M emacs "$keyinfo[Control]_" undo [[ -n "$keyinfo[Escape]" ]] && \ - bindkey "$keyinfo[Escape]_" redo + bindkey -M emacs "$keyinfo[Escape]_" redo # Search character. [[ -n "$keyinfo[Control]" ]] && \ - bindkey "$keyinfo[Control]]" vi-find-next-char + bindkey -M emacs "$keyinfo[Control]]" vi-find-next-char [[ -n "$keyinfo[Escape]" ]] && [[ -n "$keyinfo[Control]" ]] && \ - bindkey "$keyinfo[Escape]$keyinfo[Control]]" vi-find-prev-char + bindkey -M emacs "$keyinfo[Escape]$keyinfo[Control]]" vi-find-prev-char # Edit command in an external editor. [[ -n "$keyinfo[Control]" ]] && \ - bindkey "$keyinfo[Control]x$keyinfo[Control]e" edit-command-line + bindkey -M emacs "$keyinfo[Control]x$keyinfo[Control]e" edit-command-line # Expand .... to ../.. if zstyle -t ':omz:editor' dot-expansion; then - bindkey "." expand-dot-to-parent-directory-path + bindkey -M emacs "." expand-dot-to-parent-directory-path fi # Bind to history substring search plugin if enabled; # otherwise, bind to built-in Zsh history search. if (( $+widgets[history-incremental-pattern-search-backward] )); then [[ -n "$keyinfo[Control]" ]] && \ - bindkey "$keyinfo[Control]r" history-incremental-pattern-search-backward + bindkey -M emacs "$keyinfo[Control]r" history-incremental-pattern-search-backward [[ -n "$keyinfo[Control]" ]] && \ - bindkey "$keyinfo[Control]s" history-incremental-pattern-search-forward + bindkey -M emacs "$keyinfo[Control]s" history-incremental-pattern-search-forward else [[ -n "$keyinfo[Control]" ]] && \ - bindkey "$keyinfo[Control]r" history-incremental-search-backward + bindkey -M emacs "$keyinfo[Control]r" history-incremental-search-backward [[ -n "$keyinfo[Control]" ]] && \ - bindkey "$keyinfo[Control]s" history-incremental-search-forward + bindkey -M emacs "$keyinfo[Control]s" history-incremental-search-forward fi fi From f430bd75c680c7a8cc09b7c501e50726b1ddbbff Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Tue, 24 Jan 2012 00:50:51 -0500 Subject: [PATCH 571/614] Filter the HEAD symbolic reference. --- plugins/git/completions/_git-hub | 7 ++++--- plugins/git/functions/git-hub | 4 +--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/plugins/git/completions/_git-hub b/plugins/git/completions/_git-hub index da1f355fa..e4e2945da 100644 --- a/plugins/git/completions/_git-hub +++ b/plugins/git/completions/_git-hub @@ -18,9 +18,10 @@ case "$state" in (branch) remote="$words[(($CURRENT - 1))]" branches=($( - git branch -a \ - | grep "remotes/${remote}" \ - | sed -e 's/[ \*]*//g' -e "s:remotes/${remote}/::g" + git branch -r \ + | sed \ + -e "/${remote}\/HEAD -> ${remote}/d" \ + -e "s/^[[:space:]]*${remote}\///g" )) _describe -t branch 'branches' branches && ret=0 ;; diff --git a/plugins/git/functions/git-hub b/plugins/git/functions/git-hub index 2ef84ee30..7deeddfc5 100644 --- a/plugins/git/functions/git-hub +++ b/plugins/git/functions/git-hub @@ -8,9 +8,7 @@ url=$( | sed -En "s/remote.${remote}.url=(git|https?)(@|:\/\/)github.com(:|\/)(.+)\/(.+).git/https:\/\/github.com\/\4\/\5/p" ) branches=($( - git branch -a \ - | grep "remotes/${remote}" \ - | sed -e 's/[ \*]*//g' -e "s:remotes/${remote}/::g" + git branch -r | sed -e "/${remote}\/HEAD -> ${remote}/d" -e "s/^[[:space:]]*${remote}\///g" )) current_branch="$(git-branch)" branch="${2:-master}" From 31dfd1fd6df3468dc435c41583bf7c07ab11a7fe Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Tue, 24 Jan 2012 11:51:44 -0500 Subject: [PATCH 572/614] Removed the Kate plugin. --- plugins/kate/init.zsh | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 plugins/kate/init.zsh diff --git a/plugins/kate/init.zsh b/plugins/kate/init.zsh deleted file mode 100644 index 7fbf3d97a..000000000 --- a/plugins/kate/init.zsh +++ /dev/null @@ -1,12 +0,0 @@ -# Aliases -alias kate='kate >/dev/null 2>&1' # Silent start. - -# Functions -function kt() { - if [[ -z "$1" ]]; then - kate . - else - ( [[ -d "$1" ]] && cd "$1" && kate . ) - fi -} - From c2ab0d83dc4d37083ae58e4dd10a0598cea12f63 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Tue, 24 Jan 2012 11:51:57 -0500 Subject: [PATCH 573/614] Removed the TextMate plugin. --- plugins/textmate/init.zsh | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 plugins/textmate/init.zsh diff --git a/plugins/textmate/init.zsh b/plugins/textmate/init.zsh deleted file mode 100644 index 20608a1b1..000000000 --- a/plugins/textmate/init.zsh +++ /dev/null @@ -1,9 +0,0 @@ -# Functions -function tm() { - if [[ -z "$1" ]]; then - mate . - else - ( [[ -d "$1" ]] && cd "$1" && mate . ) - fi -} - From 2594270fdf86fb5a7e9d558ee2fde1f8f6189562 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Tue, 24 Jan 2012 23:39:51 -0500 Subject: [PATCH 574/614] Fixed the default keymap selection. --- keyboard.zsh | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/keyboard.zsh b/keyboard.zsh index fac062a1e..3a102ca9c 100644 --- a/keyboard.zsh +++ b/keyboard.zsh @@ -54,18 +54,8 @@ keyinfo=( 'BackTab' "$terminfo[kcbt]" ) -# Use Emacs bindings by default. -if ! zstyle -m ':omz:editor' keymap ' *'; then - zstyle ':omz:editor' keymap 'emacs' -fi - -# Stop binding on an invalid keymap. -if ! zstyle -m ':omz:editor' keymap 'emacs|vi'; then - print "omz: \`zstyle ':omz:editor' keymap\` must be set to 'emacs' or 'vi'" >&2 - return 1 -fi - -if zstyle -m ':omz:editor' keymap 'emacs'; then +zstyle -s ':omz:editor' keymap 'keymap' +if [[ "$keymap" == (emacs|) ]]; then # Use Emacs key bindings. bindkey -e @@ -120,9 +110,7 @@ if zstyle -m ':omz:editor' keymap 'emacs'; then [[ -n "$keyinfo[Control]" ]] && \ bindkey -M emacs "$keyinfo[Control]s" history-incremental-search-forward fi -fi - -if zstyle -m ':omz:editor' keymap 'vi'; then +elif [[ "$keymap" == vi ]]; then # Use vi key bindings. bindkey -v @@ -245,7 +233,12 @@ if zstyle -m ':omz:editor' keymap 'vi'; then [[ -n "$keyinfo[Control]" ]] && \ bindkey -M viins "$keyinfo[Control]s" history-incremental-search-forward fi +else + print "omz: invalid keymap: $keymap" >&2 + unset keymap + return 1 fi +unset keymap # The next key bindings are for both Emacs and Vi. [[ -n "$keyinfo[Home]" ]] && \ From ec61dbd8022a3672a1160e240cb952f247b9f5e0 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Tue, 24 Jan 2012 23:40:32 -0500 Subject: [PATCH 575/614] Fixed a few error messages. --- helper.zsh | 4 ++-- init.zsh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/helper.zsh b/helper.zsh index dc25281e2..0ad29ce38 100644 --- a/helper.zsh +++ b/helper.zsh @@ -19,12 +19,12 @@ TRAP_SIGNALS=( # Adds a function to a list to be called when a trap is triggered. function add-zsh-trap() { if (( $# < 2 )); then - print "usage: $0 type function" + print "usage: $0 type function" >&2 return 1 fi if [[ -z "$TRAP_SIGNALS[(r)$1]" ]]; then - print "$0: unknown signal: $1" + print "$0: unknown signal: $1" >&2 return 1 fi diff --git a/init.zsh b/init.zsh index 46545ae7c..97df02c0f 100644 --- a/init.zsh +++ b/init.zsh @@ -3,7 +3,7 @@ # Check for the minimum supported version. min_zsh_version='4.3.10' if ! autoload -Uz is-at-least || ! is-at-least "$min_zsh_version"; then - print "omz: too old shell version detected, minimum required: $min_zsh_version" + print "omz: old shell version detected, minimum required: $min_zsh_version" >&2 fi unset min_zsh_version From 6a8962d785c40c6c4d52ce5da07ffed6a7e33638 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 26 Jan 2012 11:59:36 -0500 Subject: [PATCH 576/614] Fixed the copyright years. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1f190f18b..1eb0a3d9d 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ improve its performance, do not hesitate to fork and send pull requests. (The MIT License) -Copyright (c) 2011 Robby Russell, Sorin Ionescu, and contributors. +Copyright (c) 2009-2012 Robby Russell, Sorin Ionescu, and contributors. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in From 7ca3ff941bc72024649da7c38ba798750fab19a6 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 26 Jan 2012 21:14:51 -0500 Subject: [PATCH 577/614] /etc/paths.d and /etc/manpaths.d are Mac only. --- environment.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/environment.zsh b/environment.zsh index 47727f1f1..510a7d43f 100644 --- a/environment.zsh +++ b/environment.zsh @@ -36,7 +36,7 @@ manpath=( /usr/share/man ) -for path_file in /etc/manpaths.d/*; do +for path_file in /etc/manpaths.d/*(.N); do manpath+=($(<$path_file)) done @@ -51,7 +51,7 @@ path=( /sbin ) -for path_file in /etc/paths.d/*; do +for path_file in /etc/paths.d/*(.N); do path+=($(<$path_file)) done From 9fb50ad9b49112fa98c13c81671d3c2f6ecabe8d Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 26 Jan 2012 21:18:52 -0500 Subject: [PATCH 578/614] Added inside of Vim indicator to the Sorin theme. --- themes/sorin/prompt_sorin_setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/sorin/prompt_sorin_setup b/themes/sorin/prompt_sorin_setup index b77c988cb..f6944a859 100644 --- a/themes/sorin/prompt_sorin_setup +++ b/themes/sorin/prompt_sorin_setup @@ -40,7 +40,7 @@ function prompt_sorin_setup() { zstyle ':omz:plugin:git:prompt' rprompt '%A%B%S%a%d%m%r%U%u' PROMPT='%F{cyan}%1~%f${git_prompt_info} %(!.%B%F{red}#%f%b.%B%F{green}❯%f%b) ' - RPROMPT='%(?::%F{red}⏎%f)${git_rprompt_info}' + RPROMPT='%(?::%F{red}⏎%f)${VIM:+" %B%F{green}V%f%b"}${git_rprompt_info}' SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? ' } From a22b49ee57b094a071186821befb15715bd33c01 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Fri, 27 Jan 2012 10:14:10 -0500 Subject: [PATCH 579/614] Fixed a comment in the zshrc template. --- templates/zshrc.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/zshrc.zsh b/templates/zshrc.zsh index 3ec7ea020..c177862fd 100644 --- a/templates/zshrc.zsh +++ b/templates/zshrc.zsh @@ -16,6 +16,7 @@ zstyle ':omz:terminal' auto-title 'yes' # Set the plugins to load (see $OMZ/plugins/). zstyle ':omz:load' plugin 'archive' 'git' +# Set the prompt theme to load. # Setting it to 'random' loads a random theme. # Auto set to 'off' on dumb terminals. zstyle ':omz:prompt' theme 'sorin' From 6c17340c59fd1c293b220a3f53540b1bf19821f3 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Fri, 27 Jan 2012 14:48:33 -0500 Subject: [PATCH 580/614] Save line length by combining enhanced brackets. --- keyboard.zsh | 10 +++++----- plugins/archive/functions/extract | 2 +- plugins/archive/functions/ls-archive | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/keyboard.zsh b/keyboard.zsh index 3a102ca9c..d78331957 100644 --- a/keyboard.zsh +++ b/keyboard.zsh @@ -63,9 +63,9 @@ if [[ "$keymap" == (emacs|) ]]; then bindkey -M emacs "$keyinfo[Escape]b" emacs-backward-word [[ -n "$keyinfo[Escape]" ]] && \ bindkey -M emacs "$keyinfo[Escape]f" emacs-forward-word - [[ -n "$keyinfo[Escape]" ]] && [[ -n "$keyinfo[Left]" ]] && \ + [[ -n "$keyinfo[Escape]" && -n "$keyinfo[Left]" ]] && \ bindkey -M emacs "$keyinfo[Escape]$keyinfo[Left]" emacs-backward-word - [[ -n "$keyinfo[Escape]" ]] && [[ -n "$keyinfo[Right]" ]] && \ + [[ -n "$keyinfo[Escape]" && -n "$keyinfo[Right]" ]] && \ bindkey -M emacs "$keyinfo[Escape]$keyinfo[Right]" emacs-forward-word # Kill to the beginning of the line. @@ -85,7 +85,7 @@ if [[ "$keymap" == (emacs|) ]]; then # Search character. [[ -n "$keyinfo[Control]" ]] && \ bindkey -M emacs "$keyinfo[Control]]" vi-find-next-char - [[ -n "$keyinfo[Escape]" ]] && [[ -n "$keyinfo[Control]" ]] && \ + [[ -n "$keyinfo[Escape]" && -n "$keyinfo[Control]" ]] && \ bindkey -M emacs "$keyinfo[Escape]$keyinfo[Control]]" vi-find-prev-char # Edit command in an external editor. @@ -195,9 +195,9 @@ elif [[ "$keymap" == vi ]]; then bindkey -M viins "$keyinfo[Escape]w" copy-region-as-kill [[ -n "$keyinfo[Escape]" ]] && \ bindkey -M viins "$keyinfo[Escape]h" run-help - [[ -n "$keyinfo[Escape]" ]] && [[ -n "$keyinfo[Left]" ]] && \ + [[ -n "$keyinfo[Escape]" && -n "$keyinfo[Left]" ]] && \ bindkey -M viins "$keyinfo[Escape]$keyinfo[Left]" emacs-backward-word - [[ -n "$keyinfo[Escape]" ]] && [[ -n "$keyinfo[Right]" ]] && \ + [[ -n "$keyinfo[Escape]" && -n "$keyinfo[Right]" ]] && \ bindkey -M viins "$keyinfo[Escape]$keyinfo[Right]" emacs-forward-word # History diff --git a/plugins/archive/functions/extract b/plugins/archive/functions/extract index 40fe5cfe9..bc3410174 100644 --- a/plugins/archive/functions/extract +++ b/plugins/archive/functions/extract @@ -15,7 +15,7 @@ EOF fi remove_archive=1 -if [[ "$1" == "-r" ]] || [[ "$1" == "--remove" ]]; then +if [[ "$1" == "-r" || "$1" == "--remove" ]]; then remove_archive=0 shift fi diff --git a/plugins/archive/functions/ls-archive b/plugins/archive/functions/ls-archive index 2e8cdc5b4..0c31b95ec 100644 --- a/plugins/archive/functions/ls-archive +++ b/plugins/archive/functions/ls-archive @@ -11,7 +11,7 @@ Report bugs to . EOF fi -if [[ "$1" == "-v" ]] || [[ "$1" == "--verbose" ]]; then +if [[ "$1" == "-v" || "$1" == "--verbose" ]]; then verbose=0 shift fi From da1a02d8531fdf7fa2734ed8fb55d6e21bbfe917 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Fri, 27 Jan 2012 18:54:32 -0500 Subject: [PATCH 581/614] Edited strings, comments, renamed, unset variables. --- init.zsh | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/init.zsh b/init.zsh index 97df02c0f..53f51eb07 100644 --- a/init.zsh +++ b/init.zsh @@ -3,7 +3,7 @@ # Check for the minimum supported version. min_zsh_version='4.3.10' if ! autoload -Uz is-at-least || ! is-at-least "$min_zsh_version"; then - print "omz: old shell version detected, minimum required: $min_zsh_version" >&2 + print "omz: old shell detected, minimum required: $min_zsh_version" >&2 fi unset min_zsh_version @@ -39,7 +39,7 @@ source "${0:h}/alias.zsh" source "${0:h}/spectrum.zsh" source "${0:h}/utility.zsh" -# Autoload Zsh function builtins. +# Autoload Zsh functions. autoload -Uz age autoload -Uz zargs autoload -Uz zcalc @@ -62,17 +62,19 @@ unset plugin plugins # Autoload Oh My Zsh functions. for fdir in "$fpath[@]"; do if [[ "$fdir" == ${0:h}/(|*/)functions ]]; then - for afunction in $fdir/[^_.]*(N.:t); do - autoload -Uz $afunction + for func in $fdir/[^_.]*(N.:t); do + autoload -Uz $func done fi done +unset fdir func # Set environment variables for launchd processes. if [[ "$OSTYPE" == darwin* ]]; then for env_var in PATH MANPATH; do launchctl setenv "$env_var" "${(P)env_var}" &! done + unset env_var fi # Load and run the prompt theming system. @@ -83,8 +85,10 @@ zstyle -a ':omz:prompt' theme 'prompt_argv' prompt "$prompt_argv[@]" unset prompt_argv -# Compile zcompdump, if modified, to increase startup speed. -if [[ "$HOME/.zcompdump" -nt "$HOME/.zcompdump.zwc" ]] || [[ ! -f "$HOME/.zcompdump.zwc" ]]; then - zcompile "$HOME/.zcompdump" +# Compile the completion dump, to increase startup speed. +dump_file="$HOME/.zcompdump" +if [[ "$dump_file" -nt "${dump_file}.zwc" || ! -f "${dump_file}.zwc" ]]; then + zcompile "$dump_file" fi +unset dump_file From 054670cee85946bda7d62373fa90cb34bb0c0f24 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Fri, 27 Jan 2012 21:03:01 -0500 Subject: [PATCH 582/614] Improved Perl find and replace functions. --- plugins/perl/completions/_prep | 11 ++++++++ plugins/perl/completions/_psub | 13 +++++++++ plugins/perl/functions/pgs | 12 --------- plugins/perl/functions/prep | 43 +++++++++++++++++++++++++++--- plugins/perl/functions/psub | 48 ++++++++++++++++++++++++++++++++++ 5 files changed, 111 insertions(+), 16 deletions(-) create mode 100644 plugins/perl/completions/_prep create mode 100644 plugins/perl/completions/_psub delete mode 100644 plugins/perl/functions/pgs create mode 100644 plugins/perl/functions/psub diff --git a/plugins/perl/completions/_prep b/plugins/perl/completions/_prep new file mode 100644 index 000000000..c1c939ee6 --- /dev/null +++ b/plugins/perl/completions/_prep @@ -0,0 +1,11 @@ +#compdef prep +#autoload + +_arguments \ + '-i[ignore case]' \ + '-m[^ and $ match the start and the end of a line]' \ + '-s[. matches newline]' \ + '-x[ignore whitespace and comments]' \ + '1::pattern:' \ + '2::files:_files' && return 0 + diff --git a/plugins/perl/completions/_psub b/plugins/perl/completions/_psub new file mode 100644 index 000000000..3fa7ef8aa --- /dev/null +++ b/plugins/perl/completions/_psub @@ -0,0 +1,13 @@ +#compdef psub +#autoload + +_arguments \ + '-g[match globally]' \ + '-i[ignore case]' \ + '-m[^ and $ match the start and the end of a line]' \ + '-s[. matches newline]' \ + '-x[ignore whitespace and comments]' \ + '1::pattern:' \ + '2::replacement:' \ + '3::files:_files' && return 0 + diff --git a/plugins/perl/functions/pgs b/plugins/perl/functions/pgs deleted file mode 100644 index bff559e7e..000000000 --- a/plugins/perl/functions/pgs +++ /dev/null @@ -1,12 +0,0 @@ -# Perl Global Substitution -if (( $# < 2 )); then - print "usage: $0 find replace [file ...]" >&2 - return 1 -fi - -local find="$1" -local replace="$2" -repeat 2 shift - -perl -i.orig -pe 's/'"$find"'/'"$replace"'/g' "$@" - diff --git a/plugins/perl/functions/prep b/plugins/perl/functions/prep index 4832629b8..3bc8b5afa 100644 --- a/plugins/perl/functions/prep +++ b/plugins/perl/functions/prep @@ -1,11 +1,46 @@ # Perl grep since 'grep -P' is terrible. -if (( $# < 1 )) ; then - print "usage: $0 pattern [file ...]" >&2 + +local usage pattern modifiers + +usage="$( +cat <&2 + print "$usage" >&2 + return 1 + ;; + ([?]) + print "$0: unknown option: $OPTARG" >&2 + print "$usage" >&2 + return 1 + ;; + esac +done +shift $(( $OPTIND - 1 )) + +if (( $# < 1 )); then + print "$usage" >&2 return 1 fi -local pattern="$1" +pattern="$1" shift -perl -nle 'print if /'"$pattern"'/;' "$@" +perl -n -l -e "print if m/${pattern//\//\\/}/${modifiers}" "$@" diff --git a/plugins/perl/functions/psub b/plugins/perl/functions/psub new file mode 100644 index 000000000..e88d4bdc8 --- /dev/null +++ b/plugins/perl/functions/psub @@ -0,0 +1,48 @@ +# Perl Substitution + +local usage pattern replacement modifiers + +usage="$( +cat <&2 + print "$usage" >&2 + return 1 + ;; + ([?]) + print "$0: unknown option: $OPTARG" >&2 + print "$usage" >&2 + return 1 + ;; + esac +done +shift $(( $OPTIND - 1 )) + +if (( $# < 2 )); then + print "$usage" >&2 + return 1 +fi + +pattern="$1" +replacement="$2" +repeat 2 shift + +perl -i'.orig' -n -l -e "s/${pattern//\//\\/}/${replacement//\//\\/}/${modifiers}; print" "$@" From f77e2c8e058d3767340ce8ab97a4d7596d7f5d31 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sat, 28 Jan 2012 17:57:03 -0500 Subject: [PATCH 583/614] Updated the README with completion information. --- README.md | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1eb0a3d9d..e65dff8c4 100644 --- a/README.md +++ b/README.md @@ -13,15 +13,19 @@ version is 4.3.10. `git clone https://github.com/sorin-ionescu/oh-my-zsh.git ~/.oh-my-zsh` -2. Create a new Zsh configuration by copying the Zsh template provided: +2. Initialize the submodules: + + `git submodule update --init --recursive` + +3. Create a new Zsh configuration by copying the Zsh template provided: `cp ~/.oh-my-zsh/templates/zshrc.zsh ~/.zshrc` -3. Set Zsh as your default shell: +4. Set Zsh as your default shell: `chsh -s /bin/zsh` -4. Open a new Zsh terminal window or tab. +5. Open a new Zsh terminal window or tab. ### Mac OS X @@ -54,7 +58,7 @@ accompanying README files to learn of what is available. tab. ![sorin theme](http://i.imgur.com/aipDQ.png "sorin theme") -### Customization +## Customization The project is managed via [Git](http://git-scm.com). It is highly recommend that you commit your changes and push them to [GitHub](http://github.com) to @@ -62,6 +66,12 @@ not lose them. If you do not know how to use Git, follow this [tutorial](http://gitimmersion.com) and bookmark this [reference](http://gitref.org). +### Completions + +Submit program completions to the +[zsh-completions](https://github.com/zsh-users/zsh-completions) project. The Oh +My Zsh completions directory will be synched against it. + ## Resources The [Zsh Reference Card](http://www.bash2zsh.com/zsh_refcard/refcard.pdf) is From e1a71a84b1cd910172360d6b7d6d44832961b273 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sun, 29 Jan 2012 16:32:01 -0500 Subject: [PATCH 584/614] Fixed Perl find/substitute options, added inverse. --- plugins/perl/completions/_prep | 1 + plugins/perl/functions/prep | 12 +++++++----- plugins/perl/functions/psub | 7 ++++--- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/plugins/perl/completions/_prep b/plugins/perl/completions/_prep index c1c939ee6..338e4b052 100644 --- a/plugins/perl/completions/_prep +++ b/plugins/perl/completions/_prep @@ -5,6 +5,7 @@ _arguments \ '-i[ignore case]' \ '-m[^ and $ match the start and the end of a line]' \ '-s[. matches newline]' \ + '-v[invert match]' \ '-x[ignore whitespace and comments]' \ '1::pattern:' \ '2::files:_files' && return 0 diff --git a/plugins/perl/functions/prep b/plugins/perl/functions/prep index 3bc8b5afa..2f5a60b34 100644 --- a/plugins/perl/functions/prep +++ b/plugins/perl/functions/prep @@ -1,6 +1,6 @@ -# Perl grep since 'grep -P' is terrible. +# Perl Grep -local usage pattern modifiers +local usage pattern modifiers invert usage="$( cat <&2 print "$usage" >&2 @@ -42,5 +44,5 @@ fi pattern="$1" shift -perl -n -l -e "print if m/${pattern//\//\\/}/${modifiers}" "$@" +perl -n -l -e "print if ${invert:+not} m/${pattern//\//\\/}/${modifiers}" "$@" diff --git a/plugins/perl/functions/psub b/plugins/perl/functions/psub index e88d4bdc8..40fd286c0 100644 --- a/plugins/perl/functions/psub +++ b/plugins/perl/functions/psub @@ -15,13 +15,13 @@ options: EOF )" -while getopts ':igmxe::' opt; do +while getopts ':gimsx' opt; do case "$opt" in - (i) modifiers="${modifiers}i" ;; (g) modifiers="${modifiers}g" ;; + (i) modifiers="${modifiers}i" ;; (m) modifiers="${modifiers}m" ;; + (s) modifiers="${sodifiers}s" ;; (x) modifiers="${modifiers}x" ;; - (e) modifiers="${modifiers}e" ;; (:) print "$0: option requires an argument: $OPTARG" >&2 print "$usage" >&2 @@ -46,3 +46,4 @@ replacement="$2" repeat 2 shift perl -i'.orig' -n -l -e "s/${pattern//\//\\/}/${replacement//\//\\/}/${modifiers}; print" "$@" + From b96bbca51c2e5de8862b7f7780c405b3f275de3d Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Tue, 31 Jan 2012 23:37:51 -0500 Subject: [PATCH 585/614] Added or edited file headers. --- alias.zsh | 7 ++++++ completion.zsh | 8 +++++++ directory.zsh | 8 +++++++ environment.zsh | 7 ++++++ functions/duh | 9 ++++++- functions/reload | 7 ++++++ helper.zsh | 7 ++++++ history.zsh | 8 +++++++ init.zsh | 6 +++++ keyboard.zsh | 7 ++++++ plugins/archive/completions/_extract | 7 ++++++ plugins/archive/completions/_ls-archive | 7 ++++++ plugins/archive/functions/extract | 7 ++++++ plugins/archive/functions/ls-archive | 7 ++++++ plugins/bundler/init.zsh | 8 +++++++ plugins/command-not-found/init.zsh | 9 ++++--- plugins/compleat/init.zsh | 12 +++++----- plugins/dpkg/functions/apt-copy | 9 ++++++- plugins/dpkg/functions/dbb-build | 9 ++++++- plugins/dpkg/init.zsh | 9 +++++++ plugins/git/alias.zsh | 7 ++++++ plugins/git/completion.zsh | 8 ++++++- plugins/git/completions/_git-hub | 7 ++++++ plugins/git/completions/_git-info | 7 ++++++ plugins/git/functions/git-branch | 8 ++++++- plugins/git/functions/git-hub | 8 ++++++- plugins/git/functions/git-info | 7 ++++++ plugins/git/functions/git-root | 8 ++++++- plugins/git/hub.zsh | 10 ++++++-- plugins/git/init.zsh | 12 +++++----- plugins/git/style.zsh | 7 +++++- plugins/gnu-utils/init.zsh | 13 +++++----- plugins/gpg-agent/init.zsh | 8 ++++++- plugins/history-substring-search/init.zsh | 8 ++++++- plugins/macports/init.zsh | 7 ++++++ plugins/node/functions/node-docs | 8 ++++++- plugins/node/init.zsh | 8 ++++++- plugins/osx/functions/manb | 8 ++++++- plugins/osx/functions/manp | 8 ++++++- plugins/osx/functions/pfd | 7 ++++++ plugins/osx/functions/pfs | 7 ++++++ plugins/osx/functions/tab | 7 ++++++ plugins/osx/functions/trash | 7 ++++++ plugins/osx/init.zsh | 7 +++++- plugins/pacman/functions/pacdisowned | 9 ++++++- plugins/pacman/functions/paclist | 9 ++++++- plugins/pacman/init.zsh | 10 ++++++-- plugins/perl/completions/_prep | 7 ++++++ plugins/perl/completions/_psub | 7 ++++++ plugins/perl/functions/prep | 7 +++++- plugins/perl/functions/psub | 7 +++++- plugins/perl/init.zsh | 7 ++++++ plugins/python/init.zsh | 7 ++++++ plugins/rails/init.zsh | 9 +++++++ plugins/rsync/init.zsh | 7 ++++++ plugins/ruby/init.zsh | 7 ++++++ plugins/screen/init.zsh | 12 +++++----- plugins/ssh-agent/init.zsh | 29 +++++++++++------------ plugins/tmux/init.zsh | 12 +++++----- plugins/wakeonlan/completions/_wake | 8 +++++++ plugins/wakeonlan/functions/wake | 8 +++++++ plugins/yum/init.zsh | 8 +++++++ plugins/z/init.zsh | 16 +++++-------- spectrum.zsh | 10 +++++--- templates/zshrc.zsh | 7 ++++++ terminal.zsh | 8 +++++++ themes/minimal/prompt_minimal_setup | 8 +++++++ themes/nicoulaj/prompt_nicoulaj_setup | 26 ++++++++++++-------- themes/sorin/prompt_sorin_setup | 17 +++++++------ themes/steeef/prompt_steeef_setup | 14 ++++++----- utility.zsh | 9 +++++++ 71 files changed, 527 insertions(+), 108 deletions(-) diff --git a/alias.zsh b/alias.zsh index 302dac4ed..3ebf0304b 100644 --- a/alias.zsh +++ b/alias.zsh @@ -1,3 +1,10 @@ +# +# Defines general aliases. +# +# Authors: +# Sorin Ionescu +# + setopt CORRECT # Correct commands. # The 'ls' Family diff --git a/completion.zsh b/completion.zsh index 374f6fc92..02d256107 100644 --- a/completion.zsh +++ b/completion.zsh @@ -1,3 +1,11 @@ +# +# Sets completion options. +# +# Authors: +# Robby Russell +# Sorin Ionescu +# + # Dumb terminals lack support. if [[ "$TERM" == 'dumb' ]]; then return diff --git a/directory.zsh b/directory.zsh index c082c469c..322dee077 100644 --- a/directory.zsh +++ b/directory.zsh @@ -1,3 +1,11 @@ +# +# Sets directory options and defines directory aliases. +# +# Authors: +# James Cox +# Sorin Ionescu +# + setopt AUTO_CD # Auto cd to a directory without typing cd. setopt AUTO_PUSHD # Push the old directory onto the stack on cd. setopt PUSHD_IGNORE_DUPS # Don't store duplicates in the stack. diff --git a/environment.zsh b/environment.zsh index 510a7d43f..9c170cd26 100644 --- a/environment.zsh +++ b/environment.zsh @@ -1,3 +1,10 @@ +# +# Sets general shell options and defines environment variables. +# +# Authors: +# Sorin Ionescu +# + # Smart URLs autoload -Uz url-quote-magic zle -N self-insert url-quote-magic diff --git a/functions/duh b/functions/duh index b01f14210..10439f1b7 100644 --- a/functions/duh +++ b/functions/duh @@ -1,4 +1,11 @@ -# Displays human readable disk usage statistics. +# +# Displays human readable disk usage. +# +# Authors: +# Suraj N. Kurapati +# Sorin Ionescu +# + function duh() { (( $# == 0 )) && set -- * if [[ "$OSTYPE" == linux* ]]; then diff --git a/functions/reload b/functions/reload index 9b7563919..bf84916d1 100644 --- a/functions/reload +++ b/functions/reload @@ -1,3 +1,10 @@ +# +# Reloads the Zsh configuration. +# +# Authors: +# Sorin Ionescu +# + # Reloads ~/.zshrc. local zshrc="$HOME/.zshrc" if [[ -n "$1" ]]; then diff --git a/helper.zsh b/helper.zsh index 0ad29ce38..dd101a5e2 100644 --- a/helper.zsh +++ b/helper.zsh @@ -1,3 +1,10 @@ +# +# Defines helper functions. +# +# Authors: +# Sorin Ionescu +# + # Checks if a file can be autoloaded by trying to load it in a subshell. function autoloadable() { ( unfunction $1 ; autoload -U +X $1 ) &> /dev/null diff --git a/history.zsh b/history.zsh index 3f9fa0f3a..5b5b9b369 100644 --- a/history.zsh +++ b/history.zsh @@ -1,3 +1,11 @@ +# +# Sets history options. +# +# Authors: +# Robby Russell +# Sorin Ionescu +# + HISTFILE="$HOME/.zhistory" HISTSIZE=10000 SAVEHIST=10000 diff --git a/init.zsh b/init.zsh index 53f51eb07..ec218ddc8 100644 --- a/init.zsh +++ b/init.zsh @@ -1,4 +1,10 @@ +# # Initializes Oh My Zsh. +# +# Authors: +# Robby Russell +# Sorin Ionescu +# # Check for the minimum supported version. min_zsh_version='4.3.10' diff --git a/keyboard.zsh b/keyboard.zsh index d78331957..6dcf1002e 100644 --- a/keyboard.zsh +++ b/keyboard.zsh @@ -1,3 +1,10 @@ +# +# Sets keyboard bindings. +# +# Authors: +# Sorin Ionescu +# + # Dumb terminals lack support. if [[ "$TERM" == 'dumb' ]]; then return diff --git a/plugins/archive/completions/_extract b/plugins/archive/completions/_extract index 3e28cfd79..901a8489d 100644 --- a/plugins/archive/completions/_extract +++ b/plugins/archive/completions/_extract @@ -1,6 +1,13 @@ #compdef extract #autoload +# +# Completes extract. +# +# Authors: +# Sorin Ionescu +# + _arguments \ '(-r --remove)'{-r,--remove}'[remove archive]' \ "*::archive file:_files -g '(#i)*.(tar|tgz|tbz|tbz2|txz|tlz|gz|bz2|xz|lzma|Z|zip|rar|7z|deb)(-.)'" && return 0 diff --git a/plugins/archive/completions/_ls-archive b/plugins/archive/completions/_ls-archive index 1931649d6..00453c4f9 100644 --- a/plugins/archive/completions/_ls-archive +++ b/plugins/archive/completions/_ls-archive @@ -1,6 +1,13 @@ #compdef ls-archive #autoload +# +# Completes ls-archive. +# +# Authors: +# Sorin Ionescu +# + _arguments \ '(-v --verbose)'{-v,--remove}'[verbose archive listing]' \ "*::archive file:_files -g '(#i)*.(tar|tgz|tbz|tbz2|txz|tlz|gz|bz2|xz|lzma|Z|zip|rar|7z)(-.)'" && return 0 diff --git a/plugins/archive/functions/extract b/plugins/archive/functions/extract index bc3410174..a18f50683 100644 --- a/plugins/archive/functions/extract +++ b/plugins/archive/functions/extract @@ -1,3 +1,10 @@ +# +# Extracts the contents of popular archive formats. +# +# Authors: +# Sorin Ionescu +# + local remove_archive local success local file_name diff --git a/plugins/archive/functions/ls-archive b/plugins/archive/functions/ls-archive index 0c31b95ec..fb7a503d5 100644 --- a/plugins/archive/functions/ls-archive +++ b/plugins/archive/functions/ls-archive @@ -1,3 +1,10 @@ +# +# Lists the contents of popular archive formats. +# +# Authors: +# Sorin Ionescu +# + local verbose if (( $# == 0 )); then diff --git a/plugins/bundler/init.zsh b/plugins/bundler/init.zsh index c3377d435..9fdb15356 100644 --- a/plugins/bundler/init.zsh +++ b/plugins/bundler/init.zsh @@ -1,3 +1,11 @@ +# +# Defines bundler aliases. +# +# Authors: +# Myron Marston +# Sorin Ionescu +# + # Aliases alias b='bundle' alias be='b exec' diff --git a/plugins/command-not-found/init.zsh b/plugins/command-not-found/init.zsh index e94b8f28f..ac9468bd3 100644 --- a/plugins/command-not-found/init.zsh +++ b/plugins/command-not-found/init.zsh @@ -1,6 +1,9 @@ -# Uses the command-not-found package Zsh support as seen in -# http://www.porcheron.info/command-not-found-for-zsh/ and -# installed in Ubuntu. +# +# Displays installation information for not found commands. +# +# Authors: +# Joseph Jon Booker +# if [[ -f /etc/zsh_command_not_found ]]; then source /etc/zsh_command_not_found diff --git a/plugins/compleat/init.zsh b/plugins/compleat/init.zsh index 10107334c..a9c684fe7 100644 --- a/plugins/compleat/init.zsh +++ b/plugins/compleat/init.zsh @@ -1,9 +1,9 @@ -# ------------------------------------------------------------------------------ -# FILE: compleat.plugin.zsh -# DESCRIPTION: oh-my-zsh plugin file. -# AUTHOR: Sorin Ionescu -# VERSION: 1.0.2 -# ------------------------------------------------------------------------------ +# +# Loads Compleat completions. +# +# Authors: +# Sorin Ionescu +# if (( ${+commands[compleat]} )); then compleat_setup="${commands[compleat]:h:h}/share/compleat-1.0/compleat_setup" diff --git a/plugins/dpkg/functions/apt-copy b/plugins/dpkg/functions/apt-copy index 2f2e2839a..c77b0cebc 100644 --- a/plugins/dpkg/functions/apt-copy +++ b/plugins/dpkg/functions/apt-copy @@ -1,4 +1,11 @@ -# Create a simple script that can be used to 'duplicate' a system. +# +# Generates a script that can be used to duplicate a dpkg-based system. +# +# Authors: +# Daniel Bolton +# Sorin Ionescu +# + 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;') diff --git a/plugins/dpkg/functions/dbb-build b/plugins/dpkg/functions/dbb-build index 7576e2eae..4fa5567ca 100644 --- a/plugins/dpkg/functions/dbb-build +++ b/plugins/dpkg/functions/dbb-build @@ -1,4 +1,11 @@ -# Kernel-package building shortcut. +# +# Makes a dpkg Linux kernel package. +# +# Authors: +# Daniel Bolton +# Sorin Ionescu +# + MAKEFLAGS='' # Temporarily unset MAKEFLAGS ( '-j3' will fail ). appendage='-custom' # This shows up in $ (uname -r ). revision=$(date +"%Y%m%d") # This shows up in the .deb file name. diff --git a/plugins/dpkg/init.zsh b/plugins/dpkg/init.zsh index a653768d1..44c879da4 100644 --- a/plugins/dpkg/init.zsh +++ b/plugins/dpkg/init.zsh @@ -1,3 +1,12 @@ +# +# Defines dpkg aliases. +# +# Authors: +# Daniel Bolton +# Benjamin Boudreau +# Sorin Ionescu +# + # 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. diff --git a/plugins/git/alias.zsh b/plugins/git/alias.zsh index 02c117d8a..d78778e8b 100644 --- a/plugins/git/alias.zsh +++ b/plugins/git/alias.zsh @@ -1,3 +1,10 @@ +# +# Defines Git aliases. +# +# Authors: +# Sorin Ionescu +# + # Git alias g='git' compdef g=git diff --git a/plugins/git/completion.zsh b/plugins/git/completion.zsh index b9867452c..8c4a56872 100644 --- a/plugins/git/completion.zsh +++ b/plugins/git/completion.zsh @@ -1,4 +1,10 @@ -# Get the latest Git completion. +# +# Gets the latest Git completion. +# +# Authors: +# Sorin Ionescu +# + completion_file="${0:h}/completions/_git" completion_file_url='http://zsh.git.sourceforge.net/git/gitweb.cgi?p=zsh/zsh;a=blob_plain;f=Completion/Unix/Command/_git;hb=HEAD' if [[ ! -e "$completion_file" ]] && (( $+commands[git] )); then diff --git a/plugins/git/completions/_git-hub b/plugins/git/completions/_git-hub index e4e2945da..86a1f336f 100644 --- a/plugins/git/completions/_git-hub +++ b/plugins/git/completions/_git-hub @@ -1,6 +1,13 @@ #compdef git-hub #autoload +# +# Completes git-hub. +# +# Authors: +# Sorin Ionescu +# + local state remotes remote branches ret=1 _arguments -C -s -S \ diff --git a/plugins/git/completions/_git-info b/plugins/git/completions/_git-info index 1708fae4f..0357c6d8f 100644 --- a/plugins/git/completions/_git-info +++ b/plugins/git/completions/_git-info @@ -1,6 +1,13 @@ #compdef git-info #autoload +# +# Completes git-info. +# +# Authors: +# Sorin Ionescu +# + _arguments "1:toggle:(( on\:'enable in-prompt information for the current repository' off\:'disable in-prompt information for the current repository' diff --git a/plugins/git/functions/git-branch b/plugins/git/functions/git-branch index b38618a31..3078ad13b 100644 --- a/plugins/git/functions/git-branch +++ b/plugins/git/functions/git-branch @@ -1,4 +1,10 @@ -# Gets the current branch. +# +# Displays the current Git branch. +# +# Authors: +# Sorin Ionescu +# + local ref="$(git symbolic-ref HEAD 2> /dev/null)" if [[ -n "$ref" ]]; then print "${ref#refs/heads/}" diff --git a/plugins/git/functions/git-hub b/plugins/git/functions/git-hub index 7deeddfc5..d3758d472 100644 --- a/plugins/git/functions/git-hub +++ b/plugins/git/functions/git-hub @@ -1,4 +1,10 @@ -# Open the GitHub repository in the browser. +# +# Opens a GitHub repository in the default browser. +# +# Authors: +# Sorin Ionescu +# + local remote branches branch current_branch url remote="${1:-origin}" diff --git a/plugins/git/functions/git-info b/plugins/git/functions/git-info index c0854c4a9..a0e4e0e0f 100644 --- a/plugins/git/functions/git-info +++ b/plugins/git/functions/git-info @@ -1,3 +1,10 @@ +# +# Displays Git repository information. +# +# Authors: +# Sorin Ionescu +# + # Gets the Git special action (am, merge, rebase, etc.). # Borrowed from vcs_info and edited. function _git-action() { diff --git a/plugins/git/functions/git-root b/plugins/git/functions/git-root index e86ce70df..d704eff1a 100644 --- a/plugins/git/functions/git-root +++ b/plugins/git/functions/git-root @@ -1,4 +1,10 @@ -# Gets the repository root. +# +# Displays the Git repository root. +# +# Authors: +# Sorin Ionescu +# + local root="$(git rev-parse --show-toplevel 2> /dev/null)" if [[ -n "$root" ]]; then print "$root" diff --git a/plugins/git/hub.zsh b/plugins/git/hub.zsh index 8586e0a58..8ff40594a 100644 --- a/plugins/git/hub.zsh +++ b/plugins/git/hub.zsh @@ -1,5 +1,11 @@ -# Hub by defunkt -# https://github.com/defunkt/hub +# +# Adds GitHub knowledge to the Git command. +# +# Authors: +# Chris Wanstrath +# Sorin Ionescu +# + if (( $+commands[hub] )); then function git() { hub "$@" diff --git a/plugins/git/init.zsh b/plugins/git/init.zsh index 1a3034931..9e7b18c0c 100644 --- a/plugins/git/init.zsh +++ b/plugins/git/init.zsh @@ -1,9 +1,9 @@ -# ------------------------------------------------------------------------------ -# FILE: git.plugin.zsh -# DESCRIPTION: oh-my-zsh plugin file. -# AUTHOR: Sorin Ionescu -# VERSION: 1.0.0 -# ------------------------------------------------------------------------------ +# +# Provides Git aliases and functions. +# +# Authors: +# Sorin Ionescu +# # Source plugin files. source "${0:h}/alias.zsh" diff --git a/plugins/git/style.zsh b/plugins/git/style.zsh index 6eae19abb..218e87aac 100644 --- a/plugins/git/style.zsh +++ b/plugins/git/style.zsh @@ -1,4 +1,9 @@ -# The default styles. +# +# Defines Git information display styles. +# +# Authors: +# Sorin Ionescu +# # %s - Special action name (am, merge, rebase). zstyle ':omz:plugin:git:prompt' action 'action:%s' diff --git a/plugins/gnu-utils/init.zsh b/plugins/gnu-utils/init.zsh index 70ec00712..cf58a8e8c 100644 --- a/plugins/gnu-utils/init.zsh +++ b/plugins/gnu-utils/init.zsh @@ -1,10 +1,9 @@ -# ------------------------------------------------------------------------------ -# FILE: gnu-utils.plugin.zsh -# DESCRIPTION: oh-my-zsh plugin file. -# AUTHOR: Sorin Ionescu -# VERSION: 1.0.2 -# ------------------------------------------------------------------------------ - +# +# Provides for the interactive usage of GNU Coreutils on BSD systems. +# +# Authors: +# Sorin Ionescu +# if (( $+commands[gdircolors] )); then function __gnu_utils() { diff --git a/plugins/gpg-agent/init.zsh b/plugins/gpg-agent/init.zsh index 518a58ec5..c38788414 100644 --- a/plugins/gpg-agent/init.zsh +++ b/plugins/gpg-agent/init.zsh @@ -1,4 +1,10 @@ -# Based on ssh-agent code. +# +# Provides for an easier use of gpg-agent. +# +# Authors: +# Florian Walch +# Sorin Ionescu +# local GPG_ENV="$HOME/.gnupg/gpg-agent.env" diff --git a/plugins/history-substring-search/init.zsh b/plugins/history-substring-search/init.zsh index 4ff38025e..8d3403f2d 100644 --- a/plugins/history-substring-search/init.zsh +++ b/plugins/history-substring-search/init.zsh @@ -1,4 +1,10 @@ -# This file integrates the history-substring-search script into oh-my-zsh. +# +# Integrates history-substring-search into Oh My Zsh. +# +# Authors: +# Suraj N. Kurapati +# Sorin Ionescu +# source "${0:h}/history-substring-search.zsh" diff --git a/plugins/macports/init.zsh b/plugins/macports/init.zsh index 313686461..c07ad2d62 100644 --- a/plugins/macports/init.zsh +++ b/plugins/macports/init.zsh @@ -1,3 +1,10 @@ +# +# Defines MacPorts aliases. +# +# Authors: +# Matt Cable +# + # Aliases alias pc="sudo port clean --all installed" alias pi="sudo port install $1" diff --git a/plugins/node/functions/node-docs b/plugins/node/functions/node-docs index cbf4bac6b..155b131b0 100644 --- a/plugins/node/functions/node-docs +++ b/plugins/node/functions/node-docs @@ -1,4 +1,10 @@ -# Open the node api for your current version to the optional section. +# +# Opens the Node.js online API documentation in the default browser. +# +# Authors: +# Sorin Ionescu +# + # TODO: Make the sections easier to use. open "http://nodejs.org/docs/$(node --version | sed 's/-.*//')/api/all.html#${1}" diff --git a/plugins/node/init.zsh b/plugins/node/init.zsh index 69333e3a8..0e1658837 100644 --- a/plugins/node/init.zsh +++ b/plugins/node/init.zsh @@ -1,4 +1,10 @@ -# Complete npm. +# +# Completes npm. +# +# Authors: +# Sorin Ionescu +# + cache_file="${0:h}/cache.zsh" if [[ ! -f "$cache_file" ]] && (( $+commands[npm] )); then # npm is slow; cache its output. diff --git a/plugins/osx/functions/manb b/plugins/osx/functions/manb index 5dfb4c5de..f8377393e 100644 --- a/plugins/osx/functions/manb +++ b/plugins/osx/functions/manb @@ -1,4 +1,10 @@ -# Open man pages in Bwana. +# +# Opens man pages in Bwana.app. +# +# Authors: +# Sorin Ionescu +# + function manb() { local page if (( $# > 0 )); then diff --git a/plugins/osx/functions/manp b/plugins/osx/functions/manp index 35c1d95bf..87da47ab8 100644 --- a/plugins/osx/functions/manp +++ b/plugins/osx/functions/manp @@ -1,4 +1,10 @@ -# Open man pages in Preview. +# +# Opens man pages in Preview.app. +# +# Authors: +# Sorin Ionescu +# + function manp() { local page if (( $# > 0 )); then diff --git a/plugins/osx/functions/pfd b/plugins/osx/functions/pfd index 5df7d2743..3e038a68b 100644 --- a/plugins/osx/functions/pfd +++ b/plugins/osx/functions/pfd @@ -1,3 +1,10 @@ +# +# Displays the current Finder.app directory. +# +# Authors: +# Sorin Ionescu +# + osascript 2>/dev/null < +# + osascript 2>/dev/null < +# + local command="cd \\\"$PWD\\\"" (( $# > 0 )) && command="${command}; $*" diff --git a/plugins/osx/functions/trash b/plugins/osx/functions/trash index 33c0f6d54..d39243731 100644 --- a/plugins/osx/functions/trash +++ b/plugins/osx/functions/trash @@ -1,3 +1,10 @@ +# +# Moves directories and files to Trash. +# +# Authors: +# Sorin Ionescu +# + print -N "${@:a}" | xargs -0 osascript -e ' on run theFilePaths tell application "Finder" diff --git a/plugins/osx/init.zsh b/plugins/osx/init.zsh index da60837fd..83d5b17ca 100644 --- a/plugins/osx/init.zsh +++ b/plugins/osx/init.zsh @@ -1,4 +1,9 @@ -# Sorin Ionescu +# +# Defines Mac OS X aliases and functions. +# +# Authors: +# Sorin Ionescu +# # Change directory to the current Finder directory. alias cdf='cd "$(pfd)"' diff --git a/plugins/pacman/functions/pacdisowned b/plugins/pacman/functions/pacdisowned index d46c0ee1f..81edf0ac6 100644 --- a/plugins/pacman/functions/pacdisowned +++ b/plugins/pacman/functions/pacdisowned @@ -1,4 +1,11 @@ -# List disowned files. +# +# Lists pacman disowned files. +# +# Authors: +# Benjamin Boudreau +# Sorin Ionescu +# + tmp="${TMPDIR-/tmp}/pacman-disowned-$UID-$$" db="$tmp/db" fs="$tmp/fs" diff --git a/plugins/pacman/functions/paclist b/plugins/pacman/functions/paclist index 648fbbf86..3f83dc8bc 100644 --- a/plugins/pacman/functions/paclist +++ b/plugins/pacman/functions/paclist @@ -1,4 +1,11 @@ -# List explicitly installed packages. +# +# Lists explicitly installed pacman packages. +# +# Authors: +# Benjamin Boudreau +# Sorin Ionescu +# + sudo pacman -Qei $(pacman -Qu|cut -d" " -f 1) \ | awk ' BEGIN {FS=":"}/^Name/{printf("\033[1;36m%s\033[1;37m", $2)}/^Description/{print $2}' diff --git a/plugins/pacman/init.zsh b/plugins/pacman/init.zsh index 8f221768f..645139ed9 100644 --- a/plugins/pacman/init.zsh +++ b/plugins/pacman/init.zsh @@ -1,7 +1,13 @@ -# Arch Linux Zsh Aliases and Functions # -# Pacman Tips: +# Defines pacman aliases. +# +# Authors: +# Benjamin Boudreau +# Sorin Ionescu +# +# Tips: # https://wiki.archlinux.org/index.php/Pacman_Tips +# # Yaourt Aliases if (( $+commands[yaourt] )); then diff --git a/plugins/perl/completions/_prep b/plugins/perl/completions/_prep index 338e4b052..8ecc7fd7b 100644 --- a/plugins/perl/completions/_prep +++ b/plugins/perl/completions/_prep @@ -1,6 +1,13 @@ #compdef prep #autoload +# +# Completes prep. +# +# Authors: +# Sorin Ionescu +# + _arguments \ '-i[ignore case]' \ '-m[^ and $ match the start and the end of a line]' \ diff --git a/plugins/perl/completions/_psub b/plugins/perl/completions/_psub index 3fa7ef8aa..cd8bcfe78 100644 --- a/plugins/perl/completions/_psub +++ b/plugins/perl/completions/_psub @@ -1,6 +1,13 @@ #compdef psub #autoload +# +# Completes psub. +# +# Authors: +# Sorin Ionescu +# + _arguments \ '-g[match globally]' \ '-i[ignore case]' \ diff --git a/plugins/perl/functions/prep b/plugins/perl/functions/prep index 2f5a60b34..c61487bb0 100644 --- a/plugins/perl/functions/prep +++ b/plugins/perl/functions/prep @@ -1,4 +1,9 @@ -# Perl Grep +# +# Provides a grep-like pattern search. +# +# Authors: +# Sorin Ionescu +# local usage pattern modifiers invert diff --git a/plugins/perl/functions/psub b/plugins/perl/functions/psub index 40fd286c0..4f2c06e3c 100644 --- a/plugins/perl/functions/psub +++ b/plugins/perl/functions/psub @@ -1,4 +1,9 @@ -# Perl Substitution +# +# Provides a sed-like pattern substitution. +# +# Authors: +# Sorin Ionescu +# local usage pattern replacement modifiers diff --git a/plugins/perl/init.zsh b/plugins/perl/init.zsh index 784118131..b807bb693 100644 --- a/plugins/perl/init.zsh +++ b/plugins/perl/init.zsh @@ -1,3 +1,10 @@ +# +# Enables local Perl module installation on Mac OS X and defines aliases. +# +# Authors: +# Sorin Ionescu +# + # For Perl older than 5.10.14, install local::lib. # curl -L -C - -O http://search.cpan.org/CPAN/authors/id/A/AP/APEIRON/local-lib-1.008004.tar.gz # tar xvf local-lib-1.008004.tar.gz diff --git a/plugins/python/init.zsh b/plugins/python/init.zsh index 3bc947c4c..0c181fdb9 100644 --- a/plugins/python/init.zsh +++ b/plugins/python/init.zsh @@ -1,3 +1,10 @@ +# +# Enables local Python package installation. +# +# Authors: +# Sorin Ionescu +# + # Prepend PEP 370 per user site packages directory, which defaults to # ~/Library/Python on Mac OS X and ~/.local elsewhere, to PATH/MANPATH. if [[ "$OSTYPE" == darwin* ]]; then diff --git a/plugins/rails/init.zsh b/plugins/rails/init.zsh index 490cdeaef..53bbda69e 100644 --- a/plugins/rails/init.zsh +++ b/plugins/rails/init.zsh @@ -1,3 +1,12 @@ +# +# Defines Ruby on Rails aliases. +# +# Authors: +# Robby Russell +# Jake Bell +# Sorin Ionescu +# + # Aliases (compatible with Rails 2) alias rc='_rails-command console' alias rd='_rails-command destroy' diff --git a/plugins/rsync/init.zsh b/plugins/rsync/init.zsh index 0ec369308..caf705a96 100644 --- a/plugins/rsync/init.zsh +++ b/plugins/rsync/init.zsh @@ -1,3 +1,10 @@ +# +# Defines rsync aliases. +# +# Authors: +# Sorin Ionescu +# + # Aliases rsync_cmd='rsync --verbose --progress --human-readable --compress --archive --hard-links --one-file-system' diff --git a/plugins/ruby/init.zsh b/plugins/ruby/init.zsh index 936a38c38..c1c877aa6 100644 --- a/plugins/ruby/init.zsh +++ b/plugins/ruby/init.zsh @@ -1,3 +1,10 @@ +# +# Configures Ruby gem installation and loads rvm/rbenv. +# +# Authors: +# Sorin Ionescu +# + # Install local gems according to Mac OS X conventions. if [[ "$OSTYPE" == darwin* ]]; then export GEM_HOME="$HOME/Library/Ruby/Gems/${$(ruby --version)[6,8]}" diff --git a/plugins/screen/init.zsh b/plugins/screen/init.zsh index e46283b80..02f914e35 100644 --- a/plugins/screen/init.zsh +++ b/plugins/screen/init.zsh @@ -1,9 +1,9 @@ -# ------------------------------------------------------------------------------ -# FILE: screen.plugin.zsh -# DESCRIPTION: oh-my-zsh plugin file. -# AUTHOR: Sorin Ionescu -# VERSION: 1.0.0 -# ------------------------------------------------------------------------------ +# +# Defines GNU Screen aliases and provides for auto launching it at startup. +# +# Authors: +# Sorin Ionescu +# # Aliases alias sl="screen -list" diff --git a/plugins/ssh-agent/init.zsh b/plugins/ssh-agent/init.zsh index 3f7a5266c..560d9bf73 100644 --- a/plugins/ssh-agent/init.zsh +++ b/plugins/ssh-agent/init.zsh @@ -1,25 +1,24 @@ # -# INSTRUCTIONS +# Provides for an easier use of ssh-agent. # -# To enabled agent forwarding support, add the following to -# your .zshrc file: +# Authors: +# Robby Russell +# Theodore Robert Campbell Jr +# Joseph M. Reagle Jr. +# Florent Thoumie +# Jonas Pfenniger +# gwjo +# Sorin Ionescu # -# zstyle ':omz:plugin:ssh-agent' forwarding 'on' +# Usage: +# To enable agent forwarding, add the following to your .zshrc: # -# To load multiple identies, use the identities style, For -# example: +# zstyle ':omz:plugin:ssh-agent' forwarding 'yes' +# +# To load multiple identies, add the following to your .zshrc: # # zstyle ':omz:plugin:ssh-agent' identities 'id_rsa' 'id_rsa2' 'id_github' # -# -# CREDITS -# -# Based on code from Joseph M. Reagle -# http://www.cygwin.com/ml/cygwin/2001-06/msg00537.html -# -# Agent forwarding support based on ideas from -# Florent Thoumie and Jonas Pfenniger -# _ssh_agent_env="$HOME/.ssh/environment-$HOST" _ssh_agent_forwarding= diff --git a/plugins/tmux/init.zsh b/plugins/tmux/init.zsh index 8e213358d..e04d25cba 100644 --- a/plugins/tmux/init.zsh +++ b/plugins/tmux/init.zsh @@ -1,9 +1,9 @@ -# ------------------------------------------------------------------------------ -# FILE: tmux.plugin.zsh -# DESCRIPTION: oh-my-zsh plugin file. -# AUTHOR: Sorin Ionescu -# VERSION: 1.0.0 -# ------------------------------------------------------------------------------ +# +# Defines tmux aliases and provides for auto launching it at startup. +# +# Authors: +# Sorin Ionescu +# # Aliases alias ta="tmux attach-session" diff --git a/plugins/wakeonlan/completions/_wake b/plugins/wakeonlan/completions/_wake index fbf5e9ea8..85aee5a16 100644 --- a/plugins/wakeonlan/completions/_wake +++ b/plugins/wakeonlan/completions/_wake @@ -1,5 +1,13 @@ #compdef wake #autoload +# +# Completes wake. +# +# Authors: +# Paul Gideon Dann +# Sorin Ionescu +# + _arguments "1:device to wake:_files -W '$HOME/.wakeonlan'" && return 0 diff --git a/plugins/wakeonlan/functions/wake b/plugins/wakeonlan/functions/wake index c4cba48bf..7e03efaaa 100644 --- a/plugins/wakeonlan/functions/wake +++ b/plugins/wakeonlan/functions/wake @@ -1,3 +1,11 @@ +# +# Wakes devices via wakeonlan. +# +# Authors: +# Paul Gideon Dann +# Sorin Ionescu +# + local config_file="$HOME/.wakeonlan/$1" if [[ ! -f "$config_file" ]]; then print "$0: no such device file: $1" >&2 diff --git a/plugins/yum/init.zsh b/plugins/yum/init.zsh index d0ee236b4..a71f67a5b 100644 --- a/plugins/yum/init.zsh +++ b/plugins/yum/init.zsh @@ -1,3 +1,11 @@ +# +# Defines yum aliases. +# +# Authors: +# Simon +# Sorin Ionescu +# + # Aliases alias ys="yum search" # Search package. alias yp="yum info" # Show package info. diff --git a/plugins/z/init.zsh b/plugins/z/init.zsh index bcdc7387a..e08e16a36 100644 --- a/plugins/z/init.zsh +++ b/plugins/z/init.zsh @@ -1,13 +1,9 @@ -# ------------------------------------------------------------------------------ -# FILE: z.plugin.zsh -# DESCRIPTION: oh-my-zsh plugin file. -# AUTHOR: Sorin Ionescu -# VERSION: 1.0.0 -# ------------------------------------------------------------------------------ - - -# z is the new j. -# https://github.com/rupa/z +# +# Maintains a frequently used directory list for fast directory changes. +# +# Authors: +# Sorin Ionescu +# if [[ -f /etc/profile.d/z.zsh ]]; then source /etc/profile.d/z.zsh diff --git a/spectrum.zsh b/spectrum.zsh index 629e04140..ed0a4835b 100644 --- a/spectrum.zsh +++ b/spectrum.zsh @@ -1,6 +1,10 @@ -# A script to make using 256 colors in Zsh less painful. -# P.C. Shyamshankar -# Sorin Ionescu +# +# Provides for easier formatting and use of 256 colors. +# +# Authors: +# P.C. Shyamshankar +# Sorin Ionescu +# typeset -Ag FX FG BG diff --git a/templates/zshrc.zsh b/templates/zshrc.zsh index c177862fd..deced37fe 100644 --- a/templates/zshrc.zsh +++ b/templates/zshrc.zsh @@ -1,3 +1,10 @@ +# +# Sets Oh My Zsh options. +# +# Authors: +# Sorin Ionescu +# + # Set the key mapping style to 'emacs' or 'vi'. zstyle ':omz:editor' keymap 'emacs' diff --git a/terminal.zsh b/terminal.zsh index 440875640..e70957709 100644 --- a/terminal.zsh +++ b/terminal.zsh @@ -1,3 +1,11 @@ +# +# Sets terminal window and tab titles. +# +# Authors: +# James Cox +# Sorin Ionescu +# + # Dumb terminals lack support. if [[ "$TERM" == 'dumb' ]]; then return diff --git a/themes/minimal/prompt_minimal_setup b/themes/minimal/prompt_minimal_setup index 35b4343cf..fbd60f2f1 100644 --- a/themes/minimal/prompt_minimal_setup +++ b/themes/minimal/prompt_minimal_setup @@ -1,3 +1,11 @@ +# +# A monochrome theme that displays basic information. +# +# Authors: +# Brian Tse +# Sorin Ionescu +# + function +vi-git-status() { # Untracked files. if [[ -n $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then diff --git a/themes/nicoulaj/prompt_nicoulaj_setup b/themes/nicoulaj/prompt_nicoulaj_setup index 84061fd17..2a6c5bd72 100644 --- a/themes/nicoulaj/prompt_nicoulaj_setup +++ b/themes/nicoulaj/prompt_nicoulaj_setup @@ -1,14 +1,20 @@ -# ------------------------------------------------------------------------------ -# Prompt for Zsh: -# * One line. -# * VCS info on the right prompt. -# * Only shows the path on the left prompt by default. -# * Crops the path to a defined length and only shows the path relative to +# +# A simple theme that displays only relevant information. +# +# Authors: +# Julien Nicoulaud +# Sorin Ionescu +# +# Features: +# - One line. +# - VCS information in the right prompt. +# - Only shows the path on the left prompt by default. +# - Crops the path to a defined length and only shows the path relative to # the current VCS repository root. -# * Wears a different color wether the last command succeeded/failed. -# * Shows user@hostname if connected through SSH. -# * Shows if logged in as root or not. -# ------------------------------------------------------------------------------ +# - Uses a different color depending on if the last command succeeded/failed. +# - Shows user@hostname if connected through SSH. +# - Shows if logged in as root or not. +# function prompt_nicoulaj_setup() { setopt LOCAL_OPTIONS diff --git a/themes/sorin/prompt_sorin_setup b/themes/sorin/prompt_sorin_setup index f6944a859..a1aafbfe1 100644 --- a/themes/sorin/prompt_sorin_setup +++ b/themes/sorin/prompt_sorin_setup @@ -1,10 +1,13 @@ -# ------------------------------------------------------------------------------ -# FILE: prompt_sorin_setup -# DESCRIPTION: oh-my-zsh theme file. -# AUTHOR: Sorin Ionescu -# VERSION: 1.0.6 -# SCREENSHOT: http://i.imgur.com/aipDQ.png -# ------------------------------------------------------------------------------ +# +# A simple theme that only shows relevant information. +# +# Authors: +# Sorin Ionescu +# +# Screenshots: +# http://i.imgur.com/aipDQ.png +# + function prompt_sorin_precmd () { setopt LOCAL_OPTIONS unsetopt XTRACE KSH_ARRAYS diff --git a/themes/steeef/prompt_steeef_setup b/themes/steeef/prompt_steeef_setup index 6584125f0..0da78d743 100644 --- a/themes/steeef/prompt_steeef_setup +++ b/themes/steeef/prompt_steeef_setup @@ -1,11 +1,13 @@ -# Prompt style and colors based on Steve Losh's Prose theme: -# http://github.com/sjl/oh-my-zsh/blob/master/themes/prose.zsh-theme # -# vcs_info modifications from Bart Trojanowski's Zsh prompt: -# http://www.jukie.net/bart/blog/pimping-out-zsh-prompt +# A theme based on Steve Losh's prompt with VCS_INFO integration. +# +# Authors: +# Steve Losh +# Bart Trojanowski +# Brian Carper +# steeef +# Sorin Ionescu # -# Git untracked files modification from Brian Carper: -# http://briancarper.net/blog/570/git-info-in-your-zsh-prompt function virtualenv_info() { if [[ -n "$VIRTUAL_ENV" ]]; then diff --git a/utility.zsh b/utility.zsh index 20178cc2c..50a7654c0 100644 --- a/utility.zsh +++ b/utility.zsh @@ -1,3 +1,12 @@ +# +# Defines utility functions. +# +# Authors: +# Robby Russell +# Suraj N. Kurapati +# Sorin Ionescu +# + # Lists the ten most used commands. alias history-stat="history | awk '{print \$2}' | sort | uniq -c | sort -n -r | head" From b646296a478b3c8867ef399eaa2bf20644f008c0 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Tue, 31 Jan 2012 23:39:03 -0500 Subject: [PATCH 586/614] Do not glob fc and history. --- alias.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/alias.zsh b/alias.zsh index 3ebf0304b..38499d5d4 100644 --- a/alias.zsh +++ b/alias.zsh @@ -40,7 +40,9 @@ alias df='df -kh' alias du='du -kh' alias e="$EDITOR" alias find='noglob find' +alias fc='noglob fc' alias gcc='nocorrect gcc' +alias history='noglob history' alias ln='nocorrect ln -i' alias locate='noglob locate' alias man='nocorrect man' From 128d29e6d98bd6d425bb29aef38462dd81a3f19d Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Tue, 31 Jan 2012 23:40:40 -0500 Subject: [PATCH 587/614] Fixed a comment in ssh-agent plugin. --- plugins/ssh-agent/init.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/ssh-agent/init.zsh b/plugins/ssh-agent/init.zsh index 560d9bf73..486d519f1 100644 --- a/plugins/ssh-agent/init.zsh +++ b/plugins/ssh-agent/init.zsh @@ -26,7 +26,7 @@ _ssh_agent_forwarding= function _ssh-agent-start() { local -a identities - # Start ssh-agent and setup environment. + # Start ssh-agent and setup the environment. /usr/bin/env ssh-agent | sed 's/^print/#print/' > "${_ssh_agent_env}" chmod 600 "${_ssh_agent_env}" source "${_ssh_agent_env}" > /dev/null From af060f8dba0a5b37169e6d22bcb9b02a34e2a48f Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Tue, 31 Jan 2012 23:41:28 -0500 Subject: [PATCH 588/614] Fixed a comment in gnu-utils plugin. --- plugins/gnu-utils/init.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/gnu-utils/init.zsh b/plugins/gnu-utils/init.zsh index cf58a8e8c..8c6ca6a69 100644 --- a/plugins/gnu-utils/init.zsh +++ b/plugins/gnu-utils/init.zsh @@ -13,7 +13,7 @@ if (( $+commands[gdircolors] )); then local cmd local prefix - # coreutils + # GNU 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' From 37c2d352637a71bf242d78d749b0e22c385033f9 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Tue, 31 Jan 2012 23:42:01 -0500 Subject: [PATCH 589/614] Removed a few semicolons in gpg-agent plugin. --- plugins/gpg-agent/init.zsh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/plugins/gpg-agent/init.zsh b/plugins/gpg-agent/init.zsh index c38788414..f646271b3 100644 --- a/plugins/gpg-agent/init.zsh +++ b/plugins/gpg-agent/init.zsh @@ -22,16 +22,14 @@ function _gpg-agent-start() { if [[ -f "${GPG_ENV}" ]]; then source "${GPG_ENV}" > /dev/null ps -ef | grep "${SSH_AGENT_PID}" | grep gpg-agent > /dev/null || { - _gpg-agent-start; + _gpg-agent-start } else - _gpg-agent-start; + _gpg-agent-start fi export GPG_AGENT_INFO export SSH_AUTH_SOCK export SSH_AGENT_PID - -GPG_TTY=$(tty) -export GPG_TTY +export GPG_TTY="$(tty)" From 3802a3e61b77e2b80db5211698cd08ca07be1c2d Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Tue, 31 Jan 2012 23:44:00 -0500 Subject: [PATCH 590/614] Fixed the coding style in a case statement. --- themes/steeef/prompt_steeef_setup | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/themes/steeef/prompt_steeef_setup b/themes/steeef/prompt_steeef_setup index 0da78d743..9d52842ea 100644 --- a/themes/steeef/prompt_steeef_setup +++ b/themes/steeef/prompt_steeef_setup @@ -33,12 +33,12 @@ function prompt_steeef_precmd() { function prompt_steeef_preexec() { case "$(history $HISTCMD)" in - *git*) + (*git*) __PROMPT_STEEEF_VCS_UPDATE=1 - ;; - *svn*) + ;; + (*svn*) __PROMPT_STEEEF_VCS_UPDATE=1 - ;; + ;; esac } From e4e56f03124d113a9153d72a633a4b632b030e9e Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Tue, 31 Jan 2012 23:53:05 -0500 Subject: [PATCH 591/614] Prettify the default git log. --- plugins/git/alias.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/git/alias.zsh b/plugins/git/alias.zsh index d78778e8b..50284f6f4 100644 --- a/plugins/git/alias.zsh +++ b/plugins/git/alias.zsh @@ -116,7 +116,7 @@ git_log_format_oneline='--pretty=format:%C(green)%h%C(reset) %s%C(red)%d%C(reset git_log_format_oneline_more='--pretty=format:%C(green)%h%C(reset) %C(blue)%ad%C(reset) %s%C(red)%d%C(reset) [%C(magenta)%an%C(reset)]' git_log_format_medium='--pretty=format:%C(green)Commit: %H%C(red)%d%C(reset)%n%C(magenta)Author: %an <%ae>%C(reset)%n%C(blue)Date: %cd%C(reset)%n%+s%n%+b' -alias gl='git log' +alias gl='git log --topo-order ${git_log_format_medium}' compdef _git gl=git-log alias glo='git log --topo-order ${git_log_format_oneline}' compdef _git glo=git-log From 83876dd31943da995c8759ec760a9c546d71960e Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Wed, 1 Feb 2012 00:05:33 -0500 Subject: [PATCH 592/614] Fixed a few comments in dpkg plugin. --- plugins/dpkg/functions/dbb-build | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/dpkg/functions/dbb-build b/plugins/dpkg/functions/dbb-build index 4fa5567ca..11d3c5302 100644 --- a/plugins/dpkg/functions/dbb-build +++ b/plugins/dpkg/functions/dbb-build @@ -6,9 +6,9 @@ # Sorin Ionescu # -MAKEFLAGS='' # Temporarily unset MAKEFLAGS ( '-j3' will fail ). -appendage='-custom' # This shows up in $ (uname -r ). -revision=$(date +"%Y%m%d") # This shows up in the .deb file name. +MAKEFLAGS='' # Temporarily unset MAKEFLAGS ('-j3' will fail). +appendage='-custom' # Displayed in $(uname -r). +revision=$(date +"%Y%m%d") # Displayed in the dpkg package file name. make-kpkg clean From 3c13411dd0b3be4988bb7e1dc42f8b59a2f394f1 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Wed, 1 Feb 2012 00:24:37 -0500 Subject: [PATCH 593/614] Added the apt-history function to dpkg plugin. --- plugins/dpkg/functions/apt-history | 37 ++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 plugins/dpkg/functions/apt-history diff --git a/plugins/dpkg/functions/apt-history b/plugins/dpkg/functions/apt-history new file mode 100644 index 000000000..5ae1446a8 --- /dev/null +++ b/plugins/dpkg/functions/apt-history @@ -0,0 +1,37 @@ +# +# Displays dpkg history. +# +# Authors: +# Peter Leung +# Benjamin Boudreau +# Sorin Ionescu +# + +case "$1" in + (install) + zgrep --no-filename 'install ' $(ls -rt /var/log/dpkg*) + ;; + (upgrade|remove) + zgrep --no-filename $1 $(ls -rt /var/log/dpkg*) + ;; + (rollback) + zgrep --no-filename upgrade $(ls -rt /var/log/dpkg*) | \ + grep "$2" -A10000000 | \ + grep "$3" -B10000000 | \ + awk '{print $4"="$5}' + ;; + (list) + zcat $(ls -rt /var/log/dpkg*) + ;; + (*) + cat >&2 < Date: Thu, 2 Feb 2012 16:34:46 -0500 Subject: [PATCH 594/614] Use zstyles for screen and tmux plugin options. --- plugins/screen/init.zsh | 20 ++++++++++++++++---- plugins/tmux/init.zsh | 19 +++++++++++++++---- 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/plugins/screen/init.zsh b/plugins/screen/init.zsh index 02f914e35..791ea3069 100644 --- a/plugins/screen/init.zsh +++ b/plugins/screen/init.zsh @@ -1,19 +1,31 @@ # -# Defines GNU Screen aliases and provides for auto launching it at startup. +# Defines GNU Screen aliases and provides for auto launching it at start-up. # # Authors: # Sorin Ionescu # +# Usage: +# To auto start it, add the following to zshrc: +# +# # Auto launch GNU Screen at start-up. +# zstyle -t ':omz:plugin:screen:auto' start 'yes' +# # Aliases alias sl="screen -list" alias sn="screen -U -S" alias sr="screen -a -A -U -D -R" -# Auto -if (( $SHLVL == 1 )) && is-true "$AUTO_SCREEN"; then +# Auto Start +if (( $SHLVL == 1 )) && zstyle -t ':omz:plugin:screen:auto' start; then (( SHLVL += 1 )) && export SHLVL - session="$(screen -list 2> /dev/null | sed '1d;$d' | awk '{print $1}' | head -1)" + + session="$( + screen -list 2> /dev/null \ + | sed '1d;$d' \ + | awk '{print $1}' \ + | head -1)" + if [[ -n "$session" ]]; then exec screen -x "$session" else diff --git a/plugins/tmux/init.zsh b/plugins/tmux/init.zsh index e04d25cba..d0c7988e4 100644 --- a/plugins/tmux/init.zsh +++ b/plugins/tmux/init.zsh @@ -1,18 +1,29 @@ # -# Defines tmux aliases and provides for auto launching it at startup. +# Defines tmux aliases and provides for auto launching it at start-up. # # Authors: # Sorin Ionescu # +# Usage: +# To auto start it, add the following to zshrc: +# +# # Auto launch tmux at start-up. +# zstyle -t ':omz:plugin:tmux:auto' start 'yes' +# # Aliases alias ta="tmux attach-session" alias tl="tmux list-sessions" -# Auto -if (( $SHLVL == 1 )) && is-true "$AUTO_TMUX"; then +# Auto Start +if (( $SHLVL == 1 )) && zstyle -t ':omz:plugin:tmux:auto' start; then (( SHLVL += 1 )) && export SHLVL - session="$(tmux list-sessions 2> /dev/null | cut -d':' -f1 | head -1)" + + session="$( + tmux list-sessions 2> /dev/null \ + | cut -d':' -f1 \ + | head -1)" + if [[ -n "$session" ]]; then exec tmux attach-session -t "$session" else From 304530d99046328f63c30dbd9d053fb10f86f1df Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 2 Feb 2012 16:50:47 -0500 Subject: [PATCH 595/614] Filter other remote branches. --- plugins/git/completions/_git-hub | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/git/completions/_git-hub b/plugins/git/completions/_git-hub index 86a1f336f..904b8c544 100644 --- a/plugins/git/completions/_git-hub +++ b/plugins/git/completions/_git-hub @@ -26,6 +26,7 @@ case "$state" in remote="$words[(($CURRENT - 1))]" branches=($( git branch -r \ + | grep "${remote}/" \ | sed \ -e "/${remote}\/HEAD -> ${remote}/d" \ -e "s/^[[:space:]]*${remote}\///g" From 1a3940b9a30f6c85d2b46a05561e4ecd02122de8 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 2 Feb 2012 18:25:21 -0500 Subject: [PATCH 596/614] Added the ability to browse GitHub files. --- plugins/git/completions/_git-hub | 9 +++++++-- plugins/git/functions/git-hub | 5 +++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/plugins/git/completions/_git-hub b/plugins/git/completions/_git-hub index 904b8c544..ac17fd27a 100644 --- a/plugins/git/completions/_git-hub +++ b/plugins/git/completions/_git-hub @@ -8,11 +8,12 @@ # Sorin Ionescu # -local state remotes remote branches ret=1 +local state remotes remote branches files ret=1 _arguments -C -s -S \ '1::args:->remote' \ - '2::args:->branch' && ret=0 + '2::args:->branch' \ + '3::args:->file' && ret=0 case "$state" in (remote) @@ -33,6 +34,10 @@ case "$state" in )) _describe -t branch 'branches' branches && ret=0 ;; + (file) + files=(${(0)"$(_call_program files git ls-files -z --exclude-standard 2>/dev/null)"}) + _wanted file expl 'file' _multi_parts - / files && ret=0 + ;; esac return $ret diff --git a/plugins/git/functions/git-hub b/plugins/git/functions/git-hub index d3758d472..59cb82a2e 100644 --- a/plugins/git/functions/git-hub +++ b/plugins/git/functions/git-hub @@ -5,7 +5,7 @@ # Sorin Ionescu # -local remote branches branch current_branch url +local remote branches branch current_branch file url remote="${1:-origin}" url=$( @@ -18,6 +18,7 @@ branches=($( )) current_branch="$(git-branch)" branch="${2:-master}" +file="$3" if [[ -z "$2" ]]; then if (( $branches[(I)$current_branch] != 0 )); then @@ -28,7 +29,7 @@ if [[ -z "$2" ]]; then fi if [[ -n "$url" ]]; then - url="${url}/tree/${branch}" + url="${url}/tree/${branch}/${file}" if (( $+commands[$BROWSER] )); then "$BROWSER" "$url" From 16962c6817ffd976a75e21b7b44f6fa4d149cd8c Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 2 Feb 2012 20:03:17 -0500 Subject: [PATCH 597/614] Simplified Git log aliases using new formats. --- plugins/git/alias.zsh | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/plugins/git/alias.zsh b/plugins/git/alias.zsh index 50284f6f4..3449f66b4 100644 --- a/plugins/git/alias.zsh +++ b/plugins/git/alias.zsh @@ -112,24 +112,22 @@ compdef _git gkt=git-checkout alias gkT='gkt $(gkl)' # Log (l) -git_log_format_oneline='--pretty=format:%C(green)%h%C(reset) %s%C(red)%d%C(reset)' -git_log_format_oneline_more='--pretty=format:%C(green)%h%C(reset) %C(blue)%ad%C(reset) %s%C(red)%d%C(reset) [%C(magenta)%an%C(reset)]' -git_log_format_medium='--pretty=format:%C(green)Commit: %H%C(red)%d%C(reset)%n%C(magenta)Author: %an <%ae>%C(reset)%n%C(blue)Date: %cd%C(reset)%n%+s%n%+b' +git_log_format_medium='--pretty=format:%C(bold)Commit:%C(reset) %C(green)%H%C(red)%d%n%C(bold)Author:%C(reset) %C(cyan)%an <%ae>%n%C(bold)Date:%C(reset) %C(blue)%ai (%ar)%C(reset)%n%+B' +git_log_format_oneline='--pretty=format:%C(green)%h%C(reset) %s%n' +git_log_format_brief='--pretty=format:%C(green)%h%C(reset) %s%n%C(blue)(%ar by %an)%C(red)%d%C(reset)%n' alias gl='git log --topo-order ${git_log_format_medium}' compdef _git gl=git-log -alias glo='git log --topo-order ${git_log_format_oneline}' -compdef _git glo=git-log -alias glO='git log --topo-order --date=short ${git_log_format_oneline_more}' -compdef _git glO=git-log -alias glg='git log --topo-order --all --graph ${git_log_format_oneline}' -compdef _git glg=git-log -alias glG='git log --topo-order --all --graph --date=short ${git_log_format_oneline_more}' -compdef _git glG=git-log alias gls='git log --topo-order --stat ${git_log_format_medium}' compdef _git gls=git-log alias gld='git log --topo-order --stat --patch --full-diff ${git_log_format_medium}' compdef _git gld=git-log +alias glo='git log --topo-order ${git_log_format_oneline}' +compdef _git glo=git-log +alias glg='git log --topo-order --all --graph ${git_log_format_oneline}' +compdef _git glg=git-log +alias glb='git log --topo-order ${git_log_format_brief}' +compdef _git glb=git-log alias glc='git shortlog --summary --numbered' compdef _git glc=git-shortlog From 33d0ecb9be24842f5433ba914d5bb34150c5f3e9 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Fri, 3 Feb 2012 17:49:40 -0500 Subject: [PATCH 598/614] Initialize rbenv for Zsh. --- plugins/ruby/init.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/ruby/init.zsh b/plugins/ruby/init.zsh index c1c877aa6..83b8b0ae0 100644 --- a/plugins/ruby/init.zsh +++ b/plugins/ruby/init.zsh @@ -26,6 +26,6 @@ fi # Loads rbenv into the shell session. if [[ -s "$HOME/.rbenv/bin/rbenv" ]]; then path=("$HOME/.rbenv/bin" $path) - eval "$(rbenv init -)" + eval "$(rbenv init - zsh)" fi From 33ee2a0bd4653010f595027db8ace0c3f0d93ff6 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sat, 4 Feb 2012 00:08:27 -0500 Subject: [PATCH 599/614] Revert "Do not assume a specific Ruby version." This reverts commit b0d47546fe920ac6a91c31078f399f947a36a9d9. It is not feasible to use multiple Ruby versions without RVM. --- plugins/ruby/init.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/ruby/init.zsh b/plugins/ruby/init.zsh index 83b8b0ae0..d2ad9d065 100644 --- a/plugins/ruby/init.zsh +++ b/plugins/ruby/init.zsh @@ -7,7 +7,7 @@ # Install local gems according to Mac OS X conventions. if [[ "$OSTYPE" == darwin* ]]; then - export GEM_HOME="$HOME/Library/Ruby/Gems/${$(ruby --version)[6,8]}" + export GEM_HOME=$HOME/Library/Ruby/Gems/1.8 path=("$GEM_HOME/bin" $path) # Set environment variables for launchd processes. From 92e8d67e5d89717c476e72b199119835b86f59b2 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Tue, 7 Feb 2012 18:27:12 -0500 Subject: [PATCH 600/614] Use vendor/bundle for bundler install path. --- plugins/bundler/init.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/bundler/init.zsh b/plugins/bundler/init.zsh index 9fdb15356..7e28cc630 100644 --- a/plugins/bundler/init.zsh +++ b/plugins/bundler/init.zsh @@ -9,7 +9,7 @@ # Aliases alias b='bundle' alias be='b exec' -alias bi='b install --path vendor' +alias bi='b install --path vendor/bundle' alias bl='b list' alias bo='b open' alias bp='b package' From 42fc29e6a897c7a68a4cf6f7d4561adf00607efa Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 9 Feb 2012 12:37:42 -0500 Subject: [PATCH 601/614] Unset GEM_HOME if RVM or rbenv are installed. --- plugins/ruby/init.zsh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/ruby/init.zsh b/plugins/ruby/init.zsh index d2ad9d065..f3878f4a0 100644 --- a/plugins/ruby/init.zsh +++ b/plugins/ruby/init.zsh @@ -16,6 +16,9 @@ fi # Loads RVM into the shell session. if [[ -s "$HOME/.rvm/scripts/rvm" ]]; then + # Let RVM manage the GEM_HOME. + unset GEM_HOME + # Auto adding variable-stored paths to ~ list conflicts with RVM. unsetopt AUTO_NAME_DIRS @@ -25,6 +28,9 @@ fi # Loads rbenv into the shell session. if [[ -s "$HOME/.rbenv/bin/rbenv" ]]; then + # Let rbenv manage the GEM_HOME. + unset GEM_HOME + path=("$HOME/.rbenv/bin" $path) eval "$(rbenv init - zsh)" fi From 06b989ebbb072569af8c87cd19a1820128659068 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 9 Feb 2012 14:17:53 -0500 Subject: [PATCH 602/614] Simplified rvm, rbenv, and Mac OS X Ruby settings. --- plugins/ruby/init.zsh | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/plugins/ruby/init.zsh b/plugins/ruby/init.zsh index f3878f4a0..7f09e5180 100644 --- a/plugins/ruby/init.zsh +++ b/plugins/ruby/init.zsh @@ -5,33 +5,25 @@ # Sorin Ionescu # -# Install local gems according to Mac OS X conventions. -if [[ "$OSTYPE" == darwin* ]]; then - export GEM_HOME=$HOME/Library/Ruby/Gems/1.8 - path=("$GEM_HOME/bin" $path) - - # Set environment variables for launchd processes. - launchctl setenv GEM_HOME "$GEM_HOME" &! -fi - # Loads RVM into the shell session. if [[ -s "$HOME/.rvm/scripts/rvm" ]]; then - # Let RVM manage the GEM_HOME. - unset GEM_HOME - # Auto adding variable-stored paths to ~ list conflicts with RVM. unsetopt AUTO_NAME_DIRS # Source RVM. source "$HOME/.rvm/scripts/rvm" -fi - # Loads rbenv into the shell session. -if [[ -s "$HOME/.rbenv/bin/rbenv" ]]; then - # Let rbenv manage the GEM_HOME. - unset GEM_HOME - +elif [[ -s "$HOME/.rbenv/bin/rbenv" ]]; then path=("$HOME/.rbenv/bin" $path) eval "$(rbenv init - zsh)" +else + # Install local gems according to Mac OS X conventions. + if [[ "$OSTYPE" == darwin* ]]; then + export GEM_HOME="$HOME/Library/Ruby/Gems/1.8" + path=("$GEM_HOME/bin" $path) + + # Set environment variables for launchd processes. + launchctl setenv GEM_HOME "$GEM_HOME" &! + fi fi From de61ae06639434140623d4e6e7e864a8dcb1054c Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 9 Feb 2012 14:19:30 -0500 Subject: [PATCH 603/614] Do not export GEM_HOME in launchd. Exporting GEM_HOME in launchd conflicts with RVM and rbenv. There are currently no known GUI programs that need it. --- plugins/ruby/init.zsh | 3 --- 1 file changed, 3 deletions(-) diff --git a/plugins/ruby/init.zsh b/plugins/ruby/init.zsh index 7f09e5180..0ddc403f7 100644 --- a/plugins/ruby/init.zsh +++ b/plugins/ruby/init.zsh @@ -21,9 +21,6 @@ else if [[ "$OSTYPE" == darwin* ]]; then export GEM_HOME="$HOME/Library/Ruby/Gems/1.8" path=("$GEM_HOME/bin" $path) - - # Set environment variables for launchd processes. - launchctl setenv GEM_HOME "$GEM_HOME" &! fi fi From 63b666ba86ec30320945b1941b3543ba48c7dcfe Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 9 Feb 2012 14:28:47 -0500 Subject: [PATCH 604/614] Merged the bundler plugin into the ruby plugin. Gem management without bundler is a pain. Ruby and bundler are inseparable. --- plugins/bundler/init.zsh | 18 ------------------ plugins/ruby/init.zsh | 9 +++++++++ 2 files changed, 9 insertions(+), 18 deletions(-) delete mode 100644 plugins/bundler/init.zsh diff --git a/plugins/bundler/init.zsh b/plugins/bundler/init.zsh deleted file mode 100644 index 7e28cc630..000000000 --- a/plugins/bundler/init.zsh +++ /dev/null @@ -1,18 +0,0 @@ -# -# Defines bundler aliases. -# -# Authors: -# Myron Marston -# Sorin Ionescu -# - -# Aliases -alias b='bundle' -alias be='b exec' -alias bi='b install --path vendor/bundle' -alias bl='b list' -alias bo='b open' -alias bp='b package' -alias bu='b update' -alias binit="bi && b package && print '\nvendor/ruby' >>! .gitignore" - diff --git a/plugins/ruby/init.zsh b/plugins/ruby/init.zsh index 0ddc403f7..c958e36a0 100644 --- a/plugins/ruby/init.zsh +++ b/plugins/ruby/init.zsh @@ -24,3 +24,12 @@ else fi fi +# Aliases +alias b='bundle' +alias be='b exec' +alias bi='b install --path vendor/bundle' +alias bl='b list' +alias bo='b open' +alias bp='b package' +alias bu='b update' +alias binit="bi && b package && print '\nvendor/ruby' >>! .gitignore" From 58874461bbd1bbb6bd4442745dec54dcfec57790 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 9 Feb 2012 22:20:36 -0500 Subject: [PATCH 605/614] Renamed binit to bI and fixed bundle .gitignore. --- plugins/ruby/init.zsh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/ruby/init.zsh b/plugins/ruby/init.zsh index c958e36a0..93c5b62b1 100644 --- a/plugins/ruby/init.zsh +++ b/plugins/ruby/init.zsh @@ -32,4 +32,9 @@ alias bl='b list' alias bo='b open' alias bp='b package' alias bu='b update' -alias binit="bi && b package && print '\nvendor/ruby' >>! .gitignore" +alias bI='bi \ + && b package \ + && print .bundle >>! .gitignore \ + && print vendor/bundle >>! .gitignore \ + && print vendor/cache >>! .gitignore' + From 0829f921db39c5600b986a760bfb420152b12489 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Thu, 9 Feb 2012 22:31:04 -0500 Subject: [PATCH 606/614] Added support for package manager installed rbenv. --- plugins/ruby/init.zsh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/ruby/init.zsh b/plugins/ruby/init.zsh index 93c5b62b1..1d87e7183 100644 --- a/plugins/ruby/init.zsh +++ b/plugins/ruby/init.zsh @@ -12,10 +12,13 @@ if [[ -s "$HOME/.rvm/scripts/rvm" ]]; then # Source RVM. source "$HOME/.rvm/scripts/rvm" -# Loads rbenv into the shell session. +# Loads manually installed rbenv into the shell session. elif [[ -s "$HOME/.rbenv/bin/rbenv" ]]; then path=("$HOME/.rbenv/bin" $path) eval "$(rbenv init - zsh)" +# Loads package manager installed rbenv into the shell session. +elif (( $+commands[rbenv] )); then + eval "$(rbenv init - zsh)" else # Install local gems according to Mac OS X conventions. if [[ "$OSTYPE" == darwin* ]]; then From 3f3b2328f964358cd77b3bfa48ce168218d1cc74 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Fri, 3 Feb 2012 19:12:47 -0500 Subject: [PATCH 607/614] Added support for ignoring Git submodules. --- plugins/git/functions/git-info | 15 ++++++++++++++- plugins/git/style.zsh | 6 ++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/plugins/git/functions/git-info b/plugins/git/functions/git-info index a0e4e0e0f..197cd2a0f 100644 --- a/plugins/git/functions/git-info +++ b/plugins/git/functions/git-info @@ -147,6 +147,9 @@ function git-info() { local rprompt local git_info_var local -A git_info_vars + local status_cmd + local ignore_submodule + local ignore_submodule_when # Clean up previous Git info. unset git_prompt_info @@ -176,6 +179,16 @@ function git-info() { # Used to abort and turn git-info off on SIGINT. _git_info_executing=true + # Use short status for easy parsing. + status_cmd='git status --short --branch' + + # Ignore submodule status. + zstyle -b ':omz:plugin:git:prompt:ignore' submodule ignore_submodule + zstyle -s ':omz:plugin:git:prompt:ignore:submodule' when ignore_submodule_when + if is-true "$ignore_submodule"; then + status_cmd+=" --ignore-submodules=${ignore_submodule_when:-all}" + fi + # Get commit. commit="$(git rev-parse HEAD 2> /dev/null)" @@ -248,7 +261,7 @@ function git-info() { [[ "$line" == UU\ * ]] && (( unmerged++ )) [[ "$line" == \?\?\ * ]] && (( untracked++ )) fi - done < <(git status --short --branch 2> /dev/null) + done < <("${(z)status_cmd}" 2> /dev/null) # Format branch. zstyle -s ':omz:plugin:git:prompt' branch branch_format diff --git a/plugins/git/style.zsh b/plugins/git/style.zsh index 218e87aac..9f0a6102c 100644 --- a/plugins/git/style.zsh +++ b/plugins/git/style.zsh @@ -56,3 +56,9 @@ zstyle ':omz:plugin:git:prompt' prompt ' git:(%b %D%C)' # Right prompt. zstyle ':omz:plugin:git:prompt' rprompt '' +# Ignore submodule. +zstyle ':omz:plugin:git:prompt:ignore' submodule 'no' + +# Ignore submodule when it is 'dirty', 'untracked', 'all', or 'none'. +zstyle ':omz:plugin:git:prompt:ignore:submodule' when 'all' + From 60b15d0035346449f4a800e6f233305b1cfda16f Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Fri, 3 Feb 2012 22:32:14 -0500 Subject: [PATCH 608/614] Improved the coding style of git-info. --- plugins/git/functions/git-info | 75 +++++++++++++++++++--------------- 1 file changed, 43 insertions(+), 32 deletions(-) diff --git a/plugins/git/functions/git-info b/plugins/git/functions/git-info index 197cd2a0f..5d0e7d3a5 100644 --- a/plugins/git/functions/git-info +++ b/plugins/git/functions/git-info @@ -156,7 +156,7 @@ function git-info() { unset git_rprompt_info # Return if not inside a Git repository work tree. - if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then + if ! is-true "$(git rev-parse --is-inside-work-tree 2>/dev/null)"; then return 1 fi @@ -183,57 +183,60 @@ function git-info() { status_cmd='git status --short --branch' # Ignore submodule status. - zstyle -b ':omz:plugin:git:prompt:ignore' submodule ignore_submodule - zstyle -s ':omz:plugin:git:prompt:ignore:submodule' when ignore_submodule_when + zstyle -b \ + ':omz:plugin:git:prompt:ignore' submodule 'ignore_submodule' + zstyle -s \ + ':omz:plugin:git:prompt:ignore:submodule' when 'ignore_submodule_when' if is-true "$ignore_submodule"; then status_cmd+=" --ignore-submodules=${ignore_submodule_when:-all}" fi # Get commit. - commit="$(git rev-parse HEAD 2> /dev/null)" + commit="$(git rev-parse HEAD 2>/dev/null)" # Format commit (short). commit_short="$commit[1,7]" - zstyle -s ':omz:plugin:git:prompt' commit commit_format + zstyle -s ':omz:plugin:git:prompt' commit 'commit_format' zformat -f commit_formatted "$commit_format" "c:$commit_short" # Stashed if [[ -f "$(git-root)/.git/refs/stash" ]]; then stashed="$(git stash list 2>/dev/null | wc -l)" - zstyle -s ':omz:plugin:git:prompt' stashed stashed_format + zstyle -s ':omz:plugin:git:prompt' stashed 'stashed_format' zformat -f stashed_formatted "$stashed_format" "S:$stashed" fi # Assume that the working copy is clean. - zstyle -s ':omz:plugin:git:prompt' clean clean_formatted + zstyle -s ':omz:plugin:git:prompt' clean 'clean_formatted' while IFS=$'\n' read line; do (( line_number++ )) - if (( line_number == 1)) && [[ "$line" == *'(no branch)'* ]]; then + if (( line_number == 1 )) && [[ "$line" == *'(no branch)'* ]]; then # Set branch to commit (short) when the branch is not found. branch="$commit_short" # Get action. action="$(_git-action)" if [[ -n "$action" ]]; then - zstyle -s ':omz:plugin:git:prompt' action action_format + zstyle -s ':omz:plugin:git:prompt' action 'action_format' zformat -f action_formatted "$action_format" "s:$action" fi elif (( line_number == 1 )) \ - && [[ "$line" == (#b)'## Initial commit on '(?##) ]]; then + && [[ "$line" == (#b)'## Initial commit on '(?##) ]]; + then branch="$match[1]" elif (( line_number == 1 )); then # Split the line into an array for parsing. branch_info=(${(s: :)line}) # Match: master...origin/master - if [[ $branch_info[2] == (#b)(?##)...(?##/?##) ]]; then + if [[ "$branch_info[2]" == (#b)(?##)...(?##/?##) ]]; then branch="$match[1]" remote="$match[2]" # Match: [ahead or [behind - if [[ $branch_info[3] == (#b)\[(ahead|behind) ]]; then + if [[ "$branch_info[3]" == (#b)\[(ahead|behind) ]]; then ahead_or_behind="$match[1]" if [[ "$ahead_or_behind" == 'behind' ]]; then # Extract digits: 10] @@ -246,12 +249,17 @@ function git-info() { fi fi # Match: master - elif [[ $branch_info[2] == (#b)(?##) ]]; then - branch=$match[1] + elif [[ "$branch_info[2]" == (#b)(?##) ]]; then + branch="$match[1]" fi else # Format dirty. - [[ -z "$dirty" ]] && zstyle -s ':omz:plugin:git:prompt' dirty dirty_formatted && unset clean_formatted + if [[ -z "$dirty" ]]; then + zstyle -s ':omz:plugin:git:prompt' dirty 'dirty_formatted' + if [[ -z "$dirty_formatted" ]]; then + unset clean_formatted + fi + fi # Count: added/deleted/modified/renamed/unmerged/untracked [[ "$line" == (((A|M|D|T) )|(AD|AM|AT|MM))\ * ]] && (( added++ )) @@ -261,72 +269,75 @@ function git-info() { [[ "$line" == UU\ * ]] && (( unmerged++ )) [[ "$line" == \?\?\ * ]] && (( untracked++ )) fi - done < <("${(z)status_cmd}" 2> /dev/null) + done < <("${(z)status_cmd}" 2>/dev/null) # Format branch. - zstyle -s ':omz:plugin:git:prompt' branch branch_format + zstyle -s ':omz:plugin:git:prompt' branch 'branch_format' zformat -f branch_formatted "$branch_format" "b:$branch" # Format remote. if [[ "$branch" != "$commit" ]]; then - [[ -z $remote ]] \ - && remote=${$(git rev-parse --verify ${branch}@{upstream} \ - --symbolic-full-name 2> /dev/null)#refs/remotes/} - zstyle -s ':omz:plugin:git:prompt' remote remote_format + if [[ -z "$remote" ]]; then + remote="${$( \ + git rev-parse \ + --verify ${branch}@{upstream} \ + --symbolic-full-name 2>/dev/null)#refs/remotes/}" + fi + zstyle -s ':omz:plugin:git:prompt' remote 'remote_format' zformat -f remote_formatted "$remote_format" "R:$remote" fi # Format ahead. if [[ -n "$ahead" ]]; then - zstyle -s ':omz:plugin:git:prompt' ahead ahead_format + zstyle -s ':omz:plugin:git:prompt' ahead 'ahead_format' zformat -f ahead_formatted "$ahead_format" "A:$ahead" fi # Format behind. if [[ -n "$behind" ]]; then - zstyle -s ':omz:plugin:git:prompt' behind behind_format + zstyle -s ':omz:plugin:git:prompt' behind 'behind_format' zformat -f behind_formatted "$behind_format" "B:$behind" fi # Format added. if (( $added > 0 )); then - zstyle -s ':omz:plugin:git:prompt' added added_format + zstyle -s ':omz:plugin:git:prompt' added 'added_format' zformat -f added_formatted "$added_format" "a:$added_format" fi # Format deleted. if (( $deleted > 0 )); then - zstyle -s ':omz:plugin:git:prompt' deleted deleted_format + zstyle -s ':omz:plugin:git:prompt' deleted 'deleted_format' zformat -f deleted_formatted "$deleted_format" "d:$deleted_format" fi # Format modified. if (( $modified > 0 )); then - zstyle -s ':omz:plugin:git:prompt' modified modified_format + zstyle -s ':omz:plugin:git:prompt' modified 'modified_format' zformat -f modified_formatted "$modified_format" "m:$modified" fi # Format renamed. if (( $renamed > 0 )); then - zstyle -s ':omz:plugin:git:prompt' renamed renamed_format + zstyle -s ':omz:plugin:git:prompt' renamed 'renamed_format' zformat -f renamed_formatted "$renamed_format" "r:$renamed" fi # Format unmerged. if (( $unmerged > 0 )); then - zstyle -s ':omz:plugin:git:prompt' unmerged unmerged_format + zstyle -s ':omz:plugin:git:prompt' unmerged 'unmerged_format' zformat -f unmerged_formatted "$unmerged_format" "U:$unmerged" fi # Format untracked. if (( $untracked > 0 )); then - zstyle -s ':omz:plugin:git:prompt' untracked untracked_format + zstyle -s ':omz:plugin:git:prompt' untracked 'untracked_format' zformat -f untracked_formatted "$untracked_format" "u:$untracked" fi # Format prompts. - zstyle -s ':omz:plugin:git:prompt' prompt prompt_format - zstyle -s ':omz:plugin:git:prompt' rprompt rprompt_format + zstyle -s ':omz:plugin:git:prompt' prompt 'prompt_format' + zstyle -s ':omz:plugin:git:prompt' rprompt 'rprompt_format' git_info_vars=( git_prompt_info "$prompt_format" @@ -334,7 +345,7 @@ function git-info() { ) for git_info_var in ${(k)git_info_vars}; do - zformat -f $git_info_var $git_info_vars[$git_info_var] \ + zformat -f "$git_info_var" "$git_info_vars[$git_info_var]" \ "s:$action_formatted" \ "a:$added_formatted" \ "A:$ahead_formatted" \ From 37ba1cbc98b106eda950c2cc909a201ca4f556cd Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Tue, 7 Feb 2012 18:30:15 -0500 Subject: [PATCH 609/614] Added an alias to git stash include untracked. --- plugins/git/alias.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/git/alias.zsh b/plugins/git/alias.zsh index 3449f66b4..8bdbd567b 100644 --- a/plugins/git/alias.zsh +++ b/plugins/git/alias.zsh @@ -207,6 +207,8 @@ alias gsp='git stash pop' compdef _git gsp=git-stash alias gss='git stash save' compdef _git gss=git-stash +alias gsS='git stash save --include-untracked' +compdef _git gsS=git-stash alias gsS='git stash save --patch --no-keep-index' compdef _git gsS=git-stash From e29049a4e35eca6fb418ae52c0baa5b578e0378f Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Fri, 10 Feb 2012 16:37:20 -0500 Subject: [PATCH 610/614] Fixed the git stash save alias. --- plugins/git/alias.zsh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/plugins/git/alias.zsh b/plugins/git/alias.zsh index 8bdbd567b..5a9be8dea 100644 --- a/plugins/git/alias.zsh +++ b/plugins/git/alias.zsh @@ -205,10 +205,8 @@ alias gsL='git stash show --patch --stat' compdef _git gsL=git-stash alias gsp='git stash pop' compdef _git gsp=git-stash -alias gss='git stash save' +alias gss='git stash save --include-untracked' compdef _git gss=git-stash -alias gsS='git stash save --include-untracked' -compdef _git gsS=git-stash alias gsS='git stash save --patch --no-keep-index' compdef _git gsS=git-stash From 81789a06a27805f59850bb71da98bc655afa8388 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sat, 18 Feb 2012 19:35:44 -0500 Subject: [PATCH 611/614] Added missing sbin directories in PATH. --- environment.zsh | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/environment.zsh b/environment.zsh index 9c170cd26..fe36881bf 100644 --- a/environment.zsh +++ b/environment.zsh @@ -48,14 +48,11 @@ for path_file in /etc/manpaths.d/*(.N); do done path=( - $HOME/.tilde/bin - $HOME/.tilde/opt/bin - /usr/local/bin - /usr/local/sbin - /usr/bin - /bin - /usr/sbin - /sbin + $HOME/.tilde/{bin,sbin} + $HOME/.tilde/opt/{bin,sbin} + /usr/local/{bin,sbin} + /usr/{bin,sbin} + /{bin,sbin} ) for path_file in /etc/paths.d/*(.N); do From d5884e79b79ea74bc092c18a2c67825058de1280 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Mon, 20 Feb 2012 12:49:47 -0500 Subject: [PATCH 612/614] Removed hard coded locale, fixed #9. --- environment.zsh | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/environment.zsh b/environment.zsh index fe36881bf..d00d7a50b 100644 --- a/environment.zsh +++ b/environment.zsh @@ -60,14 +60,9 @@ for path_file in /etc/paths.d/*(.N); do done # Language -export LANG="en_AU.UTF-8" -export LC_ALL="$LANG" -export LC_COLLATE="$LANG" -export LC_CTYPE="$LANG" -export LC_MESSAGES="$LANG" -export LC_MONETARY="$LANG" -export LC_NUMERIC="$LANG" -export LC_TIME="$LANG" +if [[ -z "$LANG" ]]; then + eval "$(locale)" +fi # Editors export EDITOR="vim" From ae42652604f8201760164967d2e138aa16eff8a2 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Mon, 20 Feb 2012 13:13:50 -0500 Subject: [PATCH 613/614] Updated completions. --- completions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/completions b/completions index 62436acb8..4009c2ace 160000 --- a/completions +++ b/completions @@ -1 +1 @@ -Subproject commit 62436acb8acbc3db4993142e84b4e851ab744213 +Subproject commit 4009c2ace429c58d9eeaf1f21a8501d537d2f258 From da886631862f337990b61e6fb60e375a23e7cf06 Mon Sep 17 00:00:00 2001 From: meh Date: Tue, 28 Feb 2012 15:00:30 +0100 Subject: [PATCH 614/614] Fix SSH Agent identities. --- plugins/ssh-agent/init.zsh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/plugins/ssh-agent/init.zsh b/plugins/ssh-agent/init.zsh index 486d519f1..4996f22fc 100644 --- a/plugins/ssh-agent/init.zsh +++ b/plugins/ssh-agent/init.zsh @@ -27,14 +27,21 @@ function _ssh-agent-start() { local -a identities # Start ssh-agent and setup the environment. - /usr/bin/env ssh-agent | sed 's/^print/#print/' > "${_ssh_agent_env}" + rm -f "${_ssh_agent_env}" + ssh-agent > "${_ssh_agent_env}" chmod 600 "${_ssh_agent_env}" source "${_ssh_agent_env}" > /dev/null # Load identies. zstyle -a ':omz:plugin:ssh-agent' identities 'identities' - print starting... - /usr/bin/ssh-add "$HOME/.ssh/${^identities}" + + print starting ssh-agent... + + if [[ ! -n "${identities}" ]]; then + ssh-add + else + ssh-add "$HOME/.ssh/${^identities}" + fi } # Test if agent-forwarding is enabled.