From e585904e1040acedd2fc3092ef99a3a9aaa0d661 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Ko=C5=A1=C4=8Do?= <3k.stanley@gmail.com> Date: Thu, 2 Jan 2014 00:35:19 +0100 Subject: [PATCH 001/537] Geeknote autocomplete and alias --- plugins/geeknote/_geeknote | 135 +++++++++++++++++++++++++++ plugins/geeknote/geeknote.plugin.zsh | 2 + 2 files changed, 137 insertions(+) create mode 100644 plugins/geeknote/_geeknote create mode 100644 plugins/geeknote/geeknote.plugin.zsh diff --git a/plugins/geeknote/_geeknote b/plugins/geeknote/_geeknote new file mode 100644 index 00000000..4d5339f2 --- /dev/null +++ b/plugins/geeknote/_geeknote @@ -0,0 +1,135 @@ +#compdef geeknote +# --------------- ------------------------------------------------------------ +# Name : _geeknote +# Synopsis : zsh completion for geeknote +# Author : Ján Koščo <3k.stanley@gmail.com> +# HomePage : http://www.geeknote.me +# Version : 0.1 +# Tag : [ shell, zsh, completion, evernote ] +# Copyright : © 2014 by Ján Koščo, +# Released under current GPL license. +# --------------- ------------------------------------------------------------ + +local -a _1st_arguments +_1st_arguments=( + 'login' + 'logout' + 'settings' + 'create' + 'edit' + 'find' + 'show' + 'remove' + 'notebook-list' + 'notebook-create' + 'notebook-edit' + 'tag-list' + 'tag-create' + 'tag-edit' + 'gnsync' + 'user' +) + +_arguments '*:: :->command' + +if (( CURRENT == 1 )); then + _describe -t commands "geeknote command" _1st_arguments + return +fi + +local -a _command_args +case "$words[1]" in + user) + _command_args=( + '(--full)--full' \ + ) + ;; + logout) + _command_args=( + '(--force)--force' \ + ) + ;; + settings) + _command_args=( + '(--editor)--editor' \ + ) + ;; + create) + _command_args=( + '(-t|--title)'{-t,--title}'[note title]' \ + '(-c|--content)'{-c,--content}'[note content]' \ + '(-tg|--tags)'{-tg,--tags}'[one tag or the list of tags which will be added to the note]' \ + '(-nb|--notebook)'{-nb,--notebook}'[name of notebook where to save note]' \ + ) + ;; + edit) + _command_args=( + '(-n|--note)'{-n,--note}'[name or ID from the previous search of a note to edit]' \ + '(-t|--title)'{-t,--title}'[note title]' \ + '(-c|--content)'{-c,--content}'[note content]' \ + '(-tg|--tags)'{-tg,--tags}'[one tag or the list of tags which will be added to the note]' \ + '(-nb|--notebook)'{-nb,--notebook}'[name of notebook where to save note]' \ + ) + ;; + remove) + _command_args=( + '(-n|--note)'{-n,--note}'[name or ID from the previous search of a note to edit]' \ + '(--force)--force' \ + ) + ;; + show) + _command_args=( + '(-n|--note)'{-n,--note}'[name or ID from the previous search of a note to edit]' \ + ) + ;; + find) + _command_args=( + '(-s|--search)'{-s,--search}'[text to search]' \ + '(-tg|--tags)'{-tg,--tags}'[notes with which tag/tags to search]' \ + '(-nb|--notebook)'{-nb,--notebook}'[in which notebook search the note]' \ + '(-d|--date)'{-d,--date}'[date in format dd.mm.yyyy or date range dd.mm.yyyy-dd.mm.yyyy]' \ + '(-cn|--count)'{-cn,--count}'[how many notes show in the result list]' \ + '(-wu|--with-url)'{-wu,--with-url}'[add direct url of each note in results to Evernote web-version]' \ + '(-ee|--exact-entry)'{-ee,--exact-entry}'[search for exact entry of the request]' \ + '(-cs|--content-search)'{-cs,--content-search}'[search by content, not by title]' \ + ) + ;; + notebook-create) + _command_args=( + '(-t|--title)'{-t,--title}'[notebook title]' \ + ) + ;; + notebook-edit) + _command_args=( + '(-nb|--notebook)'{-nb,--notebook}'[name of notebook to rename]' \ + '(-t|--title)'{-t,--title}'[new notebook title]' \ + ) + ;; + notebook-remove) + _command_args=( + '(-nb|--notebook)'{-nb,--notebook}'[name of notebook to remove]' \ + '(--force)--force' \ + ) + ;; + tag-create) + _command_args=( + '(-t|--title)'{-t,--title}'[title of tag]' \ + ) + ;; + tag-create) + _command_args=( + '(-tgn|--tagname)'{-tgn,--tagname}'[tag to edit]' \ + '(-t|--title)'{-t,--title}'[new tag name]' \ + ) + ;; + tag-remove) + _command_args=( + '(-tgn|--tagname)'{-tgn,--tagname}'[tag to remove]' \ + '(--force)--force' \ + ) + ;; + esac + +_arguments \ + $_command_args \ + && return 0 diff --git a/plugins/geeknote/geeknote.plugin.zsh b/plugins/geeknote/geeknote.plugin.zsh new file mode 100644 index 00000000..8126d26b --- /dev/null +++ b/plugins/geeknote/geeknote.plugin.zsh @@ -0,0 +1,2 @@ +#Alias +alias gn='geeknote' From aac85f095e302c72b109801063da8d8c4d13af3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Ko=C5=A1=C4=8Do?= <3k.stanley@gmail.com> Date: Fri, 22 Aug 2014 23:11:52 +0200 Subject: [PATCH 002/537] Proper handling of tags --- plugins/geeknote/_geeknote | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/geeknote/_geeknote b/plugins/geeknote/_geeknote index 4d5339f2..2d1188e8 100644 --- a/plugins/geeknote/_geeknote +++ b/plugins/geeknote/_geeknote @@ -26,6 +26,7 @@ _1st_arguments=( 'tag-list' 'tag-create' 'tag-edit' + 'tag-remove' 'gnsync' 'user' ) @@ -116,7 +117,7 @@ case "$words[1]" in '(-t|--title)'{-t,--title}'[title of tag]' \ ) ;; - tag-create) + tag-edit) _command_args=( '(-tgn|--tagname)'{-tgn,--tagname}'[tag to edit]' \ '(-t|--title)'{-t,--title}'[new tag name]' \ From b3d27be944c36b15900c9e11a6d1495096d43ba1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Ko=C5=A1=C4=8Do?= <3k.stanley@gmail.com> Date: Fri, 22 Aug 2014 23:12:02 +0200 Subject: [PATCH 003/537] Update seach parameter --- plugins/geeknote/_geeknote | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/geeknote/_geeknote b/plugins/geeknote/_geeknote index 2d1188e8..cf1a187d 100644 --- a/plugins/geeknote/_geeknote +++ b/plugins/geeknote/_geeknote @@ -90,7 +90,7 @@ case "$words[1]" in '(-nb|--notebook)'{-nb,--notebook}'[in which notebook search the note]' \ '(-d|--date)'{-d,--date}'[date in format dd.mm.yyyy or date range dd.mm.yyyy-dd.mm.yyyy]' \ '(-cn|--count)'{-cn,--count}'[how many notes show in the result list]' \ - '(-wu|--with-url)'{-wu,--with-url}'[add direct url of each note in results to Evernote web-version]' \ + '(-uo|--url-only)'{-uo,--url-only}'[add direct url of each note in results to Evernote web-version]' \ '(-ee|--exact-entry)'{-ee,--exact-entry}'[search for exact entry of the request]' \ '(-cs|--content-search)'{-cs,--content-search}'[search by content, not by title]' \ ) From a6ab704482f3f092b907a306eec2b3b8d908a5da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Ko=C5=A1=C4=8Do?= <3k.stanley@gmail.com> Date: Mon, 1 Sep 2014 20:08:29 +0200 Subject: [PATCH 004/537] Added a short description of the plugin --- plugins/geeknote/README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 plugins/geeknote/README.md diff --git a/plugins/geeknote/README.md b/plugins/geeknote/README.md new file mode 100644 index 00000000..a6b50e27 --- /dev/null +++ b/plugins/geeknote/README.md @@ -0,0 +1,12 @@ +## ZSH-Geeknote + +[Geeknote](https://github.com/VitaliyRodnenko/geeknote) plugin for [oh-my-zsh framework](http://github.com/robbyrussell/oh-my-zsh). + +Plugins provides: + +- auto completion of commands and their options +- alias `gn` + +You can find information how to install Geeknote and it's available commands on the [project website](http://www.geeknote.me/). + +Maintainer : Ján Koščo ([@s7anley](https://twitter.com/s7anley)) From b7fcdc736417086c3623888763f3ba7a40162fb1 Mon Sep 17 00:00:00 2001 From: Manfred Touron Date: Thu, 13 Nov 2014 19:00:27 +0100 Subject: [PATCH 005/537] [tmux-cssh plugin] Initial version --- plugins/tmux-cssh/_tmux-cssh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 plugins/tmux-cssh/_tmux-cssh diff --git a/plugins/tmux-cssh/_tmux-cssh b/plugins/tmux-cssh/_tmux-cssh new file mode 100644 index 00000000..604e2e47 --- /dev/null +++ b/plugins/tmux-cssh/_tmux-cssh @@ -0,0 +1,25 @@ +#compdef tmux-cssh + +# tmux-cssh autocompletion for oh-my-zsh +# Requires: tmux-cssh installed +# Author: Manfred Touron (@moul) + +_arguments \ +'(-h --help)'{-h,--help}'[This help.]' \ +'(-u --user)'{-u,--user}'[User to use.]' \ +'(-c --certificate)'{-c,--certificate}'[Path to ssh-certificate to use.]' \ +'(-sc --ssh)'{-sc,--ssh}'[SSH-connection-string, multiple.]' \ +'(-sa --ssh)'{-sa,--ssh}'[SSH connection arguments, used on every session.]' \ +'(-ts --tmux)'{-ts,--tmux}'[Alternative tmux-session-name, default: tmux-cssh]' \ +'(-ns --new)'{-ns,--new}'[Initializes a new session, like -ts \[name\].]' \ +'(-q --quiet)'{-q,--quiet}'[Quiet-mode.]' \ +'(-f --filename)'{-f,--filename}'[Filename of textfile to get -sc connection-strings from, line separated.]' \ +'(-cs --config)'{-cs,--config}'[Name of config-settings which should be get from config-file "$HOME/.tmux-cssh". Which can be a grep-regular expression to find the name(s).]' \ + ':hosts:_hosts' \ + '*:: :->subcmds' \ + && return 0 + +if (( CURRENT == 1 )); then + _describe -t commands "tmux-cssh command" + return +fi From e2bf7cb3dfcbe42686beb038035d9870eeb0faa3 Mon Sep 17 00:00:00 2001 From: isqua Date: Sat, 26 Apr 2014 02:44:02 +0400 Subject: [PATCH 006/537] Fix checkmark for clean repo in bureau theme --- themes/bureau.zsh-theme | 58 ++++++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/themes/bureau.zsh-theme b/themes/bureau.zsh-theme index 148abec1..c6296500 100644 --- a/themes/bureau.zsh-theme +++ b/themes/bureau.zsh-theme @@ -23,31 +23,35 @@ bureau_git_branch () { } bureau_git_status () { - _INDEX=$(command git status --porcelain -b 2> /dev/null) _STATUS="" - if $(echo "$_INDEX" | grep '^[AMRD]. ' &> /dev/null); then - _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_STAGED" - fi - if $(echo "$_INDEX" | grep '^.[MTD] ' &> /dev/null); then - _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNSTAGED" - fi - if $(echo "$_INDEX" | command grep -E '^\?\? ' &> /dev/null); then - _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED" - fi - if $(echo "$_INDEX" | grep '^UU ' &> /dev/null); then - _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNMERGED" - fi - if $(command git rev-parse --verify refs/stash >/dev/null 2>&1); then - _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_STASHED" - fi - if $(echo "$_INDEX" | grep '^## .*ahead' &> /dev/null); then - _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_AHEAD" - fi - if $(echo "$_INDEX" | grep '^## .*behind' &> /dev/null); then - _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_BEHIND" - fi - if $(echo "$_INDEX" | grep '^## .*diverged' &> /dev/null); then - _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_DIVERGED" + if [[ $(command git status --short 2> /dev/null) != "" ]]; then + _INDEX=$(command git status --porcelain -b 2> /dev/null) + if $(echo "$_INDEX" | command grep '^[AMRD]. ' &> /dev/null); then + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_STAGED" + fi + if $(echo "$_INDEX" | command grep '^.[MTD] ' &> /dev/null); then + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNSTAGED" + fi + if $(echo "$_INDEX" | command grep -E '^\?\? ' &> /dev/null); then + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED" + fi + if $(echo "$_INDEX" | command grep '^UU ' &> /dev/null); then + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNMERGED" + fi + if $(command git rev-parse --verify refs/stash >/dev/null 2>&1); then + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_STASHED" + fi + if $(echo "$_INDEX" | command grep '^## .*ahead' &> /dev/null); then + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_AHEAD" + fi + if $(echo "$_INDEX" | command grep '^## .*behind' &> /dev/null); then + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_BEHIND" + fi + if $(echo "$_INDEX" | command grep '^## .*diverged' &> /dev/null); then + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_DIVERGED" + fi + else + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_CLEAN" fi echo $_STATUS @@ -84,10 +88,10 @@ _LIBERTY="$_LIBERTY%{$reset_color%}" get_space () { local STR=$1$2 local zero='%([BSUbfksu]|([FB]|){*})' - local LENGTH=${#${(S%%)STR//$~zero/}} + local LENGTH=${#${(S%%)STR//$~zero/}} local SPACES="" (( LENGTH = ${COLUMNS} - $LENGTH - 1)) - + for i in {0..$LENGTH} do SPACES="$SPACES " @@ -101,7 +105,7 @@ _1RIGHT="[%*] " bureau_precmd () { _1SPACES=`get_space $_1LEFT $_1RIGHT` - print + print print -rP "$_1LEFT$_1SPACES$_1RIGHT" } From a1ed87a8a1a51f2b2363677a6f6f8d841566176c Mon Sep 17 00:00:00 2001 From: delphiki Date: Wed, 13 May 2015 16:55:54 +0200 Subject: [PATCH 007/537] Added environment based shortcuts in symfony2 plugin --- plugins/symfony2/symfony2.plugin.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/symfony2/symfony2.plugin.zsh b/plugins/symfony2/symfony2.plugin.zsh index e94280ed..8f104b53 100644 --- a/plugins/symfony2/symfony2.plugin.zsh +++ b/plugins/symfony2/symfony2.plugin.zsh @@ -25,3 +25,5 @@ alias sfcw='sf cache:warmup' alias sfroute='sf router:debug' alias sfcontainer='sf container:debug' alias sfgb='sf generate:bundle' +alias dev="sf --env=dev" +alias prod="sf --env=prod" From 8142261261167acc2feba3e57ec50defa08ec936 Mon Sep 17 00:00:00 2001 From: Andrew Janke Date: Mon, 8 Jun 2015 07:07:45 -0400 Subject: [PATCH 008/537] Hide spectrum.zsh var values to avoid junky "set" output to terminal --- lib/spectrum.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/spectrum.zsh b/lib/spectrum.zsh index b683aca2..33e819ca 100644 --- a/lib/spectrum.zsh +++ b/lib/spectrum.zsh @@ -3,7 +3,7 @@ # P.C. Shyamshankar # Copied from http://github.com/sykora/etc/blob/master/zsh/functions/spectrum/ -typeset -Ag FX FG BG +typeset -AHg FX FG BG FX=( reset "%{%}" From 0bda651dfd04801db573c0fc09aa37041e066ae9 Mon Sep 17 00:00:00 2001 From: Andrew Janke Date: Mon, 8 Jun 2015 07:19:57 -0400 Subject: [PATCH 009/537] Fix the spectrum_ls implementation in spectrum.zsh --- lib/spectrum.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/spectrum.zsh b/lib/spectrum.zsh index b683aca2..77e0dddb 100644 --- a/lib/spectrum.zsh +++ b/lib/spectrum.zsh @@ -25,13 +25,13 @@ ZSH_SPECTRUM_TEXT=${ZSH_SPECTRUM_TEXT:-Arma virumque cano Troiae qui primus ab o # Show all 256 colors with color number function spectrum_ls() { for code in {000..255}; do - print -P -- "$code: %F{$code}$ZSH_SPECTRUM_TEXT%f" + print -P -- "$code: %{$FG[$code]%}$ZSH_SPECTRUM_TEXT%{$reset_color%}" done } # Show all 256 colors where the background is set to specific color function spectrum_bls() { for code in {000..255}; do - print -P -- "$BG[$code]$code: $ZSH_SPECTRUM_TEXT %{$reset_color%}" + print -P -- "$code: %{$BG[$code]%}$ZSH_SPECTRUM_TEXT%{$reset_color%}" done } From 68e03a05923b65b0a0272f251ea1e72e3540f827 Mon Sep 17 00:00:00 2001 From: ju Date: Tue, 16 Jun 2015 08:44:50 +0200 Subject: [PATCH 010/537] Changed env based sf2 shortcuts to sfdev & sfprod --- plugins/symfony2/symfony2.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/symfony2/symfony2.plugin.zsh b/plugins/symfony2/symfony2.plugin.zsh index 8f104b53..aa7eb4cc 100644 --- a/plugins/symfony2/symfony2.plugin.zsh +++ b/plugins/symfony2/symfony2.plugin.zsh @@ -25,5 +25,5 @@ alias sfcw='sf cache:warmup' alias sfroute='sf router:debug' alias sfcontainer='sf container:debug' alias sfgb='sf generate:bundle' -alias dev="sf --env=dev" -alias prod="sf --env=prod" +alias sfdev='sf --env=dev' +alias sfprod='sf --env=prod' From 3594e27eeb18179f1762751bf32d1bc9f9757f67 Mon Sep 17 00:00:00 2001 From: Chris McCuller Date: Wed, 8 Jul 2015 09:02:23 -0400 Subject: [PATCH 011/537] Nicer formatting --- plugins/ember-cli/README.md | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/plugins/ember-cli/README.md b/plugins/ember-cli/README.md index d1dedf88..ec33ee21 100644 --- a/plugins/ember-cli/README.md +++ b/plugins/ember-cli/README.md @@ -1,22 +1,24 @@ # Ember-cli -**Maintainer:** [BilalBudhani](http://www.github.com/BilalBudhani) +**Maintainer:*[BilalBudhani](http://www.github.com/BilalBudhani) Ember-cli (http://www.ember-cli.com/) ### List of Aliases -alias es='ember serve' -alias ea='ember addon' -alias eb='ember build' -alias ed='ember destroy' -alias eg='ember generate' -alias eh='ember help' -alias ein='ember init' -alias eia='ember install:addon' -alias eib='ember install:bower' -alias ein='ember install:npm' -alias ei='ember install' -alias et='ember test' -alias eu='ember update' -alias ev='ember version' +Alias | Ember-CLI command +----- | ----------------- +**es** | *ember serve* +**ea** | *ember addon* +**eb** | *ember build* +**ed** | *ember destroy* +**eg** | *ember generate* +**eh** | *ember help* +**ein** | *ember init* +**eia** | *ember install:addon* +**eib** | *ember install:bower* +**ein** | *ember install:npm* +**ei** | *ember install* +**et** | *ember test* +**eu** | *ember update* +**ev** | *ember version* From b7617b35ffd56243fa6d310886d8effe9f27bfc1 Mon Sep 17 00:00:00 2001 From: Jonathan Cremin Date: Fri, 10 Jul 2015 14:03:55 +0100 Subject: [PATCH 012/537] Check for autoenv_init function before trying to source autoenv. --- plugins/autoenv/autoenv.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/autoenv/autoenv.plugin.zsh b/plugins/autoenv/autoenv.plugin.zsh index a8271849..edc16a4c 100644 --- a/plugins/autoenv/autoenv.plugin.zsh +++ b/plugins/autoenv/autoenv.plugin.zsh @@ -1,7 +1,7 @@ # Activates autoenv or reports its failure -if ! source $HOME/.autoenv/activate.sh 2>/dev/null; then +if ! type autoenv_init &>/dev/null && ! source $HOME/.autoenv/activate.sh 2>/dev/null; then echo '-------- AUTOENV ---------' - echo 'Could not find ~/.autoenv/activate.sh.' + echo 'Could not find autoenv_init function or ~/.autoenv/activate.sh.' echo 'Please check if autoenv is correctly installed.' echo 'In the meantime the autoenv plugin is DISABLED.' echo '--------------------------' From 775ac3ad9fefd524f217dedaf09f7fb40a18b6ee Mon Sep 17 00:00:00 2001 From: Bin Huang Date: Sat, 11 Jul 2015 09:32:05 +0800 Subject: [PATCH 013/537] The executable command on Mac OSX is 'ack' rather than 'ack-grep'. --- lib/misc.zsh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/misc.zsh b/lib/misc.zsh index 6d1a64e8..9d458ab2 100644 --- a/lib/misc.zsh +++ b/lib/misc.zsh @@ -18,7 +18,12 @@ alias _='sudo' alias please='sudo' ## more intelligent acking for ubuntu users -alias afind='ack-grep -il' +if which ack-grep > /dev/null; +then + alias afind='ack-grep -il' +else + alias afind='ack -il' +fi # only define LC_CTYPE if undefined if [[ -z "$LC_CTYPE" && -z "$LC_ALL" ]]; then From 800af047d7e5b2980c72bb5a444c1edeafc026e4 Mon Sep 17 00:00:00 2001 From: Juraj Fiala Date: Sat, 1 Aug 2015 17:45:00 +0200 Subject: [PATCH 014/537] Add sc-launch as a shortcut for start & enable I've heard many people requesting systemd to add this functionality. It's very handy under Arch. --- plugins/systemd/systemd.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/systemd/systemd.plugin.zsh b/plugins/systemd/systemd.plugin.zsh index 7d3db0f8..503f7c13 100644 --- a/plugins/systemd/systemd.plugin.zsh +++ b/plugins/systemd/systemd.plugin.zsh @@ -9,3 +9,4 @@ sudo_commands=( for c in $user_commands; do; alias sc-$c="systemctl $c"; done for c in $sudo_commands; do; alias sc-$c="sudo systemctl $c"; done +alias sc-launch="sudo systemctl start $c && sudo systemctl enable $c" From d351c76b0460f00ecd3703c9f1c4feabeeb2f3e3 Mon Sep 17 00:00:00 2001 From: Marc Scholten Date: Mon, 3 Aug 2015 14:50:57 +0200 Subject: [PATCH 015/537] Also accept any forms of yes as an answer to the "do you want to update?" prompt --- 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 5afd83c1..11caa447 100644 --- a/tools/check_for_upgrade.sh +++ b/tools/check_for_upgrade.sh @@ -43,7 +43,7 @@ then else echo "[Oh My Zsh] Would you like to check for updates? [Y/n]: \c" read line - if [ "$line" = Y ] || [ "$line" = y ] || [ -z "$line" ]; then + if [[ "$line" == Y* ]] || [[ "$line" == y* ]] || [ -z "$line" ]; then _upgrade_zsh else _update_zsh_update From 9c741284063aff4fe6f122431c7df8b0b43c1bb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Sedl=C3=A1k?= Date: Tue, 4 Aug 2015 16:01:06 +0200 Subject: [PATCH 016/537] chucknorris: add missing line/quote delimiters few quotes were missing the '%' line delimiters, so some of the quotes were appearing at once merged together --- plugins/chucknorris/fortunes/chucknorris | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/plugins/chucknorris/fortunes/chucknorris b/plugins/chucknorris/fortunes/chucknorris index b8edf9ac..e705d1c1 100644 --- a/plugins/chucknorris/fortunes/chucknorris +++ b/plugins/chucknorris/fortunes/chucknorris @@ -17,9 +17,11 @@ Chuck Norris' blood type is AK+. Ass-Kicking Positive. It is compatible only wit Chuck Norris is 1/8th Cherokee. This has nothing to do with ancestry, the man ate a fucking Indian. % In fine print on the last page of the Guinness Book of World Records it notes that all world records are held by Chuck Norris, and those listed in the book are simply the closest anyone else has ever gotten. +% There is no chin behind Chuck Norris' beard. There is only another fist. % Chuck Norris does not teabag the ladies. He potato-sacks them. +% Pluto is actually an orbiting group of British soldiers from the American Revolution who entered space after the Chuck gave them a roundhouse kick to the face. % When Chuck Norris goes to donate blood, he declines the syringe, and instead requests a hand gun and a bucket. @@ -127,6 +129,7 @@ Chuck Norris can drink an entire gallon of milk in thirty-seven seconds. Little known medical fact: Chuck Norris invented the Caesarean section when he roundhouse-kicked his way out of his monther's womb. % Chuck Norris doesn't bowl strikes, he just knocks down one pin and the other nine faint. +% The show Survivor had the original premise of putting people on an island with Chuck Norris. There were no survivors, and nobody is brave enough to go to the island to retrieve the footage. % It takes Chuck Norris 20 minutes to watch 60 Minutes. @@ -281,6 +284,7 @@ In a recent survey it was discovered the 94% of American women lost their virgin Chuck Norris invented a language that incorporates karate and roundhouse kicks. So next time Chuck Norris is kicking your ass, don't be offended or hurt, he may be just trying to tell you he likes your hat. % If at first you don't succeed, you're not Chuck Norris. +% If Chuck Norris were a calendar, every month would be named Chucktober, and every day he'd kick your ass. % Fear is not the only emotion Chuck Norris can smell. He can also detect hope, as in "I hope I don't get a roundhouse kick from Chuck Norris." @@ -349,7 +353,7 @@ As President Roosevelt said: "We have nothing to fear but fear itself. And Chuck % Chuck Norris just says "no" to drugs. If he said "yes", it would collapse Colombia's infrastructure. % -Since 1940, the year Chuck Norris was born, roundhouse-kick related deaths have increased 13,000 percent. +Since 1940, the year Chuck Norris was born, roundhouse-kick related deaths have increased 13,000 percent.? % Crime does not pay - unless you are an undertaker following Walker, Texas Ranger, on a routine patrol. % @@ -497,7 +501,8 @@ When Chuck Norris works out on the Total Gym, the Total Gym feels like it's been % Chuck Norris can skeletize a cow in two minutes. % -The only sure things are Death and Taxes?and when Chuck Norris goes to work for the IRS, they'll be the same thing. +The only sure things are Death and Taxes, and when Chuck Norris goes to work for the IRS, they'll be the same thing. +% Chuck Norris' first job was as a paperboy. There were no survivors. % With the rising cost of gasoline, Chuck Norris is beginning to worry about his drinking habit. @@ -527,8 +532,6 @@ Chuck Norris uses 8'x10' sheets of plywood as toilet paper. Noah was the only man notified before Chuck Norris relieved himself in the Atlantic Ocean. % Chuck Norris once invited all of the other badasses from TV to duke it out in order to see who was the supreme badass. Only two showed up-- Jack Bauer and MacGyver. -% - % MacGyver immediately tried to make a bomb out of some Q-Tips and Gatorade, but Chuck Norris roundhouse-kicked him in the solar plexus. MacGyver promptly threw up his own heart. % From 5c8b0cc0c1782b34790548498018fb9e0300992b Mon Sep 17 00:00:00 2001 From: Andrew Janke Date: Mon, 17 Aug 2015 22:53:45 -0400 Subject: [PATCH 017/537] Add clipcopy() and clippaste() generic cross-platform CLI clipboard functions. Change copydir, copyfile, and coffee plugins to use them, instead of the Mac-only `pbcopy` command. --- lib/clipboard.zsh | 67 ++++++++++++++++++++++++++++ plugins/coffee/coffee.plugin.zsh | 10 ++--- plugins/copydir/copydir.plugin.zsh | 4 +- plugins/copyfile/copyfile.plugin.zsh | 8 ++-- 4 files changed, 80 insertions(+), 9 deletions(-) create mode 100644 lib/clipboard.zsh diff --git a/lib/clipboard.zsh b/lib/clipboard.zsh new file mode 100644 index 00000000..24b7380f --- /dev/null +++ b/lib/clipboard.zsh @@ -0,0 +1,67 @@ +# System clipboard integration +# +# This file has support for doing system clipboard copy and paste operations +# from the command line in a generic cross-platform fashion. +# +# On OS X and Windows, the main system clipboard or "pasteboard" is used. On other +# Unix-like OSes, this considers the X Windows CLIPBOARD selection to be the +# "system clipboard", and the X Windows `xclip` command must be installed. + +# clipcopy - Copy data to clipboard +# +# Usage: +# +# | clipcopy - copies stdin to clipboard +# +# clipcopy - copies a file's contents to clipboard +# +function clipcopy() { + emulate -L zsh + local file=$1 + if [[ $OSTYPE == darwin* ]]; then + if [[ -z $file ]]; then + pbcopy + else + cat $file | pbcopy + fi + elif [[ $OSTYPE == cygwin* ]]; then + if [[ -z $file ]]; then + cat > /dev/clipboard + else + cat $file > /dev/clipboard + fi + else + which xclip &>/dev/null + if [[ $? != 0 ]]; then + print "clipcopy: Platform $OSTYPE not supported or xclip not installed" >&2 + return 1 + fi + if [[ -z $file ]]; then + xclip -in -selection clipboard + else + xclip -in -selection clipboard $file + fi + fi +} + +# clippaste - "Paste" data from clipboard to stdout +# +# Usage: +# +# clippaste - writes clipboard's contents to stdout +# +function clippaste() { + emulate -L zsh + if [[ $OSTYPE == darwin* ]]; then + pbpaste + elif [[ $OSTYPE == cygwin* ]]; then + cat /dev/clipboard + else + which xclip &>/dev/null + if [[ $? != 0 ]]; then + print "clipcopy: Platform $OSTYPE not supported or xclip not installed" >&2 + return 1 + fi + xclip -out -selection clipboard + fi +} \ No newline at end of file diff --git a/plugins/coffee/coffee.plugin.zsh b/plugins/coffee/coffee.plugin.zsh index 1a7bedd8..c7b486a6 100644 --- a/plugins/coffee/coffee.plugin.zsh +++ b/plugins/coffee/coffee.plugin.zsh @@ -6,11 +6,11 @@ cf () { } # compile & copy to clipboard cfc () { - cf $1 | pbcopy + cf $1 | clipcopy } -# compile from pasteboard & print -alias cfp='coffeeMe "$(pbpaste)"' +# compile from clipboard & print +alias cfp='coffeeMe "$(clippaste)"' -# compile from pasteboard and copy to clipboard -alias cfpc='cfp | pbcopy' +# compile from clipboard and copy to clipboard +alias cfpc='cfp | clipcopy' diff --git a/plugins/copydir/copydir.plugin.zsh b/plugins/copydir/copydir.plugin.zsh index 37bb5e08..4b918e81 100644 --- a/plugins/copydir/copydir.plugin.zsh +++ b/plugins/copydir/copydir.plugin.zsh @@ -1,3 +1,5 @@ +# Copies the pathname of the current directory to the system or X Windows clipboard function copydir { - pwd | tr -d "\r\n" | pbcopy + emulate -L zsh + print -n $PWD | clipcopy } \ No newline at end of file diff --git a/plugins/copyfile/copyfile.plugin.zsh b/plugins/copyfile/copyfile.plugin.zsh index 944a903c..f4eca5ac 100644 --- a/plugins/copyfile/copyfile.plugin.zsh +++ b/plugins/copyfile/copyfile.plugin.zsh @@ -1,5 +1,7 @@ +# Copies the contents of a given file to the system or X Windows clipboard +# +# copyfile function copyfile { - [[ "$#" != 1 ]] && return 1 - local file_to_copy=$1 - cat $file_to_copy | pbcopy + emulate -L zsh + clipcopy $1 } From 30ef85664822595e29acdbc840c45d5772d84b5d Mon Sep 17 00:00:00 2001 From: Chris McCuller Date: Thu, 3 Sep 2015 09:47:02 -0400 Subject: [PATCH 018/537] Fix maintainer line --- plugins/ember-cli/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/ember-cli/README.md b/plugins/ember-cli/README.md index ec33ee21..f5eca1ad 100644 --- a/plugins/ember-cli/README.md +++ b/plugins/ember-cli/README.md @@ -1,6 +1,6 @@ # Ember-cli -**Maintainer:*[BilalBudhani](http://www.github.com/BilalBudhani) +**Maintainer:**[BilalBudhani](http://www.github.com/BilalBudhani) Ember-cli (http://www.ember-cli.com/) From 86d881c47de3d0ed791e1e7d8c2ed480e6c781ee Mon Sep 17 00:00:00 2001 From: Juraj Fiala Date: Sun, 6 Sep 2015 13:01:09 +0200 Subject: [PATCH 019/537] Added aliases for --now commands Also removed the old sc-launch alias because this is just better. --- plugins/systemd/systemd.plugin.zsh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/systemd/systemd.plugin.zsh b/plugins/systemd/systemd.plugin.zsh index 503f7c13..f9b522e4 100644 --- a/plugins/systemd/systemd.plugin.zsh +++ b/plugins/systemd/systemd.plugin.zsh @@ -9,4 +9,7 @@ sudo_commands=( for c in $user_commands; do; alias sc-$c="systemctl $c"; done for c in $sudo_commands; do; alias sc-$c="sudo systemctl $c"; done -alias sc-launch="sudo systemctl start $c && sudo systemctl enable $c" + +alias sc-enable-now="sc-enable --now" +alias sc-disable-now="sc-disable --now" +alias sc-mask-now="sc-mask --now" From 758195cb791556c3f5268e7e075f3ab55bcd5e90 Mon Sep 17 00:00:00 2001 From: LE Manh Cuong Date: Mon, 28 Sep 2015 16:05:22 +0700 Subject: [PATCH 020/537] Encode64 Plugin - Fix wrong `echo` usage Currently, encode64 plugin using `echo -n` to print the content of $1 variable. This approach will not work with arbitrary data, which contains sequence of escaped characters, since when many `echo` implementation will expand them. This commit chage the usage to `printf`, which is builtin in all POSIX shells and can print arbitrary data reliability. --- plugins/encode64/encode64.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/encode64/encode64.plugin.zsh b/plugins/encode64/encode64.plugin.zsh index 4dbd1b45..53de6478 100644 --- a/plugins/encode64/encode64.plugin.zsh +++ b/plugins/encode64/encode64.plugin.zsh @@ -1,4 +1,4 @@ -encode64(){ echo -n $1 | base64 } -decode64(){ echo -n $1 | base64 --decode } +encode64(){ printf '%s' $1 | base64 } +decode64(){ printf '%s' $1 | base64 --decode } alias e64=encode64 alias d64=decode64 From f94fee5a7fd1a4704d65d52a2f1c522a3831ca1a Mon Sep 17 00:00:00 2001 From: Andrew Janke Date: Mon, 28 Sep 2015 08:35:25 -0400 Subject: [PATCH 021/537] installer: don't bail on errors in color setup This is a hack to keep the installer working on systems without tput/terminfo. --- tools/install.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/install.sh b/tools/install.sh index 5633320a..67d341c7 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -1,5 +1,3 @@ -set -e - # Use colors, but only if connected to a terminal, and that terminal # supports them. tput=$(which tput) @@ -21,6 +19,11 @@ else BOLD="" NORMAL="" fi + +# Only enable exit-on-error after the non-critical colorization stuff, +# which may fail on systems lacking tput or terminfo +set -e + CHECK_ZSH_INSTALLED=$(grep /zsh$ /etc/shells | wc -l) if [ ! $CHECK_ZSH_INSTALLED -ge 1 ]; then printf "${YELLOW}Zsh is not installed!${NORMAL} Please install zsh first!\n" From 5af52fbc75a07f03f2f796846184e0c2d6ca87b2 Mon Sep 17 00:00:00 2001 From: Joseph Post Date: Mon, 28 Sep 2015 10:50:35 -0500 Subject: [PATCH 022/537] gulp plugin: missing opening double quote & had unneeded parens on function --- plugins/gulp/gulp.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/gulp/gulp.plugin.zsh b/plugins/gulp/gulp.plugin.zsh index 8e11a444..f7eaefa8 100644 --- a/plugins/gulp/gulp.plugin.zsh +++ b/plugins/gulp/gulp.plugin.zsh @@ -19,8 +19,8 @@ # Grabs all available tasks from the `gulpfile.js` # in the current directory. # -function $$gulp_completion() { - compls=$(grep -Eo "gulp.task\((['\"](([a-zA-Z0-9]|-)*)['\"],)" gulpfile.js 2>/dev/null | grep -Eo "['\"](([a-zA-Z0-9]|-)*)['\"]" | sed s/"['\"]"//g | sort)" +function $$gulp_completion { + compls="$(grep -Eo "gulp.task\((['\"](([a-zA-Z0-9]|-)*)['\"],)" gulpfile.js 2>/dev/null | grep -Eo "['\"](([a-zA-Z0-9]|-)*)['\"]" | sed s/"['\"]"//g | sort)" completions=(${=compls}) compadd -- $completions From 3e04cd62d3f569da7a92380083f4e0806f2fa14e Mon Sep 17 00:00:00 2001 From: Gustavo Villa Date: Mon, 28 Sep 2015 14:59:06 -0300 Subject: [PATCH 023/537] Add 'rake middleware' alias. --- plugins/rails/rails.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/rails/rails.plugin.zsh b/plugins/rails/rails.plugin.zsh index 39e38849..1bbd1fb4 100644 --- a/plugins/rails/rails.plugin.zsh +++ b/plugins/rails/rails.plugin.zsh @@ -59,7 +59,7 @@ alias rn='rake notes' alias rr='rake routes' alias rrg='rake routes | grep' alias rt='rake test' - +alias rmd='rake middleware' # legacy stuff alias sstat='thin --stats "/thin/stats" start' From 1e305e01868a3524b7ce7ec1fdaba7e752f3ce8c Mon Sep 17 00:00:00 2001 From: Gutem Date: Mon, 28 Sep 2015 16:04:25 -0300 Subject: [PATCH 024/537] Update Simulator's Path to XCode 7.x --- plugins/xcode/xcode.plugin.zsh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/xcode/xcode.plugin.zsh b/plugins/xcode/xcode.plugin.zsh index b63a857a..0a2fa083 100644 --- a/plugins/xcode/xcode.plugin.zsh +++ b/plugins/xcode/xcode.plugin.zsh @@ -179,7 +179,10 @@ function simulator { if [[ -d "${devfolder}/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app" ]]; then open "${devfolder}/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app" # Xcode ≥ 6.x - else + elif [[ -d "${devfolder}/Applications/iOS Simulator.app" ]]; then open "${devfolder}/Applications/iOS Simulator.app" + # Xcode ≥ 7.x + else + open "${devfolder}/Applications/Simulator.app" fi } From 4589bc6c654650d52a47b5cb86c588f4ab2aca46 Mon Sep 17 00:00:00 2001 From: Andrew Janke Date: Mon, 28 Sep 2015 18:09:29 -0400 Subject: [PATCH 025/537] completion: turn off the #3889 compfix check by default --- oh-my-zsh.sh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 8e31ddd0..6cc5ac63 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -11,6 +11,8 @@ fpath=($ZSH/functions $ZSH/completions $fpath) # Load all stock functions (from $fpath files) called below. autoload -U compaudit compinit +: ${ZSH_DISABLE_COMPFIX:=true} + # Set ZSH_CUSTOM to the path where your custom config files # and plugins exists, or else we will use the default custom/ if [[ -z "$ZSH_CUSTOM" ]]; then @@ -62,13 +64,17 @@ if [ -z "$ZSH_COMPDUMP" ]; then ZSH_COMPDUMP="${ZDOTDIR:-${HOME}}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}" fi -# If completion insecurities exist, warn the user without enabling completions. -if ! compaudit &>/dev/null; then - # This function resides in the "lib/compfix.zsh" script sourced above. - handle_completion_insecurities -# Else, enable and cache completions to the desired file. +if [[ $ZSH_DISABLE_COMPFIX != true ]]; then + # If completion insecurities exist, warn the user without enabling completions. + if ! compaudit &>/dev/null; then + # This function resides in the "lib/compfix.zsh" script sourced above. + handle_completion_insecurities + # Else, enable and cache completions to the desired file. + else + compinit -d "${ZSH_COMPDUMP}" + fi else - compinit -d "${ZSH_COMPDUMP}" + compinit -i -d "${ZSH_COMPDUMP}" fi # Load all of the plugins that were defined in ~/.zshrc From df80081e9b8d652177a18542080b169268dc4d58 Mon Sep 17 00:00:00 2001 From: Xavier Haniquaut Date: Tue, 29 Sep 2015 10:20:55 +0200 Subject: [PATCH 026/537] Add alias for npm global install --- plugins/npm/npm.plugin.zsh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/npm/npm.plugin.zsh b/plugins/npm/npm.plugin.zsh index 595105d3..3a1a8ba3 100644 --- a/plugins/npm/npm.plugin.zsh +++ b/plugins/npm/npm.plugin.zsh @@ -5,6 +5,9 @@ eval "$(npm completion 2>/dev/null)" # - https://twitter.com/substack/status/23122603153150361 # Thus, we've used camelCase for the following aliases: +# Install dependencies globally +alias npmg="npm i -g " + # Install and save to dependencies in your package.json # npms is used by https://www.npmjs.com/package/npms alias npmS="npm i -S " @@ -12,6 +15,7 @@ alias npmS="npm i -S " # Install and save to dev-dependencies in your package.json # npmd is used by https://github.com/dominictarr/npmd alias npmD="npm i -D " + # Execute command from node_modules folder based on current directory # i.e npmE gulp alias npmE='PATH="$(npm bin)":"$PATH"' From 0516a39dec64568f6db194d143a0ae2969c3cf9b Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Tue, 29 Sep 2015 12:16:18 -0400 Subject: [PATCH 027/537] Remove Atom plugin The Atom plugin is obsolete. See #3193 --- plugins/atom/README.md | 23 ---------------------- plugins/atom/atom.plugin.zsh | 37 ------------------------------------ 2 files changed, 60 deletions(-) delete mode 100644 plugins/atom/README.md delete mode 100644 plugins/atom/atom.plugin.zsh diff --git a/plugins/atom/README.md b/plugins/atom/README.md deleted file mode 100644 index 6350c647..00000000 --- a/plugins/atom/README.md +++ /dev/null @@ -1,23 +0,0 @@ -## atom - -This plugin makes "at" a useful function for invoking the Atom Editor. - -Originally by Github user [aforty](https://github.com/aforty) for OSX, modified to alias 'at' to 'atom' for Linux, since atom already works on the terminal for Linux, and calling 'at' in a non-OSX environment should still work. - -### Requirements - - * [Atom](https://atom.io/) - -### Usage - - * If `at` command is called without an argument, launch Atom - - * If `at` is passed a directory, open it in Atom - - * If `at` is passed a file, open it in Atom - -### Examples - - * Open the current dir in atom: `at .` - * Open another dir in atom: `at path/to/folder` - * Open a file: `at filename.extension` diff --git a/plugins/atom/atom.plugin.zsh b/plugins/atom/atom.plugin.zsh deleted file mode 100644 index 2711cf0e..00000000 --- a/plugins/atom/atom.plugin.zsh +++ /dev/null @@ -1,37 +0,0 @@ -case $OSTYPE in -darwin*) - local _atom_paths > /dev/null 2>&1 - _atom_paths=( - "$HOME/Applications/Atom.app" - "/Applications/Atom.app" - ) - - for _atom_path in $_atom_paths; do - if [[ -a $_atom_path ]]; then - alias at="open -a '$_atom_path'" - break - fi - done - ;; -cygwin) - local _atom_path > /dev/null 2>&1 - - _atom_path=${LOCALAPPDATA}/atom/bin/atom - - if [[ -a $_atom_path ]]; then - cyg_open_atom() - { - if [[ -n $1 ]]; then - ${_atom_path} `cygpath -w -a $1` - else - ${_atom_path} - fi - } - - alias at=cyg_open_atom - fi - ;; -linux*) - # Alerts the user if 'atom' is not a found command. - type atom >/dev/null 2>&1 && alias at="atom" || { echo >&2 "You have enabled the atom oh-my-zsh plugin on Linux, but atom is not a recognized command. Please make sure you have it installed before using this plugin."; } -esac From f9c16f940e1b952dab2811e0c988bfc25f7dc93c Mon Sep 17 00:00:00 2001 From: Xavier Haniquaut Date: Wed, 30 Sep 2015 16:42:34 +0200 Subject: [PATCH 028/537] Remove broken link and move npmg alias position --- plugins/npm/npm.plugin.zsh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/plugins/npm/npm.plugin.zsh b/plugins/npm/npm.plugin.zsh index 3a1a8ba3..3f6fe0fb 100644 --- a/plugins/npm/npm.plugin.zsh +++ b/plugins/npm/npm.plugin.zsh @@ -1,13 +1,11 @@ eval "$(npm completion 2>/dev/null)" - -# npm package names are lowercase -# - https://twitter.com/substack/status/23122603153150361 -# Thus, we've used camelCase for the following aliases: - # Install dependencies globally alias npmg="npm i -g " +# npm package names are lowercase +# Thus, we've used camelCase for the following aliases: + # Install and save to dependencies in your package.json # npms is used by https://www.npmjs.com/package/npms alias npmS="npm i -S " From c146853a5e529a522ca4cd6015cd55b796788806 Mon Sep 17 00:00:00 2001 From: Andrew Janke Date: Thu, 1 Oct 2015 19:29:59 -0400 Subject: [PATCH 029/537] autoenv: also look in the Homebrew installation location for it --- plugins/autoenv/autoenv.plugin.zsh | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/plugins/autoenv/autoenv.plugin.zsh b/plugins/autoenv/autoenv.plugin.zsh index edc16a4c..c9f96811 100644 --- a/plugins/autoenv/autoenv.plugin.zsh +++ b/plugins/autoenv/autoenv.plugin.zsh @@ -1,12 +1,25 @@ # Activates autoenv or reports its failure -if ! type autoenv_init &>/dev/null && ! source $HOME/.autoenv/activate.sh 2>/dev/null; then - echo '-------- AUTOENV ---------' - echo 'Could not find autoenv_init function or ~/.autoenv/activate.sh.' - echo 'Please check if autoenv is correctly installed.' - echo 'In the meantime the autoenv plugin is DISABLED.' - echo '--------------------------' - return 1 +() { +if ! type autoenv_init >/dev/null; then + for d (~/.autoenv /usr/local/opt/autoenv); do + if [[ -e $d/activate.sh ]]; then + autoenv_dir=$d + break + fi + done + if [[ -z $autoenv_dir ]]; then + cat <&2 +-------- AUTOENV --------- +Could not locate autoenv installation. +Please check if autoenv is correctly installed. +In the meantime the autoenv plugin is DISABLED. +-------------------------- +END + return 1 + fi fi +} +[[ $? != 0 ]] && return $? # The use_env call below is a reusable command to activate/create a new Python # virtualenv, requiring only a single declarative line of code in your .env files. From 7f2656c1263488c1a54af65397ad1d0c450c8e7d Mon Sep 17 00:00:00 2001 From: Andrew Janke Date: Fri, 2 Oct 2015 03:07:01 -0400 Subject: [PATCH 030/537] git-extras: fix for compatibility with zsh _git This changes all the __git_* functions it was defining to __gitex_* to avoid collisions with the internal functions used inside _git from zsh. --- plugins/git-extras/README.md | 11 ++++ plugins/git-extras/git-extras.plugin.zsh | 82 +++++++++++++----------- 2 files changed, 54 insertions(+), 39 deletions(-) create mode 100644 plugins/git-extras/README.md diff --git a/plugins/git-extras/README.md b/plugins/git-extras/README.md new file mode 100644 index 00000000..8f12e297 --- /dev/null +++ b/plugins/git-extras/README.md @@ -0,0 +1,11 @@ +# git-extras + +This plugin provides completion definitions for some of the commands defined by [git-extras](http://github.com/tj/git-extras). + +## Setup notes + +The completions work by augmenting the `_git` completion provided by `zsh`. This only works with the `zsh`-provided `_git`, not the `_git` provided by `git` itself. If you have both `zsh` and `git` installed, you need to make sure that the `zsh`-provided `_git` takes precedence. + +### OS X Homebrew Setup + +On OS X with Homebrew, you need to install `git` with `brew install git --without-completions`. Otherwise, `git`'s `_git` will take precedence, and you won't see the completions for `git-extras` commands. diff --git a/plugins/git-extras/git-extras.plugin.zsh b/plugins/git-extras/git-extras.plugin.zsh index d91c1af8..681fbb46 100644 --- a/plugins/git-extras/git-extras.plugin.zsh +++ b/plugins/git-extras/git-extras.plugin.zsh @@ -1,10 +1,13 @@ -#compdef git # ------------------------------------------------------------------------------ # Description # ----------- # # Completion script for git-extras (http://github.com/tj/git-extras). # +# This depends on and reueses some of the internals of the _git completion +# function that ships with zsh itself. It will not work with the _git that ships +# with git. +# # ------------------------------------------------------------------------------ # Authors # ------- @@ -22,16 +25,18 @@ # ------------------------------------------------------------------------------ -__git_command_successful () { - if (( ${#pipestatus:#0} > 0 )); then - _message 'not a git repository' - return 1 - fi - return 0 +# Internal functions +# These are a lot like their __git_* equivalents inside _git + +__gitex_command_successful () { + if (( ${#*:#0} > 0 )); then + _message 'not a git repository' + return 1 + fi + return 0 } - -__git_commits() { +__gitex_commits() { declare -A commits git log --oneline -15 | sed 's/\([[:alnum:]]\{7\}\) /\1:/' | while read commit do @@ -42,7 +47,7 @@ __git_commits() { _describe -t commits commit commits && ret=0 } -__git_tag_names() { +__gitex_tag_names() { local expl declare -a tag_names tag_names=(${${(f)"$(_call_program tags git for-each-ref --format='"%(refname)"' refs/tags 2>/dev/null)"}#refs/tags/}) @@ -51,7 +56,7 @@ __git_tag_names() { } -__git_branch_names() { +__gitex_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/}) @@ -59,7 +64,7 @@ __git_branch_names() { _wanted branch-names expl branch-name compadd $* - $branch_names } -__git_specific_branch_names() { +__gitex_specific_branch_names() { local expl declare -a branch_names branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/"$1" 2>/dev/null)"}#refs/heads/$1/}) @@ -67,32 +72,28 @@ __git_specific_branch_names() { _wanted branch-names expl branch-name compadd $* - $branch_names } - -__git_feature_branch_names() { - __git_specific_branch_names 'feature' +__gitex_feature_branch_names() { + __gitex_specific_branch_names 'feature' } - -__git_refactor_branch_names() { - __git_specific_branch_names 'refactor' +__gitex_refactor_branch_names() { + __gitex_specific_branch_names 'refactor' } - -__git_bug_branch_names() { - __git_specific_branch_names 'bug' +__gitex_bug_branch_names() { + __gitex_specific_branch_names 'bug' } - -__git_submodule_names() { +__gitex_submodule_names() { local expl declare -a submodule_names - submodule_names=(${(f)"$(_call_program branchrefs git submodule status | awk '{print $2}')"}) + submodule_names=(${(f)"$(_call_program branchrefs git submodule status | awk '{print $2}')"}) # ' __git_command_successful || return _wanted submodule-names expl submodule-name compadd $* - $submodule_names } -__git_author_names() { +__gitex_author_names() { local expl declare -a author_names author_names=(${(f)"$(_call_program branchrefs git log --format='%aN' | sort -u)"}) @@ -123,7 +124,7 @@ _git-bug() { case $line[1] in (finish) _arguments -C \ - ':branch-name:__git_bug_branch_names' + ':branch-name:__gitex_bug_branch_names' ;; esac esac @@ -139,7 +140,7 @@ _git-changelog() { _git-contrib() { _arguments \ - ':author:__git_author_names' + ':author:__gitex_author_names' } @@ -151,19 +152,19 @@ _git-count() { _git-delete-branch() { _arguments \ - ':branch-name:__git_branch_names' + ':branch-name:__gitex_branch_names' } _git-delete-submodule() { _arguments \ - ':submodule-name:__git_submodule_names' + ':submodule-name:__gitex_submodule_names' } _git-delete-tag() { _arguments \ - ':tag-name:__git_tag_names' + ':tag-name:__gitex_tag_names' } @@ -172,6 +173,7 @@ _git-effort() { '--above[ignore file with less than x commits]' } + _git-extras() { local curcontext=$curcontext state line ret=1 declare -A opt_args @@ -216,7 +218,7 @@ _git-feature() { case $line[1] in (finish) _arguments -C \ - ':branch-name:__git_feature_branch_names' + ':branch-name:__gitex_feature_branch_names' ;; esac esac @@ -225,8 +227,8 @@ _git-feature() { _git-graft() { _arguments \ - ':src-branch-name:__git_branch_names' \ - ':dest-branch-name:__git_branch_names' + ':src-branch-name:__gitex_branch_names' \ + ':dest-branch-name:__gitex_branch_names' } @@ -236,12 +238,14 @@ _git-ignore() { '(--global -g)'{--global,-g}'[show global gitignore]' } + _git-missing() { _arguments \ - ':first-branch-name:__git_branch_names' \ - ':second-branch-name:__git_branch_names' + ':first-branch-name:__gitex_branch_names' \ + ':second-branch-name:__gitex_branch_names' } + _git-refactor() { local curcontext=$curcontext state line ret=1 declare -A opt_args @@ -263,7 +267,7 @@ _git-refactor() { case $line[1] in (finish) _arguments -C \ - ':branch-name:__git_refactor_branch_names' + ':branch-name:__gitex_refactor_branch_names' ;; esac esac @@ -272,12 +276,12 @@ _git-refactor() { _git-squash() { _arguments \ - ':branch-name:__git_branch_names' + ':branch-name:__gitex_branch_names' } _git-summary() { - _arguments '--line[summarize with lines other than commits]' - __git_commits + _arguments '--line[summarize with lines rather than commits]' + __gitex_commits } From b35d78f2f8535dbbcba2254ad91041312814ebc1 Mon Sep 17 00:00:00 2001 From: Will Weaver Date: Fri, 2 Oct 2015 08:14:06 -0400 Subject: [PATCH 031/537] Add Git Hubflow aliases --- plugins/git-hubflow/git-hubflow.plugin.zsh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plugins/git-hubflow/git-hubflow.plugin.zsh b/plugins/git-hubflow/git-hubflow.plugin.zsh index 4cf5b917..b0157c7a 100644 --- a/plugins/git-hubflow/git-hubflow.plugin.zsh +++ b/plugins/git-hubflow/git-hubflow.plugin.zsh @@ -20,6 +20,13 @@ # c. Or, use this file as an oh-my-zsh plugin. # +alias ghf='git hf' +alias ghff='git hf feature' +alias ghfr='git hf release' +alias ghfh='git hf hotfix' +alias ghfs='git hf support' +alias ghfu='git hf update' + _git-hf () { local curcontext="$curcontext" state line From d49cacfb7bb96049185c2edfaf3c330b0bde338e Mon Sep 17 00:00:00 2001 From: Victor Torres Date: Fri, 2 Oct 2015 23:16:56 -0300 Subject: [PATCH 032/537] Add branch plugin --- plugins/branch/README.md | 33 ++++++++++++++++++++++++++++++++ plugins/branch/branch.plugin.zsh | 26 +++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 plugins/branch/README.md create mode 100644 plugins/branch/branch.plugin.zsh diff --git a/plugins/branch/README.md b/plugins/branch/README.md new file mode 100644 index 00000000..f970266a --- /dev/null +++ b/plugins/branch/README.md @@ -0,0 +1,33 @@ +# Branch + +Displays the current Git or Mercurial branch fast. + +## Speed test + +### Mercurial + +```shell +$ time hg branch +0.11s user 0.14s system 70% cpu 0.355 total +``` + +### Branch plugin + +```shell +$ time sh /tmp/branch_prompt_info.sh +0.01s user 0.01s system 81% cpu 0.018 total +``` + +## Usage + +Edit your theme file (eg.: `~/.oh-my-zsh/theme/robbyrussell.zsh-theme`) +adding `$(branch_prompt_info)` in your prompt like this: + +```diff +- PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' ++ PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)$(branch_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' +``` + +## Maintainer + +Victor Torres () diff --git a/plugins/branch/branch.plugin.zsh b/plugins/branch/branch.plugin.zsh new file mode 100644 index 00000000..c918ea2b --- /dev/null +++ b/plugins/branch/branch.plugin.zsh @@ -0,0 +1,26 @@ +# Branch: displays the current Git or Mercurial branch fast. +# Victor Torres +# Oct 2, 2015 + +function branch_prompt_info() { + # Defines path as current directory + path=$(pwd) + # While current path is not root path + while [ $path != '/' ]; + do + # Git repository + if [ -d ${path}/.git ]; + then + echo '±' $(/bin/cat ${path}/.git/HEAD | /usr/bin/cut -d / -f 3-) + return; + fi + # Mercurial repository + if [ -d ${path}/.hg ]; + then + echo '☿' $(/bin/cat ${path}/.hg/branch) + return; + fi + # Defines path as parent directory and keeps looking for :) + path=$(/usr/bin/dirname $path) + done +} From df5e1f9c2cca5722e09bef3787571d7d948fe467 Mon Sep 17 00:00:00 2001 From: uberspot Date: Sat, 3 Oct 2015 19:37:12 +0200 Subject: [PATCH 033/537] Add 3 more nmap aliases to nmap plugin --- plugins/nmap/README.md | 19 ++++++++++++------- plugins/nmap/nmap.plugin.zsh | 6 +++++- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/plugins/nmap/README.md b/plugins/nmap/README.md index 8bb8e064..5cd64627 100644 --- a/plugins/nmap/README.md +++ b/plugins/nmap/README.md @@ -19,14 +19,19 @@ Nmap options are: ## Aliases explained - * nmap_open_ports - scan for open ports on target - * nmap_list_interfaces - list all network interfaces on host where the command runs - * nmap_slow - slow scan that avoids to spam the targets logs - * nmap_fin - scan to see if hosts are up with TCP FIN scan - * nmap_full - aggressive full scan that scans all ports, tries to determine OS and service versions + * nmap_open_ports - Scan for open ports on target + * nmap_list_interfaces - List all network interfaces on host where the command runs + * nmap_slow - Slow scan that avoids to spam the targets logs + * nmap_fin - Scan to see if hosts are up with TCP FIN scan + * nmap_full - Aggressive full scan that scans all ports, tries to determine OS and service versions * nmap_check_for_firewall - TCP ACK scan to check for firewall existence * nmap_ping_through_firewall - Host discovery with SYN and ACK probes instead of just pings to avoid firewall restrictions * nmap_fast - Fast scan of the top 300 popular ports - * nmap_detect_versions - detects versions of services and OS, runs on all ports - * nmap_check_for_vulns - uses vulscan script to check target services for vulnerabilities + * nmap_detect_versions - Detects versions of services and OS, runs on all ports + * nmap_check_for_vulns - Uses vulscan script to check target services for vulnerabilities + * nmap_full_udp - Same as full but via UDP + * nmap_traceroute - Try to traceroute using the most common ports + * nmap_full_with_scripts - Same as nmap_full but also runs all the scripts + * nmap_web_safe_osscan - Little "safer" scan for OS version as connecting to only HTTP and HTTPS ports doesn't look so attacking. + diff --git a/plugins/nmap/nmap.plugin.zsh b/plugins/nmap/nmap.plugin.zsh index f3603f62..d09f2c61 100644 --- a/plugins/nmap/nmap.plugin.zsh +++ b/plugins/nmap/nmap.plugin.zsh @@ -22,7 +22,11 @@ alias nmap_fin="nmap -sF -v" alias nmap_full="nmap -sS -T4 -PE -PP -PS80,443 -PY -g 53 -A -p1-65535 -v" alias nmap_check_for_firewall="nmap -sA -p1-65535 -v -T4" alias nmap_ping_through_firewall="nmap -PS -PA" -alias nmap_fast="nmap -F -T5 --top-ports 300" +alias nmap_fast="nmap -F -T5 --version-light --top-ports 300" alias nmap_detect_versions="nmap -sV -p1-65535 -O --osscan-guess -T4 -Pn" alias nmap_check_for_vulns="nmap --script=vulscan" +alias nmap_full_udp="nmap -sS -sU -T4 -A -v -PE -PS22,25,80 -PA21,23,80,443,3389 " +alias nmap_traceroute="nmap -sP -PE -PS22,25,80 -PA21,23,80,3389 -PU -PO --traceroute " +alias nmap_full_with_scripts="sudo nmap -sS -sU -T4 -A -v -PE -PP -PS21,22,23,25,80,113,31339 -PA80,113,443,10042 -PO --script all " +alias nmap_web_safe_osscan="sudo nmap -p 80,443 -O -v --osscan-guess --fuzzy " From 2d9df4468f5650d0d16cc789c96d828fb0dff4aa Mon Sep 17 00:00:00 2001 From: Jeff Smith Date: Sat, 3 Oct 2015 18:39:41 -0700 Subject: [PATCH 034/537] Fix 'ack-grep' bug for non-ubuntu users Redirect STDERR along with STDOUT when looking for ack-grep --- lib/misc.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/misc.zsh b/lib/misc.zsh index 223d6150..8ff076e7 100644 --- a/lib/misc.zsh +++ b/lib/misc.zsh @@ -22,7 +22,7 @@ alias _='sudo' alias please='sudo' ## more intelligent acking for ubuntu users -if which ack-grep > /dev/null; +if which ack-grep &> /dev/null; then alias afind='ack-grep -il' else From a95473919ab300e4b1a6179e8dca7356a256615d Mon Sep 17 00:00:00 2001 From: Kevin O'Neal Date: Sun, 4 Oct 2015 17:05:28 -0500 Subject: [PATCH 035/537] Update Gradle Commands --- plugins/gradle/gradle.plugin.zsh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/plugins/gradle/gradle.plugin.zsh b/plugins/gradle/gradle.plugin.zsh index 97941756..661c29d5 100644 --- a/plugins/gradle/gradle.plugin.zsh +++ b/plugins/gradle/gradle.plugin.zsh @@ -1,6 +1,6 @@ #!zsh ############################################################################## -# A descriptive listing of core Gradle commands +# A descriptive listing of core Gradle commands ############################################################################ function _gradle_core_commands() { local ret=1 state @@ -32,14 +32,22 @@ function _gradle_arguments() { '--stop[Stop the Gradle daemon]' \ '--daemon[Use the Gradle daemon]' \ '--no-daemon[Do not use the Gradle daemon]' \ - '--no-opt[Do not perform any task optimization]' \ + '--rerun-task [Specifies that any task optimization is ignored.]' \ '-i[Log at the info level]' \ '-m[Dry run]' \ '-P[Set a project property]' \ + '-p[Specifies the start directory]' \ '--profile[Profile the build time]' \ '-q[Log at the quiet level (only show errors)]' \ '-v[Print the Gradle version info]' \ '-x[Specify a task to be excluded]' \ + '-b[Specifies the build file.]' \ + '-c[Specifies the settings file.]' \ + '--continue[Continues task execution after a task failure.]' \ + '-g[Specifies the Gradle user home directory.]' \ + '-I[Specifies an initialization script.]' \ + '--refresh-dependencies[Refresh the state of dependencies.]' \ + '-u[Don''t search in parent directories for a settings.gradle file.]' \ '*::command:->command' \ && return 0 } From b6d78df62c540245f67ffc900d0b1a17a6dfb77e Mon Sep 17 00:00:00 2001 From: Andrew Janke Date: Sun, 4 Oct 2015 03:42:24 -0400 Subject: [PATCH 036/537] clip*: add xsel support --- lib/clipboard.zsh | 45 +++++++++++++++++++++--------- plugins/copydir/copydir.plugin.zsh | 2 +- 2 files changed, 33 insertions(+), 14 deletions(-) diff --git a/lib/clipboard.zsh b/lib/clipboard.zsh index 24b7380f..b663800a 100644 --- a/lib/clipboard.zsh +++ b/lib/clipboard.zsh @@ -31,15 +31,21 @@ function clipcopy() { cat $file > /dev/clipboard fi else - which xclip &>/dev/null - if [[ $? != 0 ]]; then - print "clipcopy: Platform $OSTYPE not supported or xclip not installed" >&2 - return 1 - fi - if [[ -z $file ]]; then - xclip -in -selection clipboard + if which xclip &>/dev/null; then + if [[ -z $file ]]; then + xclip -in -selection clipboard + else + xclip -in -selection clipboard $file + fi + elif which xsel &>/dev/null; then + if [[ -z $file ]]; then + xsel --clipboard --input + else + cat "$file" | xsel --clipboard --input + fi else - xclip -in -selection clipboard $file + print "clipcopy: Platform $OSTYPE not supported or xclip/xsel not installed" >&2 + return 1 fi fi } @@ -50,6 +56,17 @@ function clipcopy() { # # clippaste - writes clipboard's contents to stdout # +# clippaste | - pastes contents and pipes it to another process +# +# clippaste > - paste contents to a file +# +# Examples: +# +# # Pipe to another process +# clippaste | grep foo +# +# # Paste to a file +# clippaste > file.txt function clippaste() { emulate -L zsh if [[ $OSTYPE == darwin* ]]; then @@ -57,11 +74,13 @@ function clippaste() { elif [[ $OSTYPE == cygwin* ]]; then cat /dev/clipboard else - which xclip &>/dev/null - if [[ $? != 0 ]]; then - print "clipcopy: Platform $OSTYPE not supported or xclip not installed" >&2 + if which xclip &>/dev/null; then + xclip -out -selection clipboard + elif which xsel &>/dev/null; then + xsel --clipboard --output + else + print "clipcopy: Platform $OSTYPE not supported or xclip/xsel not installed" >&2 return 1 fi - xclip -out -selection clipboard fi -} \ No newline at end of file +} diff --git a/plugins/copydir/copydir.plugin.zsh b/plugins/copydir/copydir.plugin.zsh index 4b918e81..c4510624 100644 --- a/plugins/copydir/copydir.plugin.zsh +++ b/plugins/copydir/copydir.plugin.zsh @@ -2,4 +2,4 @@ function copydir { emulate -L zsh print -n $PWD | clipcopy -} \ No newline at end of file +} From ee8f3771e93c940cd1271dad0a6e9b6ab7cad0c4 Mon Sep 17 00:00:00 2001 From: Giordano Vicari Date: Mon, 5 Oct 2015 19:44:00 +0200 Subject: [PATCH 037/537] Added support to subtask through gulp --tasks-simple command --- plugins/gulp/gulp.plugin.zsh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/gulp/gulp.plugin.zsh b/plugins/gulp/gulp.plugin.zsh index f7eaefa8..58754952 100644 --- a/plugins/gulp/gulp.plugin.zsh +++ b/plugins/gulp/gulp.plugin.zsh @@ -2,12 +2,12 @@ # # gulp-autocompletion-zsh -# +# # Autocompletion for your gulp.js tasks # # Copyright(c) 2014 André König # MIT Licensed -# +# # # André König @@ -20,7 +20,7 @@ # in the current directory. # function $$gulp_completion { - compls="$(grep -Eo "gulp.task\((['\"](([a-zA-Z0-9]|-)*)['\"],)" gulpfile.js 2>/dev/null | grep -Eo "['\"](([a-zA-Z0-9]|-)*)['\"]" | sed s/"['\"]"//g | sort)" + compls=$(gulp --tasks-simple >/dev/null | sort) completions=(${=compls}) compadd -- $completions From d26549b7ecb93665148e37b18741ace6d0b8141a Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Mon, 5 Oct 2015 13:46:20 -0700 Subject: [PATCH 038/537] Removing legacy rails-specific aliases from the Textmate plugin. This is probably best handled as a custom plugin. --- plugins/textmate/textmate.plugin.zsh | 8 -------- 1 file changed, 8 deletions(-) diff --git a/plugins/textmate/textmate.plugin.zsh b/plugins/textmate/textmate.plugin.zsh index 773c4f8d..02813de9 100644 --- a/plugins/textmate/textmate.plugin.zsh +++ b/plugins/textmate/textmate.plugin.zsh @@ -1,11 +1,3 @@ -alias et='mate .' -alias ett='mate Gemfile app config features lib db public spec test Rakefile Capfile Todo' -alias etp='mate app config lib db public spec test vendor/plugins vendor/gems Rakefile Capfile Todo' -alias etts='mate app config lib db public script spec test vendor/plugins vendor/gems Rakefile Capfile Todo' - -# Edit Ruby app in TextMate -alias mr='mate CHANGELOG app config db lib public script spec test' - # If the tm command is called without an argument, open TextMate in the current directory # If tm is passed a directory, cd to it and open it in TextMate # If tm is passed a file, open it in TextMate From 6b73f5ec7504ebc118d4bb6fdfaf841333f9c7a4 Mon Sep 17 00:00:00 2001 From: Rodrigo Chiossi Date: Mon, 5 Oct 2015 18:32:42 -0300 Subject: [PATCH 039/537] Ask for confirmation before uninstall Prompt the user before removing oh-my-zsh from the system --- tools/uninstall.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/uninstall.sh b/tools/uninstall.sh index 23bfac0e..f9da00c9 100644 --- a/tools/uninstall.sh +++ b/tools/uninstall.sh @@ -1,3 +1,10 @@ +read -r -p "Are you sure you want to remove Oh My Zsh? [y/N] " confirmation +if ! [[ $confirmation =~ ^[yY]$ ]] +then + echo "Uninstall cancelled" + exit +fi + echo "Removing ~/.oh-my-zsh" if [ -d ~/.oh-my-zsh ] then From a7f0c71c703de2603bcf05170e797068145728c0 Mon Sep 17 00:00:00 2001 From: Avi Samloff Date: Thu, 8 Oct 2015 15:07:24 -0700 Subject: [PATCH 040/537] Fix ohmyz.sh link Change http://ohmyz.sh link to use proper markdown syntax --- README.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index a29df81a..779ce77c 100644 --- a/README.markdown +++ b/README.markdown @@ -5,7 +5,7 @@ Oh My Zsh is an open source, community-driven framework for managing your [zsh]( __Oh My Zsh is a way of life!__ Once installed, your terminal prompt will become the talk of the town _or your money back!_ Each time you interact with your command prompt, you'll be able take advantage of the hundreds of bundled plugins and pretty themes. Strangers will come up to you in cafés and ask you, _"that is amazing. are you some sort of genius?"_ Finally, you'll begin to get the sort of attention that you always felt that you deserved. ...or maybe you'll just use the time that you saved to start flossing more often. -To learn more, visit http://ohmyz.sh and/or follow [ohmyzsh](https://twitter.com/ohmyzsh) on Twitter. +To learn more, visit [ohmyz.sh](http://ohmyz.sh) and/or follow [ohmyzsh](https://twitter.com/ohmyzsh) on Twitter. ## Getting Started From 35517457921c095be1aa6ed948debfbe183b89ac Mon Sep 17 00:00:00 2001 From: Andrew Janke Date: Tue, 6 Oct 2015 21:03:47 -0400 Subject: [PATCH 041/537] Disable bracketed-paste-magic in zsh 5.1.1, where it is buggy A bracketed-paste-magic bug breaks pasting of CJK and some other characters in zsh 5.1.1. http://www.zsh.org/mla/workers/2015/msg02680.html See #4434 --- lib/misc.zsh | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/lib/misc.zsh b/lib/misc.zsh index 8ff076e7..c81dab41 100644 --- a/lib/misc.zsh +++ b/lib/misc.zsh @@ -1,14 +1,19 @@ ## Load smart urls if available -for d in $fpath; do - if [[ -e "$d/url-quote-magic" ]]; then - if [[ -e "$d/bracketed-paste-magic" ]]; then - autoload -Uz bracketed-paste-magic - zle -N bracketed-paste bracketed-paste-magic - fi - autoload -U url-quote-magic - zle -N self-insert url-quote-magic - fi -done +# bracketed-paste-magic is known buggy in zsh 5.1.1 (only), so skip it there; see #4434 +autoload -Uz is-at-least +if [[ $ZSH_VERSION != 5.1.1 ]]; then + for d in $fpath; do + if [[ -e "$d/url-quote-magic" ]]; then + if is-at-least 5.1; then + autoload -Uz bracketed-paste-magic + zle -N bracketed-paste bracketed-paste-magic + fi + autoload -Uz url-quote-magic + zle -N self-insert url-quote-magic + break + fi + done +fi ## jobs setopt long_list_jobs @@ -22,8 +27,7 @@ alias _='sudo' alias please='sudo' ## more intelligent acking for ubuntu users -if which ack-grep &> /dev/null; -then +if which ack-grep &> /dev/null; then alias afind='ack-grep -il' else alias afind='ack -il' From d15521d09dfa59da664aca6ddd40928d1031c5ad Mon Sep 17 00:00:00 2001 From: Andrew Janke Date: Thu, 8 Oct 2015 22:31:39 -0400 Subject: [PATCH 042/537] diagnostics: fix for reserved-word changes in zsh 5.1 Reference: https://github.com/zsh-users/zsh/blob/zsh-5.1.1/NEWS#L20-L32 --- lib/diagnostics.zsh | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/lib/diagnostics.zsh b/lib/diagnostics.zsh index afc33829..9c9905e4 100644 --- a/lib/diagnostics.zsh +++ b/lib/diagnostics.zsh @@ -52,6 +52,9 @@ # * Consider whether to move default output file location to TMPDIR. More robust # but less user friendly. # + +autoload -Uz is-at-least + function omz_diagnostic_dump() { emulate -L zsh @@ -247,7 +250,7 @@ function _omz_diag_dump_one_big_text() { function _omz_diag_dump_check_core_commands() { builtin echo "Core command check:" - local redefined name builtins externals + local redefined name builtins externals reserved_words redefined=() # All the zsh non-module builtin commands # These are taken from the zsh reference manual for 5.0.2 @@ -255,17 +258,32 @@ function _omz_diag_dump_check_core_commands() { # (For back-compatibility, if any of these are newish, they should be removed, # or at least made conditional on the version of the current running zsh.) # "history" is also excluded because OMZ is known to redefine that + reserved_words=( do done esac then elif else fi for case if while function + repeat time until select coproc nocorrect foreach end '!' '[[' '{' '}' + ) builtins=( alias autoload bg bindkey break builtin bye cd chdir command comparguments compcall compctl compdescribe compfiles compgroups compquote comptags - comptry compvalues continue declare dirs disable disown echo echotc echoti emulate - enable eval exec exit export false fc fg float functions getln getopts hash - integer jobs kill let limit local log logout noglob popd print printf - pushd pushln pwd r read readonly rehash return sched set setopt shift - source suspend test times trap true ttyctl type typeset ulimit umask unalias + comptry compvalues continue dirs disable disown echo echotc echoti emulate + enable eval exec exit false fc fg functions getln getopts hash + jobs kill let limit log logout noglob popd print printf + pushd pushln pwd r read rehash return sched set setopt shift + source suspend test times trap true ttyctl type ulimit umask unalias unfunction unhash unlimit unset unsetopt vared wait whence where which zcompile zle zmodload zparseopts zregexparse zstyle ) + if is-at-least 5.1; then + reserved_word+=( declare export integer float local readonly typeset ) + else + builtins+=( declare export integer float local readonly typeset ) + fi builtins_fatal=( builtin command local ) externals=( zsh ) + for name in $reserved_words; do + if [[ $(builtin whence -w $name) != "$name: reserved" ]]; then + builtin echo "reserved word '$name' has been redefined" + builtin which $name + redefined+=$name + fi + done for name in $builtins; do if [[ $(builtin whence -w $name) != "$name: builtin" ]]; then builtin echo "builtin '$name' has been redefined" From bb509dda236f8ed04b90806bc66f4ad1a41f57bc Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Fri, 9 Oct 2015 07:07:57 -0700 Subject: [PATCH 043/537] Renaming colored-man to colored-man-pages because it needs to be. --- .../colored-man-pages.plugin.zsh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename plugins/{colored-man/colored-man.plugin.zsh => colored-man-pages/colored-man-pages.plugin.zsh} (100%) diff --git a/plugins/colored-man/colored-man.plugin.zsh b/plugins/colored-man-pages/colored-man-pages.plugin.zsh similarity index 100% rename from plugins/colored-man/colored-man.plugin.zsh rename to plugins/colored-man-pages/colored-man-pages.plugin.zsh From 252078dd6c8adc78c6c9d3564dd16fca5aa146a1 Mon Sep 17 00:00:00 2001 From: Bruno Volcov Date: Fri, 9 Oct 2015 18:47:48 -0300 Subject: [PATCH 044/537] add alias to sort by version --- 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 4f274503..15caab28 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -212,6 +212,7 @@ alias gsts='git stash show --text' alias gsu='git submodule update' alias gts='git tag -s' +alias gtv='git tag | sort -V' alias gunignore='git update-index --no-assume-unchanged' alias gunwip='git log -n 1 | grep -q -c "\-\-wip\-\-" && git reset HEAD~1' From 2d0e7fbdadce6a3d052ea0f33ccf9114a4b23c0a Mon Sep 17 00:00:00 2001 From: Andrew Janke Date: Fri, 9 Oct 2015 20:35:19 -0400 Subject: [PATCH 045/537] autoenv: actually source autoenv once located Fixes bug introduced in #4440 --- plugins/autoenv/autoenv.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/autoenv/autoenv.plugin.zsh b/plugins/autoenv/autoenv.plugin.zsh index c9f96811..ea2e56dd 100644 --- a/plugins/autoenv/autoenv.plugin.zsh +++ b/plugins/autoenv/autoenv.plugin.zsh @@ -17,6 +17,7 @@ In the meantime the autoenv plugin is DISABLED. END return 1 fi + source $autoenv_dir/activate.sh fi } [[ $? != 0 ]] && return $? From 7597bf805e6c9bfd0cbe216251d6dd639ecffcea Mon Sep 17 00:00:00 2001 From: Satoshi Ohmori Date: Sat, 10 Oct 2015 11:49:56 +0900 Subject: [PATCH 046/537] Add an alias for upstream --- 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 4f274503..600f756e 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -217,6 +217,7 @@ alias gunignore='git update-index --no-assume-unchanged' alias gunwip='git log -n 1 | grep -q -c "\-\-wip\-\-" && git reset HEAD~1' alias gup='git pull --rebase' alias gupv='git pull --rebase -v' +alias glum='git pull upstream master' alias gvt='git verify-tag' From b18d386d7fe6c6569a9a05a306b50c6dada9c474 Mon Sep 17 00:00:00 2001 From: Gustavo Villa Date: Mon, 12 Oct 2015 04:32:22 -0300 Subject: [PATCH 047/537] Add option '--port' to 'rails server' alias. --- plugins/rails/rails.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/rails/rails.plugin.zsh b/plugins/rails/rails.plugin.zsh index 1bbd1fb4..a390c919 100644 --- a/plugins/rails/rails.plugin.zsh +++ b/plugins/rails/rails.plugin.zsh @@ -42,6 +42,7 @@ alias rp='rails plugin' alias ru='rails runner' alias rs='rails server' alias rsd='rails server --debugger' +alias rsp='rails server --port' # Rake aliases alias rdm='rake db:migrate' From 8a95cedc3b200762f44d1c4e9475240f0d61c8a1 Mon Sep 17 00:00:00 2001 From: Arvind Chembarpu Date: Thu, 15 Oct 2015 08:43:40 +0530 Subject: [PATCH 048/537] Init pyenv virtualenvs too --- plugins/pyenv/pyenv.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/pyenv/pyenv.plugin.zsh b/plugins/pyenv/pyenv.plugin.zsh index b3dc7aa1..706aad3c 100644 --- a/plugins/pyenv/pyenv.plugin.zsh +++ b/plugins/pyenv/pyenv.plugin.zsh @@ -18,6 +18,7 @@ for pyenvdir in "${pyenvdirs[@]}" ; do export PYENV_ROOT=$pyenvdir export PATH=${pyenvdir}/bin:$PATH eval "$(pyenv init --no-rehash - zsh)" + eval "$(pyenv virtualenv-init - zsh)" function pyenv_prompt_info() { echo "$(pyenv version-name)" From 8a362b2b1f00448af6dd2ef1a6b0d5ea2d9b025e Mon Sep 17 00:00:00 2001 From: Arvind Chembarpu Date: Thu, 15 Oct 2015 08:44:15 +0530 Subject: [PATCH 049/537] Enable pyenv rehash --- plugins/pyenv/pyenv.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/pyenv/pyenv.plugin.zsh b/plugins/pyenv/pyenv.plugin.zsh index 706aad3c..b06507b6 100644 --- a/plugins/pyenv/pyenv.plugin.zsh +++ b/plugins/pyenv/pyenv.plugin.zsh @@ -17,7 +17,7 @@ for pyenvdir in "${pyenvdirs[@]}" ; do FOUND_PYENV=1 export PYENV_ROOT=$pyenvdir export PATH=${pyenvdir}/bin:$PATH - eval "$(pyenv init --no-rehash - zsh)" + eval "$(pyenv init - zsh)" eval "$(pyenv virtualenv-init - zsh)" function pyenv_prompt_info() { From e5164d7b704d34f1f15c297b18cb90ecd22991a0 Mon Sep 17 00:00:00 2001 From: Gustavo Villa Date: Thu, 15 Oct 2015 16:14:54 -0300 Subject: [PATCH 050/537] Add 'rake stats' alias. --- plugins/rails/rails.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/rails/rails.plugin.zsh b/plugins/rails/rails.plugin.zsh index a390c919..8af1d630 100644 --- a/plugins/rails/rails.plugin.zsh +++ b/plugins/rails/rails.plugin.zsh @@ -61,6 +61,7 @@ alias rr='rake routes' alias rrg='rake routes | grep' alias rt='rake test' alias rmd='rake middleware' +alias rsts='rake stats' # legacy stuff alias sstat='thin --stats "/thin/stats" start' From e59e1c8417513a246509f7738ae05b4f2c9a8a8e Mon Sep 17 00:00:00 2001 From: Arvind Chembarpu Date: Fri, 16 Oct 2015 23:19:55 +0530 Subject: [PATCH 051/537] Check for git before trying to upgrade, as per #4504 --- tools/check_for_upgrade.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh index 5afd83c1..1c897cb3 100644 --- a/tools/check_for_upgrade.sh +++ b/tools/check_for_upgrade.sh @@ -26,6 +26,9 @@ fi # oh-my-zsh directory. [[ -w "$ZSH" ]] || return 0 +# Cancel upgrade if git is unavailable on the system +whence git >/dev/null || return 0 + if [ -f ~/.zsh-update ] then . ~/.zsh-update @@ -54,4 +57,3 @@ else # create the zsh file _update_zsh_update fi - From 75e619b72421e7330011c8bda5f99af5231a8b7d Mon Sep 17 00:00:00 2001 From: Yannick Eckey Date: Thu, 15 Oct 2015 15:37:30 +0200 Subject: [PATCH 052/537] Fix install.sh/upgrade.sh for tput-less systems @fcrozat's original fix assumes `which` not to output anything to STDOUT in case the command is not found. That is not necessarily true on all systems. A better solution is to check the return value instead. Fixes #4376 --- tools/install.sh | 5 ++--- tools/upgrade.sh | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/tools/install.sh b/tools/install.sh index 5633320a..542bf97c 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -2,9 +2,8 @@ set -e # Use colors, but only if connected to a terminal, and that terminal # supports them. -tput=$(which tput) -if [ -n "$tput" ]; then - ncolors=$($tput colors) +if which tput >/dev/null 2>&1; then + ncolors=$(tput colors) fi if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then RED="$(tput setaf 1)" diff --git a/tools/upgrade.sh b/tools/upgrade.sh index 6e969620..fe8fbadc 100644 --- a/tools/upgrade.sh +++ b/tools/upgrade.sh @@ -1,8 +1,7 @@ # Use colors, but only if connected to a terminal, and that terminal # supports them. -tput=$(which tput) -if [ -n "$tput" ]; then +if which tput >/dev/null 2>&1; then ncolors=$(tput colors) fi if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then From 2c54428d6e3c683e5b01b30d8405232f98668691 Mon Sep 17 00:00:00 2001 From: Superbil Date: Sat, 17 Oct 2015 05:55:29 +0800 Subject: [PATCH 053/537] Fixd bug for pyenv plugin Check pyenv-virtualenv can eval before use it. Signed-off-by: Superbil --- plugins/pyenv/pyenv.plugin.zsh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/pyenv/pyenv.plugin.zsh b/plugins/pyenv/pyenv.plugin.zsh index b06507b6..aa1f9488 100644 --- a/plugins/pyenv/pyenv.plugin.zsh +++ b/plugins/pyenv/pyenv.plugin.zsh @@ -18,7 +18,10 @@ for pyenvdir in "${pyenvdirs[@]}" ; do export PYENV_ROOT=$pyenvdir export PATH=${pyenvdir}/bin:$PATH eval "$(pyenv init - zsh)" - eval "$(pyenv virtualenv-init - zsh)" + + if pyenv commands | command grep -q virtualenv-init; then + eval "$(pyenv virtualenv-init - zsh)" + fi function pyenv_prompt_info() { echo "$(pyenv version-name)" From 2c8697b934847a84d68f2e00ba1d0cabeed19412 Mon Sep 17 00:00:00 2001 From: Satoshi Ohmori Date: Tue, 20 Oct 2015 18:45:12 +0900 Subject: [PATCH 054/537] [FIX #4525]: Fix typo --- plugins/git-extras/git-extras.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/git-extras/git-extras.plugin.zsh b/plugins/git-extras/git-extras.plugin.zsh index 681fbb46..507bf1b2 100644 --- a/plugins/git-extras/git-extras.plugin.zsh +++ b/plugins/git-extras/git-extras.plugin.zsh @@ -302,7 +302,7 @@ zstyle ':completion:*:*:git:*' user-commands \ count:'count commits' \ create-branch:'create local and remote branch' \ delete-branch:'delete local and remote branch' \ - delete-merged-brancees:'delete merged branches'\ + delete-merged-branches:'delete merged branches'\ delete-submodule:'delete submodule' \ delete-tag:'delete local and remote tag' \ effort:'display effort statistics' \ From c9d93757e82785a0fd1e0d1222f5d61e01849703 Mon Sep 17 00:00:00 2001 From: Brian J Brennan Date: Sun, 18 Oct 2015 13:20:49 -0400 Subject: [PATCH 055/537] Make install script safer This changeset wraps all of the commands in tools/install.sh in a function and then calls that function as the last line of the script. The current install instructions ask the user to download the install script using `curl` and pass the result to `sh`. This is totally fine (as long as both the instructions and the script itself are served using HTTPS), but the script should be written in a way such that it doesn't start trying to actually *do* anything until the very last line. The reason is due to the way `curl` work: if the socket drops before the request is complete (server abruptly hangs up, client's internet flakes out, etc.), `curl` will return the partial data that it received. Here is an example of that: ![partial file execution](https://cldup.com/qU_Mnh2GmT.png) A way this might cause issues for tools/install.sh is if the connection drops after cloning but before the repository (L53-56). The .zshrc configuration will not be copied and the shell will not be changed, but if the user tries to run the install script again it will claim oh-my-zsh is already installed (L31-39). While this is not a particularly dangerous error condition (the user can just delete .oh-my-zsh and re-run), it can certainly be confusing for new users. This also helps future-proof the script for a time when it might need to use a "dangerous" command, e.g. `rm`, and we want to make sure it happens in the most transactional way possible. --- tools/install.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/install.sh b/tools/install.sh index 67d341c7..dd9c4f84 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -1,3 +1,4 @@ +function main() { # Use colors, but only if connected to a terminal, and that terminal # supports them. tput=$(which tput) @@ -117,3 +118,6 @@ echo 'p.p.s. Get stickers and t-shirts at http://shop.planetargon.com.' echo '' printf "${NORMAL}" env zsh +} + +main From fe02e027fe2d549d6027d51b95a8a724e40958df Mon Sep 17 00:00:00 2001 From: evanandrewrose Date: Mon, 19 Oct 2015 08:21:41 -0400 Subject: [PATCH 056/537] Fix "be" -> "b" typo in coffee plugin README.md. --- plugins/coffee/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/coffee/README.md b/plugins/coffee/README.md index d0e7bbe7..432ce341 100644 --- a/plugins/coffee/README.md +++ b/plugins/coffee/README.md @@ -11,7 +11,7 @@ Preview the compiled result of your coffeescript with `cf "code"` as per the following: ```zsh -$ cf 'if a then be else c' +$ cf 'if a then b else c' if (a) { b; } else { From 78dc8583969a046b51ef4f099b1d182f73dcaa12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 21 Oct 2015 10:36:40 +0200 Subject: [PATCH 057/537] Revert "Make install script safer" This reverts commit c9d93757e82785a0fd1e0d1222f5d61e01849703, which makes it fail with a syntax error: sh: 1: Syntax error: "(" unexpected --- tools/install.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tools/install.sh b/tools/install.sh index e6590502..be43968b 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -1,4 +1,3 @@ -function main() { # Use colors, but only if connected to a terminal, and that terminal # supports them. if which tput >/dev/null 2>&1; then @@ -117,6 +116,3 @@ echo 'p.p.s. Get stickers and t-shirts at http://shop.planetargon.com.' echo '' printf "${NORMAL}" env zsh -} - -main From ca5632bce10e1f5b0fe2a59151ae0fd776619d89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 21 Oct 2015 10:44:56 +0200 Subject: [PATCH 058/537] Fix syntax error in #4515 on certain shells Drops the `function` keyword and uses only `func(){}` syntax as per the POSIX specification: http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_09_05 Related: #4531 --- tools/install.sh | 232 ++++++++++++++++++++++++----------------------- 1 file changed, 118 insertions(+), 114 deletions(-) diff --git a/tools/install.sh b/tools/install.sh index be43968b..8cba5208 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -1,118 +1,122 @@ -# Use colors, but only if connected to a terminal, and that terminal -# supports them. -if which tput >/dev/null 2>&1; then - ncolors=$(tput colors) -fi -if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then - RED="$(tput setaf 1)" - GREEN="$(tput setaf 2)" - YELLOW="$(tput setaf 3)" - BLUE="$(tput setaf 4)" - BOLD="$(tput bold)" - NORMAL="$(tput sgr0)" -else - RED="" - GREEN="" - YELLOW="" - BLUE="" - BOLD="" - NORMAL="" -fi - -# Only enable exit-on-error after the non-critical colorization stuff, -# which may fail on systems lacking tput or terminfo -set -e - -CHECK_ZSH_INSTALLED=$(grep /zsh$ /etc/shells | wc -l) -if [ ! $CHECK_ZSH_INSTALLED -ge 1 ]; then - printf "${YELLOW}Zsh is not installed!${NORMAL} Please install zsh first!\n" - exit -fi -unset CHECK_ZSH_INSTALLED - -if [ ! -n "$ZSH" ]; then - ZSH=~/.oh-my-zsh -fi - -if [ -d "$ZSH" ]; then - printf "${YELLOW}You already have Oh My Zsh installed.${NORMAL}\n" - printf "You'll need to remove $ZSH if you want to re-install.\n" - exit -fi - -# Prevent the cloned repository from having insecure permissions. Failing to do -# so causes compinit() calls to fail with "command not found: compdef" errors -# for users with insecure umasks (e.g., "002", allowing group writability). Note -# that this will be ignored under Cygwin by default, as Windows ACLs take -# precedence over umasks except for filesystems mounted with option "noacl". -umask g-w,o-w - -printf "${BLUE}Cloning Oh My Zsh...${NORMAL}\n" -hash git >/dev/null 2>&1 || { - echo "Error: git is not installed" - exit 1 -} -env git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git $ZSH || { - printf "Error: git clone of oh-my-zsh repo failed\n" - exit 1 -} - -# The Windows (MSYS) Git is not compatible with normal use on cygwin -if [ "$OSTYPE" = cygwin ]; then - if git --version | grep msysgit > /dev/null; then - echo "Error: Windows/MSYS Git is not supported on Cygwin" - echo "Error: Make sure the Cygwin git package is installed and is first on the path" - exit 1 +main() { + # Use colors, but only if connected to a terminal, and that terminal + # supports them. + if which tput >/dev/null 2>&1; then + ncolors=$(tput colors) fi -fi - -printf "${BLUE}Looking for an existing zsh config...${NORMAL}\n" -if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then - printf "${YELLOW}Found ~/.zshrc.${NORMAL} ${GREEN}Backing up to ~/.zshrc.pre-oh-my-zsh${NORMAL}\n"; - mv ~/.zshrc ~/.zshrc.pre-oh-my-zsh; -fi - -printf "${BLUE}Using the Oh My Zsh template file and adding it to ~/.zshrc${NORMAL}\n" -cp $ZSH/templates/zshrc.zsh-template ~/.zshrc -sed "/^export ZSH=/ c\\ -export ZSH=$ZSH -" ~/.zshrc > ~/.zshrc-omztemp -mv -f ~/.zshrc-omztemp ~/.zshrc - -printf "${BLUE}Copying your current PATH and adding it to the end of ~/.zshrc for you.${NORMAL}\n" -sed "/export PATH=/ c\\ -export PATH=\"$PATH\" -" ~/.zshrc > ~/.zshrc-omztemp -mv -f ~/.zshrc-omztemp ~/.zshrc - -# If this user's login shell is not already "zsh", attempt to switch. -TEST_CURRENT_SHELL=$(expr "$SHELL" : '.*/\(.*\)') -if [ "$TEST_CURRENT_SHELL" != "zsh" ]; then - # If this platform provides a "chsh" command (not Cygwin), do it, man! - if hash chsh >/dev/null 2>&1; then - printf "${BLUE}Time to change your default shell to zsh!${NORMAL}\n" - chsh -s $(grep /zsh$ /etc/shells | tail -1) - # Else, suggest the user do so manually. + if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then + RED="$(tput setaf 1)" + GREEN="$(tput setaf 2)" + YELLOW="$(tput setaf 3)" + BLUE="$(tput setaf 4)" + BOLD="$(tput bold)" + NORMAL="$(tput sgr0)" else - printf "I can't change your shell automatically because this system does not have chsh.\n" - printf "${BLUE}Please manually change your default shell to zsh!${NORMAL}\n" + RED="" + GREEN="" + YELLOW="" + BLUE="" + BOLD="" + NORMAL="" fi -fi -printf "${GREEN}" -echo ' __ __ ' -echo ' ____ / /_ ____ ___ __ __ ____ _____/ /_ ' -echo ' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ ' -echo '/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / ' -echo '\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ ' -echo ' /____/ ....is now installed!' -echo '' -echo '' -echo 'Please look over the ~/.zshrc file to select plugins, themes, and options.' -echo '' -echo 'p.s. Follow us at https://twitter.com/ohmyzsh.' -echo '' -echo 'p.p.s. Get stickers and t-shirts at http://shop.planetargon.com.' -echo '' -printf "${NORMAL}" -env zsh + # Only enable exit-on-error after the non-critical colorization stuff, + # which may fail on systems lacking tput or terminfo + set -e + + CHECK_ZSH_INSTALLED=$(grep /zsh$ /etc/shells | wc -l) + if [ ! $CHECK_ZSH_INSTALLED -ge 1 ]; then + printf "${YELLOW}Zsh is not installed!${NORMAL} Please install zsh first!\n" + exit + fi + unset CHECK_ZSH_INSTALLED + + if [ ! -n "$ZSH" ]; then + ZSH=~/.oh-my-zsh + fi + + if [ -d "$ZSH" ]; then + printf "${YELLOW}You already have Oh My Zsh installed.${NORMAL}\n" + printf "You'll need to remove $ZSH if you want to re-install.\n" + exit + fi + + # Prevent the cloned repository from having insecure permissions. Failing to do + # so causes compinit() calls to fail with "command not found: compdef" errors + # for users with insecure umasks (e.g., "002", allowing group writability). Note + # that this will be ignored under Cygwin by default, as Windows ACLs take + # precedence over umasks except for filesystems mounted with option "noacl". + umask g-w,o-w + + printf "${BLUE}Cloning Oh My Zsh...${NORMAL}\n" + hash git >/dev/null 2>&1 || { + echo "Error: git is not installed" + exit 1 + } + env git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git $ZSH || { + printf "Error: git clone of oh-my-zsh repo failed\n" + exit 1 + } + + # The Windows (MSYS) Git is not compatible with normal use on cygwin + if [ "$OSTYPE" = cygwin ]; then + if git --version | grep msysgit > /dev/null; then + echo "Error: Windows/MSYS Git is not supported on Cygwin" + echo "Error: Make sure the Cygwin git package is installed and is first on the path" + exit 1 + fi + fi + + printf "${BLUE}Looking for an existing zsh config...${NORMAL}\n" + if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then + printf "${YELLOW}Found ~/.zshrc.${NORMAL} ${GREEN}Backing up to ~/.zshrc.pre-oh-my-zsh${NORMAL}\n"; + mv ~/.zshrc ~/.zshrc.pre-oh-my-zsh; + fi + + printf "${BLUE}Using the Oh My Zsh template file and adding it to ~/.zshrc${NORMAL}\n" + cp $ZSH/templates/zshrc.zsh-template ~/.zshrc + sed "/^export ZSH=/ c\\ + export ZSH=$ZSH + " ~/.zshrc > ~/.zshrc-omztemp + mv -f ~/.zshrc-omztemp ~/.zshrc + + printf "${BLUE}Copying your current PATH and adding it to the end of ~/.zshrc for you.${NORMAL}\n" + sed "/export PATH=/ c\\ + export PATH=\"$PATH\" + " ~/.zshrc > ~/.zshrc-omztemp + mv -f ~/.zshrc-omztemp ~/.zshrc + + # If this user's login shell is not already "zsh", attempt to switch. + TEST_CURRENT_SHELL=$(expr "$SHELL" : '.*/\(.*\)') + if [ "$TEST_CURRENT_SHELL" != "zsh" ]; then + # If this platform provides a "chsh" command (not Cygwin), do it, man! + if hash chsh >/dev/null 2>&1; then + printf "${BLUE}Time to change your default shell to zsh!${NORMAL}\n" + chsh -s $(grep /zsh$ /etc/shells | tail -1) + # Else, suggest the user do so manually. + else + printf "I can't change your shell automatically because this system does not have chsh.\n" + printf "${BLUE}Please manually change your default shell to zsh!${NORMAL}\n" + fi + fi + + printf "${GREEN}" + echo ' __ __ ' + echo ' ____ / /_ ____ ___ __ __ ____ _____/ /_ ' + echo ' / __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \ ' + echo '/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / / ' + echo '\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ ' + echo ' /____/ ....is now installed!' + echo '' + echo '' + echo 'Please look over the ~/.zshrc file to select plugins, themes, and options.' + echo '' + echo 'p.s. Follow us at https://twitter.com/ohmyzsh.' + echo '' + echo 'p.p.s. Get stickers and t-shirts at http://shop.planetargon.com.' + echo '' + printf "${NORMAL}" + env zsh +} + +main From b2010a0ae63ba09632a3b427edc81888eadec4d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 21 Oct 2015 11:17:37 +0200 Subject: [PATCH 059/537] Fix syntax error in confirmation prompt of uninstall.sh We need to use POSIX syntax. This file is no longer executed with zsh. Fixes #4483. --- tools/uninstall.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/uninstall.sh b/tools/uninstall.sh index f9da00c9..488b002e 100644 --- a/tools/uninstall.sh +++ b/tools/uninstall.sh @@ -1,8 +1,8 @@ read -r -p "Are you sure you want to remove Oh My Zsh? [y/N] " confirmation -if ! [[ $confirmation =~ ^[yY]$ ]] +if [ $confirmation = y ] && [ $confirmation = Y ] then - echo "Uninstall cancelled" - exit + echo "Uninstall cancelled" + exit fi echo "Removing ~/.oh-my-zsh" From 4e42e1f7e149f85ba52b654dbea9766080a9a480 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 21 Oct 2015 11:28:12 +0200 Subject: [PATCH 060/537] Fix conditional in uninstall prompt --- tools/uninstall.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/uninstall.sh b/tools/uninstall.sh index 488b002e..80b11a10 100644 --- a/tools/uninstall.sh +++ b/tools/uninstall.sh @@ -1,5 +1,5 @@ read -r -p "Are you sure you want to remove Oh My Zsh? [y/N] " confirmation -if [ $confirmation = y ] && [ $confirmation = Y ] +if [ $confirmation = y ] || [ $confirmation = Y ] then echo "Uninstall cancelled" exit From a1755e652cd96efb22b4956e8ef9759d7d170f5d Mon Sep 17 00:00:00 2001 From: Satoshi Ohmori Date: Fri, 16 Oct 2015 04:49:53 +0900 Subject: [PATCH 061/537] Refactor for method in plugins/rake-fast/rake-fast.plugin.zsh --- plugins/rake-fast/rake-fast.plugin.zsh | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/plugins/rake-fast/rake-fast.plugin.zsh b/plugins/rake-fast/rake-fast.plugin.zsh index cfc9a079..d305eb1f 100644 --- a/plugins/rake-fast/rake-fast.plugin.zsh +++ b/plugins/rake-fast/rake-fast.plugin.zsh @@ -8,17 +8,7 @@ _rake_refresh () { } _rake_does_task_list_need_generating () { - if [ ! -f .rake_tasks ]; then return 0; - else - if [[ "$OSTYPE" = darwin* ]]; then - accurate=$(stat -f%m .rake_tasks) - changed=$(stat -f%m Rakefile) - else - accurate=$(stat -c%Y .rake_tasks) - changed=$(stat -c%Y Rakefile) - fi - return $(expr $accurate '>=' $changed) - fi + [[ ! -f .rake_tasks ]] || [[ Rakefile -nt .rake_tasks ]] } _rake_generate () { From d06f4d089302ecd448eaa557baf6ed4fca34428b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 21 Oct 2015 16:44:26 +0200 Subject: [PATCH 062/537] Fix backwards logic in uninstaller once and for all Really this time :P Fixes #4533 --- tools/uninstall.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/uninstall.sh b/tools/uninstall.sh index 80b11a10..9ad1b64a 100644 --- a/tools/uninstall.sh +++ b/tools/uninstall.sh @@ -1,5 +1,5 @@ read -r -p "Are you sure you want to remove Oh My Zsh? [y/N] " confirmation -if [ $confirmation = y ] || [ $confirmation = Y ] +if [ "$confirmation" != y ] && [ "$confirmation" != Y ] then echo "Uninstall cancelled" exit From 9264d75d5d1c10de370b0c32606b70768541eaaa Mon Sep 17 00:00:00 2001 From: Cooper Maruyama Date: Mon, 15 Jun 2015 01:22:40 -0700 Subject: [PATCH 063/537] Fix typo. * `cfp` alias was referencing an old version of the `cf` command which no longer exists. This has been updated to reference a valid command. --- plugins/coffee/coffee.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/coffee/coffee.plugin.zsh b/plugins/coffee/coffee.plugin.zsh index 77cb663f..6d1ce5ce 100644 --- a/plugins/coffee/coffee.plugin.zsh +++ b/plugins/coffee/coffee.plugin.zsh @@ -10,7 +10,7 @@ cfc () { } # compile from clipboard & print -alias cfp='coffeeMe "$(clippaste)"' +alias cfp='cf "$(clippaste)"' # compile from clipboard and copy to clipboard alias cfpc='cfp | clipcopy' From e9de366ea7f20962f1847828b3ca185bab69a118 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 21 Oct 2015 17:39:13 +0200 Subject: [PATCH 064/537] Update custom location command and fix code format --- README.markdown | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/README.markdown b/README.markdown index 779ce77c..cee314de 100644 --- a/README.markdown +++ b/README.markdown @@ -25,11 +25,15 @@ Oh My Zsh is installed by running one of the following commands in your terminal #### via curl -`sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"` +```shell +sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" +``` #### via wget -`sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"` +```shell +sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)" +``` ## Using Oh My Zsh @@ -100,7 +104,7 @@ The default location is `~/.oh-my-zsh` (hidden in your home directory) If you'd like to change the install directory with the `ZSH` environment variable, either by running `export ZSH=/your/path` before installing, or by setting it before the end of the install pipeline like this: ```shell -curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | ZSH=~/.dotfiles/zsh sh +export ZSH="~/.dotfiles/oh-my-zsh"; sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" ``` #### Manual Installation From 67abf0f955551e22335f5912a87e92d278afb669 Mon Sep 17 00:00:00 2001 From: Alexander Golikov Date: Thu, 22 Oct 2015 16:58:44 +0500 Subject: [PATCH 065/537] Update frontcube.zsh-theme MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix «rvm» variable usage in RPROMPT out --- themes/frontcube.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/frontcube.zsh-theme b/themes/frontcube.zsh-theme index d9f5b6d9..539e744f 100644 --- a/themes/frontcube.zsh-theme +++ b/themes/frontcube.zsh-theme @@ -4,7 +4,7 @@ PROMPT=' %{$fg_bold[gray]%}%~%{$fg_bold[blue]%}%{$fg_bold[blue]%} % %{$reset_color%} %{$fg[green]%}➞ %{$reset_color%' -RPROMPT='$(git_prompt_info) $(rvm)' +RPROMPT='$(git_prompt_info) ${rvm}' ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}[git:" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" From 45cd2df31fc6d1250cbcad2ee0d562c67a163523 Mon Sep 17 00:00:00 2001 From: LE Manh Cuong Date: Fri, 23 Oct 2015 09:03:24 +0700 Subject: [PATCH 066/537] Update uninstall.sh - Need dot `.` for POSIX compliant instead of `source` - Use modern syntax for command substitution - Fix missing double quotes --- tools/uninstall.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/uninstall.sh b/tools/uninstall.sh index 9ad1b64a..147535a1 100644 --- a/tools/uninstall.sh +++ b/tools/uninstall.sh @@ -18,14 +18,14 @@ then if [ -f ~/.zshrc ] || [ -h ~/.zshrc ] then - ZSHRC_SAVE=".zshrc.omz-uninstalled-`date +%Y%m%d%H%M%S`"; + ZSHRC_SAVE=".zshrc.omz-uninstalled-$(date +%Y%m%d%H%M%S)"; echo "Found ~/.zshrc -- Renaming to ~/${ZSHRC_SAVE}"; - mv ~/.zshrc ~/${ZSHRC_SAVE}; + mv ~/.zshrc ~/"${ZSHRC_SAVE}"; fi mv ~/.zshrc.pre-oh-my-zsh ~/.zshrc; - source ~/.zshrc; + . ~/.zshrc; else if hash chsh >/dev/null 2>&1 then From 53a63355beb1143aa5f6759a3dfdb1d7657475fe Mon Sep 17 00:00:00 2001 From: LE Manh Cuong Date: Fri, 23 Oct 2015 14:15:03 +0700 Subject: [PATCH 067/537] Change coding style --- tools/uninstall.sh | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/tools/uninstall.sh b/tools/uninstall.sh index 147535a1..132e6376 100644 --- a/tools/uninstall.sh +++ b/tools/uninstall.sh @@ -1,23 +1,19 @@ read -r -p "Are you sure you want to remove Oh My Zsh? [y/N] " confirmation -if [ "$confirmation" != y ] && [ "$confirmation" != Y ] -then +if [ "$confirmation" != y ] && [ "$confirmation" != Y ]; then echo "Uninstall cancelled" exit fi echo "Removing ~/.oh-my-zsh" -if [ -d ~/.oh-my-zsh ] -then +if [ -d ~/.oh-my-zsh ]; then rm -rf ~/.oh-my-zsh fi echo "Looking for original zsh config..." -if [ -f ~/.zshrc.pre-oh-my-zsh ] || [ -h ~/.zshrc.pre-oh-my-zsh ] -then +if [ -f ~/.zshrc.pre-oh-my-zsh ] || [ -h ~/.zshrc.pre-oh-my-zsh ]; then echo "Found ~/.zshrc.pre-oh-my-zsh -- Restoring to ~/.zshrc"; - if [ -f ~/.zshrc ] || [ -h ~/.zshrc ] - then + if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then ZSHRC_SAVE=".zshrc.omz-uninstalled-$(date +%Y%m%d%H%M%S)"; echo "Found ~/.zshrc -- Renaming to ~/${ZSHRC_SAVE}"; mv ~/.zshrc ~/"${ZSHRC_SAVE}"; @@ -27,8 +23,7 @@ then . ~/.zshrc; else - if hash chsh >/dev/null 2>&1 - then + if hash chsh >/dev/null 2>&1; then echo "Switching back to bash" chsh -s /bin/bash else From 8d388e464c705153e6a4d15bb783048ff5e51612 Mon Sep 17 00:00:00 2001 From: Danny Hawkins Date: Fri, 30 Oct 2015 08:11:38 +0000 Subject: [PATCH 068/537] use capit instead of shipit as shipit conflicts with npm package shipit --- plugins/capistrano/_capistrano | 6 +++--- plugins/capistrano/capistrano.plugin.zsh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/capistrano/_capistrano b/plugins/capistrano/_capistrano index c19c20b7..a79e47b2 100644 --- a/plugins/capistrano/_capistrano +++ b/plugins/capistrano/_capistrano @@ -1,7 +1,7 @@ -#compdef shipit +#compdef capit #autoload -# Added `shipit` because `cap` is a reserved word. `cap` completion doesn't work. +# Added `capit` because `cap` is a reserved word. `cap` completion doesn't work. # http://zsh.sourceforge.net/Doc/Release/Zsh-Modules.html#The-zsh_002fcap-Module local curcontext="$curcontext" state line ret=1 @@ -14,7 +14,7 @@ _arguments -C \ _cap_tasks() { if [[ -f config/deploy.rb || -f Capfile ]]; then if [[ ! -f .cap_tasks~ ]]; then - shipit --tasks | sed 's/\(\[\)\(.*\)\(\]\)/\2:/' | awk '{command=$2; $1=$2=$3=""; gsub(/^[ \t\r\n]+/, "", $0); gsub(":", "\\:", command); print command"["$0"]"}' > .cap_tasks~ + capit --tasks | sed 's/\(\[\)\(.*\)\(\]\)/\2:/' | awk '{command=$2; $1=$2=$3=""; gsub(/^[ \t\r\n]+/, "", $0); gsub(":", "\\:", command); print command"["$0"]"}' > .cap_tasks~ fi OLD_IFS=$IFS diff --git a/plugins/capistrano/capistrano.plugin.zsh b/plugins/capistrano/capistrano.plugin.zsh index c85eb474..0b555979 100644 --- a/plugins/capistrano/capistrano.plugin.zsh +++ b/plugins/capistrano/capistrano.plugin.zsh @@ -1,7 +1,7 @@ # Added `shipit` because `cap` is a reserved word. `cap` completion doesn't work. # http://zsh.sourceforge.net/Doc/Release/Zsh-Modules.html#The-zsh_002fcap-Module -func shipit() { +func capit() { if [ -f Gemfile ] then bundle exec cap $* From 9e4aba4c8c59c9fce50590f78e12fdff0b69c792 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sun, 1 Nov 2015 00:21:26 +0100 Subject: [PATCH 069/537] archlinux: use $+commands instead of 'command -v' in a subshell --- plugins/archlinux/archlinux.plugin.zsh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/plugins/archlinux/archlinux.plugin.zsh b/plugins/archlinux/archlinux.plugin.zsh index b83c2456..99de5b93 100644 --- a/plugins/archlinux/archlinux.plugin.zsh +++ b/plugins/archlinux/archlinux.plugin.zsh @@ -2,7 +2,7 @@ # 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 `command -v yaourt` ]]; then +if (( $+commands[yaourt] )); then upgrade () { yaourt -Syu } @@ -21,11 +21,11 @@ if [[ -x `command -v yaourt` ]]; then alias yalst='yaourt -Qe' # List installed packages, even those installed from AUR (they're tagged as "local") alias yaorph='yaourt -Qtd' # Remove orphans using yaourt # Additional yaourt alias examples - if [[ -x `command -v abs` && -x `command -v aur` ]]; then + if (( $+commands[abs] && $+commands[aur] )); then alias yaupd='yaourt -Sy && sudo abs && sudo aur' # Update and refresh the local package, ABS and AUR databases against repositories - elif [[ -x `command -v abs` ]]; then + elif (( $+commands[abs] )); then alias yaupd='yaourt -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories - elif [[ -x `command -v aur` ]]; then + elif (( $+commands[aur] )); then alias yaupd='yaourt -Sy && sudo aur' # Update and refresh the local package and AUR databases against repositories else alias yaupd='yaourt -Sy' # Update and refresh the local package database against repositories @@ -49,11 +49,11 @@ alias pacreps='pacman -Ss' # Search for package(s) in the repositori alias pacloc='pacman -Qi' # Display information about a given package in the local database alias paclocs='pacman -Qs' # Search for package(s) in the local database # Additional pacman alias examples -if [[ -x `command -v abs` && -x `command -v aur` ]]; then +if (( $+commands[abs] && $+commands[aur] )); then alias pacupd='sudo pacman -Sy && sudo abs && sudo aur' # Update and refresh the local package, ABS and AUR databases against repositories -elif [[ -x `command -v abs` ]]; then +elif (( $+commands[abs] )); then alias pacupd='sudo pacman -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories -elif [[ -x `command -v aur` ]]; then +elif (( $+commands[aur] )); then alias pacupd='sudo pacman -Sy && sudo aur' # Update and refresh the local package and AUR databases against repositories else alias pacupd='sudo pacman -Sy' # Update and refresh the local package database against repositories From 4c292ea2b023a331dcf1af5644487f2272d24a4d Mon Sep 17 00:00:00 2001 From: Sebastian Gniazdowski Date: Sun, 20 Sep 2015 14:39:46 +0200 Subject: [PATCH 070/537] Initial commit of Zsh Navigation Tools --- .../.config/znt/README.txt | 1 + .../.config/znt/n-aliases.conf | 5 + .../.config/znt/n-cd.conf | 25 + .../.config/znt/n-env.conf | 9 + .../.config/znt/n-functions.conf | 10 + .../.config/znt/n-history.conf | 5 + .../.config/znt/n-kill.conf | 13 + .../.config/znt/n-list.conf | 3 + .../.config/znt/n-options.conf | 5 + .../.config/znt/n-panelize.conf | 5 + plugins/zsh-navigation-tools/LICENSE | 700 ++++++++++++++++++ plugins/zsh-navigation-tools/README.txt | 101 +++ plugins/zsh-navigation-tools/n-aliases | 47 ++ plugins/zsh-navigation-tools/n-cd | 68 ++ plugins/zsh-navigation-tools/n-env | 47 ++ plugins/zsh-navigation-tools/n-functions | 54 ++ plugins/zsh-navigation-tools/n-history | 53 ++ plugins/zsh-navigation-tools/n-kill | 96 +++ plugins/zsh-navigation-tools/n-list | 410 ++++++++++ plugins/zsh-navigation-tools/n-list-draw | 131 ++++ plugins/zsh-navigation-tools/n-list-input | 238 ++++++ plugins/zsh-navigation-tools/n-options | 84 +++ plugins/zsh-navigation-tools/n-panelize | 61 ++ plugins/zsh-navigation-tools/znt-cd-widget | 8 + .../zsh-navigation-tools/znt-history-widget | 8 + plugins/zsh-navigation-tools/znt-kill-widget | 8 + .../zsh-navigation-tools/znt-usetty-wrapper | 40 + .../zsh-navigation-tools.plugin.zsh | 38 + 28 files changed, 2273 insertions(+) create mode 100644 plugins/zsh-navigation-tools/.config/znt/README.txt create mode 100644 plugins/zsh-navigation-tools/.config/znt/n-aliases.conf create mode 100644 plugins/zsh-navigation-tools/.config/znt/n-cd.conf create mode 100644 plugins/zsh-navigation-tools/.config/znt/n-env.conf create mode 100644 plugins/zsh-navigation-tools/.config/znt/n-functions.conf create mode 100644 plugins/zsh-navigation-tools/.config/znt/n-history.conf create mode 100644 plugins/zsh-navigation-tools/.config/znt/n-kill.conf create mode 100644 plugins/zsh-navigation-tools/.config/znt/n-list.conf create mode 100644 plugins/zsh-navigation-tools/.config/znt/n-options.conf create mode 100644 plugins/zsh-navigation-tools/.config/znt/n-panelize.conf create mode 100644 plugins/zsh-navigation-tools/LICENSE create mode 100644 plugins/zsh-navigation-tools/README.txt create mode 100644 plugins/zsh-navigation-tools/n-aliases create mode 100644 plugins/zsh-navigation-tools/n-cd create mode 100644 plugins/zsh-navigation-tools/n-env create mode 100644 plugins/zsh-navigation-tools/n-functions create mode 100644 plugins/zsh-navigation-tools/n-history create mode 100644 plugins/zsh-navigation-tools/n-kill create mode 100644 plugins/zsh-navigation-tools/n-list create mode 100644 plugins/zsh-navigation-tools/n-list-draw create mode 100644 plugins/zsh-navigation-tools/n-list-input create mode 100644 plugins/zsh-navigation-tools/n-options create mode 100644 plugins/zsh-navigation-tools/n-panelize create mode 100644 plugins/zsh-navigation-tools/znt-cd-widget create mode 100644 plugins/zsh-navigation-tools/znt-history-widget create mode 100644 plugins/zsh-navigation-tools/znt-kill-widget create mode 100644 plugins/zsh-navigation-tools/znt-usetty-wrapper create mode 100755 plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh diff --git a/plugins/zsh-navigation-tools/.config/znt/README.txt b/plugins/zsh-navigation-tools/.config/znt/README.txt new file mode 100644 index 00000000..c3d6c821 --- /dev/null +++ b/plugins/zsh-navigation-tools/.config/znt/README.txt @@ -0,0 +1 @@ +These are skeletons, configuration is read from ~/.config/znt/* diff --git a/plugins/zsh-navigation-tools/.config/znt/n-aliases.conf b/plugins/zsh-navigation-tools/.config/znt/n-aliases.conf new file mode 100644 index 00000000..98f4625f --- /dev/null +++ b/plugins/zsh-navigation-tools/.config/znt/n-aliases.conf @@ -0,0 +1,5 @@ +# How should be current element of the list drawn. Possible values: reverse, +# underline. Default (without option set) is reverse +# On Linux virtual terminal this will be enforced to reverse (because of poor +# underline support on that terminal) +# local active_text=underline diff --git a/plugins/zsh-navigation-tools/.config/znt/n-cd.conf b/plugins/zsh-navigation-tools/.config/znt/n-cd.conf new file mode 100644 index 00000000..5fcfe64f --- /dev/null +++ b/plugins/zsh-navigation-tools/.config/znt/n-cd.conf @@ -0,0 +1,25 @@ +# Hotlist +local hotlist +hotlist=( + /usr/share/zsh/site-functions + /usr/share/zsh + /usr/local/share/zsh/site-functions + /usr/local/share/zsh + /usr/local/bin + /usr/lib +) + +# Suppress adding (to directory stack) directories visited by n-cd +# Value 0 is the default (directories will be added to dirstack) +local NCD_DONT_PUSHD=0 + +# How should be current element of the list drawn. Possible values: reverse, +# underline. Default (without option set) is reverse +# On Linux virtual terminal this will be enforced to reverse (because of poor +# underline support on that terminal) +# local active_text=underline + +# Colorize last segments of the paths +# (#s) is ^, (#e) is $, # is *, ## is + (comparing to regex) +local NLIST_COLORING_PATTERN="[a-zA-Z0-9 ._-]##/#(#e)" +local NLIST_COLORING_COLOR=$'\x1b[00;33m' diff --git a/plugins/zsh-navigation-tools/.config/znt/n-env.conf b/plugins/zsh-navigation-tools/.config/znt/n-env.conf new file mode 100644 index 00000000..0c4bdce6 --- /dev/null +++ b/plugins/zsh-navigation-tools/.config/znt/n-env.conf @@ -0,0 +1,9 @@ +# How should be current element of the list drawn. Possible values: reverse, +# underline. Default (without option set) is reverse +# On Linux virtual terminal this will be enforced to reverse (because of poor +# underline support on that terminal) +# local active_text=underline + +# (#s) is ^, (#e) is $, # is *, ## is + (comparing to regex) +local NLIST_COLORING_PATTERN="[a-zA-Z0-9_]##" +local NLIST_COLORING_MATCH_MULTIPLE=0 diff --git a/plugins/zsh-navigation-tools/.config/znt/n-functions.conf b/plugins/zsh-navigation-tools/.config/znt/n-functions.conf new file mode 100644 index 00000000..93d31e8f --- /dev/null +++ b/plugins/zsh-navigation-tools/.config/znt/n-functions.conf @@ -0,0 +1,10 @@ +# Which editor to use, zed or vared +# vared is the default +local feditor="zed" +# local feditor="vared" + +# How should be current element of the list drawn. Possible values: reverse, +# underline. Default (without option set) is reverse +# On Linux virtual terminal this will be enforced to reverse (because of poor +# underline support on that terminal) +# local active_text=underline diff --git a/plugins/zsh-navigation-tools/.config/znt/n-history.conf b/plugins/zsh-navigation-tools/.config/znt/n-history.conf new file mode 100644 index 00000000..f798f712 --- /dev/null +++ b/plugins/zsh-navigation-tools/.config/znt/n-history.conf @@ -0,0 +1,5 @@ +# How should be current element of the list drawn. Possible values: reverse, +# underline. Default (without option set) is reverse +# On Linux virtual terminal this will be enforced to reverse (because of poor +# underline support on that terminal) +local active_text=underline diff --git a/plugins/zsh-navigation-tools/.config/znt/n-kill.conf b/plugins/zsh-navigation-tools/.config/znt/n-kill.conf new file mode 100644 index 00000000..f1c4f02d --- /dev/null +++ b/plugins/zsh-navigation-tools/.config/znt/n-kill.conf @@ -0,0 +1,13 @@ +# How should be current element of the list drawn. Possible values: reverse, +# underline. Default (without option set) is reverse +# On Linux virtual terminal this will be enforced to reverse (because of poor +# underline support on that terminal) +# local active_text=underline + +# Colorize first number column and last path segment +# This doesn't cover scripts named "[0-9]## *", which should be very rare +# (#s) is ^, (#e) is $, # is *, ## is + (comparing to regex) +# | is alternative, but only in () +local NLIST_COLORING_PATTERN="((#s) #[0-9]## |[[][^]]#](#e)|[^ 0-9/?\\\\][^/\\\\]#(#e)|[^ /\\\\]##[^0-9/\\\\ ]##[^/\\\\]#(#e))" +local NLIST_COLORING_COLOR=$'\x1b[00;33m' +local NLIST_COLORING_MATCH_MULTIPLE=1 diff --git a/plugins/zsh-navigation-tools/.config/znt/n-list.conf b/plugins/zsh-navigation-tools/.config/znt/n-list.conf new file mode 100644 index 00000000..cf9d2a3b --- /dev/null +++ b/plugins/zsh-navigation-tools/.config/znt/n-list.conf @@ -0,0 +1,3 @@ +# Should the list (text, borders) be drawn in bold +# Value 1 is the default +local bold=1 diff --git a/plugins/zsh-navigation-tools/.config/znt/n-options.conf b/plugins/zsh-navigation-tools/.config/znt/n-options.conf new file mode 100644 index 00000000..98f4625f --- /dev/null +++ b/plugins/zsh-navigation-tools/.config/znt/n-options.conf @@ -0,0 +1,5 @@ +# How should be current element of the list drawn. Possible values: reverse, +# underline. Default (without option set) is reverse +# On Linux virtual terminal this will be enforced to reverse (because of poor +# underline support on that terminal) +# local active_text=underline diff --git a/plugins/zsh-navigation-tools/.config/znt/n-panelize.conf b/plugins/zsh-navigation-tools/.config/znt/n-panelize.conf new file mode 100644 index 00000000..98f4625f --- /dev/null +++ b/plugins/zsh-navigation-tools/.config/znt/n-panelize.conf @@ -0,0 +1,5 @@ +# How should be current element of the list drawn. Possible values: reverse, +# underline. Default (without option set) is reverse +# On Linux virtual terminal this will be enforced to reverse (because of poor +# underline support on that terminal) +# local active_text=underline diff --git a/plugins/zsh-navigation-tools/LICENSE b/plugins/zsh-navigation-tools/LICENSE new file mode 100644 index 00000000..075c80cc --- /dev/null +++ b/plugins/zsh-navigation-tools/LICENSE @@ -0,0 +1,700 @@ +This software is dual-licensed under MIT and GPLv3. + +MIT License +----------- + +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. + +GPLv3 License +-------------- + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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 3 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, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/plugins/zsh-navigation-tools/README.txt b/plugins/zsh-navigation-tools/README.txt new file mode 100644 index 00000000..4771742d --- /dev/null +++ b/plugins/zsh-navigation-tools/README.txt @@ -0,0 +1,101 @@ +# Zsh Navigation Tools + +http://imageshack.com/a/img633/7967/ps6rKR.png + +A tool generating a selectable curses-based list of elements that has access to +current Zsh session, i.e. has broad capabilities to work together with it. +That's n-list. The files n-cd, n-env, n-kill, etc. are applications of +the tool. Feature highlights include incremental multi-word searching, ANSI +coloring, unique mode, horizontal scroll, non-selectable elements, grepping and +various integrations with Zsh. + +## History Widget + +To have n-history as the incremental searcher bound to Ctrl-R copy znt-* +files into the */site-functions dir (unless you use Oh My Zsh) and +add: + + autoload znt-history-widget + zle -N znt-history-widget + bindkey "^R" znt-history-widget + +to .zshrc. This is done automatically when using Oh My Zsh. Two other +widgets exist, znt-cd-widget and znt-kill-widget, they can be too assigned +to key combinations: + + zle -N znt-cd-widget + bindkey "^T" znt-cd-widget + zle -N znt-kill-widget + bindkey "^Y" znt-kill-widget + +## Introduction + +The tools are: + +- n-aliases - browses aliases, relegates editing to vared +- n-cd - browses dirstack and bookmarked directories, allows to enter selected directory +- n-functions - browses functions, relegates editing to zed or vared +- n-history - browses history, allows to edit and run commands from it +- n-kill - browses processes list, allows to send signal to selected process +- n-env - browses environment, relegates editing to vared +- n-options - browses options, allows to toggle their state +- n-panelize - loads output of given command into the list for browsing + +All tools support horizontal scroll with <,>, {,}, h,l or left and right +cursors. Other keys are: + +- [,] - jump directory bookmarks in n-cd and typical signals in n-kill +- Ctrl-d, Ctrl-u - half page up or down +- Ctrl-p, Ctrl-n - previous and next (also done with vim's j,k) +- Ctrl-l - redraw of whole display +- g, G - beginning and end of the list +- Ctrl-o, o - enter uniq mode (no duplicate lines) +- / - start incremental search +- Enter - finish incremental search, retaining filter +- Esc - exit incremental search, clearing filter +- Ctrl-w (in incremental search) - delete whole word +- Ctrl-k (in incremental search) - delete whole line + +## Programming + +The function n-list is used as follows: + + n-list {element1} [element2] ... [elementN] + +This is all that is needed to be done to have the features like ANSI coloring, +incremental multi-word search, unique mode, horizontal scroll, non-selectable +elements (grepping is done outside n-list, see the tools for how it can be +done). To set up non-selectable entries add their indices into array +NLIST_NONSELECTABLE_ELEMENTS: + + typeset -a NLIST_NONSELECTABLE_ELEMENTS + NLIST_NONSELECTABLE_ELEMENTS=( 1 ) + +Result is stored as $reply[REPLY] ($ isn't needed before REPLY because +of arithmetic context inside []). The returned array might be different from +input arguments as n-list can process them via incremental search or uniq +mode. $REPLY is the index in that possibly processed array. If $REPLY +equals -1 it means that no selection have been made (user quitted via q +key). + +To set up entries that can be jumped to with [,] keys add their indices to +NLIST_HOP_INDEXES array: + + typeset -a NLIST_HOP_INDEXES + NLIST_HOP_INDEXES=( 1 10 ) + +n-list can automatically colorize entries according to a Zsh pattern. +Following example will colorize all numbers with blue: + + local NLIST_COLORING_PATTERN="[0-9]##" + local NLIST_COLORING_COLOR=$'\x1b[00;34m' + local NLIST_COLORING_END_COLOR=$'\x1b[0m' + local NLIST_COLORING_MATCH_MULTIPLE=1 + n-list "This is a number 123" "This line too has a number: 456" + +Blue is the default color, it doesn't have to be set. See zshexpn man page +for more information on Zsh patterns. Briefly, comparing to regular +expressions, (#s) is ^, (#e) is $, # is *, ## is +. Alternative +will work when in parenthesis, i.e. (a|b). BTW by using this method you can +colorize output of the tools, via their config files (check out e.g. n-cd.conf, +it uses this). diff --git a/plugins/zsh-navigation-tools/n-aliases b/plugins/zsh-navigation-tools/n-aliases new file mode 100644 index 00000000..d81db925 --- /dev/null +++ b/plugins/zsh-navigation-tools/n-aliases @@ -0,0 +1,47 @@ +# Copy this file into /usr/share/zsh/site-functions/ +# and add 'autoload n-aliases` to .zshrc +# +# This function allows to choose an alias for edition with vared +# +# Uses n-list + +emulate -L zsh + +setopt extendedglob +zmodload zsh/curses +zmodload zsh/parameter + +local IFS=" +" + +unset NLIST_COLORING_PATTERN + +[ -f ~/.config/znt/n-list.conf ] && . ~/.config/znt/n-list.conf +[ -f ~/.config/znt/n-aliases.conf ] && . ~/.config/znt/n-aliases.conf + +local list +local selected + +NLIST_REMEMBER_STATE=0 + +list=( "${(@k)aliases}" ) +list=( "${(@M)list:#(#i)*$1*}" ) + +local NLIST_GREP_STRING="$1" + +if [ "$#list" -eq 0 ]; then + echo "No matching aliases" + return 1 +fi + +list=( "${(@i)list}" ) +n-list "$list[@]" + +if [ "$REPLY" -gt 0 ]; then + selected="$reply[REPLY]" + echo "Editing \`$selected':" + print -rs "vared aliases\\[$selected\\]" + vared aliases\[$selected\] +fi + +# vim: set filetype=zsh: diff --git a/plugins/zsh-navigation-tools/n-cd b/plugins/zsh-navigation-tools/n-cd new file mode 100644 index 00000000..b1ac5b15 --- /dev/null +++ b/plugins/zsh-navigation-tools/n-cd @@ -0,0 +1,68 @@ +# Copy this file into /usr/share/zsh/site-functions/ +# and add 'autoload n-cd` to .zshrc +# +# This function allows to choose a directory from pushd stack +# +# Uses n-list + +emulate -L zsh + +setopt extendedglob pushdignoredups + +zmodload zsh/curses +local IFS=" +" + +# Unset before configuration is read +unset NLIST_COLORING_PATTERN + +[ -f ~/.config/znt/n-list.conf ] && . ~/.config/znt/n-list.conf +[ -f ~/.config/znt/n-cd.conf ] && . ~/.config/znt/n-cd.conf + +local list +local selected + +NLIST_REMEMBER_STATE=0 + +list=( `dirs -p` ) +list=( "${(@M)list:#(#i)*$1*}" ) + +local NLIST_GREP_STRING="$1" + +[ "$#list" -eq 0 ] && echo "No matching directories" + +if [ "$#hotlist" -ge 1 ]; then + typeset -a NLIST_NONSELECTABLE_ELEMENTS NLIST_HOP_INDEXES + local tmp_list_size="$#list" + NLIST_NONSELECTABLE_ELEMENTS=( $(( tmp_list_size+1 )) $(( tmp_list_size+2 )) ) + list=( "$list[@]" "" $'\x1b[00;31m'"Hotlist"$'\x1b[00;00m': "$hotlist[@]" ) + (( tmp_list_size+=3 )) + local middle_hop=$(( (tmp_list_size+$#list) / 2 )) + [[ "$middle_hop" -eq $tmp_list_size || "$middle_hop" -eq $#list ]] && middle_hop="" + [ "$tmp_list_size" -eq $#list ] && tmp_list_size="" + NLIST_HOP_INDEXES=( 1 $tmp_list_size $middle_hop $#list ) +else + [ "$#list" -eq 0 ] && return 1 +fi + +n-list "${list[@]}" + +if [ "$REPLY" -gt 0 ]; then + selected="$reply[REPLY]" + selected="${selected/#\~/$HOME}" + + (( NCD_DONT_PUSHD )) && setopt NO_AUTO_PUSHD + cd "$selected" + (( NCD_DONT_PUSHD )) && setopt AUTO_PUSHD + + # ZLE? + if [ "${(t)CURSOR}" = "integer-local-special" ]; then + zle -M "You have selected $selected" + else + echo "You have selected $selected" + fi +else + [ "${(t)CURSOR}" = "integer-local-special" ] && zle redisplay +fi + +# vim: set filetype=zsh: diff --git a/plugins/zsh-navigation-tools/n-env b/plugins/zsh-navigation-tools/n-env new file mode 100644 index 00000000..612796c0 --- /dev/null +++ b/plugins/zsh-navigation-tools/n-env @@ -0,0 +1,47 @@ +# Copy this file into /usr/share/zsh/site-functions/ +# and add 'autoload n-env` to .zshrc +# +# This function allows to choose an environment variable +# for edition with vared +# +# Uses n-list + +emulate -L zsh + +setopt extendedglob +unsetopt equals +zmodload zsh/curses + +local IFS=" +" + +[ -f ~/.config/znt/n-list.conf ] && . ~/.config/znt/n-list.conf +[ -f ~/.config/znt/n-env.conf ] && . ~/.config/znt/n-env.conf + +local list +local selected + +NLIST_REMEMBER_STATE=0 + +list=( `env` ) +list=( "${(@M)list:#(#i)*$1*}" ) + +local NLIST_GREP_STRING="$1" + +if [ "$#list" -eq 0 ]; then + echo "No matching variables" + return 1 +fi + +list=( "${(@i)list}" ) +n-list "$list[@]" + +if [ "$REPLY" -gt 0 ]; then + selected="$reply[REPLY]" + selected="${selected%%=*}" + echo "Editing \`$selected':" + print -rs "vared \"$selected\"" + vared "$selected" +fi + +# vim: set filetype=zsh: diff --git a/plugins/zsh-navigation-tools/n-functions b/plugins/zsh-navigation-tools/n-functions new file mode 100644 index 00000000..6f10a3de --- /dev/null +++ b/plugins/zsh-navigation-tools/n-functions @@ -0,0 +1,54 @@ +# Copy this file into /usr/share/zsh/site-functions/ +# and add 'autoload n-functions` to .zshrc +# +# This function allows to choose a function for edition with vared +# +# Uses n-list + +emulate -L zsh + +setopt extendedglob +zmodload zsh/curses +zmodload zsh/parameter + +local IFS=" +" + +unset NLIST_COLORING_PATTERN + +[ -f ~/.config/znt/n-list.conf ] && . ~/.config/znt/n-list.conf +[ -f ~/.config/znt/n-functions.conf ] && . ~/.config/znt/n-functions.conf + +local list +local selected + +NLIST_REMEMBER_STATE=0 + +list=( "${(@k)functions}" ) +list=( "${(@M)list:#(#i)*$1*}" ) + +local NLIST_GREP_STRING="$1" + +if [ "$#list" -eq 0 ]; then + echo "No matching functions" + return 1 +fi + +list=( "${(@i)list}" ) +n-list "$list[@]" + +if [ "$REPLY" -gt 0 ]; then + selected="$reply[REPLY]" + if [ "$feditor" = "zed" ]; then + echo "Editing \`$selected' (ESC ZZ or Ctrl-x-w to finish):" + autoload zed + print -rs "zed -f -- \"$selected\"" + zed -f -- "$selected" + else + echo "Editing \`$selected':" + print -rs "vared functions\\[$selected\\]" + vared functions\[$selected\] + fi +fi + +# vim: set filetype=zsh: diff --git a/plugins/zsh-navigation-tools/n-history b/plugins/zsh-navigation-tools/n-history new file mode 100644 index 00000000..e66f2a50 --- /dev/null +++ b/plugins/zsh-navigation-tools/n-history @@ -0,0 +1,53 @@ +# Copy this file into /usr/share/zsh/site-functions/ +# and add 'autoload n-history` to .zshrc +# +# This function allows to browse Z shell's history and use the +# entries +# +# Uses n-list + +emulate -L zsh + +setopt extendedglob +zmodload zsh/curses + +local IFS=" +" + +unset NLIST_COLORING_PATTERN + +[ -f ~/.config/znt/n-list.conf ] && . ~/.config/znt/n-list.conf +[ -f ~/.config/znt/n-history.conf ] && . ~/.config/znt/n-history.conf + +local list +local selected + +NLIST_REMEMBER_STATE=0 + +list=( `builtin history -rn 1` ) +list=( "${(@M)list:#(#i)*$1*}" ) + +local NLIST_GREP_STRING="$1" + +if [ "$#list" -eq 0 ]; then + echo "No matching history entries" + return 1 +fi + +n-list "${list[@]}" + +if [ "$REPLY" -gt 0 ]; then + selected="$reply[REPLY]" + # ZLE? + if [ "${(t)CURSOR}" = "integer-local-special" ]; then + zle redisplay + zle kill-whole-line + zle -U "$selected" + else + print -zr "$selected" + fi +else + [ "${(t)CURSOR}" = "integer-local-special" ] && zle redisplay +fi + +# vim: set filetype=zsh: diff --git a/plugins/zsh-navigation-tools/n-kill b/plugins/zsh-navigation-tools/n-kill new file mode 100644 index 00000000..e5208228 --- /dev/null +++ b/plugins/zsh-navigation-tools/n-kill @@ -0,0 +1,96 @@ +# Copy this file into /usr/share/zsh/site-functions/ +# and add 'autoload n-kill` to .zshrc +# +# This function allows to choose a process and a signal to send to it +# +# Uses n-list + +emulate -L zsh + +setopt extendedglob +zmodload zsh/curses + +local IFS=" +" + +[ -f ~/.config/znt/n-list.conf ] && . ~/.config/znt/n-list.conf +[ -f ~/.config/znt/n-kill.conf ] && . ~/.config/znt/n-kill.conf + +typeset -A signals +signals=( + 1 "1 - HUP" + 2 "2 - INT" + 3 "3 - QUIT" + 6 "6 - ABRT" + 9 "9 - KILL" + 14 "14 - ALRM" + 15 "15 - TERM" + 17 "17 - STOP" + 19 "19 - CONT" +) + +local list +local selected +local signal +local -a signal_names +local title + +NLIST_REMEMBER_STATE=0 + +typeset -a NLIST_NONSELECTABLE_ELEMENTS +NLIST_NONSELECTABLE_ELEMENTS=( 1 ) + +type ps 2>/dev/null 1>&2 || { echo >&2 "Error: \`ps' not found"; return 1 } + +case "$(uname)" in + CYGWIN*) list=( `command ps -Wa` ) ;; + *) list=( `command ps -o pid,uid,command -A` ) ;; +esac + +# Ask of PID +title=$'\x1b[00;31m'"${list[1]}"$'\x1b[00;00m\0' +shift list +list=( "$title" "${(@M)list:#(#i)*$1*}" ) + +local NLIST_GREP_STRING="$1" + +if [ "$#list" -eq 1 ]; then + echo "No matching processes" + return 1 +fi + +n-list "$list[@]" + +# Got answer? (could be Ctrl-C or 'q') +if [ "$REPLY" -gt 0 ]; then + selected="$reply[REPLY]" + selected="${selected## #}" + pid="${selected%% *}" + + # Now ask of signal + signal_names=( ${(vin)signals} ) + typeset -a NLIST_HOP_INDEXES + NLIST_HOP_INDEXES=( 3 6 8 ) + unset NLIST_COLORING_PATTERN + n-list $'\x1b[00;31mSelect signal:\x1b[00;00m' "$signal_names[@]" + + if [ "$REPLY" -gt 0 ]; then + selected="$reply[REPLY]" + signal="${(k)signals[(r)$selected]}" + + # ZLE? + if [ "${(t)CURSOR}" = "integer-local-special" ]; then + zle redisplay + zle kill-whole-line + zle -U "kill -$signal $pid" + else + print -zr "kill -$signal $pid" + fi + else + [ "${(t)CURSOR}" = "integer-local-special" ] && zle redisplay + fi +else + [ "${(t)CURSOR}" = "integer-local-special" ] && zle redisplay +fi + +# vim: set filetype=zsh: diff --git a/plugins/zsh-navigation-tools/n-list b/plugins/zsh-navigation-tools/n-list new file mode 100644 index 00000000..3b326515 --- /dev/null +++ b/plugins/zsh-navigation-tools/n-list @@ -0,0 +1,410 @@ +# $1, $2, ... - elements of the list +# $NLIST_NONSELECTABLE_ELEMENTS - array of indexes (1-based) that cannot be selected +# $REPLY is the output variable - contains index (1-based) or -1 when no selection +# +# Copy this file into /usr/share/zsh/site-functions/ +# and add 'autoload n-list` to .zshrc +# +# This function outputs a list of elements that can be +# navigated with keyboard. Uses curses library + +emulate -LR zsh + +setopt typesetsilent extendedglob noshortloops + +_nlist_has_terminfo=0 + +zmodload zsh/curses +zmodload zsh/terminfo 2>/dev/null && _nlist_has_terminfo=1 + +trap "REPLY=-2; reply=(); return" TERM INT QUIT +trap "_nlist_exit" EXIT + +# Drawing and input +autoload n-list-draw n-list-input + +# Cleanup before any exit +_nlist_exit() { + setopt localoptions + setopt extendedglob + + [[ "$REPLY" = -(#c0,1)[0-9]## ]] || REPLY="-1" + zcurses 2>/dev/null delwin inner + zcurses 2>/dev/null delwin main + zcurses 2>/dev/null refresh + zcurses end + _nlist_alternate_screen 0 + _nlist_cursor_visibility 1 + unset _nlist_has_terminfo +} + +# Outputs a message in the bottom of the screen +_nlist_status_msg() { + # -1 for border, -1 for 0-based indexing + zcurses move main $(( term_height - 1 - 1 )) 2 + zcurses clear main eol + zcurses string main "$1" + #status_msg_strlen is localized in caller + status_msg_strlen=$#1 +} + +# Prefer tput, then module terminfo +_nlist_cursor_visibility() { + if type tput 2>/dev/null 1>&2; then + [ "$1" = "1" ] && { tput cvvis; tput cnorm } + [ "$1" = "0" ] && tput civis + elif [ "$_nlist_has_terminfo" = "1" ]; then + [ "$1" = "1" ] && { [ -n $terminfo[cvvis] ] && echo -n $terminfo[cvvis]; + [ -n $terminfo[cnorm] ] && echo -n $terminfo[cnorm] } + [ "$1" = "0" ] && [ -n $terminfo[civis] ] && echo -n $terminfo[civis] + fi +} + +# Reason for this function is that on some systems +# smcup and rmcup are not knowing why left empty +_nlist_alternate_screen() { + [ "$_nlist_has_terminfo" -ne "1" ] && return + [[ "$1" = "1" && -n "$terminfo[smcup]" ]] && return + [[ "$1" = "0" && -n "$terminfo[rmcup]" ]] && return + + case "$TERM" in + *rxvt*) + [ "$1" = "1" ] && echo -n $'\x1b7\x1b[?47h' + [ "$1" = "0" ] && echo -n $'\x1b[2J\x1b[?47l\x1b8' + ;; + *) + [ "$1" = "1" ] && echo -n $'\x1b[?1049h' + [ "$1" = "0" ] && echo -n $'\x1b[?1049l' + # just to remember two other that work: $'\x1b7\x1b[r\x1b[?47h', $'\x1b[?47l\x1b8' + ;; + esac +} + +_nlist_compute_user_vars_difference() { + if [[ "${(t)NLIST_NONSELECTABLE_ELEMENTS}" != "array" && + "${(t)NLIST_NONSELECTABLE_ELEMENTS}" != "array-local" ]] + then + last_element_difference=0 + current_difference=0 + else + last_element_difference=$#NLIST_NONSELECTABLE_ELEMENTS + current_difference=0 + local idx + for idx in "${(n)NLIST_NONSELECTABLE_ELEMENTS[@]}"; do + [ "$idx" -le "$NLIST_CURRENT_IDX" ] && current_difference+=1 || break + done + fi +} + +# List was processed, check if variables aren't off range +_nlist_verify_vars() { + [ "$NLIST_CURRENT_IDX" -gt "$last_element" ] && NLIST_CURRENT_IDX="$last_element" + [[ "$NLIST_CURRENT_IDX" -eq 0 && "$last_element" -ne 0 ]] && NLIST_CURRENT_IDX=1 + (( NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN=0+((NLIST_CURRENT_IDX-1)/page_height)*page_height+1 )) +} + +# Compute the variables which are shown to the user +_nlist_setup_user_vars() { + if [ "$1" = "1" ]; then + # Basic values when there are no non-selectables + NLIST_USER_CURRENT_IDX="$NLIST_CURRENT_IDX" + NLIST_USER_LAST_ELEMENT="$last_element" + else + _nlist_compute_user_vars_difference + NLIST_USER_CURRENT_IDX=$(( NLIST_CURRENT_IDX - current_difference )) + NLIST_USER_LAST_ELEMENT=$(( last_element - last_element_difference )) + fi +} + +_nlist_coloring_list_into_col_list() { + local col=$'\x1b[00;34m' reset=$'\x1b[0m' + [ -n "$NLIST_COLORING_COLOR" ] && col="$NLIST_COLORING_COLOR" + [ -n "$NLIST_COLORING_END_COLOR" ] && reset="$NLIST_COLORING_END_COLOR" + + if [ "$NLIST_COLORING_MATCH_MULTIPLE" -eq 1 ]; then + col_list=( "${(@)list//(#mi)$~NLIST_COLORING_PATTERN/$col${MATCH}$reset}" ) + else + col_list=( "${(@)list/(#mi)$~NLIST_COLORING_PATTERN/$col${MATCH}$reset}" ) + fi +} + +# +# Main code +# + +# Check if there is proper input +if [ "$#" -lt 1 ]; then + echo "Usage: n-list element_1 ..." + return 1 +fi + +REPLY="-1" +reply=() + +integer term_height="$LINES" +integer term_width="$COLUMNS" +if [[ "$term_height" -lt 1 || "$term_width" -lt 1 ]]; then + local stty_out=$( stty size ) + term_height="${stty_out% *}" + term_width="${stty_out#* }" +fi +integer inner_height=term_height-3 +integer inner_width=term_width-3 +integer page_height=inner_height +integer page_width=inner_width + +typeset -a list col_list disp_list +integer last_element=$# +local action +local final_key +integer selection +integer last_element_difference=0 +integer current_difference=0 +local prev_search_buffer="" +integer prev_uniq_mode=0 +integer prev_start_idx=-1 + +# Ability to remember the list between calls +if [[ -z "$NLIST_REMEMBER_STATE" || "$NLIST_REMEMBER_STATE" -eq 0 || "$NLIST_REMEMBER_STATE" -eq 2 ]]; then + NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN=1 + NLIST_CURRENT_IDX=1 + NLIST_IS_SEARCH_MODE=0 + NLIST_SEARCH_BUFFER="" + NLIST_TEXT_OFFSET=0 + NLIST_IS_UNIQ_MODE=0 + + # Zero - because it isn't known, unless we + # confirm that first element is selectable + NLIST_USER_CURRENT_IDX=0 + [[ ${NLIST_NONSELECTABLE_ELEMENTS[(r)1]} != 1 ]] && NLIST_USER_CURRENT_IDX=1 + NLIST_USER_LAST_ELEMENT=$(( last_element - $#NLIST_NONSELECTABLE_ELEMENTS )) + + # 2 is init once, then remember + [ "$NLIST_REMEMBER_STATE" -eq 2 ] && NLIST_REMEMBER_STATE=1 +fi + +if [ "$NLIST_START_IN_SEARCH_MODE" -eq 1 ]; then + NLIST_START_IN_SEARCH_MODE=0 + NLIST_IS_SEARCH_MODE=1 +fi + +if [ "$NLIST_START_IN_UNIQ_MODE" -eq 1 ]; then + NLIST_START_IN_UNIQ_MODE=0 + NLIST_IS_UNIQ_MODE=1 +fi + +_nlist_alternate_screen 1 +zcurses init +zcurses delwin main 2>/dev/null +zcurses delwin inner 2>/dev/null +zcurses addwin main "$term_height" "$term_width" 0 0 +zcurses addwin inner "$inner_height" "$inner_width" 1 2 +zcurses bg main white/black +zcurses bg inner white/black +if [ "$NLIST_IS_SEARCH_MODE" -ne 1 ]; then + _nlist_cursor_visibility 0 +fi + +# +# Listening for input +# + +local key keypad + +# Clear input buffer +zcurses timeout main 0 +zcurses input main key keypad +zcurses timeout main -1 +key="" +keypad="" + +list=( "$@" ) +last_element="$#list" + +integer is_colored=0 +if [[ -z "$NLIST_SEARCH_BUFFER" && -n "$NLIST_COLORING_PATTERN" ]]; then + is_colored=1 + _nlist_coloring_list_into_col_list +fi + +while (( 1 )); do + # Do searching (filtering with string) + if [ -n "$NLIST_SEARCH_BUFFER" ]; then + # Compute new list, col_list ? + if [[ "$NLIST_SEARCH_BUFFER" != "$prev_search_buffer" || "$NLIST_IS_UNIQ_MODE" -ne "$prev_uniq_mode" ]]; then + prev_search_buffer="$NLIST_SEARCH_BUFFER" + prev_uniq_mode="$NLIST_IS_UNIQ_MODE" + # regenerating list -> regenerating disp_list + prev_start_idx=-1 + + # Take all elements, including duplicates and non-selectables + typeset +U list + list=( "$@" ) + + # Remove non-selectable elements + [ "$#NLIST_NONSELECTABLE_ELEMENTS" -gt 0 ] && for i in "${(nO)NLIST_NONSELECTABLE_ELEMENTS[@]}"; do + list[$i]=() + done + + # Remove duplicates + [ "$NLIST_IS_UNIQ_MODE" -eq 1 ] && typeset -U list + + last_element="$#list" + + # Next do the filtering + local search_buffer="${NLIST_SEARCH_BUFFER%% ##}" + search_buffer="${search_buffer## ##}" + search_buffer="${search_buffer//(#m)[][*?|#~^()><\\]/\\$MATCH}" + if [ -n "$search_buffer" ]; then + # Patterns will be *foo*~^*bar* and foo|bar) + local search_pattern="${search_buffer// ##/*~^*}" + local colsearch_pattern="${search_buffer// ##/|}" + + list=( "${(@M)list:#(#i)*$~search_pattern*}" ) + last_element="$#list" + + local red=$'\x1b[00;31m' reset=$'\x1b[00;00m' + col_list=( "${(@)list//(#mi)($~colsearch_pattern)/$red${MATCH}$reset}" ) + else + col_list=( "$list[@]" ) + fi + + # Called after processing list + _nlist_verify_vars + fi + + _nlist_setup_user_vars 1 + + integer end_idx=$(( NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN + page_height - 1 )) + [ "$end_idx" -gt "$last_element" ] && end_idx=last_element + + if [ "$prev_start_idx" -ne "$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN" ]; then + prev_start_idx="$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN" + disp_list=( "${(@)col_list[NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN, end_idx]}" ) + fi + + # Output colored list + n-list-draw "$(( (NLIST_CURRENT_IDX-1) % page_height + 1 ))" \ + "$page_height" "$page_width" 0 0 "$NLIST_TEXT_OFFSET" inner \ + "$disp_list[@]" + else + # There is no search, but there was in previous loop + # OR + # Uniq mode was entered or left out + # -> compute new list (maybe also col_list) + if [[ -n "$prev_search_buffer" || "$NLIST_IS_UNIQ_MODE" -ne "$prev_uniq_mode" ]]; then + prev_search_buffer="" + prev_uniq_mode="$NLIST_IS_UNIQ_MODE" + # regenerating list -> regenerating disp_list + prev_start_idx=-1 + + # Take all elements, including duplicates and non-selectables + typeset +U list + list=( "$@" ) + + # Remove non-selectable elements only when in uniq mode + [ "$NLIST_IS_UNIQ_MODE" -eq 1 ] && [ "$#NLIST_NONSELECTABLE_ELEMENTS" -gt 0 ] && + for i in "${(nO)NLIST_NONSELECTABLE_ELEMENTS[@]}"; do + list[$i]=() + done + + # Remove duplicates when in uniq mode + [ "$NLIST_IS_UNIQ_MODE" -eq 1 ] && typeset -U list + + # Apply coloring pattern (when not with search query) + is_colored=0 + if [ -n "$NLIST_COLORING_PATTERN" ]; then + is_colored=1 + _nlist_coloring_list_into_col_list + fi + + last_element="$#list" + # Called after processing list + _nlist_verify_vars + fi + + # "1" - shouldn't bother with non-selectables + _nlist_setup_user_vars "$NLIST_IS_UNIQ_MODE" + + integer end_idx=$(( NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN + page_height - 1 )) + [ "$end_idx" -gt "$last_element" ] && end_idx=last_element + + if [ "$is_colored" -eq 0 ]; then + if [ "$prev_start_idx" -ne "$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN" ]; then + prev_start_idx="$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN" + disp_list=( "${(@)list[NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN, end_idx]}" ) + fi + else + if [ "$prev_start_idx" -ne "$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN" ]; then + prev_start_idx="$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN" + disp_list=( "${(@)col_list[NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN, end_idx]}" ) + fi + fi + + # Output the list + n-list-draw "$(( (NLIST_CURRENT_IDX-1) % page_height + 1 ))" \ + "$page_height" "$page_width" 0 0 "$NLIST_TEXT_OFFSET" inner \ + "$disp_list[@]" + fi + + local status_msg_strlen + if [ "$NLIST_IS_SEARCH_MODE" = "1" ]; then + local _txt2="" + [ "$NLIST_IS_UNIQ_MODE" -eq 1 ] && _txt2="[-UNIQ-] " + _nlist_status_msg "${_txt2}Filtering with: ${NLIST_SEARCH_BUFFER// /+}" + elif [[ ${NLIST_NONSELECTABLE_ELEMENTS[(r)$NLIST_CURRENT_IDX]} != $NLIST_CURRENT_IDX || + -n "$NLIST_SEARCH_BUFFER" || "$NLIST_IS_UNIQ_MODE" -eq 1 ]]; then + local _txt="" _txt2="" + [ -n "$NLIST_GREP_STRING" ] && _txt=" [$NLIST_GREP_STRING]" + [ "$NLIST_IS_UNIQ_MODE" -eq 1 ] && _txt2="[-UNIQ-] " + _nlist_status_msg "${_txt2}Current #$NLIST_USER_CURRENT_IDX (of #$NLIST_USER_LAST_ELEMENT entries)$_txt" + else + _nlist_status_msg "" + fi + + zcurses border main + zcurses refresh main inner + zcurses move main $(( term_height - 1 - 1 )) $(( status_msg_strlen + 2 )) + + # Wait for input + zcurses input main key keypad + + # Get the special (i.e. "keypad") key or regular key + if [ -n "$key" ]; then + final_key="$key" + elif [ -n "$keypad" ]; then + final_key="$keypad" + else + _nlist_status_msg "Inproper input detected" + zcurses refresh main inner + fi + + n-list-input "$NLIST_CURRENT_IDX" "$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN" \ + "$page_height" "$page_width" "$last_element" "$NLIST_TEXT_OFFSET" \ + "$final_key" "$NLIST_IS_SEARCH_MODE" "$NLIST_SEARCH_BUFFER" \ + "$NLIST_IS_UNIQ_MODE" + + selection="$reply[1]" + action="$reply[2]" + NLIST_CURRENT_IDX="$reply[3]" + NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN="$reply[4]" + NLIST_TEXT_OFFSET="$reply[5]" + NLIST_IS_SEARCH_MODE="$reply[6]" + NLIST_SEARCH_BUFFER="$reply[7]" + NLIST_IS_UNIQ_MODE="$reply[8]" + + if [ "$action" = "SELECT" ]; then + REPLY="$selection" + reply=( "$list[@]" ) + break + elif [ "$action" = "QUIT" ]; then + REPLY=-1 + reply=( "$list[@]" ) + break + elif [ "$action" = "REDRAW" ]; then + zcurses clear main redraw + zcurses clear inner redraw + fi +done + +# vim: set filetype=zsh: diff --git a/plugins/zsh-navigation-tools/n-list-draw b/plugins/zsh-navigation-tools/n-list-draw new file mode 100644 index 00000000..1b2571fb --- /dev/null +++ b/plugins/zsh-navigation-tools/n-list-draw @@ -0,0 +1,131 @@ +# Copy this file into /usr/share/zsh/site-functions/ +# and add 'autoload n-list-draw` to .zshrc +# +# This is an internal function not for direct use + +emulate -L zsh + +zmodload zsh/curses + +setopt typesetsilent extendedglob + +_nlist_print_with_ansi() { + local win="$1" text="$2" out col chunk Xout + integer text_offset="$3" max_text_len="$4" text_len=0 no_match=0 nochunk_text_len to_skip_from_chunk to_chop_off_from_chunk before_len + + # 1 - non-escaped text, 2 - first number in the escaped text, with ; + # 3 - second number, 4 - text after whole escape text + + typeset -a c + c=( black red green yellow blue magenta cyan white ) + + while [[ -n "$text" && "$no_match" -eq 0 ]]; do + if [[ "$text" = (#b)([^$'\x1b']#)$'\x1b'\[([0-9](#c0,2))(#B)(\;|)(#b)([0-9](#c0,2))m(*) ]]; then + # Text for further processing + text="$match[4]" + # Text chunk to output now + out="$match[1]" + # Save color + col="$match[2]" + (( match[3] >= 30 && match[3] <= 37 )) && col="$match[3]" + else + out="$text" + no_match=1 + fi + + if [ -n "$out" ]; then +################ Expand tabs ################ + chunk="$out" + before_len="$text_len" + Xout="" + + while [ -n "$chunk" ]; do + [[ "$chunk" = (#b)([^$'\t']#)$'\t'(*) ]] && { + (( all_text_len=((before_len+${#match[1]})/8+1)*8 )) + + Xout+="${(r:all_text_len-before_len:: :)match[1]}" + + before_len+=all_text_len-before_len + chunk="$match[2]" + } || { + Xout+="$chunk" + break + } + done +############################################# + + # Input text length without the current chunk + nochunk_text_len=text_len + # Input text length up to current chunk + text_len+="$#Xout" + + # Should start displaying with this chunk? + # I.e. stop skipping left part of the input text? + if (( text_len > text_offset )); then + to_skip_from_chunk=text_offset-nochunk_text_len + + # LEFT - is chunk off the left skip boundary? +1 for 1-based index in string + (( to_skip_from_chunk > 0 )) && Xout="${Xout[to_skip_from_chunk+1,-1]}" + + # RIGHT - is text off the screen? + if (( text_len-text_offset > max_text_len )); then + to_chop_off_from_chunk=0+(text_len-text_offset)-max_text_len + Xout="${Xout[1,-to_chop_off_from_chunk-1]}" + fi + + [ -n "$Xout" ] && zcurses string "$win" "$Xout" + fi + fi + + if (( no_match == 0 )); then + if (( col >= 30 && col <= 37 )); then + zcurses attr "$win" $c[col-29]/black + elif [[ "$col" -eq 0 ]]; then + zcurses attr "$win" white/black + fi + fi + done +} + +integer highlight="$1" +integer page_height="$2" +integer page_width="$3" +local y_offset="$4" +local x_offset="$5" +local text_offset="$6" +local win="$7" +shift 7 +integer max_text_len=page_width-x_offset + +[ "$bold" = "0" ] && bold="" || bold="+bold" +[[ "$active_text" = "underline" || "$active_text" = "reverse" ]] || active_text="reverse" +# With Linux terminal underline won't work properly +[ "$TERM" = "linux" ] && active_text="reverse" + +integer max_idx=page_height +integer end_idx=max_idx +[ "$end_idx" -gt "$#" ] && end_idx="$#" +integer y=y_offset + +zcurses attr "$win" $bold white/black + +integer i text_len +local text +for (( i=1; i<=end_idx; i++ )); do + zcurses move "$win" $y "$x_offset" + + [ "$i" = "$highlight" ] && zcurses attr "$win" +"$active_text" + _nlist_print_with_ansi "$win" "$@[i]" "$text_offset" "$max_text_len" + zcurses clear "$win" eol + [ "$i" = "$highlight" ] && zcurses attr "$win" -"$active_text" + + y+=1 +done + +if [ "$end_idx" -lt "$max_idx" ]; then + zcurses move "$win" $y "$x_offset" + zcurses clear "$win" eol +fi + +zcurses attr "$win" white/black +# vim: set filetype=zsh: diff --git a/plugins/zsh-navigation-tools/n-list-input b/plugins/zsh-navigation-tools/n-list-input new file mode 100644 index 00000000..380acdc0 --- /dev/null +++ b/plugins/zsh-navigation-tools/n-list-input @@ -0,0 +1,238 @@ +# Copy this file into /usr/share/zsh/site-functions/ +# and add 'autoload n-list-input` to .zshrc +# +# This is an internal function not for direct use + +emulate -L zsh + +zmodload zsh/curses + +setopt typesetsilent + +# Compute first to show index +_nlist_compute_first_to_show_idx() { + from_what_idx_list_is_shown=0+((current_idx-1)/page_height)*page_height+1 +} + +typeset -ga reply +reply=( -1 '' ) +integer current_idx="$1" +integer from_what_idx_list_is_shown="$2" +integer page_height="$3" +integer page_width="$4" +integer last_element="$5" +integer hscroll="$6" +local key="$7" +integer search="$8" +local buffer="$9" +integer uniq_mode="$10" + +# +# Listening for input +# + +if [ "$search" = "0" ]; then + +case "$key" in + (UP|k|$'\C-P') + # Are there any elements before the current one? + [ "$current_idx" -gt 1 ] && current_idx=current_idx-1; + _nlist_compute_first_to_show_idx + ;; + (DOWN|j|$'\C-N') + # Are there any elements after the current one? + [ "$current_idx" -lt "$last_element" ] && current_idx=current_idx+1; + _nlist_compute_first_to_show_idx + ;; + (PPAGE) + current_idx=current_idx-page_height + [ "$current_idx" -lt 1 ] && current_idx=1; + _nlist_compute_first_to_show_idx + ;; + (NPAGE|" ") + current_idx=current_idx+page_height + [ "$current_idx" -gt "$last_element" ] && current_idx=last_element; + _nlist_compute_first_to_show_idx + ;; + ($'\C-U') + current_idx=current_idx-page_height/2 + [ "$current_idx" -lt 1 ] && current_idx=1; + _nlist_compute_first_to_show_idx + ;; + ($'\C-D') + current_idx=current_idx+page_height/2 + [ "$current_idx" -gt "$last_element" ] && current_idx=last_element; + _nlist_compute_first_to_show_idx + ;; + (HOME|g) + current_idx=1 + _nlist_compute_first_to_show_idx + ;; + (END|G) + current_idx=last_element + _nlist_compute_first_to_show_idx + ;; + ($'\n') + # Is that element selectable? + # Check for this only when there is no search + if [[ "$NLIST_SEARCH_BUFFER" != "" || "$NLIST_IS_UNIQ_MODE" -eq 1 || + ${NLIST_NONSELECTABLE_ELEMENTS[(r)$current_idx]} != $current_idx ]] + then + # Save current element in the result variable + reply=( $current_idx SELECT ) + fi + ;; + (q) + reply=( -1 QUIT ) + ;; + (/) + search=1 + _nlist_cursor_visibility 1 + ;; + ($'\t') + reply=( $current_idx LEAVE ) + ;; + ($'\C-L') + reply=( -1 REDRAW ) + ;; + (\]) + [[ "${(t)NLIST_HOP_INDEXES}" = "array" || "${(t)NLIST_HOP_INDEXES}" = "array-local" ]] && + [ -z "$NLIST_SEARCH_BUFFER" ] && [ "$NLIST_IS_UNIQ_MODE" -eq 0 ] && + for idx in "${(n)NLIST_HOP_INDEXES[@]}"; do + if [ "$idx" -gt "$current_idx" ]; then + current_idx=$idx + _nlist_compute_first_to_show_idx + break + fi + done + ;; + (\[) + [[ "${(t)NLIST_HOP_INDEXES}" = "array" || "${(t)NLIST_HOP_INDEXES}" = "array-local" ]] && + [ -z "$NLIST_SEARCH_BUFFER" ] && [ "$NLIST_IS_UNIQ_MODE" -eq 0 ] && + for idx in "${(nO)NLIST_HOP_INDEXES[@]}"; do + if [ "$idx" -lt "$current_idx" ]; then + current_idx=$idx + _nlist_compute_first_to_show_idx + break + fi + done + ;; + ('<'|'{'|LEFT|'h') + hscroll=hscroll-7 + [ "$hscroll" -lt 0 ] && hscroll=0 + ;; + ('>'|'}'|RIGHT|'l') + hscroll+=7 + ;; + ($'\E') + buffer="" + ;; + (o|$'\C-O') + uniq_mode=1-uniq_mode + ;; + (*) + ;; +esac + +else + +case "$key" in + ($'\n') + search=0 + _nlist_cursor_visibility 0 + ;; + ($'\C-L') + reply=( -1 REDRAW ) + ;; + + # + # Slightly limited navigation + # + + (UP|$'\C-P') + [ "$current_idx" -gt 1 ] && current_idx=current_idx-1; + _nlist_compute_first_to_show_idx + ;; + (DOWN|$'\C-N') + [ "$current_idx" -lt "$last_element" ] && current_idx=current_idx+1; + _nlist_compute_first_to_show_idx + ;; + (PPAGE) + current_idx=current_idx-page_height + [ "$current_idx" -lt 1 ] && current_idx=1; + _nlist_compute_first_to_show_idx + ;; + (NPAGE) + current_idx=current_idx+page_height + [ "$current_idx" -gt "$last_element" ] && current_idx=last_element; + _nlist_compute_first_to_show_idx + ;; + ($'\C-U') + current_idx=current_idx-page_height/2 + [ "$current_idx" -lt 1 ] && current_idx=1; + _nlist_compute_first_to_show_idx + ;; + ($'\C-D') + current_idx=current_idx+page_height/2 + [ "$current_idx" -gt "$last_element" ] && current_idx=last_element; + _nlist_compute_first_to_show_idx + ;; + (HOME) + current_idx=1 + _nlist_compute_first_to_show_idx + ;; + (END) + current_idx=last_element + _nlist_compute_first_to_show_idx + ;; + (LEFT) + hscroll=hscroll-7 + [ "$hscroll" -lt 0 ] && hscroll=0 + ;; + (RIGHT) + hscroll+=7 + ;; + (F1|F2|F3|F4|F5|F6|F7|F8|F9|F10) + # ignore + ;; + + # + # The input + # + + ($'\b'|$'\C-?'|BACKSPACE) + buffer="${buffer%?}" + ;; + ($'\C-W') + [ "$buffer" = "${buffer% *}" ] && buffer="" || buffer="${buffer% *}" + ;; + ($'\C-K') + buffer="" + ;; + ($'\E') + buffer="" + search=0 + _nlist_cursor_visibility 0 + ;; + ($'\C-O') + uniq_mode=1-uniq_mode + ;; + (*) + if [[ $#key == 1 && $((#key)) -lt 31 ]]; then + # ignore all other control keys + else + buffer+="$key" + fi + ;; +esac + +fi + +reply[3]="$current_idx" +reply[4]="$from_what_idx_list_is_shown" +reply[5]="$hscroll" +reply[6]="$search" +reply[7]="$buffer" +reply[8]="$uniq_mode" + +# vim: set filetype=zsh: diff --git a/plugins/zsh-navigation-tools/n-options b/plugins/zsh-navigation-tools/n-options new file mode 100644 index 00000000..91589bd4 --- /dev/null +++ b/plugins/zsh-navigation-tools/n-options @@ -0,0 +1,84 @@ +# Copy this file into /usr/share/zsh/site-functions/ +# and add 'autoload n-options` to .zshrc +# +# This function allows to browse and toggle shell's options +# +# Uses n-list + +#emulate -L zsh + +zmodload zsh/curses + +local IFS=" +" + +unset NLIST_COLORING_PATTERN + +[ -f ~/.config/znt/n-list.conf ] && . ~/.config/znt/n-list.conf +[ -f ~/.config/znt/n-options.conf ] && . ~/.config/znt/n-options.conf + +# TODO restore options +unsetopt localoptions + +integer kshoptionprint=0 +[[ -o kshoptionprint ]] && kshoptionprint=1 +setopt kshoptionprint + +local list +local selected +local option +local state + +# 0 - don't remember, 1 - remember, 2 - init once, then remember +NLIST_REMEMBER_STATE=2 + +local NLIST_GREP_STRING="${1:=}" + +while (( 1 )); do + list=( `setopt` ) + list=( "${(M)list[@]:#*${1:=}*}" ) + list=( "${list[@]:#kshoptionprint*}" ) + + if [ "$#list" -eq 0 ]; then + echo "No matching options" + break + fi + + local red=$'\x1b[00;31m' green=$'\x1b[00;32m' reset=$'\x1b[00;00m' + list=( "${list[@]/ off/${red} off$reset}" ) + #list=( "${list[@]/ on/${green} on$reset}" ) + list=( "${(i)list[@]}" ) + + n-list "${list[@]}" + + if [ "$REPLY" -gt 0 ]; then + [[ -o ksharrays ]] && selected="${reply[$(( REPLY - 1 ))]}" || selected="${reply[$REPLY]}" + option="${selected%% *}" + state="${selected##* }" + + if [[ -o globsubst ]]; then + unsetopt globsubst + state="${state%$reset}" + setopt globsubst + else + state="${state%$reset}" + fi + + # Toggle the option + if [ "$state" = "on" ]; then + echo "Setting |$option| to off" + unsetopt "$option" + else + echo "Setting |$option| to on" + setopt "$option" + fi + else + break + fi +done + +NLIST_REMEMBER_STATE=0 + +[[ "$kshoptionprint" -eq 0 ]] && unsetopt kshoptionprint + +# vim: set filetype=zsh: diff --git a/plugins/zsh-navigation-tools/n-panelize b/plugins/zsh-navigation-tools/n-panelize new file mode 100644 index 00000000..a70565c7 --- /dev/null +++ b/plugins/zsh-navigation-tools/n-panelize @@ -0,0 +1,61 @@ +# Copy this file into /usr/share/zsh/site-functions/ +# and add 'autoload n-panelize` to .zshrc +# +# This function somewhat reminds the panelize feature from Midnight Commander +# It allows browsing output of arbitrary command. Example usage: +# v-panelize ls /usr/local/bin +# +# Uses n-list + +emulate -L zsh + +setopt extendedglob +zmodload zsh/curses + +local IFS=" +" + +unset NLIST_COLORING_PATTERN + +[ -f ~/.config/znt/n-list.conf ] && . ~/.config/znt/n-list.conf +[ -f ~/.config/znt/n-panelize.conf ] && . ~/.config/znt/n-panelize.conf + +local list +local selected + +NLIST_REMEMBER_STATE=0 + +if [ -t 0 ]; then + # Check if there is proper input + if [ "$#" -lt 1 ]; then + echo "Usage: n-panelize {command} [option|argument] ... or command | n-panelize" + return 1 + fi + + list=( `"$@"` ) + # TODO: $? doesn't reach user + [ "$?" -eq 127 ] && return $? +else + # Check if can reattach to terminal + if [[ ! -c /dev/tty && ! -t 2 ]]; then + echo "No terminal available (no /dev/tty)" + return 1 + fi + + list=( "${(@f)"$(<&0)"}" ) + + if [[ ! -c /dev/tty ]]; then + exec <&2 + else + exec /dev/null; then + exec {FD}<&0 + restore=2 + else + restore=1 + fi + + if [[ ! -c /dev/tty ]]; then + exec <&2 + else + exec Date: Mon, 2 Nov 2015 16:12:38 +0900 Subject: [PATCH 071/537] Avoid using "PREFIX" that cause nvm to complain about. --- themes/sunrise.zsh-theme | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/themes/sunrise.zsh-theme b/themes/sunrise.zsh-theme index 28befd01..9b9259a2 100644 --- a/themes/sunrise.zsh-theme +++ b/themes/sunrise.zsh-theme @@ -11,9 +11,9 @@ B=$fg_no_bold[blue] RESET=$reset_color if [ "$USER" = "root" ]; then - PROMPTCOLOR="%{$R%}" PREFIX="-!-"; + PROMPTCOLOR="%{$R%}" PROMPTPREFIX="-!-"; else - PROMPTCOLOR="" PREFIX="---"; + PROMPTCOLOR="" PROMPTPREFIX="---"; fi local return_code="%(?..%{$R%}%? ↵%{$RESET%})" @@ -67,7 +67,7 @@ function custom_git_prompt() { } # %B sets bold text -PROMPT='%B$PREFIX %2~ $(custom_git_prompt)%{$M%}%B»%b%{$RESET%} ' +PROMPT='%B$PROMPTPREFIX %2~ $(custom_git_prompt)%{$M%}%B»%b%{$RESET%} ' RPS1="${return_code}" ZSH_THEME_GIT_PROMPT_PREFIX="%{$Y%}‹" From f6557932e9f8e4366198856baff92ec3afbe5b5c Mon Sep 17 00:00:00 2001 From: Alberto Gireud Date: Thu, 22 Oct 2015 11:15:14 -0500 Subject: [PATCH 072/537] Add OSX support for command-not-found --- plugins/command-not-found/command-not-found.plugin.zsh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugins/command-not-found/command-not-found.plugin.zsh b/plugins/command-not-found/command-not-found.plugin.zsh index 797554a1..0e2f2133 100644 --- a/plugins/command-not-found/command-not-found.plugin.zsh +++ b/plugins/command-not-found/command-not-found.plugin.zsh @@ -23,3 +23,11 @@ if [ -f /usr/libexec/pk-command-not-found ]; then return $retval } fi + +# OSX command-not-found support +# https://github.com/Homebrew/homebrew-command-not-found +if type brew &> /dev/null; then + if brew command command-not-found-init > /dev/null 2>&1; then + eval "$(brew command-not-found-init)"; + fi +fi From c25002a13fe5decb1d2c1501269efec97f7413c9 Mon Sep 17 00:00:00 2001 From: LE Manh Cuong Date: Wed, 4 Nov 2015 20:36:53 +0700 Subject: [PATCH 073/537] Removing `source` command --- tools/uninstall.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/uninstall.sh b/tools/uninstall.sh index 132e6376..bf2244be 100644 --- a/tools/uninstall.sh +++ b/tools/uninstall.sh @@ -21,7 +21,7 @@ if [ -f ~/.zshrc.pre-oh-my-zsh ] || [ -h ~/.zshrc.pre-oh-my-zsh ]; then mv ~/.zshrc.pre-oh-my-zsh ~/.zshrc; - . ~/.zshrc; + echo "Your original zsh config was restored. Please restart your session." else if hash chsh >/dev/null 2>&1; then echo "Switching back to bash" From d3363964a24d253baa0116d34a465bfabf797c7a Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Thu, 23 Jul 2015 09:16:13 +0200 Subject: [PATCH 074/537] Updated z version Closes #3248 Closes #4570 --- plugins/z/README | 43 +++-- plugins/z/z.1 | 35 ++-- plugins/z/z.sh | 405 ++++++++++++++++++++++++----------------------- 3 files changed, 259 insertions(+), 224 deletions(-) diff --git a/plugins/z/README b/plugins/z/README index ec5abc6f..7de82a4c 100644 --- a/plugins/z/README +++ b/plugins/z/README @@ -6,7 +6,7 @@ NAME z - jump around SYNOPSIS - z [-chlrt] [regex1 regex2 ... regexn] + z [-chlrtx] [regex1 regex2 ... regexn] AVAILABILITY bash, zsh @@ -15,10 +15,13 @@ DESCRIPTION Tracks your most used directories, based on 'frecency'. After a short learning phase, z will take you to the most 'frecent' - directory that matches ALL of the regexes given on the command line. + directory that matches ALL of the regexes given on the command line, in + order. + + For example, z foo bar would match /foo/bar but not /bar/foo. OPTIONS - -c restrict matches to subdirectories of the current directory. + -c restrict matches to subdirectories of the current directory -h show a brief help message @@ -28,10 +31,12 @@ OPTIONS -t match by recent access only + -x remove the current directory from the datafile + EXAMPLES z foo cd to most frecent dir matching foo - z foo bar cd to most frecent dir matching foo and bar + z foo bar cd to most frecent dir matching foo, then bar z -r foo cd to highest ranked dir matching foo @@ -55,8 +60,9 @@ NOTES Set $_Z_NO_RESOLVE_SYMLINKS to prevent symlink resolution. Set $_Z_NO_PROMPT_COMMAND to handle PROMPT_COMMAND/precmd your- self. - Set $_Z_EXCLUDE_DIRS to an array of directories to exclude. - (These settings should go in .bashrc/.zshrc before the lines + Set $_Z_EXCLUDE_DIRS to an array of directory trees to exclude. + Set $_Z_OWNER to allow usage when in 'sudo -s' mode. + (These settings should go in .bashrc/.zshrc before the line added above.) Install the provided man page z.1 somewhere like /usr/local/man/man1. @@ -64,12 +70,12 @@ NOTES Aging: The rank of directories maintained by z undergoes aging based on a sim- ple formula. The rank of each entry is incremented every time it is - accessed. When the sum of ranks is greater than 6000, all ranks are - multiplied by 0.99. Entries with a rank lower than 1 are forgotten. + accessed. When the sum of ranks is over 9000, all ranks are multiplied + by 0.99. Entries with a rank lower than 1 are forgotten. Frecency: - Frecency is a portmantaeu of 'recent' and 'frequency'. It is a weighted - rank that depends on how often and how recently something occured. As + Frecency is a portmanteau of 'recent' and 'frequency'. It is a weighted + rank that depends on how often and how recently something occurred. As far as I know, Mozilla came up with the term. To z, a directory that has low ranking but has been accessed recently @@ -107,20 +113,23 @@ ENVIRONMENT resolving of symlinks. If it is not set, symbolic links will be resolved when added to the datafile. - In bash, z prepends a command to the PROMPT_COMMAND environment vari- - able to maintain its database. In zsh, z appends a function _z_precmd - to the precmd_functions array. + In bash, z appends a command to the PROMPT_COMMAND environment variable + to maintain its database. In zsh, z appends a function _z_precmd to the + precmd_functions array. The environment variable $_Z_NO_PROMPT_COMMAND can be set if you want to handle PROMPT_COMMAND or precmd yourself. The environment variable $_Z_EXCLUDE_DIRS can be set to an array of - directories to exclude from tracking. $HOME is always excluded. Direc- - tories must be full paths without trailing slashes. + directory trees to exclude from tracking. $HOME is always excluded. + Directories must be full paths without trailing slashes. + + The environment variable $_Z_OWNER can be set to your username, to + allow usage of z when your sudo enviroment keeps $HOME set. FILES - Data is stored in $HOME/.z. This can be overridden by setting the - $_Z_DATA environment variable. When initialized, z will raise an error + Data is stored in $HOME/.z. This can be overridden by setting the + $_Z_DATA environment variable. When initialized, z will raise an error if this path is a directory, and not function correctly. A man page (z.1) is provided. diff --git a/plugins/z/z.1 b/plugins/z/z.1 index 022a4b35..cc99910b 100644 --- a/plugins/z/z.1 +++ b/plugins/z/z.1 @@ -4,7 +4,7 @@ NAME z \- jump around .SH SYNOPSIS -z [\-chlrt] [regex1 regex2 ... regexn] +z [\-chlrtx] [regex1 regex2 ... regexn] .SH AVAILABILITY bash, zsh @@ -13,12 +13,14 @@ DESCRIPTION Tracks your most used directories, based on 'frecency'. .P After a short learning phase, \fBz\fR will take you to the most 'frecent' -directory that matches ALL of the regexes given on the command line. +directory that matches ALL of the regexes given on the command line, in order. + +For example, \fBz foo bar\fR would match \fB/foo/bar\fR but not \fB/bar/foo\fR. .SH OPTIONS .TP \fB\-c\fR -restrict matches to subdirectories of the current directory. +restrict matches to subdirectories of the current directory .TP \fB\-h\fR show a brief help message @@ -31,13 +33,16 @@ match by rank only .TP \fB\-t\fR match by recent access only +.TP +\fB\-x\fR +remove the current directory from the datafile .SH EXAMPLES .TP 14 \fBz foo\fR cd to most frecent dir matching foo .TP 14 \fBz foo bar\fR -cd to most frecent dir matching foo and bar +cd to most frecent dir matching foo, then bar .TP 14 \fBz -r foo\fR cd to highest ranked dir matching foo @@ -76,10 +81,13 @@ Set \fB$_Z_NO_RESOLVE_SYMLINKS\fR to prevent symlink resolution. Set \fB$_Z_NO_PROMPT_COMMAND\fR to handle \fBPROMPT_COMMAND/precmd\fR yourself. .RE .RS -Set \fB$_Z_EXCLUDE_DIRS\fR to an array of directories to exclude. +Set \fB$_Z_EXCLUDE_DIRS\fR to an array of directory trees to exclude. .RE .RS -(These settings should go in .bashrc/.zshrc before the lines added above.) +Set \fB$_Z_OWNER\fR to allow usage when in 'sudo -s' mode. +.RE +.RS +(These settings should go in .bashrc/.zshrc before the line added above.) .RE .RS Install the provided man page \fBz.1\fR somewhere like \fB/usr/local/man/man1\fR. @@ -88,12 +96,12 @@ Install the provided man page \fBz.1\fR somewhere like \fB/usr/local/man/man1\fR Aging: The rank of directories maintained by \fBz\fR undergoes aging based on a simple formula. The rank of each entry is incremented every time it is accessed. When -the sum of ranks is greater than 6000, all ranks are multiplied by 0.99. Entries -with a rank lower than 1 are forgotten. +the sum of ranks is over 9000, all ranks are multiplied by 0.99. Entries with a +rank lower than 1 are forgotten. .SS Frecency: -Frecency is a portmantaeu of 'recent' and 'frequency'. It is a weighted rank -that depends on how often and how recently something occured. As far as I +Frecency is a portmanteau of 'recent' and 'frequency'. It is a weighted rank +that depends on how often and how recently something occurred. As far as I know, Mozilla came up with the term. .P To \fBz\fR, a directory that has low ranking but has been accessed recently @@ -131,7 +139,7 @@ The environment variable \fB$_Z_NO_RESOLVE_SYMLINKS\fR can be set to prevent resolving of symlinks. If it is not set, symbolic links will be resolved when added to the datafile. .P -In bash, \fBz\fR prepends a command to the \fBPROMPT_COMMAND\fR environment +In bash, \fBz\fR appends a command to the \fBPROMPT_COMMAND\fR environment variable to maintain its database. In zsh, \fBz\fR appends a function \fB_z_precmd\fR to the \fBprecmd_functions\fR array. .P @@ -139,8 +147,11 @@ The environment variable \fB$_Z_NO_PROMPT_COMMAND\fR can be set if you want to handle \fBPROMPT_COMMAND\fR or \fBprecmd\fR yourself. .P The environment variable \fB$_Z_EXCLUDE_DIRS\fR can be set to an array of -directories to exclude from tracking. \fB$HOME\fR is always excluded. +directory trees to exclude from tracking. \fB$HOME\fR is always excluded. Directories must be full paths without trailing slashes. +.P +The environment variable \fB$_Z_OWNER\fR can be set to your username, to +allow usage of \fBz\fR when your sudo enviroment keeps \fB$HOME\fR set. .SH FILES Data is stored in \fB$HOME/.z\fR. This can be overridden by setting the diff --git a/plugins/z/z.sh b/plugins/z/z.sh index 7e444ef4..d0eeb97e 100644 --- a/plugins/z/z.sh +++ b/plugins/z/z.sh @@ -3,29 +3,25 @@ # maintains a jump-list of the directories you actually use # # INSTALL: -# * put something like this in your .bashrc/.zshrc: -# . /path/to/z.sh -# * cd around for a while to build up the db -# * PROFIT!! -# * optionally: -# set $_Z_CMD in .bashrc/.zshrc to change the command (default z). -# set $_Z_DATA in .bashrc/.zshrc to change the datafile (default ~/.z). -# set $_Z_NO_RESOLVE_SYMLINKS to prevent symlink resolution. -# set $_Z_NO_PROMPT_COMMAND if you're handling PROMPT_COMMAND yourself. -# set $_Z_EXCLUDE_DIRS to an array of directories to exclude. +# * put something like this in your .bashrc/.zshrc: +# . /path/to/z.sh +# * cd around for a while to build up the db +# * PROFIT!! +# * optionally: +# set $_Z_CMD in .bashrc/.zshrc to change the command (default z). +# set $_Z_DATA in .bashrc/.zshrc to change the datafile (default ~/.z). +# set $_Z_NO_RESOLVE_SYMLINKS to prevent symlink resolution. +# set $_Z_NO_PROMPT_COMMAND if you're handling PROMPT_COMMAND yourself. +# set $_Z_EXCLUDE_DIRS to an array of directories to exclude. +# set $_Z_OWNER to your username if you want use z while sudo with $HOME kept # # USE: -# * z foo # cd to most frecent dir matching foo -# * z foo bar # cd to most frecent dir matching foo and bar -# * z -r foo # cd to highest ranked dir matching foo -# * z -t foo # cd to most recently accessed dir matching foo -# * z -l foo # list matches instead of cd -# * z -c foo # restrict matches to subdirs of $PWD - -case $- in - *i*) ;; - *) echo 'ERROR: z.sh is meant to be sourced, not directly executed.' -esac +# * z foo # cd to most frecent dir matching foo +# * z foo bar # cd to most frecent dir matching foo and bar +# * z -r foo # cd to highest ranked dir matching foo +# * z -t foo # cd to most recently accessed dir matching foo +# * z -l foo # list matches instead of cd +# * z -c foo # restrict matches to subdirs of $PWD [ -d "${_Z_DATA:-$HOME/.z}" ] && { echo "ERROR: z.sh's datafile (${_Z_DATA:-$HOME/.z}) is a directory." @@ -33,196 +29,215 @@ esac _z() { - local datafile="${_Z_DATA:-$HOME/.z}" + local datafile="${_Z_DATA:-$HOME/.z}" - # bail out if we don't own ~/.z (we're another user but our ENV is still set) - [ -f "$datafile" -a ! -O "$datafile" ] && return + # bail if we don't own ~/.z and $_Z_OWNER not set + [ -z "$_Z_OWNER" -a -f "$datafile" -a ! -O "$datafile" ] && return - # add entries - if [ "$1" = "--add" ]; then - shift + # add entries + if [ "$1" = "--add" ]; then + shift - # $HOME isn't worth matching - [ "$*" = "$HOME" ] && return + # $HOME isn't worth matching + [ "$*" = "$HOME" ] && return - # don't track excluded dirs - local exclude - for exclude in "${_Z_EXCLUDE_DIRS[@]}"; do - [ "$*" = "$exclude" ] && return - done + # don't track excluded directory trees + local exclude + for exclude in "${_Z_EXCLUDE_DIRS[@]}"; do + case "$*" in "$exclude*") return;; esac + done - # maintain the file - local tempfile - tempfile="$(mktemp "$datafile.XXXXXX")" || return - while read line; do - [ -d "${line%%\|*}" ] && echo $line - done < "$datafile" | awk -v path="$*" -v now="$(date +%s)" -F"|" ' - BEGIN { - rank[path] = 1 - time[path] = now - } - $2 >= 1 { - if( $1 == path ) { - rank[$1] = $2 + 1 - time[$1] = now - } else { - rank[$1] = $2 - time[$1] = $3 - } - count += $2 - } - END { - if( count > 6000 ) { - for( i in rank ) print i "|" 0.99*rank[i] "|" time[i] # aging - } else for( i in rank ) print i "|" rank[i] "|" time[i] - } - ' 2>/dev/null >| "$tempfile" - if [ $? -ne 0 -a -f "$datafile" ]; then - env rm -f "$tempfile" - else - env mv -f "$tempfile" "$datafile" - fi + # maintain the data file + local tempfile="$datafile.$RANDOM" + while read line; do + # only count directories + [ -d "${line%%\|*}" ] && echo $line + done < "$datafile" | awk -v path="$*" -v now="$(date +%s)" -F"|" ' + BEGIN { + rank[path] = 1 + time[path] = now + } + $2 >= 1 { + # drop ranks below 1 + if( $1 == path ) { + rank[$1] = $2 + 1 + time[$1] = now + } else { + rank[$1] = $2 + time[$1] = $3 + } + count += $2 + } + END { + if( count > 9000 ) { + # aging + for( x in rank ) print x "|" 0.99*rank[x] "|" time[x] + } else for( x in rank ) print x "|" rank[x] "|" time[x] + } + ' 2>/dev/null >| "$tempfile" + # do our best to avoid clobbering the datafile in a race condition + if [ $? -ne 0 -a -f "$datafile" ]; then + env rm -f "$tempfile" + else + [ "$_Z_OWNER" ] && chown $_Z_OWNER:$(id -ng $_Z_OWNER) "$tempfile" + env mv -f "$tempfile" "$datafile" || env rm -f "$tempfile" + fi - # tab completion - elif [ "$1" = "--complete" ]; then - while read line; do - [ -d "${line%%\|*}" ] && echo $line - done < "$datafile" | awk -v q="$2" -F"|" ' - BEGIN { - if( q == tolower(q) ) nocase = 1 - split(substr(q,3),fnd," ") - } - { - if( nocase ) { - for( i in fnd ) tolower($1) !~ tolower(fnd[i]) && $1 = "" - } else { - for( i in fnd ) $1 !~ fnd[i] && $1 = "" - } - if( $1 ) print $1 - } - ' 2>/dev/null + # tab completion + elif [ "$1" = "--complete" -a -s "$datafile" ]; then + while read line; do + [ -d "${line%%\|*}" ] && echo $line + done < "$datafile" | awk -v q="$2" -F"|" ' + BEGIN { + if( q == tolower(q) ) imatch = 1 + q = substr(q, 3) + gsub(" ", ".*", q) + } + { + if( imatch ) { + if( tolower($1) ~ tolower(q) ) print $1 + } else if( $1 ~ q ) print $1 + } + ' 2>/dev/null - else - # list/go - while [ "$1" ]; do case "$1" in - --) while [ "$1" ]; do shift; local fnd="$fnd $1";done;; - -*) local opt=${1:1}; while [ "$opt" ]; do case ${opt:0:1} in - c) local fnd="^$PWD $fnd";; - h) echo "${_Z_CMD:-z} [-chlrt] args" >&2; return;; - l) local list=1;; - r) local typ="rank";; - t) local typ="recent";; - esac; opt=${opt:1}; done;; - *) local fnd="$fnd $1";; - esac; local last=$1; shift; done - [ "$fnd" -a "$fnd" != "^$PWD " ] || local list=1 + else + # list/go + while [ "$1" ]; do case "$1" in + --) while [ "$1" ]; do shift; local fnd="$fnd${fnd:+ }$1";done;; + -*) local opt=${1:1}; while [ "$opt" ]; do case ${opt:0:1} in + c) local fnd="^$PWD $fnd";; + h) echo "${_Z_CMD:-z} [-chlrtx] args" >&2; return;; + x) sed -i -e "\:^${PWD}|.*:d" "$datafile";; + l) local list=1;; + r) local typ="rank";; + t) local typ="recent";; + esac; opt=${opt:1}; done;; + *) local fnd="$fnd${fnd:+ }$1";; + esac; local last=$1; [ "$#" -gt 0 ] && shift; done + [ "$fnd" -a "$fnd" != "^$PWD " ] || local list=1 - # if we hit enter on a completion just go there - case "$last" in - # completions will always start with / - /*) [ -z "$list" -a -d "$last" ] && cd "$last" && return;; - esac + # if we hit enter on a completion just go there + case "$last" in + # completions will always start with / + /*) [ -z "$list" -a -d "$last" ] && cd "$last" && return;; + esac - # no file yet - [ -f "$datafile" ] || return + # no file yet + [ -f "$datafile" ] || return - local cd - cd="$(while read line; do - [ -d "${line%%\|*}" ] && echo $line - done < "$datafile" | awk -v t="$(date +%s)" -v list="$list" -v typ="$typ" -v q="$fnd" -F"|" ' - function frecent(rank, time) { - dx = t-time - if( dx < 3600 ) return rank*4 - if( dx < 86400 ) return rank*2 - if( dx < 604800 ) return rank/2 - return rank/4 - } - function output(files, toopen, override) { - if( list ) { - cmd = "sort -n >&2" - for( i in files ) if( files[i] ) printf "%-10s %s\n", files[i], i | cmd - if( override ) printf "%-10s %s\n", "common:", override > "/dev/stderr" - } else { - if( override ) toopen = override - print toopen - } - } - function common(matches) { - # shortest match - for( i in matches ) { - if( matches[i] && (!short || length(i) < length(short)) ) short = i - } - if( short == "/" ) return - # shortest match must be common to each match. escape special characters in - # a copy when testing, so we can return the original. - clean_short = short - gsub(/[\(\)\[\]\|]/, "\\\\&", clean_short) - for( i in matches ) if( matches[i] && i !~ clean_short ) return - return short - } - BEGIN { split(q, a, " "); oldf = noldf = -9999999999 } - { - if( typ == "rank" ) { - f = $2 - } else if( typ == "recent" ) { - f = $3-t - } else f = frecent($2, $3) - wcase[$1] = nocase[$1] = f - for( i in a ) { - if( $1 !~ a[i] ) delete wcase[$1] - if( tolower($1) !~ tolower(a[i]) ) delete nocase[$1] - } - if( wcase[$1] && wcase[$1] > oldf ) { - cx = $1 - oldf = wcase[$1] - } else if( nocase[$1] && nocase[$1] > noldf ) { - ncx = $1 - noldf = nocase[$1] - } - } - END { - if( cx ) { - output(wcase, cx, common(wcase)) - } else if( ncx ) output(nocase, ncx, common(nocase)) - } - ')" - [ $? -gt 0 ] && return - [ "$cd" ] && cd "$cd" - fi + local cd + cd="$(while read line; do + [ -d "${line%%\|*}" ] && echo $line + done < "$datafile" | awk -v t="$(date +%s)" -v list="$list" -v typ="$typ" -v q="$fnd" -F"|" ' + function frecent(rank, time) { + # relate frequency and time + dx = t - time + if( dx < 3600 ) return rank * 4 + if( dx < 86400 ) return rank * 2 + if( dx < 604800 ) return rank / 2 + return rank / 4 + } + function output(files, out, common) { + # list or return the desired directory + if( list ) { + cmd = "sort -n >&2" + for( x in files ) { + if( files[x] ) printf "%-10s %s\n", files[x], x | cmd + } + if( common ) { + printf "%-10s %s\n", "common:", common > "/dev/stderr" + } + } else { + if( common ) out = common + print out + } + } + function common(matches) { + # find the common root of a list of matches, if it exists + for( x in matches ) { + if( matches[x] && (!short || length(x) < length(short)) ) { + short = x + } + } + if( short == "/" ) return + # use a copy to escape special characters, as we want to return + # the original. yeah, this escaping is awful. + clean_short = short + gsub(/\[\(\)\[\]\|\]/, "\\\\&", clean_short) + for( x in matches ) if( matches[x] && x !~ clean_short ) return + return short + } + BEGIN { + gsub(" ", ".*", q) + hi_rank = ihi_rank = -9999999999 + } + { + if( typ == "rank" ) { + rank = $2 + } else if( typ == "recent" ) { + rank = $3 - t + } else rank = frecent($2, $3) + if( $1 ~ q ) { + matches[$1] = rank + } else if( tolower($1) ~ tolower(q) ) imatches[$1] = rank + if( matches[$1] && matches[$1] > hi_rank ) { + best_match = $1 + hi_rank = matches[$1] + } else if( imatches[$1] && imatches[$1] > ihi_rank ) { + ibest_match = $1 + ihi_rank = imatches[$1] + } + } + END { + # prefer case sensitive + if( best_match ) { + output(matches, best_match, common(matches)) + } else if( ibest_match ) { + output(imatches, ibest_match, common(imatches)) + } + } + ')" + [ $? -gt 0 ] && return + [ "$cd" ] && cd "$cd" + fi } alias ${_Z_CMD:-z}='_z 2>&1' [ "$_Z_NO_RESOLVE_SYMLINKS" ] || _Z_RESOLVE_SYMLINKS="-P" -if compctl &> /dev/null; then - [ "$_Z_NO_PROMPT_COMMAND" ] || { - # zsh populate directory list, avoid clobbering any other precmds - if [ "$_Z_NO_RESOLVE_SYMLINKS" ]; then - _z_precmd() { - _z --add "${PWD:a}" +if type compctl >/dev/null 2>&1; then + # zsh + [ "$_Z_NO_PROMPT_COMMAND" ] || { + # populate directory list, avoid clobbering any other precmds. + if [ "$_Z_NO_RESOLVE_SYMLINKS" ]; then + _z_precmd() { + _z --add "${PWD:a}" + } + else + _z_precmd() { + _z --add "${PWD:A}" + } + fi + [[ -n "${precmd_functions[(r)_z_precmd]}" ]] || { + precmd_functions[$(($#precmd_functions+1))]=_z_precmd + } } - else - _z_precmd() { - _z --add "${PWD:A}" + _z_zsh_tab_completion() { + # tab completion + local compl + read -l compl + reply=(${(f)"$(_z --complete "$compl")"}) + } + compctl -U -K _z_zsh_tab_completion _z +elif type complete >/dev/null 2>&1; then + # bash + # tab completion + complete -o filenames -C '_z --complete "$COMP_LINE"' ${_Z_CMD:-z} + [ "$_Z_NO_PROMPT_COMMAND" ] || { + # populate directory list. avoid clobbering other PROMPT_COMMANDs. + grep "_z --add" <<< "$PROMPT_COMMAND" >/dev/null || { + PROMPT_COMMAND="$PROMPT_COMMAND"$'\n''_z --add "$(command pwd '$_Z_RESOLVE_SYMLINKS' 2>/dev/null)" 2>/dev/null;' + } } - fi - precmd_functions+=(_z_precmd) - } - # zsh tab completion - _z_zsh_tab_completion() { - local compl - read -l compl - reply=(${(f)"$(_z --complete "$compl")"}) - } - compctl -U -K _z_zsh_tab_completion _z -elif complete &> /dev/null; then - # bash tab completion - complete -o filenames -C '_z --complete "$COMP_LINE"' ${_Z_CMD:-z} - [ "$_Z_NO_PROMPT_COMMAND" ] || { - # bash populate directory list. avoid clobbering other PROMPT_COMMANDs. - echo $PROMPT_COMMAND | grep -q "_z --add" || { - PROMPT_COMMAND='_z --add "$(pwd '$_Z_RESOLVE_SYMLINKS' 2>/dev/null)" 2>/dev/null;'"$PROMPT_COMMAND" - } - } fi From 24492a2fdb6feed1b529459dbd97061460aa968f Mon Sep 17 00:00:00 2001 From: Andrew Janke Date: Fri, 2 Oct 2015 01:21:29 -0400 Subject: [PATCH 075/537] Update github plugin to work with current hub versions Removes old completion setup that breaks with current _git and _hub completions. Ruby is no longer required by hub; removes that test. Does not define new completions for hub; they are now defined by hub itself. Change the functions to use hub to create the repos on GitHub. Add error checking to the functions. Removes apparently-unused _github completion definition. --- plugins/github/README.md | 46 ++++++++++++++ plugins/github/_github | 40 ------------ plugins/github/github.plugin.zsh | 101 +++++++++++++------------------ 3 files changed, 87 insertions(+), 100 deletions(-) create mode 100644 plugins/github/README.md delete mode 100644 plugins/github/_github diff --git a/plugins/github/README.md b/plugins/github/README.md new file mode 100644 index 00000000..21b7367f --- /dev/null +++ b/plugins/github/README.md @@ -0,0 +1,46 @@ +# github + +This plugin supports working with GitHub the command line. It provides a few things: + +* Sets up the `hub` wrapper and completions for the `git` command if you have `hub` installed. +* Completion for the `github` Ruby gem. +* Convenience functions for working with repos and URLs. + +### Functions + +* `empty_gh` - Creates a new empty repo (with a `README.md`) and pushes it to GitHub +* `new_gh` - Initializes an existing directory as a repo and pushes it to GitHub +* `exist_gh` - Takes an existing repo and pushes it to GitHub +* `git.io` - Shortens a URL using [git.io](http://git.io) + + +## Installation + +[Hub](http://github.com/github/hub) needs to be installed if you want to use it. On OS X with Homebrew, this can be done with `brew install hub`. The `hub` completion definition needs to be added to your `$FPATH` before initializing OMZ. + +The [`github` Ruby gem](http://github.com/defunkt/github-gem) needs to be installed if you want to use it. + +### Configuration + +These settings affect `github`'s behavior. + +#### Environment variables + +* `$GITHUB_USER` +* `$GITHUB_PASSWORD` + +#### Git configuration options + +* `github.user` - GitHub username for repo operations + +See `man hub` for more details. + +### Homebrew installation note + +If you have installed `hub` using Homebrew, its completions may not be on your `$FPATH` if you are using the system `zsh`. Homebrew installs `zsh` completion definitions to `/usr/local/share/zsh/site-functions`, which on `$FPATH` for the Homebrew-installed `zsh`, but not for the system `zsh`. If you want it to work with the system `zsh`, add this to your `~/.zshrc` before it sources `oh-my-zsh.sh`. + +```zsh +if (( ! ${fpath[(I)/usr/local/share/zsh/site-functions]} )); then + FPATH=/usr/local/share/zsh/site-functions:$FPATH +fi +``` diff --git a/plugins/github/_github b/plugins/github/_github deleted file mode 100644 index 83e1713c..00000000 --- a/plugins/github/_github +++ /dev/null @@ -1,40 +0,0 @@ -#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 -_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/github/github.plugin.zsh b/plugins/github/github.plugin.zsh index bd69b1bd..ca19901f 100644 --- a/plugins/github/github.plugin.zsh +++ b/plugins/github/github.plugin.zsh @@ -1,56 +1,25 @@ -# Setup hub function for git, if it is available; http://github.com/defunkt/hub -if [ "$commands[(I)hub]" ] && [ "$commands[(I)ruby]" ]; then - # Autoload _git completion functions - if declare -f _git > /dev/null; then - _git - fi - - if declare -f _git_commands > /dev/null; then - _hub_commands=( - 'alias:show shell instructions for wrapping git' - 'pull-request:open a pull request on GitHub' - 'fork:fork origin repo on GitHub' - 'create:create new repo on GitHub for the current project' - 'browse:browse the project on GitHub' - 'compare:open GitHub compare view' - ) - # Extend the '_git_commands' function with hub commands - eval "$(declare -f _git_commands | sed -e 's/base_commands=(/base_commands=(${_hub_commands} /')" - fi - # eval `hub alias -s zsh` - function git(){ - if ! (( $+_has_working_hub )); then - hub --version &> /dev/null - _has_working_hub=$(($? == 0)) - fi - if (( $_has_working_hub )) ; then - hub "$@" - else - command git "$@" - fi - } +# Set up hub wrapper for git, if it is available; http://github.com/github/hub +if [ "$commands[(I)hub]" ]; then + if hub --version &>/dev/null; then + eval $(hub alias -s zsh) + fi fi # Functions ################################################################# -# https://github.com/dbb +# Based on https://github.com/dbb/githome/blob/master/.config/zsh/functions - -# empty_gh [NAME_OF_REPO] +# empty_gh # # Use this when creating a new repo from scratch. +# Creates a new repo with a blank README.md in it and pushes it up to GitHub. empty_gh() { # [NAME_OF_REPO] - repo=$1 - ghuser=$( git config github.user ) + emulate -L zsh + local repo=$1 - mkdir "$repo" - cd "$repo" - git init - touch README - git add README - git commit -m 'Initial commit.' - git remote add origin git@github.com:${ghuser}/${repo}.git - git push -u origin master + mkdir "$repo" + touch "$repo/README.md" + new_gh "$repo" } # new_gh [DIRECTORY] @@ -58,16 +27,25 @@ empty_gh() { # [NAME_OF_REPO] # Use this when you have a directory that is not yet set up for git. # This function will add all non-hidden files to git. new_gh() { # [DIRECTORY] - cd "$1" - ghuser=$( git config github.user ) + emulate -L zsh + local repo="$1" + cd "$repo" \ + || return - git init - # add all non-dot files - print '.*'"\n"'*~' >> .gitignore - git add ^.* - git commit -m 'Initial commit.' - git remote add origin git@github.com:${ghuser}/${repo}.git - git push -u origin master + git init \ + || return + # add all non-dot files + print '.*'"\n"'*~' >> .gitignore + git add [^.]* \ + || return + git add .gitignore \ + || return + git commit -m 'Initial commit.' \ + || return + hub create \ + || return + git push -u origin master \ + || return } # exist_gh [DIRECTORY] @@ -75,13 +53,13 @@ new_gh() { # [DIRECTORY] # Use this when you have a git repo that's ready to go and you want to add it # to your GitHub. exist_gh() { # [DIRECTORY] - cd "$1" - name=$( git config user.name ) - ghuser=$( git config github.user ) - repo=$1 + emulate -L zsh + local repo=$1 + cd "$repo" - git remote add origin git@github.com:${ghuser}/${repo}.git - git push -u origin master + hub create \ + || return + git push -u origin master } # git.io "GitHub URL" @@ -91,7 +69,10 @@ exist_gh() { # [DIRECTORY] # source: https://github.com/nvogel/dotzsh # documentation: https://github.com/blog/985-git-io-github-url-shortener # -git.io() {curl -i -s http://git.io -F "url=$1" | grep "Location" | cut -f 2 -d " "} +git.io() { + emulate -L zsh + curl -i -s http://git.io -F "url=$1" | grep "Location" | cut -f 2 -d " " +} # End Functions ############################################################# From cc116f65d621f25a97beee108cfb8884ef5f3518 Mon Sep 17 00:00:00 2001 From: Andrew Janke Date: Fri, 6 Nov 2015 19:44:26 -0500 Subject: [PATCH 076/537] agnoster: stronger warning about changing SEGMENT_SEPARATOR character --- themes/agnoster.zsh-theme | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme index e54346ac..c981213f 100644 --- a/themes/agnoster.zsh-theme +++ b/themes/agnoster.zsh-theme @@ -43,7 +43,8 @@ CURRENT_BG='NONE' # This is defined using a Unicode escape sequence so it is unambiguously readable, regardless of # what font the user is viewing this source code in. Do not replace the # escape sequence with a single literal character. - SEGMENT_SEPARATOR=$'\ue0b0' #  + # Do not change this! Do not make it '\u2b80'; that is the old, wrong code point. + SEGMENT_SEPARATOR=$'\ue0b0' } # Begin a segment From 76c423862feeec193163a01a5f3a20f36757f630 Mon Sep 17 00:00:00 2001 From: Justin LeFebvre Date: Sat, 7 Nov 2015 16:36:42 -0500 Subject: [PATCH 077/537] =?UTF-8?q?I=20noticed=20that=20for=20certain=20pr?= =?UTF-8?q?ojects=20with=20unstaged=20changed=20I=20would=20get=20a=20'U'?= =?UTF-8?q?=20character=20instead=20of=20the=20'=E2=97=8F'=20character.=20?= =?UTF-8?q?This=20should=20fix=20that.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/agnoster.zsh-theme | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme index e54346ac..a6bb9c64 100644 --- a/themes/agnoster.zsh-theme +++ b/themes/agnoster.zsh-theme @@ -36,7 +36,7 @@ CURRENT_BG='NONE' local LC_ALL="" LC_CTYPE="en_US.UTF-8" # NOTE: This segment separator character is correct. In 2012, Powerline changed # the code points they use for their special characters. This is the new code point. - # If this is not working for you, you probably have an old version of the + # If this is not working for you, you probably have an old version of the # Powerline-patched fonts installed. Download and install the new version. # Do not submit PRs to change this unless you have reviewed the Powerline code point # history and have new information. @@ -118,7 +118,7 @@ prompt_git() { zstyle ':vcs_info:*' get-revision true zstyle ':vcs_info:*' check-for-changes true zstyle ':vcs_info:*' stagedstr '✚' - zstyle ':vcs_info:git:*' unstagedstr '●' + zstyle ':vcs_info:*' unstagedstr '●' zstyle ':vcs_info:*' formats ' %u%c' zstyle ':vcs_info:*' actionformats ' %u%c' vcs_info From 06db64840cde7f70c2a5bbd8f6a2c8961202fc18 Mon Sep 17 00:00:00 2001 From: Pepe Bawagan Date: Tue, 10 Nov 2015 18:51:55 +0800 Subject: [PATCH 078/537] typo: able take -> able to take --- README.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index cee314de..6007d650 100644 --- a/README.markdown +++ b/README.markdown @@ -3,7 +3,7 @@ Oh My Zsh is an open source, community-driven framework for managing your [zsh](http://www.zsh.org/) configuration. That sounds boring. Let's try this again. -__Oh My Zsh is a way of life!__ Once installed, your terminal prompt will become the talk of the town _or your money back!_ Each time you interact with your command prompt, you'll be able take advantage of the hundreds of bundled plugins and pretty themes. Strangers will come up to you in cafés and ask you, _"that is amazing. are you some sort of genius?"_ Finally, you'll begin to get the sort of attention that you always felt that you deserved. ...or maybe you'll just use the time that you saved to start flossing more often. +__Oh My Zsh is a way of life!__ Once installed, your terminal prompt will become the talk of the town _or your money back!_ Each time you interact with your command prompt, you'll be able to take advantage of the hundreds of bundled plugins and pretty themes. Strangers will come up to you in cafés and ask you, _"that is amazing. are you some sort of genius?"_ Finally, you'll begin to get the sort of attention that you always felt that you deserved. ...or maybe you'll just use the time that you saved to start flossing more often. To learn more, visit [ohmyz.sh](http://ohmyz.sh) and/or follow [ohmyzsh](https://twitter.com/ohmyzsh) on Twitter. From bee79f0871e0a317bc78d440d070c4f8ab6cc32a Mon Sep 17 00:00:00 2001 From: Denis Date: Mon, 16 Nov 2015 01:33:20 +0300 Subject: [PATCH 079/537] bundle outdated alias --- plugins/bundler/bundler.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index dfff6956..382a1a47 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -2,6 +2,7 @@ alias be="bundle exec" alias bl="bundle list" alias bp="bundle package" alias bo="bundle open" +alias bout="bundle outdated" alias bu="bundle update" alias bi="bundle_install" alias bcn="bundle clean" From 602cc62a5db6e8cfa085f05e2abb6a86e999a696 Mon Sep 17 00:00:00 2001 From: Ahmad Awais Date: Mon, 16 Nov 2015 23:37:02 +0500 Subject: [PATCH 080/537] Removed Similar Aliases Two similar aliases which were causing issues. --- plugins/wp-cli/wp-cli.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/wp-cli/wp-cli.plugin.zsh b/plugins/wp-cli/wp-cli.plugin.zsh index 6c70a7a0..7b41c325 100644 --- a/plugins/wp-cli/wp-cli.plugin.zsh +++ b/plugins/wp-cli/wp-cli.plugin.zsh @@ -63,7 +63,7 @@ alias wppp='wp plugin path' alias wpps='wp plugin search' alias wppst='wp plugin status' alias wppt='wp plugin toggle' -alias wppu='wp plugin uninstall' +alias wppun='wp plugin uninstall' alias wppu='wp plugin update' # Post @@ -75,7 +75,7 @@ alias wppog='wp post get' alias wppol='wp post list' alias wppom='wp post meta' alias wppou='wp post update' -alias wppou='wp post url' +alias wppourl='wp post url' # Rewrite From cca422eacfb0d418af00c7df9dc97639b65a1eca Mon Sep 17 00:00:00 2001 From: Andrew Janke Date: Mon, 16 Nov 2015 16:57:42 -0500 Subject: [PATCH 081/537] Mercurial plugin: revise README Closes #4616 Changes the `plugins=(... mercurial ...)` to be closer to correct zsh syntax, removing commas and extra spaces. Revises discussion on configuring themes to avoid sounding like users should modify the theme definition file in the main OMZ folder. Prioritizes the suggestion of using a theme which already supports hg_prompt_info. --- plugins/mercurial/README.md | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/plugins/mercurial/README.md b/plugins/mercurial/README.md index 89e1c174..f42212d6 100644 --- a/plugins/mercurial/README.md +++ b/plugins/mercurial/README.md @@ -2,23 +2,20 @@ ### Usage Update .zshrc: -1. Add name to the list of plugins, e.g. `plugins = (..., mercurial, ...)` +1. Add name to the list of plugins, e.g. `plugins=(... mercurial ...)` (that is pretty obvious). -2. Change PROMPT variable of current theme to contain current folder mercurial repo info: +2. Switch to a theme which uses `hg_prompt_info`. - robbyrussel theme is used by default, so you need to modify PROMPT var - from [this file](https://github.com/robbyrussell/oh-my-zsh/blob/master/themes/robbyrussell.zsh-theme) - by adding `$(hg_prompt_info)` after `$(git_prompt_info)`, so currently it - looks next: + Or, customize the `$PROMPT` variable of your current theme to contain current folder mercurial repo info. This can be done by putting a custom version of the theme in `$ZSH_CUSTOM` or by changing `$PROMPT` in `.zshrc` after loading the theme. - ```diff - - PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' - + PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)$(hg_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' + The `robbyrussell` theme is used by default, so you need to modify `$PROMPT` var by adding `$(hg_prompt_info)` after `$(git_prompt_info)`, so it looks like this: + + ```zsh + PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)$(hg_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' ``` - - and put modified var at the end of **.zshrc**. + 3. Initialize additional vars used in plugin. So in short put next in **.zshrc**: - + ``` ZSH_THEME_HG_PROMPT_PREFIX="%{$fg_bold[magenta]%}hg:(%{$fg[red]%}" ZSH_THEME_HG_PROMPT_SUFFIX="%{$reset_color%}" @@ -55,8 +52,7 @@ Update .zshrc: #### Displays repo branch and directory status in prompt This is the same as git plugin does. -**Note**: additional changes to **.zshrc** are required in order for this to -work. +**Note**: Additional changes to **.zshrc**, or using a theme designed to use `hg_prompt_info`, are required in order for this to work. ### Mantainers [ptrv](https://github.com/ptrv) - original creator From 8f823c63715009ef949f72a1bbb0102b472c24cd Mon Sep 17 00:00:00 2001 From: Ahmad Awais Date: Tue, 17 Nov 2015 12:23:39 +0500 Subject: [PATCH 082/537] Update README.md --- plugins/wp-cli/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/wp-cli/README.md b/plugins/wp-cli/README.md index 6dda07d1..1a79d60f 100644 --- a/plugins/wp-cli/README.md +++ b/plugins/wp-cli/README.md @@ -43,7 +43,7 @@ WP-CLI is a set of command-line tools for managing WordPress installations. You - wpps='search' - wppst='status' - wppt='toggle' -- wppu='uninstall' +- wppun='uninstall' - wppu='update' ### Post @@ -55,7 +55,7 @@ WP-CLI is a set of command-line tools for managing WordPress installations. You - wppol='wp post list' - wppom='wp post meta' - wppou='wp post update' -- wppou='wp post url' +- wppourl='wp post url' ### Sidebar - wpsbl='wp sidebar list' From 8ea773582f4628b1ed7222b95463f835b684478d Mon Sep 17 00:00:00 2001 From: Andrew Janke Date: Mon, 27 Jul 2015 21:21:43 -0400 Subject: [PATCH 083/537] vi-mode: remove line-init/finish widgets that broken terminfo keybindings The zle-line-init and zle-line-finish definitions here were broken with respect to smkx/rmkx because their "if" logic had fallthrough where it shouldn't, so the mode was left in rmkx all the time. This just removes those widgets entirely, because they're now defined (correctly) in lib/keybindings.zsh and not needed in plugins. --- plugins/vi-mode/vi-mode.plugin.zsh | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/plugins/vi-mode/vi-mode.plugin.zsh b/plugins/vi-mode/vi-mode.plugin.zsh index 4424bb29..0e2af5dc 100644 --- a/plugins/vi-mode/vi-mode.plugin.zsh +++ b/plugins/vi-mode/vi-mode.plugin.zsh @@ -1,15 +1,5 @@ -# Ensures that $terminfo values are valid and updates editor information when -# the keymap changes. -function zle-keymap-select zle-line-init zle-line-finish { - # The terminal must be in application mode when ZLE is active for $terminfo - # values to be valid. - if (( ${+terminfo[smkx]} )); then - printf '%s' ${terminfo[smkx]} - fi - if (( ${+terminfo[rmkx]} )); then - printf '%s' ${terminfo[rmkx]} - fi - +# Updates editor information when the keymap changes. +function zle-keymap-select() { zle reset-prompt zle -R } @@ -19,8 +9,6 @@ TRAPWINCH() { zle && { zle reset-prompt; zle -R } } -zle -N zle-line-init -zle -N zle-line-finish zle -N zle-keymap-select zle -N edit-command-line From c8e280f2ab8e7768b100e590c6836502d5cf8fb9 Mon Sep 17 00:00:00 2001 From: Andrew Janke Date: Wed, 18 Nov 2015 06:53:15 -0500 Subject: [PATCH 084/537] dircycle: remove redundant key bindings In bindkey strings, "^[" and "\e" mean the same thing. They're both notations for Escape. --- plugins/dircycle/dircycle.plugin.zsh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/plugins/dircycle/dircycle.plugin.zsh b/plugins/dircycle/dircycle.plugin.zsh index 1e31105b..8a406b54 100644 --- a/plugins/dircycle/dircycle.plugin.zsh +++ b/plugins/dircycle/dircycle.plugin.zsh @@ -27,11 +27,11 @@ insert-cycledright () { zle -N insert-cycledright -# add key bindings for iTerm2 -if [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then - bindkey "^[[1;6D" insert-cycledleft - bindkey "^[[1;6C" insert-cycledright -else - bindkey "\e[1;6D" insert-cycledleft - bindkey "\e[1;6C" insert-cycledright -fi \ No newline at end of file +# These sequences work for xterm, Apple Terminal.app, and probably others. +# Not for rxvt-unicode, but it doesn't seem differentiate Ctrl-Shift-Arrow +# from plain Shift-Arrow, at least by default. +# iTerm2 does not have these key combinations defined by default; you will need +# to add them under "Keys" in your profile if you want to use this. You can do +# this conveniently by loading the "xterm with Numeric Keypad" preset. +bindkey "\e[1;6D" insert-cycledleft +bindkey "\e[1;6C" insert-cycledright From 950bbccd604cc8e8b161550969330373a7ea0cbe Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Wed, 6 May 2015 16:13:02 +0200 Subject: [PATCH 085/537] gradle plugin: also list tasks in subprojects --- plugins/gradle/gradle.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/gradle/gradle.plugin.zsh b/plugins/gradle/gradle.plugin.zsh index 661c29d5..2f6bf4d8 100644 --- a/plugins/gradle/gradle.plugin.zsh +++ b/plugins/gradle/gradle.plugin.zsh @@ -80,7 +80,7 @@ _gradle_tasks () { if [ in_gradle ]; then _gradle_arguments if _gradle_does_task_list_need_generating; then - gradle tasks --all | grep "^[ ]*[a-zA-Z0-9:]*\ -\ " | sed "s/ - .*$//" | sed "s/[\ ]*//" > .gradletasknamecache + gradle tasks --all | awk '/[a-zA-Z0-9:-]* - / {print $1}' > .gradletasknamecache fi compadd -X "==== Gradle Tasks ====" `cat .gradletasknamecache` fi @@ -90,7 +90,7 @@ _gradlew_tasks () { if [ in_gradle ]; then _gradle_arguments if _gradle_does_task_list_need_generating; then - ./gradlew tasks --all | grep "^[ ]*[a-zA-Z0-9:]*\ -\ " | sed "s/ - .*$//" | sed "s/[\ ]*//" > .gradletasknamecache + ./gradlew tasks --all | awk '/[a-zA-Z0-9:-]* - / {print $1}' > .gradletasknamecache fi compadd -X "==== Gradlew Tasks ====" `cat .gradletasknamecache` fi From 249d2229d4929f181e1168d1a6ade2eb5c054e4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sat, 21 Nov 2015 03:10:55 +0100 Subject: [PATCH 086/537] Cleanup gradle plugin file - Delete useless #!zsh - Simplify gradle build file check - Format comments and delete TODO stuff (already dealt with) - Use `$()` syntax for cat commands --- plugins/gradle/gradle.plugin.zsh | 36 +++++++------------------------- 1 file changed, 7 insertions(+), 29 deletions(-) diff --git a/plugins/gradle/gradle.plugin.zsh b/plugins/gradle/gradle.plugin.zsh index 2f6bf4d8..a908eaea 100644 --- a/plugins/gradle/gradle.plugin.zsh +++ b/plugins/gradle/gradle.plugin.zsh @@ -1,4 +1,3 @@ -#!zsh ############################################################################## # A descriptive listing of core Gradle commands ############################################################################ @@ -54,22 +53,11 @@ function _gradle_arguments() { ############################################################################## -# Are we in a directory containing a build.gradle file? -############################################################################ -function in_gradle() { - if [[ -f build.gradle ]]; then - echo 1 - fi -} - -############################################################################## Examine the build.gradle file to see if its -# timestamp has changed, and if so, regen -# the .gradle_tasks cache file +# Examine the build.gradle file to see if its timestamp has changed; +# and if so, regenerate the .gradle_tasks cache file ############################################################################ _gradle_does_task_list_need_generating () { - [ ! -f .gradletasknamecache ] && return 0; - [ build.gradle -nt .gradletasknamecache ] && return 0; - return 1; + [[ ! -f .gradletasknamecache ]] || [[ build.gradle -nt .gradletasknamecache ]] } @@ -77,22 +65,22 @@ _gradle_does_task_list_need_generating () { # Discover the gradle tasks by running "gradle tasks --all" ############################################################################ _gradle_tasks () { - if [ in_gradle ]; then + if [[ -f build.gradle ]]; then _gradle_arguments if _gradle_does_task_list_need_generating; then gradle tasks --all | awk '/[a-zA-Z0-9:-]* - / {print $1}' > .gradletasknamecache fi - compadd -X "==== Gradle Tasks ====" `cat .gradletasknamecache` + compadd -X "==== Gradle Tasks ====" $(cat .gradletasknamecache) fi } _gradlew_tasks () { - if [ in_gradle ]; then + if [[ -f build.gradle ]]; then _gradle_arguments if _gradle_does_task_list_need_generating; then ./gradlew tasks --all | awk '/[a-zA-Z0-9:-]* - / {print $1}' > .gradletasknamecache fi - compadd -X "==== Gradlew Tasks ====" `cat .gradletasknamecache` + compadd -X "==== Gradlew Tasks ====" $(cat .gradletasknamecache) fi } @@ -102,13 +90,3 @@ _gradlew_tasks () { ############################################################################ compdef _gradle_tasks gradle compdef _gradlew_tasks gradlew - - -############################################################################## -# Open questions for future improvements: -# 1) Should 'gradle tasks' use --all or just the regular set? -# 2) Should gradlew use the same approach as gradle? -# 3) Should only the " - " be replaced with a colon so it can work -# with the richer descriptive method of _arguments? -# gradle tasks | grep "^[a-zA-Z0-9]*\ -\ " | sed "s/ - /\:/" -############################################################################# From 7d9648e6314d184800cc4549db2fd7b7d13bdec7 Mon Sep 17 00:00:00 2001 From: Markus Faerevaag Date: Mon, 23 Nov 2015 22:22:45 +0100 Subject: [PATCH 087/537] [wd] update minor version (v0.4.2) --- plugins/wd/wd.sh | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/plugins/wd/wd.sh b/plugins/wd/wd.sh index 3b954816..cf54713b 100755 --- a/plugins/wd/wd.sh +++ b/plugins/wd/wd.sh @@ -8,7 +8,7 @@ # @github.com/mfaerevaag/wd # version -readonly WD_VERSION=0.4 +readonly WD_VERSION=0.4.2 # colors readonly WD_BLUE="\033[96m" @@ -143,7 +143,7 @@ wd_warp() fi elif [[ ${points[$point]} != "" ]] then - cd ${points[$point]} + cd ${points[$point]/#\~/$HOME} else wd_exit_fail "Unknown warp point '${point}'" fi @@ -169,7 +169,7 @@ wd_add() elif [[ ${points[$2]} == "" ]] || $force then wd_remove $point > /dev/null - printf "%q:%s\n" "${point}" "${PWD}" >> $WD_CONFIG + printf "%q:%s\n" "${point}" "${PWD/#$HOME/~}" >> $WD_CONFIG wd_print_msg $WD_GREEN "Warp point added" @@ -203,6 +203,21 @@ wd_list_all() { wd_print_msg $WD_BLUE "All warp points:" + entries=$(sed "s:${HOME}:~:g" $WD_CONFIG) + + max_warp_point_length=0 + while IFS= read -r line + do + arr=(${(s,:,)line}) + key=${arr[1]} + + length=${#key} + if [[ length -gt max_warp_point_length ]] + then + max_warp_point_length=$length + fi + done <<< $entries + while IFS= read -r line do if [[ $line != "" ]] @@ -213,16 +228,16 @@ wd_list_all() if [[ -z $wd_quiet_mode ]] then - printf "%20s -> %s\n" $key $val + printf "%${max_warp_point_length}s -> %s\n" $key $val fi fi - done <<< $(sed "s:${HOME}:~:g" $WD_CONFIG) + done <<< $entries } wd_ls() { wd_getdir $1 - ls $dir + ls ${dir/#\~/$HOME} } wd_path() @@ -248,6 +263,7 @@ wd_show() local wd_matches wd_matches=() # do a reverse lookup to check whether PWD is in $points + PWD="${PWD/$HOME/~}" if [[ ${points[(r)$PWD]} == $PWD ]] then for name in ${(k)points} From b57ddd6a6798a03e0302811e27edb82735280f67 Mon Sep 17 00:00:00 2001 From: WeeBull Date: Thu, 26 Nov 2015 14:08:53 +0000 Subject: [PATCH 088/537] Use actual `commit --amend` command for Mercurial Rather than trying to emulate `git commit --amend` using mercurial queues (which might have side effects if you're using MQ for other things) use the `commit --amend` command which was introduced in Mercurial 2.2 (2012-05-01). --- plugins/mercurial/mercurial.plugin.zsh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/mercurial/mercurial.plugin.zsh b/plugins/mercurial/mercurial.plugin.zsh index 86200ccf..3ae59496 100644 --- a/plugins/mercurial/mercurial.plugin.zsh +++ b/plugins/mercurial/mercurial.plugin.zsh @@ -14,8 +14,7 @@ alias hgo='hg outgoing' alias hgp='hg push' alias hgs='hg status' alias hgsl='hg log --limit 20 --template "{node|short} | {date|isodatesec} | {author|user}: {desc|strip|firstline}\n" ' -# this is the 'git commit --amend' equivalent -alias hgca='hg qimport -r tip ; hg qrefresh -e ; hg qfinish tip' +alias hgca='hg commit --amend' # list unresolved files (since hg does not list unmerged files in the status command) alias hgun='hg resolve --list' From ebfba0e5392ea9855bfd3ed0ef1b9f49c6a9176f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 20 Oct 2015 22:01:14 +0200 Subject: [PATCH 089/537] Drop the use of nohup on OSX for tmux compatibility Apparently `nohup` is not needed in OSX, and using it has the side that it may break under tmux with the error nohup: can't detach from console: No such file or directory For now, this commit only drops the use of `nohup` in OSX. But it *may* not be necessary under other similar platforms. --- lib/functions.zsh | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/lib/functions.zsh b/lib/functions.zsh index efb73a1b..a2585595 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -28,7 +28,10 @@ function open_command() { ;; esac - nohup $open_cmd "$@" &>/dev/null + # don't use nohup on OSX + [[ "$OSTYPE" != darwin* ]] && open_cmd="nohup $open_cmd" + + $open_cmd "$@" &>/dev/null } # @@ -67,7 +70,7 @@ function try_alias_value() { # # Arguments: # 1. name - The variable to set -# 2. val - The default value +# 2. val - The default value # Return value: # 0 if the variable exists, 3 if it was set # @@ -81,12 +84,12 @@ function default() { # # Arguments: # 1. name - The env variable to set -# 2. val - The default value +# 2. val - The default value # Return value: # 0 if the env variable exists, 3 if it was set # function env_default() { - env | grep -q "^$1=" && return 0 + env | grep -q "^$1=" && return 0 export "$1=$2" && return 3 } @@ -101,7 +104,7 @@ zmodload zsh/langinfo # # By default, reserved characters and unreserved "mark" characters are # not escaped by this function. This allows the common usage of passing -# an entire URL in, and encoding just special characters in it, with +# an entire URL in, and encoding just special characters in it, with # the expectation that reserved and mark characters are used appropriately. # The -r and -m options turn on escaping of the reserved and mark characters, # respectively, which allows arbitrary strings to be fully escaped for @@ -112,7 +115,7 @@ zmodload zsh/langinfo # # Usage: # omz_urlencode [-r] [-m] -# +# # -r causes reserved characters (;/?:@&=+$,) to be escaped # # -m causes "mark" characters (_.!~*''()-) to be escaped @@ -177,8 +180,8 @@ function omz_urlencode() { # URL-decode a string # # Decodes a RFC 2396 URL-encoded (%-escaped) string. -# This decodes the '+' and '%' escapes in the input string, and leaves -# other characters unchanged. Does not enforce that the input is a +# This decodes the '+' and '%' escapes in the input string, and leaves +# other characters unchanged. Does not enforce that the input is a # valid URL-encoded string. This is a convenience to allow callers to # pass in a full URL or similar strings and decode them for human # presentation. @@ -196,7 +199,7 @@ function omz_urldecode { local caller_encoding=$langinfo[CODESET] local LC_ALL=C export LC_ALL - + # Change + back to ' ' local tmp=${encoded_url:gs/+/ /} # Protect other escapes to pass through the printf unchanged @@ -220,4 +223,3 @@ function omz_urldecode { echo -E "$decoded" } - From f0981d564a5f9705cb87c00d746ab73ce7f2ec33 Mon Sep 17 00:00:00 2001 From: Andrew Janke Date: Sat, 31 Oct 2015 14:53:41 -0400 Subject: [PATCH 090/537] termsupport: protect subshell with quotes --- lib/functions.zsh | 2 +- lib/termsupport.zsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/functions.zsh b/lib/functions.zsh index a2585595..8ef3420b 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -114,7 +114,7 @@ zmodload zsh/langinfo # Returns nonzero if encoding failed. # # Usage: -# omz_urlencode [-r] [-m] +# omz_urlencode [-r] [-m] [-P] # # -r causes reserved characters (;/?:@&=+$,) to be escaped # diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index 5f61fe8e..4c5068e9 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -74,7 +74,7 @@ if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then # the host name to disambiguate local vs. remote paths. # Percent-encode the pathname. - local URL_PATH=$(omz_urlencode -P $PWD) + local URL_PATH="$(omz_urlencode -P $PWD)" [[ $? != 0 ]] && return 1 local PWD_URL="file://$HOST$URL_PATH" # Undocumented Terminal.app-specific control sequence From d7e6ba0b66fd65c71e9e3d4a4a5216dfde141944 Mon Sep 17 00:00:00 2001 From: Andrew Janke Date: Tue, 7 Jul 2015 16:47:31 -0400 Subject: [PATCH 091/537] history-substring-search: add a script to automatically update OMZ from the upstream repo --- .../update-from-upstream.zsh | 94 +++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100755 plugins/history-substring-search/update-from-upstream.zsh diff --git a/plugins/history-substring-search/update-from-upstream.zsh b/plugins/history-substring-search/update-from-upstream.zsh new file mode 100755 index 00000000..45950f44 --- /dev/null +++ b/plugins/history-substring-search/update-from-upstream.zsh @@ -0,0 +1,94 @@ +#!/usr/bin/env zsh +# +# update-from-upstream.zsh +# +# This script updates the Oh My Zsh version of the zsh-history-substring-search +# plugin from the independent upstream repo. This is to be run by OMZ developers +# when they want to pull in new changes from upstream to OMZ. It is not run +# during normal use of the plugin. +# +# The official upstream repo is zsh-users/zsh-history-substring-search +# https://github.com/zsh-users/zsh-history-substring-search +# +# This is a zsh script, not a function. Call it with `zsh update-from-upstream.zsh` +# from the command line, running it from within the plugin directory. +# +# You can set the environment variable REPO_PATH to point it at an upstream +# repo you have already prepared. Otherwise, it will do a clean checkout of +# upstream's HEAD to a temporary local repo and use that. + + +# Just bail on any error so we don't have to do extra checking. +# This is a developer-use script, so terse output like that should +# be fine. +set -e + + +UPSTREAM_BASE=zsh-history-substring-search +UPSTREAM_REPO=zsh-users/$UPSTREAM_BASE +need_repo_cleanup=false +upstream_github_url="https://github.com/$UPSTREAM_REPO" + +if [[ -z "$UPSTREAM_REPO_PATH" ]]; then + # Do a clean checkout + my_tempdir=$(mktemp -d -t omz-update-histsubstrsrch) + UPSTREAM_REPO_PATH="$my_tempdir/$UPSTREAM_BASE" + git clone "$upstream_github_url" "$UPSTREAM_REPO_PATH" + need_repo_cleanup=true + print "Checked out upstream repo to $UPSTREAM_REPO_PATH" +else + print "Using existing zsh-history-substring-search repo at $UPSTREAM_REPO_PATH" +fi + +upstream="$UPSTREAM_REPO_PATH" + +# Figure out what we're pulling in +upstream_sha=$(cd $upstream && git rev-parse HEAD) +upstream_commit_date=$(cd $upstream && git log -1 --pretty=format:%ci) +print "upstream SHA: $upstream_sha" +print "upstream commit date: $upstream_commit_date" +print + +# Copy the files over, using the OMZ plugin's names where needed +cp -v "$upstream"/* . +mv zsh-history-substring-search.plugin.zsh history-substring-search.plugin.zsh +mv zsh-history-substring-search.zsh history-substring-search.zsh + +if [[ $need_repo_cleanup == true ]]; then + print "Removing temporary repo at $my_tempdir" + rm -rf "$my_tempdir" +fi + +# Do OMZ-specific edits + +print +print "Updating files with OMZ-specific stuff" + +# Tack OMZ-specific notes on to readme +thin_line="------------------------------------------------------------------------------" +cat >> README.md < Date: Tue, 7 Jul 2015 16:48:05 -0400 Subject: [PATCH 092/537] history-substring-search: update to upstream version 2015-09-28 Updates OMZ's copy to commit 2c295432175990c1bb4e90bc13f609daa67a25d6 from zsh-users/zsh-history-substring-search --- .../history-substring-search/README.markdown | 7 - plugins/history-substring-search/README.md | 149 +++++++++ .../history-substring-search.plugin.zsh | 15 +- .../history-substring-search.zsh | 313 +++++++----------- .../update-from-upstream.zsh | 63 +++- 5 files changed, 335 insertions(+), 212 deletions(-) delete mode 100644 plugins/history-substring-search/README.markdown create mode 100644 plugins/history-substring-search/README.md diff --git a/plugins/history-substring-search/README.markdown b/plugins/history-substring-search/README.markdown deleted file mode 100644 index c154afdc..00000000 --- a/plugins/history-substring-search/README.markdown +++ /dev/null @@ -1,7 +0,0 @@ -To activate this script, please include it the `plugins` variable within `~/.zshrc` - - `plugins=(git history-substring-search)` - -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/README.md b/plugins/history-substring-search/README.md new file mode 100644 index 00000000..0c02e91b --- /dev/null +++ b/plugins/history-substring-search/README.md @@ -0,0 +1,149 @@ +zsh-history-substring-search +============================================================================== + +This is a clean-room implementation of the [Fish shell][1]'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. +You can also use K and J in VI mode or ^P and ^N in EMACS mode for the same. + +[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/zsh-users/zsh-history-substring-search +[6]: https://github.com/zsh-users/zsh-syntax-highlighting + +------------------------------------------------------------------------------ +Requirements +------------------------------------------------------------------------------ + +* [ZSH](http://zsh.sourceforge.net) 4.3 or newer + +------------------------------------------------------------------------------ +Usage +------------------------------------------------------------------------------ + +1. Load this script into your interactive ZSH session: + + % source zsh-history-substring-search.zsh + + If you want to use [zsh-syntax-highlighting][6] along with this script, + then make sure that you load it *before* you load this script: + + % source zsh-syntax-highlighting.zsh + % source zsh-history-substring-search.zsh + +2. Bind keyboard shortcuts to this script's functions: + + # bind UP and DOWN arrow keys + zmodload zsh/terminfo + bindkey "$terminfo[kcuu1]" history-substring-search-up + bindkey "$terminfo[kcud1]" history-substring-search-down + + # bind UP and DOWN arrow keys (compatibility fallback + # for Ubuntu 12.04, Fedora 21, and MacOSX 10.9 users) + bindkey '^[[A' history-substring-search-up + bindkey '^[[B' history-substring-search-down + + # bind P and N for EMACS mode + bindkey -M emacs '^P' history-substring-search-up + bindkey -M emacs '^N' history-substring-search-down + + # bind k and j for VI mode + bindkey -M vicmd 'k' history-substring-search-up + bindkey -M vicmd 'j' history-substring-search-down + +3. 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. + +4. 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. + +To always receive _unique_ search results, use `setopt HIST_IGNORE_ALL_DUPS`. +Alternatively, use `setopt HIST_FIND_NO_DUPS` which makes this plugin skip +duplicate _adjacent_ search results as you cycle through them---however, this +does not guarantee that search results are unique: if your search results were +"Dog", "Dog", "HotDog", "Dog", then cycling them gives "Dog", "HotDog", "Dog". +Notice that the "Dog" search result appeared twice as you cycled through them! +If you wish to avoid this limitation, then use `setopt HIST_IGNORE_ALL_DUPS`. + +------------------------------------------------------------------------------ +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 project][3] in January 2011. + +It was later extracted from fizsh 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. + +------------------------------------------------------------------------------ +Oh My Zsh Distribution Notes +------------------------------------------------------------------------------ + +What you are looking at now is Oh My Zsh's repackaging of zsh-history-substring-search +as an OMZ module inside the Oh My Zsh distribution. + +The upstream repo, zsh-users/zsh-history-substring-search, can be found on GitHub at +https://github.com/zsh-users/zsh-history-substring-search. + +This downstream copy was last updated from the following upstream commit: + + SHA: 2c295432175990c1bb4e90bc13f609daa67a25d6 + Commit date: 2015-09-28 10:47:34 -0700 + +Everything above this section is a copy of the original upstream's README, so things +may differ slightly when you're using this inside OMZ. In particular, you do not +need to set up key bindings for the up and down arrows yourself in `~/.zshrc`; the OMZ +plugin does that for you. You may still want to set up additional emacs- or vi-specific +bindings as mentioned above. + diff --git a/plugins/history-substring-search/history-substring-search.plugin.zsh b/plugins/history-substring-search/history-substring-search.plugin.zsh index 99a5922c..25fd3a2d 100644 --- a/plugins/history-substring-search/history-substring-search.plugin.zsh +++ b/plugins/history-substring-search/history-substring-search.plugin.zsh @@ -1,6 +1,6 @@ -# This file integrates the history-substring-search script into oh-my-zsh. +# This file integrates the zsh-history-substring-search script into oh-my-zsh. -source "$ZSH/plugins/history-substring-search/history-substring-search.zsh" +source "${0:r:r}.zsh" if test "$CASE_SENSITIVE" = true; then unset HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS @@ -10,3 +10,14 @@ if test "$DISABLE_COLOR" = true; then unset HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND unset HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND fi + + +# Bind terminal-specific up and down keys + +if [[ -n "$terminfo[kcuu1]" ]]; then + bindkey "$terminfo[kcuu1]" history-substring-search-up +fi +if [[ -n "$terminfo[kcud1]" ]]; then + bindkey "$terminfo[kcud1]" history-substring-search-down +fi + diff --git a/plugins/history-substring-search/history-substring-search.zsh b/plugins/history-substring-search/history-substring-search.zsh index 65f0750d..ad316acc 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 @@ -140,7 +49,7 @@ HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS='i' # the main ZLE widgets #----------------------------------------------------------------------------- -function history-substring-search-up() { +history-substring-search-up() { _history-substring-search-begin _history-substring-search-up-history || @@ -150,7 +59,7 @@ function history-substring-search-up() { _history-substring-search-end } -function history-substring-search-down() { +history-substring-search-down() { _history-substring-search-begin _history-substring-search-down-history || @@ -163,14 +72,6 @@ function history-substring-search-down() { zle -N history-substring-search-up zle -N history-substring-search-down -zmodload zsh/terminfo -if [[ -n "$terminfo[kcuu1]" ]]; then - bindkey "$terminfo[kcuu1]" history-substring-search-up -fi -if [[ -n "$terminfo[kcud1]" ]]; then - bindkey "$terminfo[kcud1]" history-substring-search-down -fi - #----------------------------------------------------------------------------- # implementation details #----------------------------------------------------------------------------- @@ -185,32 +86,20 @@ zmodload -F zsh/parameter # if [[ $+functions[_zsh_highlight] -eq 0 ]]; then # - # Dummy implementation of _zsh_highlight() - # that simply removes existing highlights + # Dummy implementation of _zsh_highlight() that + # simply removes any existing highlights when the + # user inserts printable characters into $BUFFER. # - function _zsh_highlight() { - region_highlight=() - } - - # - # Remove existing highlights when the user - # inserts printable characters into $BUFFER - # - function ordinary-key-press() { + _zsh_highlight() { if [[ $KEYS == [[:print:]] ]]; then region_highlight=() fi - zle .self-insert } - 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. @@ -241,50 +130,53 @@ 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|yank*)}; 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() { +_history-substring-search-begin() { setopt localoptions extendedglob - _history_substring_search_move_cursor_eol=false + + _history_substring_search_refresh_display= _history_substring_search_query_highlight= # @@ -308,12 +200,10 @@ function _history-substring-search-begin() { # # Find all occurrences of the search query in the history file. # - # (k) turns it an array of line numbers. + # (k) returns the "keys" (history index numbers) instead of the values + # (Oa) reverses the order, because (R) returns results reversed. # - # (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}*]}) + _history_substring_search_matches=(${(kOa)history[(R)(#$HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS)*${_history_substring_search_query_escaped}*]}) # # Define the range of values that $_history_substring_search_match_index @@ -349,12 +239,15 @@ function _history-substring-search-begin() { fi } -function _history-substring-search-end() { +_history-substring-search-end() { setopt localoptions extendedglob + _history_substring_search_result=$BUFFER - # move the cursor to the end of the command line - if [[ $_history_substring_search_move_cursor_eol == true ]]; then + # the search was succesful so display the result properly by clearing away + # existing highlights and moving the cursor to the end of the result buffer + if [[ $_history_substring_search_refresh_display -eq 1 ]]; then + region_highlight=() CURSOR=${#BUFFER} fi @@ -379,10 +272,10 @@ function _history-substring-search-end() { # read -k -t 200 && zle -U $REPLY # Exit successfully from the history-substring-search-* widgets. - true + return 0 } -function _history-substring-search-up-buffer() { +_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: @@ -405,13 +298,13 @@ function _history-substring-search-up-buffer() { if [[ $#buflines -gt 1 && $CURSOR -ne $#BUFFER && $#xlbuflines -ne 1 ]]; then zle up-line-or-history - return true + return 0 fi - false + return 1 } -function _history-substring-search-down-buffer() { +_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: @@ -434,13 +327,13 @@ function _history-substring-search-down-buffer() { if [[ $#buflines -gt 1 && $CURSOR -ne $#BUFFER && $#xrbuflines -ne 1 ]]; then zle down-line-or-history - return true + return 0 fi - false + return 1 } -function _history-substring-search-up-history() { +_history-substring-search-up-history() { # # Behave like up in ZSH, except clear the $BUFFER # when beginning of history is reached like in Fish. @@ -453,16 +346,16 @@ 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 + return 0 fi - false + return 1 } -function _history-substring-search-down-history() { +_history-substring-search-down-history() { # # Behave like down-history in ZSH, except clear the # $BUFFER when end of history is reached like in Fish. @@ -472,21 +365,31 @@ function _history-substring-search-down-history() { # 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 + _history_substring_search_refresh_display=1 # going down from somewhere above the bottom of history else - zle down-history + zle down-line-or-history fi - return true + return 0 fi - false + return 1 } -function _history-substring-search-up-search() { - _history_substring_search_move_cursor_eol=true +_history-substring-search-not-found() { + # + # Nothing matched the search query, so put it back into the $BUFFER while + # highlighting it accordingly so the user can revise it and search again. + # + _history_substring_search_old_buffer=$BUFFER + BUFFER=$_history_substring_search_query + _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND +} + +_history-substring-search-up-search() { + _history_substring_search_refresh_display=1 # # Highlight matches during history-substring-up-search: @@ -542,9 +445,7 @@ function _history-substring-search-up-search() { # 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 + _history-substring-search-not-found elif [[ $_history_substring_search_match_index -eq $_history_substring_search_matches_count_plus ]]; then # @@ -561,11 +462,30 @@ function _history-substring-search-up-search() { (( _history_substring_search_match_index-- )) BUFFER=$_history_substring_search_old_buffer _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND + + else + # + # We are at the beginning of history and there are no further matches. + # + _history-substring-search-not-found + return + fi + + # + # When HIST_FIND_NO_DUPS is set, meaning that only unique command lines from + # history should be matched, make sure the new and old results are different. + # But when HIST_IGNORE_ALL_DUPS is set, ZSH already ensures a unique history. + # + if [[ ! -o HIST_IGNORE_ALL_DUPS && -o HIST_FIND_NO_DUPS && $BUFFER == $_history_substring_search_result ]]; then + # + # Repeat the current search so that a different (unique) match is found. + # + _history-substring-search-up-search fi } -function _history-substring-search-down-search() { - _history_substring_search_move_cursor_eol=true +_history-substring-search-down-search() { + _history_substring_search_refresh_display=1 # # Highlight matches during history-substring-up-search: @@ -622,9 +542,7 @@ function _history-substring-search-down-search() { # 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 + _history-substring-search-not-found elif [[ $_history_substring_search_match_index -eq 0 ]]; then # @@ -641,6 +559,25 @@ function _history-substring-search-down-search() { (( _history_substring_search_match_index++ )) BUFFER=$_history_substring_search_old_buffer _history_substring_search_query_highlight=$HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND + + else + # + # We are at the end of history and there are no further matches. + # + _history-substring-search-not-found + return + fi + + # + # When HIST_FIND_NO_DUPS is set, meaning that only unique command lines from + # history should be matched, make sure the new and old results are different. + # But when HIST_IGNORE_ALL_DUPS is set, ZSH already ensures a unique history. + # + if [[ ! -o HIST_IGNORE_ALL_DUPS && -o HIST_FIND_NO_DUPS && $BUFFER == $_history_substring_search_result ]]; then + # + # Repeat the current search so that a different (unique) match is found. + # + _history-substring-search-down-search fi } diff --git a/plugins/history-substring-search/update-from-upstream.zsh b/plugins/history-substring-search/update-from-upstream.zsh index 45950f44..6e6cca5d 100755 --- a/plugins/history-substring-search/update-from-upstream.zsh +++ b/plugins/history-substring-search/update-from-upstream.zsh @@ -24,20 +24,21 @@ set -e -UPSTREAM_BASE=zsh-history-substring-search -UPSTREAM_REPO=zsh-users/$UPSTREAM_BASE +upstream_basename=zsh-history-substring-search +plugin_basename=history-substring-search +UPSTREAM_REPO=zsh-users/$upstream_basename need_repo_cleanup=false upstream_github_url="https://github.com/$UPSTREAM_REPO" if [[ -z "$UPSTREAM_REPO_PATH" ]]; then # Do a clean checkout my_tempdir=$(mktemp -d -t omz-update-histsubstrsrch) - UPSTREAM_REPO_PATH="$my_tempdir/$UPSTREAM_BASE" + UPSTREAM_REPO_PATH="$my_tempdir/$upstream_basename" git clone "$upstream_github_url" "$UPSTREAM_REPO_PATH" need_repo_cleanup=true print "Checked out upstream repo to $UPSTREAM_REPO_PATH" else - print "Using existing zsh-history-substring-search repo at $UPSTREAM_REPO_PATH" + print "Using existing $upstream_basename repo at $UPSTREAM_REPO_PATH" fi upstream="$UPSTREAM_REPO_PATH" @@ -45,14 +46,16 @@ upstream="$UPSTREAM_REPO_PATH" # Figure out what we're pulling in upstream_sha=$(cd $upstream && git rev-parse HEAD) upstream_commit_date=$(cd $upstream && git log -1 --pretty=format:%ci) +upstream_just_date=${${=upstream_commit_date}[1]} print "upstream SHA: $upstream_sha" -print "upstream commit date: $upstream_commit_date" +print "upstream commit time: $upstream_commit_date" +print "upstream commit date: $upstream_just_date" print # Copy the files over, using the OMZ plugin's names where needed cp -v "$upstream"/* . -mv zsh-history-substring-search.plugin.zsh history-substring-search.plugin.zsh -mv zsh-history-substring-search.zsh history-substring-search.zsh +mv -v zsh-history-substring-search.zsh $plugin_basename.zsh +mv -v zsh-history-substring-search.plugin.zsh $plugin_basename.plugin.zsh if [[ $need_repo_cleanup == true ]]; then print "Removing temporary repo at $my_tempdir" @@ -63,19 +66,38 @@ fi print print "Updating files with OMZ-specific stuff" +print + +# OMZ binds the keys as part of the plugin loading + +cat >> $plugin_basename.plugin.zsh <> README.md < Date: Tue, 3 Nov 2015 15:26:12 -0500 Subject: [PATCH 093/537] z plugin: fix loading from custom location The old implementation would attempt to load both the default and custom implementations, with the custom one coming first, so it would get clobbered by the default version. --- plugins/z/z.plugin.zsh | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/plugins/z/z.plugin.zsh b/plugins/z/z.plugin.zsh index 196b88b1..96abee89 100644 --- a/plugins/z/z.plugin.zsh +++ b/plugins/z/z.plugin.zsh @@ -1,6 +1 @@ -_load_z() { - source $1/z.sh -} - -[[ -f $ZSH_CUSTOM/plugins/z/z.plugin.zsh ]] && _load_z $ZSH_CUSTOM/plugins/z -[[ -f $ZSH/plugins/z/z.plugin.zsh ]] && _load_z $ZSH/plugins/z +source "${0:h}/z.sh" From fea74b4b34412cca1b0bc3ec232e5ec8c602ee8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sun, 29 Nov 2015 19:31:26 +0100 Subject: [PATCH 094/537] Fix open_command nohup call There a syntax error if $cmd_var contains more than one word, so we drop the current way to prepend nohup and use a simpler if-else form. --- lib/functions.zsh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/functions.zsh b/lib/functions.zsh index 8ef3420b..ec6f3721 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -29,9 +29,11 @@ function open_command() { esac # don't use nohup on OSX - [[ "$OSTYPE" != darwin* ]] && open_cmd="nohup $open_cmd" - - $open_cmd "$@" &>/dev/null + if [[ "$OSTYPE" == darwin* ]]; then + $open_cmd "$@" &>/dev/null + else + nohup $open_cmd "$@" &>/dev/null + fi } # From c2b4d9ff40f2f965a5d9d282081f3f8bf51bb5b5 Mon Sep 17 00:00:00 2001 From: Sebastian Gniazdowski Date: Mon, 30 Nov 2015 10:48:30 +0100 Subject: [PATCH 095/537] znt: n-history supports multi-line cmds and starts with current buffer --- .../zsh-navigation-tools/.config/znt/n-cd.conf | 1 + .../.config/znt/n-history.conf | 5 +++++ plugins/zsh-navigation-tools/n-history | 7 ++++--- plugins/zsh-navigation-tools/n-list | 15 +++++++++++++++ plugins/zsh-navigation-tools/znt-history-widget | 2 ++ 5 files changed, 27 insertions(+), 3 deletions(-) diff --git a/plugins/zsh-navigation-tools/.config/znt/n-cd.conf b/plugins/zsh-navigation-tools/.config/znt/n-cd.conf index 5fcfe64f..f8c49bfa 100644 --- a/plugins/zsh-navigation-tools/.config/znt/n-cd.conf +++ b/plugins/zsh-navigation-tools/.config/znt/n-cd.conf @@ -1,6 +1,7 @@ # Hotlist local hotlist hotlist=( + ~/.config/znt /usr/share/zsh/site-functions /usr/share/zsh /usr/local/share/zsh/site-functions diff --git a/plugins/zsh-navigation-tools/.config/znt/n-history.conf b/plugins/zsh-navigation-tools/.config/znt/n-history.conf index f798f712..5d4bad82 100644 --- a/plugins/zsh-navigation-tools/.config/znt/n-history.conf +++ b/plugins/zsh-navigation-tools/.config/znt/n-history.conf @@ -3,3 +3,8 @@ # On Linux virtual terminal this will be enforced to reverse (because of poor # underline support on that terminal) local active_text=underline + +# Highlight a few keywords +local NLIST_COLORING_PATTERN="(while|for |sudo|make|(#s)git|vim(#e)|vim |emacs(#e)|emacs )" +local NLIST_COLORING_COLOR=$'\x1b[00;33m' +local NLIST_COLORING_MATCH_MULTIPLE=1 diff --git a/plugins/zsh-navigation-tools/n-history b/plugins/zsh-navigation-tools/n-history index e66f2a50..c9e53316 100644 --- a/plugins/zsh-navigation-tools/n-history +++ b/plugins/zsh-navigation-tools/n-history @@ -10,6 +10,7 @@ emulate -L zsh setopt extendedglob zmodload zsh/curses +zmodload zsh/parameter local IFS=" " @@ -24,16 +25,16 @@ local selected NLIST_REMEMBER_STATE=0 -list=( `builtin history -rn 1` ) +list=( "$history[@]" ) list=( "${(@M)list:#(#i)*$1*}" ) -local NLIST_GREP_STRING="$1" - if [ "$#list" -eq 0 ]; then echo "No matching history entries" return 1 fi +local NLIST_GREP_STRING="$1" +local NLIST_REPLACE_NEWLINES="1" n-list "${list[@]}" if [ "$REPLY" -gt 0 ]; then diff --git a/plugins/zsh-navigation-tools/n-list b/plugins/zsh-navigation-tools/n-list index 3b326515..c7066318 100644 --- a/plugins/zsh-navigation-tools/n-list +++ b/plugins/zsh-navigation-tools/n-list @@ -139,6 +139,7 @@ if [ "$#" -lt 1 ]; then fi REPLY="-1" +typeset -ga reply reply=() integer term_height="$LINES" @@ -188,6 +189,11 @@ if [ "$NLIST_START_IN_SEARCH_MODE" -eq 1 ]; then NLIST_IS_SEARCH_MODE=1 fi +if [ -n "$NLIST_SET_SEARCH_TO" ]; then + NLIST_SEARCH_BUFFER="$NLIST_SET_SEARCH_TO" + NLIST_SET_SEARCH_TO="" +fi + if [ "$NLIST_START_IN_UNIQ_MODE" -eq 1 ]; then NLIST_START_IN_UNIQ_MODE=0 NLIST_IS_UNIQ_MODE=1 @@ -281,6 +287,9 @@ while (( 1 )); do if [ "$prev_start_idx" -ne "$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN" ]; then prev_start_idx="$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN" disp_list=( "${(@)col_list[NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN, end_idx]}" ) + + # We have display list, lets replace newlines with "\n" when needed (1/3) + [ "$NLIST_REPLACE_NEWLINES" -eq 1 ] && disp_list=( "${(@)disp_list//$'\n'/\\n}" ) fi # Output colored list @@ -333,11 +342,17 @@ while (( 1 )); do if [ "$prev_start_idx" -ne "$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN" ]; then prev_start_idx="$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN" disp_list=( "${(@)list[NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN, end_idx]}" ) + + # We have display list, lets replace newlines with "\n" when needed (2/3) + [ "$NLIST_REPLACE_NEWLINES" -eq 1 ] && disp_list=( "${(@)disp_list//$'\n'/\\n}" ) fi else if [ "$prev_start_idx" -ne "$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN" ]; then prev_start_idx="$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN" disp_list=( "${(@)col_list[NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN, end_idx]}" ) + + # We have display list, lets replace newlines with "\n" when needed (3/3) + [ "$NLIST_REPLACE_NEWLINES" -eq 1 ] && disp_list=( "${(@)disp_list//$'\n'/\\n}" ) fi fi diff --git a/plugins/zsh-navigation-tools/znt-history-widget b/plugins/zsh-navigation-tools/znt-history-widget index 097de823..9ddae606 100644 --- a/plugins/zsh-navigation-tools/znt-history-widget +++ b/plugins/zsh-navigation-tools/znt-history-widget @@ -1,8 +1,10 @@ autoload znt-usetty-wrapper n-history local NLIST_START_IN_SEARCH_MODE=1 local NLIST_START_IN_UNIQ_MODE=1 +local NLIST_SET_SEARCH_TO="$BUFFER" znt-usetty-wrapper n-history "$@" unset NLIST_START_IN_SEARCH_MODE unset NLIST_START_IN_UNIQ_MODE +unset NLIST_SET_SEARCH_TO From 711c1bcb40483c862e62bbd4528474b9c8009a48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Mon, 30 Nov 2015 15:16:47 +0200 Subject: [PATCH 096/537] Add support for "putty" $TERM in termsupport.zsh --- lib/termsupport.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index 4c5068e9..4780be80 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -18,7 +18,7 @@ function title { if [[ "$TERM" == screen* ]]; then print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars - elif [[ "$TERM" == xterm* ]] || [[ "$TERM" == rxvt* ]] || [[ "$TERM" == ansi ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then + elif [[ "$TERM" == xterm* ]] || [[ "$TERM" == putty ]] || [[ "$TERM" == rxvt* ]] || [[ "$TERM" == ansi ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then print -Pn "\e]2;$2:q\a" #set window name print -Pn "\e]1;$1:q\a" #set icon (=tab) name fi From c8852902a93ec007c326ae51e711d7b3a9c5b0c4 Mon Sep 17 00:00:00 2001 From: Sebastian Gniazdowski Date: Mon, 30 Nov 2015 15:05:49 +0100 Subject: [PATCH 097/537] Renamed README.txt to README.md --- plugins/zsh-navigation-tools/{README.txt => README.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename plugins/zsh-navigation-tools/{README.txt => README.md} (100%) diff --git a/plugins/zsh-navigation-tools/README.txt b/plugins/zsh-navigation-tools/README.md similarity index 100% rename from plugins/zsh-navigation-tools/README.txt rename to plugins/zsh-navigation-tools/README.md From 39e4dfb6a60cba39a47df68764075d841829be49 Mon Sep 17 00:00:00 2001 From: Sebastian Gniazdowski Date: Mon, 30 Nov 2015 15:31:19 +0100 Subject: [PATCH 098/537] Updated README.md --- plugins/zsh-navigation-tools/README.md | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/plugins/zsh-navigation-tools/README.md b/plugins/zsh-navigation-tools/README.md index 4771742d..686213c3 100644 --- a/plugins/zsh-navigation-tools/README.md +++ b/plugins/zsh-navigation-tools/README.md @@ -2,16 +2,17 @@ http://imageshack.com/a/img633/7967/ps6rKR.png -A tool generating a selectable curses-based list of elements that has access to -current Zsh session, i.e. has broad capabilities to work together with it. -That's n-list. The files n-cd, n-env, n-kill, etc. are applications of -the tool. Feature highlights include incremental multi-word searching, ANSI +Set of tools like n-history – multi-word history searcher, n-cd – directory +bookmark manager, n-kill – htop like kill utility, and more. Based on +n-list, a tool generating selectable curses-based list of elements that has +access to current Zsh session, i.e. has broad capabilities to work together +with it. Feature highlights include incremental multi-word searching, ANSI coloring, unique mode, horizontal scroll, non-selectable elements, grepping and various integrations with Zsh. ## History Widget -To have n-history as the incremental searcher bound to Ctrl-R copy znt-* +To have n-history as multi-word incremental searcher bound to Ctrl-R copy znt-* files into the */site-functions dir (unless you use Oh My Zsh) and add: @@ -21,13 +22,16 @@ add: to .zshrc. This is done automatically when using Oh My Zsh. Two other widgets exist, znt-cd-widget and znt-kill-widget, they can be too assigned -to key combinations: +to key combinations (no need for autoload when using Oh My Zsh): zle -N znt-cd-widget bindkey "^T" znt-cd-widget zle -N znt-kill-widget bindkey "^Y" znt-kill-widget +Oh My Zsh stores history into ~/.zsh_history. When you switch to OMZ you could +want to copy your previous data (from e.g. ~/.zhistory) into the new location. + ## Introduction The tools are: @@ -99,3 +103,9 @@ expressions, (#s) is ^, (#e) is $, # is *, ## is +. Alternative will work when in parenthesis, i.e. (a|b). BTW by using this method you can colorize output of the tools, via their config files (check out e.g. n-cd.conf, it uses this). + +## Performance +ZNT is fastest with Zsh before 5.0.8 and starting from 5.2 (the version yet to +be released). + +# vim:filetype=conf From ae84be7e31f72a4fcb34b6e3c5f5c5332b4a8330 Mon Sep 17 00:00:00 2001 From: Sebastian Gniazdowski Date: Mon, 30 Nov 2015 18:28:24 +0100 Subject: [PATCH 099/537] znt: updated README.md --- plugins/zsh-navigation-tools/README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/zsh-navigation-tools/README.md b/plugins/zsh-navigation-tools/README.md index 686213c3..670a85ec 100644 --- a/plugins/zsh-navigation-tools/README.md +++ b/plugins/zsh-navigation-tools/README.md @@ -105,7 +105,8 @@ colorize output of the tools, via their config files (check out e.g. n-cd.conf, it uses this). ## Performance -ZNT is fastest with Zsh before 5.0.8 and starting from 5.2 (the version yet to +ZNT are fastest with Zsh before 5.0.8 and starting from 5.2 (the version yet to be released). -# vim:filetype=conf + +vim:filetype=conf From d427ac1ef9d62dcba34437dd177db6c41df254bf Mon Sep 17 00:00:00 2001 From: Sebastian Gniazdowski Date: Mon, 30 Nov 2015 19:22:34 +0100 Subject: [PATCH 100/537] znt: twice as fast searching --- plugins/zsh-navigation-tools/n-list | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/plugins/zsh-navigation-tools/n-list b/plugins/zsh-navigation-tools/n-list index c7066318..26431a0d 100644 --- a/plugins/zsh-navigation-tools/n-list +++ b/plugins/zsh-navigation-tools/n-list @@ -261,18 +261,15 @@ while (( 1 )); do local search_buffer="${NLIST_SEARCH_BUFFER%% ##}" search_buffer="${search_buffer## ##}" search_buffer="${search_buffer//(#m)[][*?|#~^()><\\]/\\$MATCH}" + local search_pattern="" + local colsearch_pattern="" if [ -n "$search_buffer" ]; then # Patterns will be *foo*~^*bar* and foo|bar) - local search_pattern="${search_buffer// ##/*~^*}" - local colsearch_pattern="${search_buffer// ##/|}" + search_pattern="${search_buffer// ##/*~^*}" + colsearch_pattern="${search_buffer// ##/|}" list=( "${(@M)list:#(#i)*$~search_pattern*}" ) last_element="$#list" - - local red=$'\x1b[00;31m' reset=$'\x1b[00;00m' - col_list=( "${(@)list//(#mi)($~colsearch_pattern)/$red${MATCH}$reset}" ) - else - col_list=( "$list[@]" ) fi # Called after processing list @@ -286,7 +283,12 @@ while (( 1 )); do if [ "$prev_start_idx" -ne "$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN" ]; then prev_start_idx="$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN" - disp_list=( "${(@)col_list[NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN, end_idx]}" ) + disp_list=( "${(@)list[NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN, end_idx]}" ) + + if [ -n "$colsearch_pattern" ]; then + local red=$'\x1b[00;31m' reset=$'\x1b[00;00m' + disp_list=( "${(@)disp_list//(#mi)($~colsearch_pattern)/$red${MATCH}$reset}" ) + fi # We have display list, lets replace newlines with "\n" when needed (1/3) [ "$NLIST_REPLACE_NEWLINES" -eq 1 ] && disp_list=( "${(@)disp_list//$'\n'/\\n}" ) From 0a79f1e836d6096ec67deabca8105f60b124cbbe Mon Sep 17 00:00:00 2001 From: Mark Ingalls Date: Mon, 9 Nov 2015 14:34:47 -0700 Subject: [PATCH 101/537] make this work in the git-for-windows SDK Added an option for the msys value of $OSTYPE --- lib/functions.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/functions.zsh b/lib/functions.zsh index ec6f3721..1623df2b 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -23,6 +23,7 @@ function open_command() { darwin*) open_cmd="open" ;; cygwin*) open_cmd="cygstart" ;; linux*) open_cmd="xdg-open" ;; + msys*) open_cmd="start" ;; *) echo "Platform $OSTYPE not supported" return 1 ;; From afdfe2391eeab13f2480a88514af895ce660d30c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Mon, 30 Nov 2015 21:08:40 +0100 Subject: [PATCH 102/537] Add empty string parameter to start command Otherwise `start` will confuse the first parameter as the title of a new command prompt if the parameter contains whitespace. That is because the command to be run will be: start "abc def" which opens a new command prompt window with the title "abc def". With the added empty string we force the start command to interpret the passed parameter as the file / command: start "" "abc def" which will be interpreted like `""` is the title and the rest is the file or command to start. ------- **NOTE:** this wouldn't be necessary if the start script in msys was defined differently; that is, if it had the empty string already incorporated in the script (/usr/bin/start), like so: ```diff -cmd //c start "${@//&/^&}" +cmd //c start "" "${@//&/^&}" ``` Notice however that this would make it impossible to use start setting a different title, so it's probably best to leave it as is. More info: http://sourceforge.net/p/msys2/tickets/14/ ------- The change `${(z)open_cmd}` is necessary to force zsh to split the variable by the spaces and interpret it as separate words. More info: http://zsh.sourceforge.net/FAQ/zshfaq03.html#l17 --- lib/functions.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/functions.zsh b/lib/functions.zsh index 1623df2b..bbdbea5c 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -23,7 +23,7 @@ function open_command() { darwin*) open_cmd="open" ;; cygwin*) open_cmd="cygstart" ;; linux*) open_cmd="xdg-open" ;; - msys*) open_cmd="start" ;; + msys*) open_cmd="start \"\"" ;; *) echo "Platform $OSTYPE not supported" return 1 ;; @@ -33,7 +33,7 @@ function open_command() { if [[ "$OSTYPE" == darwin* ]]; then $open_cmd "$@" &>/dev/null else - nohup $open_cmd "$@" &>/dev/null + nohup ${(z)open_cmd} "$@" &>/dev/null fi } From 584e0a6ef9ade95cf68dab4f2026d2bd5954fe33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Mon, 30 Nov 2015 21:18:27 +0100 Subject: [PATCH 103/537] Use shwordsplit in open_command() --- lib/functions.zsh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/functions.zsh b/lib/functions.zsh index bbdbea5c..f9d4a971 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -16,14 +16,17 @@ function take() { } function open_command() { + emulate -L zsh + setopt shwordsplit + local open_cmd # define the open command case "$OSTYPE" in - darwin*) open_cmd="open" ;; - cygwin*) open_cmd="cygstart" ;; - linux*) open_cmd="xdg-open" ;; - msys*) open_cmd="start \"\"" ;; + darwin*) open_cmd='open' ;; + cygwin*) open_cmd='cygstart' ;; + linux*) open_cmd='xdg-open' ;; + msys*) open_cmd='start ""' ;; *) echo "Platform $OSTYPE not supported" return 1 ;; @@ -33,7 +36,7 @@ function open_command() { if [[ "$OSTYPE" == darwin* ]]; then $open_cmd "$@" &>/dev/null else - nohup ${(z)open_cmd} "$@" &>/dev/null + nohup $open_cmd "$@" &>/dev/null fi } From d55111f2003aa474bb5045638cdd5141ae8309da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Tue, 1 Dec 2015 00:59:35 +0200 Subject: [PATCH 104/537] Support all kinds of putty-like terminal strings. --- lib/termsupport.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index 4780be80..9750a9fe 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -18,7 +18,7 @@ function title { if [[ "$TERM" == screen* ]]; then print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars - elif [[ "$TERM" == xterm* ]] || [[ "$TERM" == putty ]] || [[ "$TERM" == rxvt* ]] || [[ "$TERM" == ansi ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then + elif [[ "$TERM" == xterm* ]] || [[ "$TERM" == putty* ]] || [[ "$TERM" == rxvt* ]] || [[ "$TERM" == ansi ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then print -Pn "\e]2;$2:q\a" #set window name print -Pn "\e]1;$1:q\a" #set icon (=tab) name fi From 63d7500cf1a62214f44a8c690852e687902fb3d3 Mon Sep 17 00:00:00 2001 From: Dawid Ferenczy Date: Wed, 23 Apr 2014 01:35:47 +0100 Subject: [PATCH 105/537] Added setting of the window title in Cygwin --- lib/termsupport.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index 9750a9fe..f11a7dd1 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -9,7 +9,7 @@ function title { emulate -L zsh setopt prompt_subst - + [[ "$EMACS" == *term* ]] && return # if $2 is unset use $1 as default @@ -18,7 +18,7 @@ function title { if [[ "$TERM" == screen* ]]; then print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars - elif [[ "$TERM" == xterm* ]] || [[ "$TERM" == putty* ]] || [[ "$TERM" == rxvt* ]] || [[ "$TERM" == ansi ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then + elif [[ "$TERM" == xterm* ]] || [[ "$TERM" == putty* ]] || [[ "$TERM" == rxvt* ]] || [[ "$TERM" == ansi ]] || [[ "$TERM" == cygwin ]] || [[ "$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 fi From 103eb32721a62062363dfaec562e882ab52d21df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 1 Dec 2015 14:04:12 +0100 Subject: [PATCH 106/537] Use a case structure to id terminal types --- lib/termsupport.zsh | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index f11a7dd1..178e6351 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -16,12 +16,21 @@ function title { # if it is set and empty, leave it as is : ${2=$1} - if [[ "$TERM" == screen* ]]; then - print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars - elif [[ "$TERM" == xterm* ]] || [[ "$TERM" == putty* ]] || [[ "$TERM" == rxvt* ]] || [[ "$TERM" == ansi ]] || [[ "$TERM" == cygwin ]] || [[ "$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 - fi + case "$TERM" in + cygwin|xterm*|putty*|rxvt*|ansi) + print -Pn "\e]2;$2:q\a" # set window name + print -Pn "\e]1;$1:q\a" # set tab name + ;; + screen*) + print -Pn "\ek$1:q\e\\" # set screen hardstatus + ;; + *) + if [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then + print -Pn "\e]2;$2:q\a" # set window name + print -Pn "\e]1;$1:q\a" # set tab name + fi + ;; + esac } ZSH_THEME_TERM_TAB_TITLE_IDLE="%15<..<%~%<<" #15 char left truncated PWD From eca912e51ac379691e3d5904808271aba7de8e51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 1 Dec 2015 14:05:18 +0100 Subject: [PATCH 107/537] Quote all variables in if statements --- lib/termsupport.zsh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index 178e6351..6271725a 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -36,14 +36,15 @@ function title { ZSH_THEME_TERM_TAB_TITLE_IDLE="%15<..<%~%<<" #15 char left truncated PWD ZSH_THEME_TERM_TITLE_IDLE="%n@%m: %~" # Avoid duplication of directory in terminals with independent dir display -if [[ $TERM_PROGRAM == Apple_Terminal ]]; then +if [[ "$TERM_PROGRAM" == Apple_Terminal ]]; then ZSH_THEME_TERM_TITLE_IDLE="%n@%m" fi # Runs before showing the prompt function omz_termsupport_precmd { emulate -L zsh - if [[ $DISABLE_AUTO_TITLE == true ]]; then + + if [[ "$DISABLE_AUTO_TITLE" == true ]]; then return fi @@ -53,12 +54,12 @@ function omz_termsupport_precmd { # Runs before executing the command function omz_termsupport_preexec { emulate -L zsh - if [[ $DISABLE_AUTO_TITLE == true ]]; then + setopt extended_glob + + if [[ "$DISABLE_AUTO_TITLE" == true ]]; then return fi - setopt extended_glob - # cmd name only, or if this is sudo or ssh, the next cmd local CMD=${1[(wr)^(*=*|sudo|ssh|mosh|rake|-*)]:gs/%/%%} local LINE="${2:gs/%/%%}" From 4e306887c248f3887a8e163c993f31df5a62487e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 1 Dec 2015 14:05:38 +0100 Subject: [PATCH 108/537] Cleanup update_terminalapp_cwd function --- lib/termsupport.zsh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index 6271725a..7cf15b0a 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -76,19 +76,18 @@ preexec_functions+=(omz_termsupport_preexec) # With extra fixes to handle multibyte chars and non-UTF-8 locales if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then - # Emits the control sequence to notify Terminal.app of the cwd + # Identifies the directory using a file: URI scheme, including + # the host name to disambiguate local vs. remote paths. function update_terminalapp_cwd() { emulate -L zsh - # Identify the directory using a "file:" scheme URL, including - # the host name to disambiguate local vs. remote paths. # Percent-encode the pathname. local URL_PATH="$(omz_urlencode -P $PWD)" [[ $? != 0 ]] && return 1 - local PWD_URL="file://$HOST$URL_PATH" + # Undocumented Terminal.app-specific control sequence - printf '\e]7;%s\a' $PWD_URL + printf '\e]7;%s\a' "file://$HOST$URL_PATH" } # Use a precmd hook instead of a chpwd hook to avoid contaminating output From a42a3eead76d2e2d20d135853f3fb0b5efc80ede Mon Sep 17 00:00:00 2001 From: Hugh Wang Date: Wed, 2 Dec 2015 12:05:05 +0800 Subject: [PATCH 109/537] Recognize Firefox addon and Android packages. --- plugins/extract/extract.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh index 690126ba..5d0809e9 100644 --- a/plugins/extract/extract.plugin.zsh +++ b/plugins/extract/extract.plugin.zsh @@ -52,7 +52,7 @@ function extract() { (*.xz) unxz "$1" ;; (*.lzma) unlzma "$1" ;; (*.Z) uncompress "$1" ;; - (*.zip|*.war|*.jar|*.sublime-package|*.ipsw) unzip "$1" -d $extract_dir ;; + (*.zip|*.war|*.jar|*.sublime-package|*.ipsw|*.xpi|*.apk) unzip "$1" -d $extract_dir ;; (*.rar) unrar x -ad "$1" ;; (*.7z) 7za x "$1" ;; (*.deb) From 89205f90e533478f231beebbcf7b889bb085159e Mon Sep 17 00:00:00 2001 From: Sebastian Gniazdowski Date: Thu, 3 Dec 2015 11:07:35 +0100 Subject: [PATCH 110/537] znt: faster startup of tools using colorifying (e.g. n-history) --- plugins/zsh-navigation-tools/README.md | 3 +- plugins/zsh-navigation-tools/n-list | 47 +++++++------------------- 2 files changed, 14 insertions(+), 36 deletions(-) diff --git a/plugins/zsh-navigation-tools/README.md b/plugins/zsh-navigation-tools/README.md index 670a85ec..630b2e84 100644 --- a/plugins/zsh-navigation-tools/README.md +++ b/plugins/zsh-navigation-tools/README.md @@ -105,8 +105,7 @@ colorize output of the tools, via their config files (check out e.g. n-cd.conf, it uses this). ## Performance -ZNT are fastest with Zsh before 5.0.8 and starting from 5.2 (the version yet to -be released). +ZNT are fastest with Zsh before 5.0.8 and starting from 5.2 vim:filetype=conf diff --git a/plugins/zsh-navigation-tools/n-list b/plugins/zsh-navigation-tools/n-list index 26431a0d..0a98d86e 100644 --- a/plugins/zsh-navigation-tools/n-list +++ b/plugins/zsh-navigation-tools/n-list @@ -116,15 +116,15 @@ _nlist_setup_user_vars() { fi } -_nlist_coloring_list_into_col_list() { +_nlist_colorify_disp_list() { local col=$'\x1b[00;34m' reset=$'\x1b[0m' [ -n "$NLIST_COLORING_COLOR" ] && col="$NLIST_COLORING_COLOR" [ -n "$NLIST_COLORING_END_COLOR" ] && reset="$NLIST_COLORING_END_COLOR" if [ "$NLIST_COLORING_MATCH_MULTIPLE" -eq 1 ]; then - col_list=( "${(@)list//(#mi)$~NLIST_COLORING_PATTERN/$col${MATCH}$reset}" ) + disp_list=( "${(@)disp_list//(#mi)$~NLIST_COLORING_PATTERN/$col${MATCH}$reset}" ) else - col_list=( "${(@)list/(#mi)$~NLIST_COLORING_PATTERN/$col${MATCH}$reset}" ) + disp_list=( "${(@)disp_list/(#mi)$~NLIST_COLORING_PATTERN/$col${MATCH}$reset}" ) fi } @@ -154,7 +154,7 @@ integer inner_width=term_width-3 integer page_height=inner_height integer page_width=inner_width -typeset -a list col_list disp_list +typeset -a list disp_list integer last_element=$# local action local final_key @@ -227,16 +227,10 @@ keypad="" list=( "$@" ) last_element="$#list" -integer is_colored=0 -if [[ -z "$NLIST_SEARCH_BUFFER" && -n "$NLIST_COLORING_PATTERN" ]]; then - is_colored=1 - _nlist_coloring_list_into_col_list -fi - while (( 1 )); do # Do searching (filtering with string) if [ -n "$NLIST_SEARCH_BUFFER" ]; then - # Compute new list, col_list ? + # Compute new list? if [[ "$NLIST_SEARCH_BUFFER" != "$prev_search_buffer" || "$NLIST_IS_UNIQ_MODE" -ne "$prev_uniq_mode" ]]; then prev_search_buffer="$NLIST_SEARCH_BUFFER" prev_uniq_mode="$NLIST_IS_UNIQ_MODE" @@ -290,7 +284,7 @@ while (( 1 )); do disp_list=( "${(@)disp_list//(#mi)($~colsearch_pattern)/$red${MATCH}$reset}" ) fi - # We have display list, lets replace newlines with "\n" when needed (1/3) + # We have display list, lets replace newlines with "\n" when needed (1/2) [ "$NLIST_REPLACE_NEWLINES" -eq 1 ] && disp_list=( "${(@)disp_list//$'\n'/\\n}" ) fi @@ -302,7 +296,7 @@ while (( 1 )); do # There is no search, but there was in previous loop # OR # Uniq mode was entered or left out - # -> compute new list (maybe also col_list) + # -> compute new list if [[ -n "$prev_search_buffer" || "$NLIST_IS_UNIQ_MODE" -ne "$prev_uniq_mode" ]]; then prev_search_buffer="" prev_uniq_mode="$NLIST_IS_UNIQ_MODE" @@ -322,13 +316,6 @@ while (( 1 )); do # Remove duplicates when in uniq mode [ "$NLIST_IS_UNIQ_MODE" -eq 1 ] && typeset -U list - # Apply coloring pattern (when not with search query) - is_colored=0 - if [ -n "$NLIST_COLORING_PATTERN" ]; then - is_colored=1 - _nlist_coloring_list_into_col_list - fi - last_element="$#list" # Called after processing list _nlist_verify_vars @@ -340,22 +327,14 @@ while (( 1 )); do integer end_idx=$(( NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN + page_height - 1 )) [ "$end_idx" -gt "$last_element" ] && end_idx=last_element - if [ "$is_colored" -eq 0 ]; then - if [ "$prev_start_idx" -ne "$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN" ]; then - prev_start_idx="$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN" - disp_list=( "${(@)list[NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN, end_idx]}" ) + if [ "$prev_start_idx" -ne "$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN" ]; then + prev_start_idx="$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN" + disp_list=( "${(@)list[NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN, end_idx]}" ) - # We have display list, lets replace newlines with "\n" when needed (2/3) - [ "$NLIST_REPLACE_NEWLINES" -eq 1 ] && disp_list=( "${(@)disp_list//$'\n'/\\n}" ) - fi - else - if [ "$prev_start_idx" -ne "$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN" ]; then - prev_start_idx="$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN" - disp_list=( "${(@)col_list[NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN, end_idx]}" ) + [ -n "$NLIST_COLORING_PATTERN" ] && _nlist_colorify_disp_list - # We have display list, lets replace newlines with "\n" when needed (3/3) - [ "$NLIST_REPLACE_NEWLINES" -eq 1 ] && disp_list=( "${(@)disp_list//$'\n'/\\n}" ) - fi + # We have display list, lets replace newlines with "\n" when needed (2/2) + [ "$NLIST_REPLACE_NEWLINES" -eq 1 ] && disp_list=( "${(@)disp_list//$'\n'/\\n}" ) fi # Output the list From 2e3731c5b1f0070a076fa84e9e2c35975a962ee5 Mon Sep 17 00:00:00 2001 From: Danyil Bohdan Date: Fri, 4 Dec 2015 14:16:52 +0200 Subject: [PATCH 111/537] "fishy" theme: Shorten path .foo to .f, not . When the current path is /home/user/.config/doublecmd the prompt now reads "/h/u/.c/doublecmd", not "/h/u/./doublecmd" as was the case. This matches what the Fish shell does. Enclose the Perl snippet in single quotes instead of double quotes. --- themes/fishy.zsh-theme | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/themes/fishy.zsh-theme b/themes/fishy.zsh-theme index 8b24172a..5937592d 100644 --- a/themes/fishy.zsh-theme +++ b/themes/fishy.zsh-theme @@ -1,13 +1,13 @@ # ZSH Theme emulating the Fish shell's default prompt. _fishy_collapsed_wd() { - echo $(pwd | perl -pe " + echo $(pwd | perl -pe ' BEGIN { - binmode STDIN, ':encoding(UTF-8)'; - binmode STDOUT, ':encoding(UTF-8)'; - }; s|^$HOME|~|g; s|/([^/])[^/]*(?=/)|/\$1|g -") -} + binmode STDIN, ":encoding(UTF-8)"; + binmode STDOUT, ":encoding(UTF-8)"; + }; s|^$HOME|~|g; s|/([^/.])[^/]*(?=/)|/$1|g; s|/\.([^/])[^/]*(?=/)|/.$1|g; +') +} local user_color='green'; [ $UID -eq 0 ] && user_color='red' PROMPT='%n@%m %{$fg[$user_color]%}$(_fishy_collapsed_wd)%{$reset_color%}%(!.#.>) ' From c793baeadd2bd290bf1aba0cf522e79cde51fa7a Mon Sep 17 00:00:00 2001 From: Sebastian Gniazdowski Date: Fri, 4 Dec 2015 19:51:09 +0100 Subject: [PATCH 112/537] znt: optimize heap usage for older Zsh's (e.g. 5.0.8) --- plugins/zsh-navigation-tools/n-list | 6 +++++- plugins/zsh-navigation-tools/n-panelize | 11 +++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/plugins/zsh-navigation-tools/n-list b/plugins/zsh-navigation-tools/n-list index 0a98d86e..55c08515 100644 --- a/plugins/zsh-navigation-tools/n-list +++ b/plugins/zsh-navigation-tools/n-list @@ -224,7 +224,11 @@ zcurses timeout main -1 key="" keypad="" -list=( "$@" ) +# This loop makes script faster on some Zsh's (e.g. 5.0.8) +repeat 1; do + list=( "$@" ) +done + last_element="$#list" while (( 1 )); do diff --git a/plugins/zsh-navigation-tools/n-panelize b/plugins/zsh-navigation-tools/n-panelize index a70565c7..01d01cb9 100644 --- a/plugins/zsh-navigation-tools/n-panelize +++ b/plugins/zsh-navigation-tools/n-panelize @@ -32,7 +32,11 @@ if [ -t 0 ]; then return 1 fi - list=( `"$@"` ) + # This loop makes script faster on some Zsh's (e.g. 5.0.8) + repeat 1; do + list=( `"$@"` ) + done + # TODO: $? doesn't reach user [ "$?" -eq 127 ] && return $? else @@ -42,7 +46,10 @@ else return 1 fi - list=( "${(@f)"$(<&0)"}" ) + # This loop makes script faster on some Zsh's (e.g. 5.0.8) + repeat 1; do + list=( "${(@f)"$(<&0)"}" ) + done if [[ ! -c /dev/tty ]]; then exec <&2 From ee343814b799cc44b84d8999d5cb444159815bac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sat, 5 Dec 2015 18:49:26 +0100 Subject: [PATCH 113/537] Use $HOME instead of tilde inside quotes The tilde character is not expanded when inside quotes. See https://github.com/robbyrussell/oh-my-zsh/issues/4668#issuecomment-162213379 --- README.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index 6007d650..9d7210f7 100644 --- a/README.markdown +++ b/README.markdown @@ -104,7 +104,7 @@ The default location is `~/.oh-my-zsh` (hidden in your home directory) If you'd like to change the install directory with the `ZSH` environment variable, either by running `export ZSH=/your/path` before installing, or by setting it before the end of the install pipeline like this: ```shell -export ZSH="~/.dotfiles/oh-my-zsh"; sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" +export ZSH="$HOME/.dotfiles/oh-my-zsh"; sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" ``` #### Manual Installation From 0d45e771c8d3d1f7c465be465fcbdb4169141347 Mon Sep 17 00:00:00 2001 From: Bilal Amarni Date: Sun, 6 Dec 2015 13:56:10 +0100 Subject: [PATCH 114/537] [Composer] redirect stderr to /dev/null for completion commands --- plugins/composer/composer.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/composer/composer.plugin.zsh b/plugins/composer/composer.plugin.zsh index 86f5be3d..07eb1de8 100644 --- a/plugins/composer/composer.plugin.zsh +++ b/plugins/composer/composer.plugin.zsh @@ -7,11 +7,11 @@ # Composer basic command completion _composer_get_command_list () { - $_comp_command1 --no-ansi | sed "1,/Available commands/d" | awk '/^[ \t]*[a-z]+/ { print $1 }' + $_comp_command1 --no-ansi 2>/dev/null | sed "1,/Available commands/d" | awk '/^[ \t]*[a-z]+/ { print $1 }' } _composer_get_required_list () { - $_comp_command1 show -s --no-ansi | sed '1,/requires/d' | awk 'NF > 0 && !/^requires \(dev\)/{ print $1 }' + $_comp_command1 show -s --no-ansi 2>/dev/null | sed '1,/requires/d' | awk 'NF > 0 && !/^requires \(dev\)/{ print $1 }' } _composer () { From 357d57c541970f59dd673df38ce166e9454c6da8 Mon Sep 17 00:00:00 2001 From: Sebastian Gniazdowski Date: Mon, 7 Dec 2015 14:15:09 +0100 Subject: [PATCH 115/537] znt: include some status information on top of the window --- plugins/zsh-navigation-tools/n-list | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/zsh-navigation-tools/n-list b/plugins/zsh-navigation-tools/n-list index 55c08515..d13e048b 100644 --- a/plugins/zsh-navigation-tools/n-list +++ b/plugins/zsh-navigation-tools/n-list @@ -363,6 +363,11 @@ while (( 1 )); do fi zcurses border main + + local top_msg="${(C)ZSH_NAME} $ZSH_VERSION, shell level $SHLVL, $USER" + zcurses move main 0 $(( term_width / 2 - $#top_msg / 2 )) + zcurses string main $top_msg + zcurses refresh main inner zcurses move main $(( term_height - 1 - 1 )) $(( status_msg_strlen + 2 )) From fb5effd5d8e08e4f35af9b056e2a0bfa5d0e1c5a Mon Sep 17 00:00:00 2001 From: Gregory McCue Date: Thu, 10 Dec 2015 22:58:53 +0100 Subject: [PATCH 116/537] Add Ecosia to web-search plugin. --- plugins/web-search/web-search.plugin.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/web-search/web-search.plugin.zsh b/plugins/web-search/web-search.plugin.zsh index 369a0e68..d3bf97d7 100644 --- a/plugins/web-search/web-search.plugin.zsh +++ b/plugins/web-search/web-search.plugin.zsh @@ -13,6 +13,7 @@ function web_search() { yandex "https://yandex.ru/yandsearch?text=" github "https://github.com/search?q=" baidu "https://www.baidu.com/s?wd=" + ecosia "https://www.ecosia.org/search?q=" ) # check whether the search engine is supported @@ -43,6 +44,7 @@ alias ddg='web_search duckduckgo' alias yandex='web_search yandex' alias github='web_search github' alias baidu='web_search baidu' +alias ecosia='web_search ecosia' #add your own !bang searches here alias wiki='web_search duckduckgo \!w' From c52f67746b0992bfdbddc57bcd096a595859558c Mon Sep 17 00:00:00 2001 From: Andrew Janke Date: Thu, 10 Dec 2015 20:06:01 -0500 Subject: [PATCH 117/537] common-aliases: handle "dev" versions in version check Uses `is-at-least` instead of a numeric comparison hack, so versions with non-numeric bits like "4.5.0-dev5" don't throw errors. --- plugins/common-aliases/common-aliases.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/common-aliases/common-aliases.plugin.zsh b/plugins/common-aliases/common-aliases.plugin.zsh index fc19d73c..c7aafd8b 100644 --- a/plugins/common-aliases/common-aliases.plugin.zsh +++ b/plugins/common-aliases/common-aliases.plugin.zsh @@ -52,7 +52,7 @@ alias mv='mv -i' # zsh is able to auto-do some kungfoo # depends on the SUFFIX :) -if [ ${ZSH_VERSION//\./} -ge 420 ]; then +if is-at-least 4.2.0; then # open browser on urls _browser_fts=(htm html de org net com at cx nl se dk dk php) for ft in $_browser_fts ; do alias -s $ft=$BROWSER ; done From b6997f6972191c64edcb5bcefcd4566a111f2883 Mon Sep 17 00:00:00 2001 From: Kaelig Date: Fri, 11 Dec 2015 15:36:55 -0800 Subject: [PATCH 118/537] Update link to git completion --- plugins/git-flow/git-flow.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/git-flow/git-flow.plugin.zsh b/plugins/git-flow/git-flow.plugin.zsh index 444440bc..d69fcb1b 100644 --- a/plugins/git-flow/git-flow.plugin.zsh +++ b/plugins/git-flow/git-flow.plugin.zsh @@ -6,7 +6,7 @@ # To achieve git-flow completion nirvana: # # 0. Update your zsh's git-completion module to the newest version. -# From here. http://zsh.git.sourceforge.net/git/gitweb.cgi?p=zsh/zsh;a=blob_plain;f=Completion/Unix/Command/_git;hb=HEAD +# From here. http://sourceforge.net/p/zsh/code/ci/master/tree/Completion/Unix/Command/_git?format=raw # # 1. Install this file. Either: # From 4fbfb149d3edcfe18b7b008c3a4a8e7523d4b811 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sun, 13 Dec 2015 20:36:31 +0100 Subject: [PATCH 119/537] Add back the `-` alias to go to the previous directory The alias was removed in #3564. A couple of users were using it, so I'm adding it back. --- lib/directories.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/directories.zsh b/lib/directories.zsh index 3bffa9fd..a50a692c 100644 --- a/lib/directories.zsh +++ b/lib/directories.zsh @@ -8,6 +8,7 @@ alias -g ....='../../..' alias -g .....='../../../..' alias -g ......='../../../../..' +alias -- -='cd -' alias 1='cd -' alias 2='cd -2' alias 3='cd -3' From 45822e85c5b2e131d9898cf90710d7ea82006dea Mon Sep 17 00:00:00 2001 From: Andrew Janke Date: Mon, 27 Jul 2015 21:01:21 -0400 Subject: [PATCH 120/537] history-substring-search: bind arrows in both emacs and viins modes This avoids an ordering dependency between this and the vi-mode plugin. --- .../history-substring-search.plugin.zsh | 9 ++++++--- .../history-substring-search/update-from-upstream.zsh | 6 ++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/plugins/history-substring-search/history-substring-search.plugin.zsh b/plugins/history-substring-search/history-substring-search.plugin.zsh index 25fd3a2d..7883a65f 100644 --- a/plugins/history-substring-search/history-substring-search.plugin.zsh +++ b/plugins/history-substring-search/history-substring-search.plugin.zsh @@ -13,11 +13,14 @@ fi # Bind terminal-specific up and down keys - +# Bind in both emacs and vi modes so it works in both, and is not +# sensitive to whether this is loaded before or after the vi-mode plugin if [[ -n "$terminfo[kcuu1]" ]]; then - bindkey "$terminfo[kcuu1]" history-substring-search-up + bindkey -M emacs "$terminfo[kcuu1]" history-substring-search-up + bindkey -M viins "$terminfo[kcuu1]" history-substring-search-up fi if [[ -n "$terminfo[kcud1]" ]]; then - bindkey "$terminfo[kcud1]" history-substring-search-down + bindkey -M emacs "$terminfo[kcud1]" history-substring-search-down + bindkey -M viins "$terminfo[kcud1]" history-substring-search-down fi diff --git a/plugins/history-substring-search/update-from-upstream.zsh b/plugins/history-substring-search/update-from-upstream.zsh index 6e6cca5d..81e1942a 100755 --- a/plugins/history-substring-search/update-from-upstream.zsh +++ b/plugins/history-substring-search/update-from-upstream.zsh @@ -76,10 +76,12 @@ cat >> $plugin_basename.plugin.zsh < Date: Sun, 22 Feb 2015 23:07:51 +0100 Subject: [PATCH 121/537] Better research history with arrow keys This change enables UP-arrow and DOWN-arrow full-line history completion. For example, if you write `git clone` and press UP: - Before this change, it will use the last command that starts with `git`. - After this change, it will use the last command that starts with `git clone`. --- lib/key-bindings.zsh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/key-bindings.zsh b/lib/key-bindings.zsh index eb2b5805..0e056dc7 100644 --- a/lib/key-bindings.zsh +++ b/lib/key-bindings.zsh @@ -27,11 +27,17 @@ if [[ "${terminfo[knp]}" != "" ]]; then bindkey "${terminfo[knp]}" down-line-or-history # [PageDown] - Down a line of history fi +# start typing + [Up-Arrow] - fuzzy find history forward if [[ "${terminfo[kcuu1]}" != "" ]]; then - bindkey "${terminfo[kcuu1]}" up-line-or-search # start typing + [Up-Arrow] - fuzzy find history forward + autoload -U up-line-or-beginning-search + zle -N up-line-or-beginning-search + bindkey "${terminfo[kcuu1]}" up-line-or-beginning-search fi +# start typing + [Down-Arrow] - fuzzy find history backward if [[ "${terminfo[kcud1]}" != "" ]]; then - bindkey "${terminfo[kcud1]}" down-line-or-search # start typing + [Down-Arrow] - fuzzy find history backward + autoload -U down-line-or-beginning-search + zle -N down-line-or-beginning-search + bindkey "${terminfo[kcud1]}" down-line-or-beginning-search fi if [[ "${terminfo[khome]}" != "" ]]; then From 6190d3e8ba487c712e1e85ea9c06a02e0bfb04bb Mon Sep 17 00:00:00 2001 From: Kaelig Date: Sun, 13 Dec 2015 16:49:13 -0800 Subject: [PATCH 122/537] Point to the GitHub repository --- plugins/git-flow/git-flow.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/git-flow/git-flow.plugin.zsh b/plugins/git-flow/git-flow.plugin.zsh index d69fcb1b..a8386cb1 100644 --- a/plugins/git-flow/git-flow.plugin.zsh +++ b/plugins/git-flow/git-flow.plugin.zsh @@ -6,7 +6,7 @@ # To achieve git-flow completion nirvana: # # 0. Update your zsh's git-completion module to the newest version. -# From here. http://sourceforge.net/p/zsh/code/ci/master/tree/Completion/Unix/Command/_git?format=raw +# From here. https://raw.githubusercontent.com/zsh-users/zsh/master/Completion/Unix/Command/_git # # 1. Install this file. Either: # From d7797503418422148e84bc06c9e446bdd77c3a01 Mon Sep 17 00:00:00 2001 From: moyamo Date: Thu, 19 Nov 2015 19:03:56 +0200 Subject: [PATCH 123/537] Default to using terminfo to set the terminal title Currently, the title is only set on supported terminals (i.e. xterm, urxvt, screen etc.). Using terminfo entries to set the terminal title adds support for many more terminals. --- lib/termsupport.zsh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index 7cf15b0a..84c1e186 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -28,6 +28,14 @@ function title { if [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then print -Pn "\e]2;$2:q\a" # set window name print -Pn "\e]1;$1:q\a" # set tab name + else + # Try to use terminfo to set the title + # If the feature is available set title + if [[ -n "$terminfo[fsl]" ]] && [[ -n "$terminfo[tsl]" ]]; then + echoti tsl + print -Pn "$1" + echoti fsl + fi fi ;; esac From 71deb74552d54630d99ae1db3647ebed7b3bc735 Mon Sep 17 00:00:00 2001 From: moyamo Date: Mon, 14 Dec 2015 13:05:51 +0200 Subject: [PATCH 124/537] Fix indentation --- lib/termsupport.zsh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index 84c1e186..871ab28d 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -32,10 +32,10 @@ function title { # Try to use terminfo to set the title # If the feature is available set title if [[ -n "$terminfo[fsl]" ]] && [[ -n "$terminfo[tsl]" ]]; then - echoti tsl - print -Pn "$1" - echoti fsl - fi + echoti tsl + print -Pn "$1" + echoti fsl + fi fi ;; esac From b15918d414f255f8d2b36c99a338f930d7431b21 Mon Sep 17 00:00:00 2001 From: Danyil Bohdan Date: Mon, 14 Dec 2015 13:35:44 +0200 Subject: [PATCH 125/537] "fishy" theme: Fix "~" use in prompt Actually replace the value of the environment variable $HOME with "~" instead of appending the tilde in front of the prompt. --- themes/fishy.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/fishy.zsh-theme b/themes/fishy.zsh-theme index 5937592d..83bd455b 100644 --- a/themes/fishy.zsh-theme +++ b/themes/fishy.zsh-theme @@ -5,7 +5,7 @@ _fishy_collapsed_wd() { BEGIN { binmode STDIN, ":encoding(UTF-8)"; binmode STDOUT, ":encoding(UTF-8)"; - }; s|^$HOME|~|g; s|/([^/.])[^/]*(?=/)|/$1|g; s|/\.([^/])[^/]*(?=/)|/.$1|g; + }; s|^$ENV{HOME}|~|g; s|/([^/.])[^/]*(?=/)|/$1|g; s|/\.([^/])[^/]*(?=/)|/.$1|g ') } From cf5db83facf67a27faa2860241f6ddc1d7e27b4f Mon Sep 17 00:00:00 2001 From: Victor Torres Date: Mon, 14 Dec 2015 17:39:26 -0300 Subject: [PATCH 126/537] Implementing mcornella's suggestions in pull request 4451. --- plugins/branch/branch.plugin.zsh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/plugins/branch/branch.plugin.zsh b/plugins/branch/branch.plugin.zsh index c918ea2b..a1e9ca31 100644 --- a/plugins/branch/branch.plugin.zsh +++ b/plugins/branch/branch.plugin.zsh @@ -4,23 +4,23 @@ function branch_prompt_info() { # Defines path as current directory - path=$(pwd) + local current_dir=$PWD # While current path is not root path - while [ $path != '/' ]; + while [[ $current_dir != '/' ]] do # Git repository - if [ -d ${path}/.git ]; + if [[ -d "${current_dir}/.git" ]] then - echo '±' $(/bin/cat ${path}/.git/HEAD | /usr/bin/cut -d / -f 3-) + echo '±' ${"$(<"$current_dir/.git/HEAD")"##*/} return; fi # Mercurial repository - if [ -d ${path}/.hg ]; + if [[ -d "${current_dir}/.hg" ]] then - echo '☿' $(/bin/cat ${path}/.hg/branch) + echo '☿' $(<"$current_dir/.hg/branch") return; fi # Defines path as parent directory and keeps looking for :) - path=$(/usr/bin/dirname $path) + current_dir="${current_dir:h}" done } From fe63ed09b7a8d8040dbbe9892f89c1c46d4ff75d Mon Sep 17 00:00:00 2001 From: Victor Torres Date: Mon, 14 Dec 2015 20:58:29 -0300 Subject: [PATCH 127/537] Updating speed test info and using zsh command line. --- plugins/branch/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/branch/README.md b/plugins/branch/README.md index f970266a..56ab8da4 100644 --- a/plugins/branch/README.md +++ b/plugins/branch/README.md @@ -14,13 +14,13 @@ $ time hg branch ### Branch plugin ```shell -$ time sh /tmp/branch_prompt_info.sh -0.01s user 0.01s system 81% cpu 0.018 total +$ time zsh /tmp/branch_prompt_info_test.zsh +0.00s user 0.01s system 78% cpu 0.014 total ``` ## Usage -Edit your theme file (eg.: `~/.oh-my-zsh/theme/robbyrussell.zsh-theme`) +Edit your theme file (eg.: `~/.oh-my-zsh/theme/robbyrussell.zsh-theme`) adding `$(branch_prompt_info)` in your prompt like this: ```diff From 9f552130bd0c390420a51bbfd2933c065a1581d0 Mon Sep 17 00:00:00 2001 From: Andrew Janke Date: Thu, 25 Jun 2015 15:04:01 -0400 Subject: [PATCH 128/537] Move current_branch() from git plugin to core lib/git.zsh Fixes #4085: core -> plugin dependency issue. Rename it to git_current_branch for clarity that it's git-specific. Update all plugins that were calling it to use new name. Fix variable leaks by making more variables in lib/git.zsh local. Have lib/git.zsh use [[ ]] instead of [ ] everywhere. --- lib/git.zsh | 69 ++++++++++++++++++++-------------- plugins/git/git.plugin.zsh | 31 ++++++--------- themes/eastwood.zsh-theme | 4 +- themes/gallois.zsh-theme | 6 ++- themes/josh.zsh-theme | 4 +- themes/juanghurtado.zsh-theme | 4 +- themes/mortalscumbag.zsh-theme | 4 +- themes/peepcode.zsh-theme | 2 +- themes/sunrise.zsh-theme | 1 - 9 files changed, 64 insertions(+), 61 deletions(-) diff --git a/lib/git.zsh b/lib/git.zsh index 1e203c7c..51e323a7 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -1,5 +1,6 @@ -# get the name of the branch we are on +# Outputs current branch info in prompt format function git_prompt_info() { + local ref if [[ "$(command git config --get oh-my-zsh.hide-status 2>/dev/null)" != "1" ]]; then ref=$(command git symbolic-ref HEAD 2> /dev/null) || \ ref=$(command git rev-parse --short HEAD 2> /dev/null) || return 0 @@ -7,9 +8,8 @@ function git_prompt_info() { fi } - # Checks if working tree is dirty -parse_git_dirty() { +function parse_git_dirty() { local STATUS='' local FLAGS FLAGS=('--porcelain') @@ -29,32 +29,26 @@ parse_git_dirty() { fi } -# get the difference between the local and remote branches -git_remote_status() { +# Gets the difference between the local and remote branches +function git_remote_status() { + local remote ahead behind git_remote_status git_remote_status_detailed remote=${$(command git rev-parse --verify ${hook_com[branch]}@{upstream} --symbolic-full-name 2>/dev/null)/refs\/remotes\/} - if [[ -n ${remote} ]] ; then + if [[ -n ${remote} ]]; then ahead=$(command git rev-list ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null | wc -l) behind=$(command git rev-list HEAD..${hook_com[branch]}@{upstream} 2>/dev/null | wc -l) - if [ $ahead -eq 0 ] && [ $behind -eq 0 ] - then - git_remote_status="$ZSH_THEME_GIT_PROMPT_EQUAL_REMOTE" - elif [ $ahead -gt 0 ] && [ $behind -eq 0 ] - then + if [[ $ahead -gt 0 ]] && [[ $behind -eq 0 ]]; then git_remote_status="$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE" git_remote_status_detailed="$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE$((ahead))%{$reset_color%}" - elif [ $behind -gt 0 ] && [ $ahead -eq 0 ] - then + elif [[ $behind -gt 0 ]] && [[ $ahead -eq 0 ]]; then git_remote_status="$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE" git_remote_status_detailed="$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE$((behind))%{$reset_color%}" - elif [ $ahead -gt 0 ] && [ $behind -gt 0 ] - then + elif [[ $ahead -gt 0 ]] && [[ $behind -gt 0 ]]; then git_remote_status="$ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE" git_remote_status_detailed="$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE$((ahead))%{$reset_color%}$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE$((behind))%{$reset_color%}" fi - if [ $ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_DETAILED ] - then + if [[ -n $ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_DETAILED ]]; then git_remote_status="$ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_PREFIX$remote$git_remote_status_detailed$ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_SUFFIX" fi @@ -62,31 +56,47 @@ git_remote_status() { fi } +# Outputs the name of the current branch +# Usage example: git pull origin $(git_current_branch) +# Using '--quiet' with 'symbolic-ref' will not cause a fatal error (128) if +# it's not a symbolic ref, but in a Git repo. +function git_current_branch() { + local ref + ref=$(command git symbolic-ref --quiet HEAD 2> /dev/null) + local ret=$? + if [[ $ret != 0 ]]; then + [[ $ret == 128 ]] && return # no git repo. + ref=$(command git rev-parse --short HEAD 2> /dev/null) || return + fi + echo ${ref#refs/heads/} +} + + # Gets the number of commits ahead from remote function git_commits_ahead() { if $(echo "$(command git log @{upstream}..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then - COMMITS=$(command git log @{upstream}..HEAD | grep '^commit' | wc -l | tr -d ' ') + local COMMITS=$(command git log @{upstream}..HEAD | grep '^commit' | wc -l | tr -d ' ') echo "$ZSH_THEME_GIT_COMMITS_AHEAD_PREFIX$COMMITS$ZSH_THEME_GIT_COMMITS_AHEAD_SUFFIX" fi } # Outputs if current branch is ahead of remote function git_prompt_ahead() { - if [[ -n "$(command git rev-list origin/$(current_branch)..HEAD 2> /dev/null)" ]]; then + if [[ -n "$(command git rev-list origin/$(git_current_branch)..HEAD 2> /dev/null)" ]]; then echo "$ZSH_THEME_GIT_PROMPT_AHEAD" fi } # Outputs if current branch is behind remote function git_prompt_behind() { - if [[ -n "$(command git rev-list HEAD..origin/$(current_branch) 2> /dev/null)" ]]; then + if [[ -n "$(command git rev-list HEAD..origin/$(git_current_branch) 2> /dev/null)" ]]; then echo "$ZSH_THEME_GIT_PROMPT_BEHIND" fi } # Outputs if current branch exists on remote or not function git_prompt_remote() { - if [[ -n "$(command git show-ref origin/$(current_branch) 2> /dev/null)" ]]; then + if [[ -n "$(command git show-ref origin/$(git_current_branch) 2> /dev/null)" ]]; then echo "$ZSH_THEME_GIT_PROMPT_REMOTE_EXISTS" else echo "$ZSH_THEME_GIT_PROMPT_REMOTE_MISSING" @@ -95,16 +105,17 @@ function git_prompt_remote() { # Formats prompt string for current git commit short SHA function git_prompt_short_sha() { - SHA=$(command git rev-parse --short HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER" + local SHA=$(command 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=$(command git rev-parse HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER" + local SHA=$(command 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() { +function git_prompt_status() { + local INDEX STATUS INDEX=$(command git status --porcelain -b 2> /dev/null) STATUS="" if $(echo "$INDEX" | command grep -E '^\?\? ' &> /dev/null); then @@ -150,9 +161,9 @@ git_prompt_status() { echo $STATUS } -#compare the provided version of git to the version installed and on path -#prints 1 if input version <= installed version -#prints -1 otherwise +# Compares the provided version of git to the version installed and on path +# Outputs -1, 0, or 1 if the installed version is less than, equal to, or +# greater than the input version, respectively. function git_compare_version() { local INPUT_GIT_VERSION=$1; local INSTALLED_GIT_VERSION @@ -173,7 +184,7 @@ function git_compare_version() { echo 0 } -#this is unlikely to change so make it all statically assigned +# This is unlikely to change so make it all statically assigned POST_1_7_2_GIT=$(git_compare_version "1.7.2") -#clean up the namespace slightly by removing the checker function +# Clean up the namespace slightly by removing the checker function unset -f git_compare_version diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index d78b82df..b851fb97 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -6,19 +6,12 @@ zstyle -s ":vcs_info:git:*:-all-" "command" _omz_git_git_cmd # Functions # -# The current branch name -# Usage example: git pull origin $(current_branch) -# Using '--quiet' with 'symbolic-ref' will not cause a fatal error (128) if -# it's not a symbolic ref, but in a Git repo. +# The name of the current branch +# Back-compatibility wrapper for when this function was defined here in +# the plugin, before being pulled in to core lib/git.zsh as git_current_branch() +# to fix the core -> git plugin dependency. function current_branch() { - local ref - ref=$($_omz_git_git_cmd symbolic-ref --quiet HEAD 2> /dev/null) - local ret=$? - if [[ $ret != 0 ]]; then - [[ $ret == 128 ]] && return # no git repo. - ref=$($_omz_git_git_cmd rev-parse --short HEAD 2> /dev/null) || return - fi - echo ${ref#refs/heads/} + git_current_branch } # The list of remotes function current_repository() { @@ -99,7 +92,7 @@ alias gfo='git fetch origin' alias gg='git gui citool' alias gga='git gui citool --amend' ggf() { -[[ "$#" != 1 ]] && local b="$(current_branch)" +[[ "$#" != 1 ]] && local b="$(git_current_branch)" git push --force origin "${b:=$1}" } compdef _git ggf=git-checkout @@ -107,23 +100,23 @@ ggl() { if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then git pull origin "${*}" else -[[ "$#" == 0 ]] && local b="$(current_branch)" +[[ "$#" == 0 ]] && local b="$(git_current_branch)" git pull origin "${b:=$1}" fi } compdef _git ggl=git-checkout -alias ggpull='git pull origin $(current_branch)' +alias ggpull='git pull origin $(git_current_branch)' compdef _git ggpull=git-checkout ggp() { if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then git push origin "${*}" else -[[ "$#" == 0 ]] && local b="$(current_branch)" +[[ "$#" == 0 ]] && local b="$(git_current_branch)" git push origin "${b:=$1}" fi } compdef _git ggp=git-checkout -alias ggpush='git push origin $(current_branch)' +alias ggpush='git push origin $(git_current_branch)' compdef _git ggpush=git-checkout ggpnp() { if [[ "$#" == 0 ]]; then @@ -133,9 +126,9 @@ ggl "${*}" && ggp "${*}" fi } compdef _git ggpnp=git-checkout -alias ggsup='git branch --set-upstream-to=origin/$(current_branch)' +alias ggsup='git branch --set-upstream-to=origin/$(git_current_branch)' ggu() { -[[ "$#" != 1 ]] && local b="$(current_branch)" +[[ "$#" != 1 ]] && local b="$(git_current_branch)" git pull --rebase origin "${b:=$1}" } compdef _git ggu=git-checkout diff --git a/themes/eastwood.zsh-theme b/themes/eastwood.zsh-theme index 1b284cdc..88134f8e 100644 --- a/themes/eastwood.zsh-theme +++ b/themes/eastwood.zsh-theme @@ -14,9 +14,9 @@ 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) + local cb=$(git_current_branch) if [ -n "$cb" ]; then - echo "$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_PREFIX$(current_branch)$ZSH_THEME_GIT_PROMPT_SUFFIX" + echo "$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_PREFIX$(git_current_branch)$ZSH_THEME_GIT_PROMPT_SUFFIX" fi } diff --git a/themes/gallois.zsh-theme b/themes/gallois.zsh-theme index d383ed58..515325e3 100644 --- a/themes/gallois.zsh-theme +++ b/themes/gallois.zsh-theme @@ -1,3 +1,5 @@ +# Depends on the git plugin for work_in_progress() + 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%}" @@ -5,9 +7,9 @@ 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) + local cb=$(git_current_branch) if [ -n "$cb" ]; then - echo "$(parse_git_dirty)%{$fg_bold[yellow]%}$(work_in_progress)%{$reset_color%}$ZSH_THEME_GIT_PROMPT_PREFIX$(current_branch)$ZSH_THEME_GIT_PROMPT_SUFFIX" + echo "$(parse_git_dirty)%{$fg_bold[yellow]%}$(work_in_progress)%{$reset_color%}$ZSH_THEME_GIT_PROMPT_PREFIX$(git_current_branch)$ZSH_THEME_GIT_PROMPT_SUFFIX" fi } diff --git a/themes/josh.zsh-theme b/themes/josh.zsh-theme index 12dfe406..c8f0f4dd 100644 --- a/themes/josh.zsh-theme +++ b/themes/josh.zsh-theme @@ -9,7 +9,7 @@ function josh_prompt { (( spare_width = ${COLUMNS} )) prompt=" " - branch=$(current_branch) + branch=$(git_current_branch) ruby_version=$(rvm_prompt_info || rbenv_prompt_info) path_size=${#PWD} branch_size=${#branch} @@ -31,7 +31,7 @@ function josh_prompt { prompt=" $prompt" done - prompt="%{%F{green}%}$PWD$prompt%{%F{red}%}$(rvm_prompt_info || rbenv_prompt_info)%{$reset_color%} $(current_branch)" + prompt="%{%F{green}%}$PWD$prompt%{%F{red}%}$(rvm_prompt_info || rbenv_prompt_info)%{$reset_color%} $(git_current_branch)" echo $prompt } diff --git a/themes/juanghurtado.zsh-theme b/themes/juanghurtado.zsh-theme index bc470e83..dbdfde7b 100644 --- a/themes/juanghurtado.zsh-theme +++ b/themes/juanghurtado.zsh-theme @@ -1,5 +1,3 @@ -# Needs Git plugin for current_branch method - # Color shortcuts RED=$fg[red] YELLOW=$fg[yellow] @@ -40,4 +38,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%}' +RPROMPT='%{$GREEN_BOLD%}$(git_current_branch)$(git_prompt_short_sha)$(git_prompt_status)%{$RESET_COLOR%}' diff --git a/themes/mortalscumbag.zsh-theme b/themes/mortalscumbag.zsh-theme index ccce4197..55ece976 100644 --- a/themes/mortalscumbag.zsh-theme +++ b/themes/mortalscumbag.zsh-theme @@ -5,7 +5,7 @@ function my_git_prompt() { STATUS="" # is branch 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 STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_AHEAD" fi @@ -37,7 +37,7 @@ function my_git_prompt() { } function my_current_branch() { - echo $(current_branch || echo "(no branch)") + echo $(git_current_branch || echo "(no branch)") } function ssh_connection() { diff --git a/themes/peepcode.zsh-theme b/themes/peepcode.zsh-theme index ca2a8862..96e4f119 100644 --- a/themes/peepcode.zsh-theme +++ b/themes/peepcode.zsh-theme @@ -28,7 +28,7 @@ git_dirty() { } git_prompt() { - local cb=$(current_branch) + local cb=$(git_current_branch) if [ -n "$cb" ]; then local repo_path=$(git_repo_path) echo " %{$fg_bold[grey]%}$cb %{$fg[white]%}$(git_commit_id)%{$reset_color%}$(git_mode)$(git_dirty)" diff --git a/themes/sunrise.zsh-theme b/themes/sunrise.zsh-theme index 28befd01..57d2649c 100644 --- a/themes/sunrise.zsh-theme +++ b/themes/sunrise.zsh-theme @@ -1,6 +1,5 @@ # Sunrise theme for oh-my-zsh # Intended to be used with Solarized: http://ethanschoonover.com/solarized -# (Needs Git plugin for current_branch method) # Color shortcuts R=$fg_no_bold[red] From 18ca953f12ef41395536776c9bfb5bc76b40b814 Mon Sep 17 00:00:00 2001 From: Robin Hallabro Date: Mon, 29 Jun 2015 07:48:35 +0200 Subject: [PATCH 129/537] Use consistent wording when updating When the user is asked to update oh-my-zsh it says "[Oh My Zsh] Would you like to check for updates? [Y/n]:". When the user agreed to update the next text would say "Upgrading Oh My Zsh" which is inconsistent with the question. --- tools/upgrade.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/upgrade.sh b/tools/upgrade.sh index fe8fbadc..d5e7e8ba 100644 --- a/tools/upgrade.sh +++ b/tools/upgrade.sh @@ -20,7 +20,7 @@ else NORMAL="" fi -printf "${BLUE}%s${NORMAL}\n" "Upgrading Oh My Zsh" +printf "${BLUE}%s${NORMAL}\n" "Updating Oh My Zsh" cd "$ZSH" if git pull --rebase --stat origin master then From a8157293a776cdf8bd7c192033ab369a2f7bb9cb Mon Sep 17 00:00:00 2001 From: cknoblauch Date: Tue, 6 Oct 2015 18:22:26 -0300 Subject: [PATCH 130/537] colored-man plugin: Quoted PATH variable Some environments (in my case, cygwin) have PATH variables with directories with spaces in them, breaking colored-man. Adding quotes around the PATH environment variable makes the plugin run OK. --- plugins/colored-man-pages/colored-man-pages.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/colored-man-pages/colored-man-pages.plugin.zsh b/plugins/colored-man-pages/colored-man-pages.plugin.zsh index 5c613f49..8ff240bf 100644 --- a/plugins/colored-man-pages/colored-man-pages.plugin.zsh +++ b/plugins/colored-man-pages/colored-man-pages.plugin.zsh @@ -27,6 +27,6 @@ man() { LESS_TERMCAP_us=$(printf "\e[1;32m") \ PAGER=/usr/bin/less \ _NROFF_U=1 \ - PATH=${HOME}/bin:${PATH} \ + PATH="$HOME/bin:$PATH" \ man "$@" } From 09d2a597a588abd69647c37b082009125ae07b9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 15 Dec 2015 04:09:31 +0100 Subject: [PATCH 131/537] Fix style of colored-man-pages plugin --- .../colored-man-pages.plugin.zsh | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/plugins/colored-man-pages/colored-man-pages.plugin.zsh b/plugins/colored-man-pages/colored-man-pages.plugin.zsh index 8ff240bf..dd0f241f 100644 --- a/plugins/colored-man-pages/colored-man-pages.plugin.zsh +++ b/plugins/colored-man-pages/colored-man-pages.plugin.zsh @@ -1,32 +1,32 @@ -if [ "$OSTYPE[0,7]" = "solaris" ] +if [ "$OSTYPE" = solaris* ] then - if [ ! -x ${HOME}/bin/nroff ] + if [ ! -x "$HOME/bin/nroff" ] then - mkdir -p ${HOME}/bin - cat > ${HOME}/bin/nroff < "$HOME/bin/nroff" < Date: Tue, 15 Dec 2015 09:35:29 +0100 Subject: [PATCH 132/537] znt: more optimizing workarounds for 5.0.6 <= zsh < 5.2 --- plugins/zsh-navigation-tools/README.md | 2 +- plugins/zsh-navigation-tools/n-list | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/plugins/zsh-navigation-tools/README.md b/plugins/zsh-navigation-tools/README.md index 630b2e84..4420dab8 100644 --- a/plugins/zsh-navigation-tools/README.md +++ b/plugins/zsh-navigation-tools/README.md @@ -105,7 +105,7 @@ colorize output of the tools, via their config files (check out e.g. n-cd.conf, it uses this). ## Performance -ZNT are fastest with Zsh before 5.0.8 and starting from 5.2 +ZNT are fastest with Zsh before 5.0.6 and starting from 5.2 vim:filetype=conf diff --git a/plugins/zsh-navigation-tools/n-list b/plugins/zsh-navigation-tools/n-list index d13e048b..388712bd 100644 --- a/plugins/zsh-navigation-tools/n-list +++ b/plugins/zsh-navigation-tools/n-list @@ -243,7 +243,9 @@ while (( 1 )); do # Take all elements, including duplicates and non-selectables typeset +U list - list=( "$@" ) + repeat 1; do + list=( "$@" ) + done # Remove non-selectable elements [ "$#NLIST_NONSELECTABLE_ELEMENTS" -gt 0 ] && for i in "${(nO)NLIST_NONSELECTABLE_ELEMENTS[@]}"; do @@ -309,7 +311,9 @@ while (( 1 )); do # Take all elements, including duplicates and non-selectables typeset +U list - list=( "$@" ) + repeat 1; do + list=( "$@" ) + done # Remove non-selectable elements only when in uniq mode [ "$NLIST_IS_UNIQ_MODE" -eq 1 ] && [ "$#NLIST_NONSELECTABLE_ELEMENTS" -gt 0 ] && From 8042394c7892b06d08e01907ab5d9887c10a252f Mon Sep 17 00:00:00 2001 From: Giordano Vicari Date: Tue, 15 Dec 2015 11:14:25 +0100 Subject: [PATCH 133/537] Update gulp.plugin.zsh Sort pipe dropped and fix 2>/dev/null --- plugins/gulp/gulp.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/gulp/gulp.plugin.zsh b/plugins/gulp/gulp.plugin.zsh index 58754952..2b310513 100644 --- a/plugins/gulp/gulp.plugin.zsh +++ b/plugins/gulp/gulp.plugin.zsh @@ -20,7 +20,7 @@ # in the current directory. # function $$gulp_completion { - compls=$(gulp --tasks-simple >/dev/null | sort) + compls=$(gulp --tasks-simple 2>/dev/null) completions=(${=compls}) compadd -- $completions From 4f314e2a326a0b0934ed7df214b24c2b91f1c82d Mon Sep 17 00:00:00 2001 From: Giordano Vicari Date: Tue, 15 Dec 2015 11:41:36 +0100 Subject: [PATCH 134/537] Update gulp.plugin.zsh Add local stuff --- plugins/gulp/gulp.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/gulp/gulp.plugin.zsh b/plugins/gulp/gulp.plugin.zsh index 2b310513..e941d5a6 100644 --- a/plugins/gulp/gulp.plugin.zsh +++ b/plugins/gulp/gulp.plugin.zsh @@ -20,9 +20,9 @@ # in the current directory. # function $$gulp_completion { - compls=$(gulp --tasks-simple 2>/dev/null) + local compls=$(gulp --tasks-simple 2>/dev/null) - completions=(${=compls}) + local completions=(${=compls}) compadd -- $completions } From 5e310c530814e80b73b166f215225f7fca8be119 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 15 Dec 2015 11:52:48 +0100 Subject: [PATCH 135/537] Fix syntax error in colored-man-pages Commit 09d2a597a5 introduced the bug, which is due to using single brackets conditions at the same time as *. This commit should fix it and use double brackets everywhere else. Fixes #4699 --- plugins/colored-man-pages/colored-man-pages.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/colored-man-pages/colored-man-pages.plugin.zsh b/plugins/colored-man-pages/colored-man-pages.plugin.zsh index dd0f241f..44e0c71a 100644 --- a/plugins/colored-man-pages/colored-man-pages.plugin.zsh +++ b/plugins/colored-man-pages/colored-man-pages.plugin.zsh @@ -1,6 +1,6 @@ -if [ "$OSTYPE" = solaris* ] +if [[ "$OSTYPE" = solaris* ]] then - if [ ! -x "$HOME/bin/nroff" ] + if [[ ! -x "$HOME/bin/nroff" ]] then mkdir -p "$HOME/bin" cat > "$HOME/bin/nroff" < Date: Tue, 15 Dec 2015 03:06:23 +0100 Subject: [PATCH 136/537] Add hub's completion file This uses the version at commit 35c76bf (2015-12-08) https://github.com/github/hub/commit/35c76bf91dc3d699173599464b9b41cb877ee440 --- plugins/github/_hub | 163 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 163 insertions(+) create mode 100644 plugins/github/_hub diff --git a/plugins/github/_hub b/plugins/github/_hub new file mode 100644 index 00000000..3a649387 --- /dev/null +++ b/plugins/github/_hub @@ -0,0 +1,163 @@ +#compdef hub + +# Zsh will source this file when attempting to autoload the "_hub" function, +# typically on the first attempt to complete the hub command. We define two new +# setup helper routines (one for the zsh-distributed version, one for the +# git-distributed, bash-based version). Then we redefine the "_hub" function to +# call "_git" after some other interception. +# +# This is pretty fragile, if you think about it. Any number of implementation +# changes in the "_git" scripts could cause problems down the road. It would be +# better if the stock git completions were just a bit more permissive about how +# it allowed third-party commands to be added. + +(( $+functions[__hub_setup_zsh_fns] )) || +__hub_setup_zsh_fns () { + (( $+functions[_git-alias] )) || + _git-alias () { + _arguments \ + '-s[output shell script suitable for eval]' \ + '1::shell:(zsh bash csh)' + } + + (( $+functions[_git-browse] )) || + _git-browse () { + _arguments \ + '-u[output the URL]' \ + '2::subpage:(wiki commits issues)' + } + + (( $+functions[_git-compare] )) || + _git-compare () { + _arguments \ + '-u[output the URL]' \ + ':[start...]end range:' + } + + (( $+functions[_git-create] )) || + _git-create () { + _arguments \ + '::name (REPOSITORY or ORGANIZATION/REPOSITORY):' \ + '-p[make repository private]' \ + '-d[description]:description' \ + '-h[home page]:repository home page URL:_urls' + } + + (( $+functions[_git-fork] )) || + _git-fork () { + _arguments \ + '--no-remote[do not add a remote for the new fork]' + } + + (( $+functions[_git-pull-request] )) || + _git-pull-request () { + _arguments \ + '-f[force (skip check for local commits)]' \ + '-b[base]:base ("branch", "owner\:branch", "owner/repo\:branch"):' \ + '-h[head]:head ("branch", "owner\:branch", "owner/repo\:branch"):' \ + - set1 \ + '-m[message]' \ + '-F[file]' \ + '-a[user]' \ + '-M[milestone]' \ + '-l[labels]' \ + - set2 \ + '-i[issue]:issue number:' \ + - set3 \ + '::issue-url:_urls' + } + + # stash the "real" command for later + functions[_hub_orig_git_commands]=$functions[_git_commands] + + # Replace it with our own wrapper. + declare -f _git_commands >& /dev/null && unfunction _git_commands + _git_commands () { + local ret=1 + # call the original routine + _call_function ret _hub_orig_git_commands + + # Effectively "append" our hub commands to the behavior of the original + # _git_commands function. Using this wrapper function approach ensures + # that we only offer the user the hub subcommands when the user is + # actually trying to complete subcommands. + hub_commands=( + alias:'show shell instructions for wrapping git' + pull-request:'open a pull request on GitHub' + fork:'fork origin repo on GitHub' + create:'create new repo on GitHub for the current project' + browse:'browse the project on GitHub' + compare:'open GitHub compare view' + ci-status:'lookup commit in GitHub Status API' + ) + _describe -t hub-commands 'hub command' hub_commands && ret=0 + + return ret + } +} + +(( $+functions[__hub_setup_bash_fns] )) || +__hub_setup_bash_fns () { + # TODO more bash-style fns needed here to complete subcommand args. They take + # the form "_git_CMD" where "CMD" is something like "pull-request". + + # Duplicate and rename the 'list_all_commands' function + eval "$(declare -f __git_list_all_commands | \ + sed 's/__git_list_all_commands/__git_list_all_commands_without_hub/')" + + # Wrap the 'list_all_commands' function with extra hub commands + __git_list_all_commands() { + cat <<-EOF +alias +pull-request +fork +create +browse +compare +ci-status +EOF + __git_list_all_commands_without_hub + } + + # Ensure cached commands are cleared + __git_all_commands="" +} + +# redefine _hub to a much smaller function in the steady state +_hub () { + # only attempt to intercept the normal "_git" helper functions once + (( $+__hub_func_replacement_done )) || + () { + # At this stage in the shell's execution the "_git" function has not yet + # been autoloaded, so the "_git_commands" or "__git_list_all_commands" + # functions will not be defined. Call it now (with a bogus no-op service + # to prevent premature completion) so that we can wrap them. + if declare -f _git >& /dev/null ; then + _hub_noop () { __hub_zsh_provided=1 } # zsh-provided will call this one + __hub_noop_main () { __hub_git_provided=1 } # git-provided will call this one + local service=hub_noop + _git + unfunction _hub_noop + unfunction __hub_noop_main + service=git + fi + + if (( $__hub_zsh_provided )) ; then + __hub_setup_zsh_fns + elif (( $__hub_git_provided )) ; then + __hub_setup_bash_fns + fi + + __hub_func_replacement_done=1 + } + + # Now perform the actual completion, allowing the "_git" function to call our + # replacement "_git_commands" function as needed. Both versions expect + # service=git or they will call nonexistent routines or end up in an infinite + # loop. + service=git + declare -f _git >& /dev/null && _git +} + +# make sure we actually attempt to complete on the first "tab" from the user +_hub From 015437cab8676749ec4f181b0bdc813aa5d406e8 Mon Sep 17 00:00:00 2001 From: Giordano Vicari Date: Tue, 15 Dec 2015 12:14:41 +0100 Subject: [PATCH 137/537] Update gulp.plugin.zsh Remove `local` stuff that cause an error in shell --- plugins/gulp/gulp.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/gulp/gulp.plugin.zsh b/plugins/gulp/gulp.plugin.zsh index e941d5a6..2b310513 100644 --- a/plugins/gulp/gulp.plugin.zsh +++ b/plugins/gulp/gulp.plugin.zsh @@ -20,9 +20,9 @@ # in the current directory. # function $$gulp_completion { - local compls=$(gulp --tasks-simple 2>/dev/null) + compls=$(gulp --tasks-simple 2>/dev/null) - local completions=(${=compls}) + completions=(${=compls}) compadd -- $completions } From 3ebbb40b31fa1ce9f10040742cdb06ea04fa7c41 Mon Sep 17 00:00:00 2001 From: Pavan Rikhi Date: Tue, 15 Dec 2015 10:53:13 -0500 Subject: [PATCH 138/537] colored-man-pages: Use Portable `less` Path --- plugins/colored-man-pages/colored-man-pages.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/colored-man-pages/colored-man-pages.plugin.zsh b/plugins/colored-man-pages/colored-man-pages.plugin.zsh index 44e0c71a..54f0bdda 100644 --- a/plugins/colored-man-pages/colored-man-pages.plugin.zsh +++ b/plugins/colored-man-pages/colored-man-pages.plugin.zsh @@ -25,7 +25,7 @@ man() { LESS_TERMCAP_so=$(printf "\e[1;44;33m") \ LESS_TERMCAP_ue=$(printf "\e[0m") \ LESS_TERMCAP_us=$(printf "\e[1;32m") \ - PAGER=/usr/bin/less \ + PAGER="${commands[less]:-$PAGER}" \ _NROFF_U=1 \ PATH="$HOME/bin:$PATH" \ man "$@" From 247a582d09d4d98d6695c2c88797d893be2f3bbd Mon Sep 17 00:00:00 2001 From: Paul Calabro Date: Tue, 15 Dec 2015 22:52:13 -0700 Subject: [PATCH 139/537] Fixed a typo. --- plugins/git-extras/git-extras.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/git-extras/git-extras.plugin.zsh b/plugins/git-extras/git-extras.plugin.zsh index 507bf1b2..0dcd630e 100644 --- a/plugins/git-extras/git-extras.plugin.zsh +++ b/plugins/git-extras/git-extras.plugin.zsh @@ -4,7 +4,7 @@ # # Completion script for git-extras (http://github.com/tj/git-extras). # -# This depends on and reueses some of the internals of the _git completion +# This depends on and reuses some of the internals of the _git completion # function that ships with zsh itself. It will not work with the _git that ships # with git. # From 0842384987e73f258474b7af87032daee56a5bc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 17 Dec 2015 18:37:49 +0100 Subject: [PATCH 140/537] Put `local var` declaration in its own line in lib/git.zsh In places, the local statement will override the exit code and the written command won't have the effect intended when it was written. For example, when it's not inside a git repo the exit code won't be true, but the local statement will make it true regardless. See #4708. --- lib/git.zsh | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/git.zsh b/lib/git.zsh index 51e323a7..de51daaf 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -75,7 +75,8 @@ function git_current_branch() { # Gets the number of commits ahead from remote function git_commits_ahead() { if $(echo "$(command git log @{upstream}..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then - local COMMITS=$(command git log @{upstream}..HEAD | grep '^commit' | wc -l | tr -d ' ') + local COMMITS + COMMITS=$(command git log @{upstream}..HEAD | grep '^commit' | wc -l | tr -d ' ') echo "$ZSH_THEME_GIT_COMMITS_AHEAD_PREFIX$COMMITS$ZSH_THEME_GIT_COMMITS_AHEAD_SUFFIX" fi } @@ -105,12 +106,14 @@ function git_prompt_remote() { # Formats prompt string for current git commit short SHA function git_prompt_short_sha() { - local SHA=$(command git rev-parse --short HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER" + local SHA + SHA=$(command 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() { - local SHA=$(command git rev-parse HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER" + local SHA + SHA=$(command 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 @@ -165,11 +168,10 @@ function git_prompt_status() { # Outputs -1, 0, or 1 if the installed version is less than, equal to, or # greater than the input version, respectively. function git_compare_version() { - local INPUT_GIT_VERSION=$1; - local INSTALLED_GIT_VERSION - INPUT_GIT_VERSION=(${(s/./)INPUT_GIT_VERSION}); - INSTALLED_GIT_VERSION=($(command git --version 2>/dev/null)); - INSTALLED_GIT_VERSION=(${(s/./)INSTALLED_GIT_VERSION[3]}); + local INPUT_GIT_VERSION INSTALLED_GIT_VERSION + INPUT_GIT_VERSION=(${(s/./)1}) + INSTALLED_GIT_VERSION=($(command git --version 2>/dev/null)) + INSTALLED_GIT_VERSION=(${(s/./)INSTALLED_GIT_VERSION[3]}) for i in {1..3}; do if [[ $INSTALLED_GIT_VERSION[$i] -gt $INPUT_GIT_VERSION[$i] ]]; then @@ -187,4 +189,4 @@ function git_compare_version() { # This is unlikely to change so make it all statically assigned POST_1_7_2_GIT=$(git_compare_version "1.7.2") # Clean up the namespace slightly by removing the checker function -unset -f git_compare_version +unfunction git_compare_version From d853ec4b629f24c6622f414f312fbf83cec0990d Mon Sep 17 00:00:00 2001 From: atk91 Date: Fri, 25 Dec 2015 11:33:29 +0300 Subject: [PATCH 141/537] Closes #4727 --- 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 b851fb97..262f5b2e 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -146,15 +146,15 @@ alias gke='\gitk --all $(git log -g --pretty=format:%h)' compdef _git gke='gitk' alias gl='git pull' -alias glg='git log --stat --color' -alias glgp='git log --stat --color -p' -alias glgg='git log --graph --color' +alias glg='git log --stat' +alias glgp='git log --stat -p' +alias glgg='git log --graph' alias glgga='git log --graph --decorate --all' alias glgm='git log --graph --max-count=10' -alias glo='git log --oneline --decorate --color' +alias glo='git log --oneline --decorate' alias glol="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit" alias glola="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --all" -alias glog='git log --oneline --decorate --color --graph' +alias glog='git log --oneline --decorate --graph' alias glp="_git_log_prettily" compdef _git glp=git-log From 06659f7fc1455990d5aa0c37609e191839ad5be0 Mon Sep 17 00:00:00 2001 From: Satoshi Ohmori Date: Fri, 25 Dec 2015 19:54:12 +0900 Subject: [PATCH 142/537] Support bundler --- plugins/rails/rails.plugin.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/rails/rails.plugin.zsh b/plugins/rails/rails.plugin.zsh index 8af1d630..5dfca49e 100644 --- a/plugins/rails/rails.plugin.zsh +++ b/plugins/rails/rails.plugin.zsh @@ -13,6 +13,8 @@ function _rails_command () { function _rake_command () { if [ -e "bin/rake" ]; then bin/rake $@ + elif type bundle &> /dev/null && [ -e "Gemfile" ]; then + bundle exec rake $@ else command rake $@ fi From fdde897debf11bda824c85a87743ae85ab26b47c Mon Sep 17 00:00:00 2001 From: Satoshi Ohmori Date: Sun, 3 Jan 2016 21:36:42 +0900 Subject: [PATCH 143/537] Update year to 2016 --- MIT-LICENSE.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MIT-LICENSE.txt b/MIT-LICENSE.txt index dfbd9003..b9a350de 100644 --- a/MIT-LICENSE.txt +++ b/MIT-LICENSE.txt @@ -1,6 +1,6 @@ The MIT License -Copyright (c) 2009-2015 Robby Russell and contributors (see https://github.com/robbyrussell/oh-my-zsh/contributors) +Copyright (c) 2009-2016 Robby Russell and contributors (see https://github.com/robbyrussell/oh-my-zsh/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 From 03cc1f74f37c538dbc774051165bdd24ab05e586 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Mon, 4 Jan 2016 17:17:20 +0100 Subject: [PATCH 144/537] Cleanup LICENSE file and fix README link --- MIT-LICENSE.txt | 13 +++++++------ README.markdown | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/MIT-LICENSE.txt b/MIT-LICENSE.txt index b9a350de..42f607f5 100644 --- a/MIT-LICENSE.txt +++ b/MIT-LICENSE.txt @@ -1,6 +1,7 @@ -The MIT License +The MIT License (MIT) -Copyright (c) 2009-2016 Robby Russell and contributors (see https://github.com/robbyrussell/oh-my-zsh/contributors) +Copyright (c) 2009-2016 Robby Russell and contributors +See the full list at https://github.com/robbyrussell/oh-my-zsh/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 @@ -9,13 +10,13 @@ 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. +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.markdown b/README.markdown index 9d7210f7..33128ef9 100644 --- a/README.markdown +++ b/README.markdown @@ -210,4 +210,4 @@ We have [stickers](http://shop.planetargon.com/products/ohmyzsh-stickers-set-of- ## License -Oh My Zsh is released under the [MIT license](https://github.com/robbyrussell/oh-my-zsh/blob/master/MIT-LICENSE.txt). +Oh My Zsh is released under the [MIT license](MIT-LICENSE.txt). From 3dfd2166faa0660cbdddf5df3cd902d9c87d3c3a Mon Sep 17 00:00:00 2001 From: Stefan Wrobel Date: Thu, 7 Jan 2016 17:31:03 -0800 Subject: [PATCH 145/537] chruby plugin locals moved inside function --- plugins/chruby/chruby.plugin.zsh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/chruby/chruby.plugin.zsh b/plugins/chruby/chruby.plugin.zsh index 164b4319..758b4a56 100644 --- a/plugins/chruby/chruby.plugin.zsh +++ b/plugins/chruby/chruby.plugin.zsh @@ -16,9 +16,6 @@ # rvm and rbenv plugins also provide this alias alias rubies='chruby' -local _chruby_path -local _chruby_auto - _homebrew-installed() { whence brew &> /dev/null } @@ -42,6 +39,9 @@ if _ruby-build_installed; then fi _source_from_omz_settings() { + local _chruby_path + local _chruby_auto + zstyle -s :omz:plugins:chruby path _chruby_path zstyle -s :omz:plugins:chruby auto _chruby_auto From 9dd8def1693afee18d47f97375b913d4d3e60cda Mon Sep 17 00:00:00 2001 From: Andrew Janke Date: Fri, 18 Dec 2015 16:47:48 -0500 Subject: [PATCH 146/537] forklift: update homepage URL and tweak formatting --- plugins/forklift/README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/forklift/README.md b/plugins/forklift/README.md index b452a357..6c5cbab2 100644 --- a/plugins/forklift/README.md +++ b/plugins/forklift/README.md @@ -4,10 +4,12 @@ Plugin for ForkLift, an FTP application for OS X. ### Requirements -* [ForkLift](http://forkliftapp.com/forklift/) +* [ForkLift](http://www.binarynights.com/forklift/) ### Usage -* If `fl` is called without arguments then the current folder is opened in ForkLift. Is equivalent to `fl .` +fl [*file_or_folder*] -* If `fl` is called with a directory as the argument, then that directory is opened in ForkLift \ No newline at end of file +* If `fl` is called without arguments then the current folder is opened in ForkLift. This is equivalent to `fl .`. + +* If `fl` is called with a directory as the argument, then that directory is opened in ForkLift. If called with a non-directory file as the argument, then the file's parent directory is opened. From a67dfae72b5d52b7e94304083a51d57c5c718e97 Mon Sep 17 00:00:00 2001 From: "L.C. Karssen" Date: Wed, 8 Jan 2014 10:45:05 +0100 Subject: [PATCH 147/537] Set colour for user@hostname to red if we're root (or sudo) in the bira theme. --- themes/bira.zsh-theme | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/themes/bira.zsh-theme b/themes/bira.zsh-theme index 21572047..1ead9355 100644 --- a/themes/bira.zsh-theme +++ b/themes/bira.zsh-theme @@ -1,7 +1,13 @@ # 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%}' + +if [[ $UID -eq 0 ]]; then + local user_host='%{$terminfo[bold]$fg[red]%}%n@%m%{$reset_color%}' +else + local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}' +fi + local current_dir='%{$terminfo[bold]$fg[blue]%} %~%{$reset_color%}' local rvm_ruby='' if which rvm-prompt &> /dev/null; then From 854c41d843385282dadc90b653429964f011d061 Mon Sep 17 00:00:00 2001 From: "L.C. Karssen" Date: Mon, 27 Jul 2015 12:03:02 +0200 Subject: [PATCH 148/537] Fix in avit theme: $CARETCOLOR was not to actually colour the caret, so change to root user wouldn't show in the prompt. --- themes/avit.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/avit.zsh-theme b/themes/avit.zsh-theme index 65466b82..f9a92827 100644 --- a/themes/avit.zsh-theme +++ b/themes/avit.zsh-theme @@ -2,7 +2,7 @@ PROMPT=' $(_user_host)${_current_dir} $(git_prompt_info) $(_ruby_version) -▶ ' +%{$fg[$CARETCOLOR]%}▶%{$resetcolor%} ' PROMPT2='%{$fg[grey]%}◀%{$reset_color%} ' From ceca00a50354c3c3aaceae6ce40caacf24d0bb54 Mon Sep 17 00:00:00 2001 From: "L.C. Karssen" Date: Mon, 27 Jul 2015 12:03:50 +0200 Subject: [PATCH 149/537] Adapt some colours in the avit theme for better visibility in the default Ubuntu terminal theme. --- themes/avit.zsh-theme | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/themes/avit.zsh-theme b/themes/avit.zsh-theme index f9a92827..21478a35 100644 --- a/themes/avit.zsh-theme +++ b/themes/avit.zsh-theme @@ -8,8 +8,8 @@ PROMPT2='%{$fg[grey]%}◀%{$reset_color%} ' RPROMPT='$(_vi_status)%{$(echotc UP 1)%}$(_git_time_since_commit) $(git_prompt_status) ${_return_status}%{$(echotc DO 1)%}' -local _current_dir="%{$fg[blue]%}%3~%{$reset_color%} " -local _return_status="%{$fg[red]%}%(?..⍉)%{$reset_color%}" +local _current_dir="%{$terminfo[bold]$fg[blue]%}%3~%{$reset_color%} " +local _return_status="%{$terminfo[bold]$fg[red]%}%(?..⍉)%{$reset_color%}" local _hist_no="%{$fg[grey]%}%h%{$reset_color%}" function _user_host() { @@ -85,13 +85,13 @@ ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[yellow]%}⚑ " ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%}✖ " ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%}▴ " ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[cyan]%}§ " -ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[grey]%}◒ " +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[white]%}◒ " # Colors vary depending on time lapsed. ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT="%{$fg[green]%}" ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM="%{$fg[yellow]%}" ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG="%{$fg[red]%}" -ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[grey]%}" +ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[white]%}" # LS colors, made with http://geoff.greer.fm/lscolors/ export LSCOLORS="exfxcxdxbxegedabagacad" From 18801e25d26c6a10c39e9ef9eeecd8921e9de4c7 Mon Sep 17 00:00:00 2001 From: "L.C. Karssen" Date: Mon, 27 Jul 2015 17:53:36 +0200 Subject: [PATCH 150/537] Shorter way of creating bold colours in a ZSH theme (applied to the avit theme). --- themes/avit.zsh-theme | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/avit.zsh-theme b/themes/avit.zsh-theme index 21478a35..fc6b0045 100644 --- a/themes/avit.zsh-theme +++ b/themes/avit.zsh-theme @@ -8,8 +8,8 @@ PROMPT2='%{$fg[grey]%}◀%{$reset_color%} ' RPROMPT='$(_vi_status)%{$(echotc UP 1)%}$(_git_time_since_commit) $(git_prompt_status) ${_return_status}%{$(echotc DO 1)%}' -local _current_dir="%{$terminfo[bold]$fg[blue]%}%3~%{$reset_color%} " -local _return_status="%{$terminfo[bold]$fg[red]%}%(?..⍉)%{$reset_color%}" +local _current_dir="%{$fg_bold[blue]%}%3~%{$reset_color%} " +local _return_status="%{$fg_bold[red]%}%(?..⍉)%{$reset_color%}" local _hist_no="%{$fg[grey]%}%h%{$reset_color%}" function _user_host() { From 63e216ba9d20cb5960aaa59e4bc38405dd03c52c Mon Sep 17 00:00:00 2001 From: "L.C. Karssen" Date: Mon, 27 Jul 2015 23:00:35 +0200 Subject: [PATCH 151/537] oh-my-zsh avit theme: instead of only showing the last 3 directories in the $PWD shorten the path by removing some middle parts if $PWD becomes too long. --- themes/avit.zsh-theme | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/themes/avit.zsh-theme b/themes/avit.zsh-theme index fc6b0045..b5a05799 100644 --- a/themes/avit.zsh-theme +++ b/themes/avit.zsh-theme @@ -1,17 +1,25 @@ # AVIT ZSH Theme PROMPT=' -$(_user_host)${_current_dir} $(git_prompt_info) $(_ruby_version) +$(_user_host)$(_current_dir) $(git_prompt_info) $(_ruby_version) %{$fg[$CARETCOLOR]%}▶%{$resetcolor%} ' PROMPT2='%{$fg[grey]%}◀%{$reset_color%} ' RPROMPT='$(_vi_status)%{$(echotc UP 1)%}$(_git_time_since_commit) $(git_prompt_status) ${_return_status}%{$(echotc DO 1)%}' -local _current_dir="%{$fg_bold[blue]%}%3~%{$reset_color%} " local _return_status="%{$fg_bold[red]%}%(?..⍉)%{$reset_color%}" local _hist_no="%{$fg[grey]%}%h%{$reset_color%}" +function _current_dir() { + local _max_pwd_length="65" + if [[ $(echo -n $PWD | wc -c) -gt ${_max_pwd_length} ]]; then + echo "%{$fg_bold[blue]%}%-2~ ... %3~%{$reset_color%} " + else + echo "%{$fg_bold[blue]%}%~%{$reset_color%} " + fi +} + function _user_host() { if [[ -n $SSH_CONNECTION ]]; then me="%n@%m" From 0a47451a462284d20c633a7d6b3431a71bf65759 Mon Sep 17 00:00:00 2001 From: "L.C. Karssen" Date: Tue, 8 Sep 2015 10:53:03 +0200 Subject: [PATCH 152/537] =?UTF-8?q?Updated=20colour=20of=20=E2=97=80=20in?= =?UTF-8?q?=20PROMPT2=20of=20the=20avit=20theme.=20In=20commit=20729fd53?= =?UTF-8?q?=20I=20incorrectly=20only=20changed=20PROMPT1.=20Now=20both=20?= =?UTF-8?q?=E2=96=B6=20and=20=E2=97=80=20follow=20$CARETCOLOR.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/avit.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/avit.zsh-theme b/themes/avit.zsh-theme index b5a05799..3d097a24 100644 --- a/themes/avit.zsh-theme +++ b/themes/avit.zsh-theme @@ -4,7 +4,7 @@ PROMPT=' $(_user_host)$(_current_dir) $(git_prompt_info) $(_ruby_version) %{$fg[$CARETCOLOR]%}▶%{$resetcolor%} ' -PROMPT2='%{$fg[grey]%}◀%{$reset_color%} ' +PROMPT2='%{$fg[$CARETCOLOR]%}◀%{$reset_color%} ' RPROMPT='$(_vi_status)%{$(echotc UP 1)%}$(_git_time_since_commit) $(git_prompt_status) ${_return_status}%{$(echotc DO 1)%}' From 87f8251388ed2d99a430fd7f9695b8dc1048d3d2 Mon Sep 17 00:00:00 2001 From: Michele Bologna Date: Wed, 13 Jan 2016 15:36:59 +0100 Subject: [PATCH 153/537] Re-added $ZSH_THEME_GIT_PROMPT_EQUAL_REMOTE Re-added $ZSH_THEME_GIT_PROMPT_EQUAL_REMOTE variable which was removed in 9f55213 --- lib/git.zsh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/git.zsh b/lib/git.zsh index de51daaf..f91b516b 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -37,7 +37,9 @@ function git_remote_status() { ahead=$(command git rev-list ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null | wc -l) behind=$(command git rev-list HEAD..${hook_com[branch]}@{upstream} 2>/dev/null | wc -l) - if [[ $ahead -gt 0 ]] && [[ $behind -eq 0 ]]; then + if [[ $ahead -eq 0 ]] && [[ $behind -eq 0 ]]; then + git_remote_status="$ZSH_THEME_GIT_PROMPT_EQUAL_REMOTE" + elif [[ $ahead -gt 0 ]] && [[ $behind -eq 0 ]]; then git_remote_status="$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE" git_remote_status_detailed="$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE$((ahead))%{$reset_color%}" elif [[ $behind -gt 0 ]] && [[ $ahead -eq 0 ]]; then From b9ace281798c4c2565d57dc67d4c0687d9d36e82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CValentin?= <“valentin.bud@gmail.com”> Date: Thu, 31 Dec 2015 15:05:15 +0200 Subject: [PATCH 154/537] Vault basic autocompletion. --- plugins/vault/README.md | 18 ++ plugins/vault/_vault | 400 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 418 insertions(+) create mode 100644 plugins/vault/README.md create mode 100644 plugins/vault/_vault diff --git a/plugins/vault/README.md b/plugins/vault/README.md new file mode 100644 index 00000000..0f61c941 --- /dev/null +++ b/plugins/vault/README.md @@ -0,0 +1,18 @@ +## Vault (https://www.vaultproject.io) autocomplete plugin + +- Adds autocomplete options for all vault commands. + +####Show help for all commands +![General Help](http://i.imgur.com/yv5Db1r.png "Help for all commands") + + +####Create new Vault token +![Create token](http://i.imgur.com/xMegNgh.png "Create token") + + +####Enable audit backends +![Audit backends](http://i.imgur.com/fKLeiSF.png "Audit backends") + + + +Crafted with <3 by Valentin Bud ([@valentinbud](https://twitter.com/valentinbud)) \ No newline at end of file diff --git a/plugins/vault/_vault b/plugins/vault/_vault new file mode 100644 index 00000000..c5338dff --- /dev/null +++ b/plugins/vault/_vault @@ -0,0 +1,400 @@ +#compdef vault + +typeset -a main_args +main_args=( + '(-version)-version[Prints the Vault version]' + '(-help)-help[Prints Vault Help]' +) + +typeset -a general_args +general_args=( + '(-help)-help[Prints Help]' + '(-address)-address=-[The address of the Vault server. Overrides the VAULT_ADDR environment variable if set.]:address:' + '(-ca-cert)-ca-cert=-[Path to a PEM encoded CA cert file to use to verify the Vault server SSL certificate. Overrides the VAULT_CACERT environment variable if set.]:file:_files -g "*.pem"' + '(-ca-path)-ca-path=-[Path to a directory of PEM encoded CA cert files to verify the Vault server SSL certificate. If both -ca-cert and -ca-path are specified, -ca-path is used.Overrides the VAULT_CAPATH environment variable if set.]:directory:_directories' + '(-client-cert)-client-cert=-[Path to a PEM encoded client certificate for TLS authentication to the Vault server. Must also specify -client-key. Overrides the VAULT_CLIENT_CERT environment variable if set.]:file:_files -g "*.pem"' + '(-client-key)-client-key=-[Path to an unencrypted PEM encoded private key matching the client certificate from -client-cert. Overrides the VAULT_CLIENT_KEY environment variable if set.]:file:_files -g "*.pem"' + '(-tls-skip-verify)-tls-skip-verify[Do not verify TLS certificate. This is highly not recommended. Verification will also be skipped if VAULT_SKIP_VERIFY is set.]' +) + +typeset -a audit_enable_args +audit_enable_args=( + '(-description)-description=-[A human-friendly description for the backend. This shows up only when querying the enabled backends.]:description:' + '(-id)-id=-[Specify a unique ID for this audit backend. This is purely for referencing this audit backend. By default this will be the backend type.]:id:' +) + +typeset -a auth_args +auth_args=( + '(-method)-method=-[Outputs help for the authentication method with the given name for the remote server. If this authentication method is not available, exit with code 1.]:method:(cert ldap github userpass app-id)' + '(-method-help)-method-help[If set, the help for the selected method will be shown.]' + '(-methods)-methods[List the available auth methods.]' + '(-no-verify)-no-verify[Do not verify the token after creation; avoids a use count]' +) + +typeset -a auth_enable_args +auth_enable_args=( + '(-description)-description=-[Human-friendly description of the purpose for the auth provider. This shows up in the auth-list command.]:description:' + '(-path)-path=-[Mount point for the auth provider. This defaults to the type of the mount. This will make the auth provider available at "/auth/"]:path:' +) + +typeset -a init_args +init_args=( + '(-key-shares)-key-shares=-[(default: 5) The number of key shares to split the master key into.]:keyshares:' + '(-key-threshold)-key-threshold=-[(default: 3) The number of key shares required to reconstruct the master key.]:keythreshold:' + '(-pgp-keys)-pgp-keys[If provided, must be a comma-separated list of files on disk containing binary- or base64-format public PGP keys. The number of files must match "key-shares". The output unseal keys will encrypted and hex-encoded, in order, with the given public keys. If you want to use them with the "vault unseal" command, you will need to hex decode and decrypt; this will be the plaintext unseal key.]:pgpkeys:_files' +) + +typeset -a mount_tune_args +mount_tune_args=( + '(-default-lease-ttl)-default-lease-ttl=-[Default lease time-to-live for this backend. If not specified, uses the system default, or the previously set value. Set to "system" to explicitly set it to use the system default.]:defaultleasettl:' + '(-max-lease-ttl)-max-lease-ttl=-[Max lease time-to-live for this backend. If not specified, uses the system default, or the previously set value. Set to "system" to explicitly set it to use the system default.]:maxleasettl:' +) + +typeset -a mount_args +mount_args=( + $mount_tune_args + '(-path)-path=-[Mount point for the logical backend. This defauls to the type of the mount.]:path:' + '(-description)-description=-[Human-friendly description of the purpose for the mount. This shows up in the mounts command.]:description:' +) + +typeset -a rekey_args +rekey_args=( + $init_args + '(-init)-init[Initialize the rekey operation by setting the desired number of shares and the key threshold. This can only be done if no rekey is already initiated.]:init:' + '(-cancel)-cancel[Reset the rekey process by throwing away prior keys and the rekey configuration.]:cancel:' + '(-status)-status[Prints the status of the current rekey operation. This can be used to see the status without attempting to provide an unseal key.]:status:' +) + +typeset -a ssh_args +ssh_args=( + '(-role)-role[Role to be used to create the key. ]:role:' + '(-no-exec)-no-exec[Shows the credentials but does not establish connection.]:noexec:' + '(-mount-point)-mount-point[Mount point of SSH backend. If the backend is mounted at "ssh", which is the default as well, this parameter can be skipped.]:mountpoint:' + '(-format)-format[If no-exec option is enabled, then the credentials will be printed out and SSH connection will not be established. The format of the output can be "json" or "table". JSON output is useful when writing scripts. Default is "table".]:format:(json table)' +) + +typeset -a token_create_args +token_create_args=( + '(-id)-id=-[The token value that clients will use to authenticate with vault. If not provided this defaults to a 36 character UUID. A root token is required to specify the ID of a token.]:id:' + '(-display-name)-display-name=-[A display name to associate with this token. This is a non-security sensitive value used to help identify created secrets, i.e. prefixes.]:displayname:' + '(-ttl)-ttl=-[TTL to associate with the token. This option enables the tokens to be renewable.]:ttl:' + '*-metadata=-[Metadata to associate with the token. This shows up in the audit log. This can be specified multiple times.]:metadata:' + '(-orphan)-orphan[If specified, the token will have no parent. Only root tokens can create orphan tokens. This prevents the new token from being revoked with your token.]:orphan:' + '(-no-default-policy)-no-default-policy[If specified, the token will not have the "default" policy included in its policy set.]:nodefaultpolicy:' + '*-policy=-[Policy to associate with this token. This can be specified multiple times.]:policy:__vault_policies' + '(-use-limit)-use-limit=-[The number of times this token can be used until it is automatically revoked.]:uselimit:' + '(-format)-format=-[The format for output. By default it is a whitespace-delimited table. This can also be json.]:format:(json table)' +) + +typeset -a server_args +server_args=( + '*-config=-[Path to the configuration file or directory. This can be specified multiple times. If it is a directory, all files with a ".hcl" or ".json" suffix will be loaded.]:config:_files' + '-dev[Enables Dev mode. In this mode, Vault is completely in-memory and unsealed. Do not run the Dev server in production!]:dev:' + '-log-level=-[Log verbosity. Defaults to "info", will be outputtedto stderr. Supported values: "trace", "debug", "info", "warn", "err"]:loglevel:(trace debug info warn err)' +) + +_vault_audit-list() { + _arguments : \ + ${general_args[@]} && ret=0 +} + +_vault_audit-disable() { + # vault audit-list doesn't print the backend id so for now + # no *smart* autocompletion for this subcommand. + _arguments : \ + ${general_args[@]} \ + ':::(file syslog)' && ret=0 +} + +_vault_audit-enable() { + _arguments : \ + ${general_args[@]} \ + ${audit_enable_args[@]} \ + ': :->backends' \ + '*:: :->backendconfig' && ret=0 + + case $state in + backends) + local -a backends + backends=( + 'file:The "file" audit backend writes audit logs to a file.' + 'syslog:The "syslog" audit backend writes audit logs to syslog.' + ) + _describe -t backends 'vault audit backends' backends && ret=0 + ;; + backendconfig) + case ${line[1]} in + file) + _values -w "Audit Backend File" \ + 'path[(required) - The path to where the file will be written. If this path exists, the audit backend will append to it.]:file:_files' \ + 'log_raw[(optional) Should security sensitive information be logged raw. Defaults to "false".]:log_raw:(true false)' && ret=0 + ;; + syslog) + _values -w "Audit Backend Syslog" \ + 'facility[(optional) - The syslog facility to use. Defaults to "AUTH".]:facility:(kern user mail daemon auth syslog lpr news uucp authpriv ftp cron local0 local1 local2 local3 local4 local5 local6 local7)' \ + 'tag[(optional) - The syslog tag to use. Defaults to "vault".]:tag:' \ + 'log_raw[(optional) Should security sensitive information be logged raw.]:log_raw:(true false)' && ret=0 + ;; + esac + ;; + esac +} + +_vault_auth() { + _arguments : \ + ${general_args[@]} \ + ${auth_args[@]} && ret=0 +} + +_vault_auth-enable() { + _arguments : \ + ${general_args[@]} \ + ${auth_enable_args[@]} \ + ':::(cert ldap github userpass app-id)' && ret=0 +} + +__vault_auth_methods() { + local -a authmethods + authmethods=($(vault auth -methods | awk 'NR>1{split ($1,a,"/"); print a[1]":["$2"]"}')) + _describe -t authmethods 'authmethods' authmethods && ret=0 +} + +_vault_auth-disable() { + _arguments : \ + ${general_args[@]} \ + ':::__vault_auth_methods' && ret=0 + +} + +_vault_init() { + _arguments : \ + ${general_args[@]} \ + ${init_args[@]} && ret=0 +} + +_vault_key-status() { + _arguments : \ + ${general_args[@]} && ret=0 +} + +__vault_mounts() { + local -a mounts + mounts=($(vault mounts | awk 'NR>1{split ($1,a,"/"); print a[1]":["$2"]"}')) + _describe -t mounts 'mounts' mounts && ret=0 +} + +_vault_mounts() { + _arguments : \ + ${general_args[@]} && ret=0 +} + +_vault_mount() { + # to find out how many types of backens are there + _arguments : \ + ${general_args[@]} \ + ${mount_args[@]} \ + ':::(generic ssh)' && ret=0 +} + +_vault_mount-tune() { + _arguments : \ + ${general_args[@]} \ + ${mount_tune_args[@]} \ + ':::__vault_mounts' && ret=0 +} + +_vault_unmount() { + _arguments : \ + ${general_args[@]} \ + ':::__vault_mounts' && ret=0 +} + +_vault_remount() { + _arguments : \ + ${general_args[@]} \ + ':::__vault_mounts' \ + ':::' && ret=0 +} + +__vault_policies() { + local -a policies + policies=($(vault policies | awk '{print $1":["$1"]"}')) + _describe -t policies 'policies' policies && ret=0 +} + +_vault_policies() { + _arguments : \ + ${general_args[@]} \ + ':::__vault_policies' && ret=0 +} + +_vault_policy-delete() { + _arguments : \ + ${general_args[@]} \ + ':::__vault_policies' && ret=0 +} + +_vault_policy-write() { + _arguments : \ + ${general_args[@]} \ + ': ::' \ + '::policy:_files' && ret=0 +} + +_vault_status() { + _arguments : \ + ${general_args[@]} && ret=0 +} + +_vault_rekey() { + _arguments : \ + ${general_args[@]} \ + ${rekey_args[@]} \ + ': ::' && ret=0 +} + +_vault_rotate() { + _arguments : \ + ${general_args[@]} && ret=0 +} + +_vault_seal() { + _arguments : \ + ${general_args[@]} && ret=0 +} + +_vault_ssh() { + _arguments : \ + ${general_args[@]} \ + ${ssh_args[@]} \ + ': ::' && ret=0 +} + +_vault_token-create() { + _arguments : \ + ${general_args[@]} \ + ${token_create_args[@]} && ret=0 +} + +_vault_token-renew() { + _arguments : \ + ${general_args[@]} \ + '(-format)-format=-[The format for output. By default it is a whitespace-delimited table. This can also be json.]:format:(json table)' \ + ': ::' \ + ': ::' && ret=0 +} + +_vault_token-revoke() { + _arguments : \ + ${general_args[@]} \ + '(-mode)-mode=-[The type of revocation to do. See the documentation above for more information.]:mode:( orphan path)' \ + ': ::' && ret=0 +} + +_vault_unseal() { + _arguments : \ + ${general_args[@]} \ + '(-reset)-reset[Reset the unsealing process by throwing away prior keys in process to unseal the vault.]:reset:' \ + ': ::' && ret=0 +} + +_vault_version() { + # no args +} + +_vault_delete() { + _arguments : \ + ${general_args[@]} \ + ': ::' && ret=0 +} + +_vault_path-help() { + _arguments : \ + ${general_args[@]} \ + ': ::' && ret=0 +} + +_vault_revoke() { + _arguments : \ + ${general_args[@]} \ + '(-format)-format=-[The format for output. By default it is a whitespace-delimited table. This can also be json.]:format:(json table)' \ + ': ::' \ + ': ::' && ret=0 +} + +_vault_server() { + _arguments : \ + ${server_args[@]} && ret=0 + +} + +_vault_write() { + _arguments : \ + ${general_args[@]} \ + '(-f -force)'{-f,-force}'[Force the write to continue without any data values specified. This allows writing to keys that do not need or expect any fields to be specified.]:force:' \ + ': ::' \ + ': ::' && ret=0 +} + +_vault_read() { + _arguments : \ + ${general_args[@]} \ + '(-format)-format=-[The format for output. By default it is a whitespace-delimited table. This can also be json.]:format:(json table)' \ + '(-field)-field=-[If included, the raw value of the specified field will be output raw to stdout.]:field:' \ + ': ::' && ret=0 +} + +_vault_commands() { + local -a commands + + commands=( + "delete":"Delete operation on secrets in Vault" + "path-help":"Look up the help for a path" + "read":"Read data or secrets from Vault" + "renew":"Renew the lease of a secret" + "revoke":"Revoke a secret" + "server":"Start a Vault server" + "status":"Outputs status of whether Vault is sealed and if HA mode is enabled" + "write":"Write secrets or configuration into Vault" + "audit-disable":"Disable an audit backend" + "audit-enable":"Enable an audit backend" + "audit-list":"Lists enabled audit backends in Vault" + "auth":"Prints information about how to authenticate with Vault" + "auth-disable":"Disable an auth provider" + "auth-enable":"Enable a new auth provider" + "init":"Initialize a new Vault server" + "key-status":"Provides information about the active encryption key" + "mount":"Mount a logical backend" + "mount-tune":"Tune mount configuration parameters" + "mounts":"Lists mounted backends in Vault" + "policies":"List the policies on the server" + "policy-delete":"Delete a policy from the server" + "policy-write":"Write a policy to the server" + "rekey":"Rekeys Vault to generate new unseal keys" + "remount":"Remount a secret backend to a new path" + "rotate":"Rotates the backend encryption key used to persist data" + "seal":"Seals the vault server" + "ssh":"Initiate a SSH session" + "token-create":"Create a new auth token" + "token-renew":"Renew an auth token if there is an associated lease" + "token-revoke":"Revoke one or more auth tokens" + "unmount":"Unmount a secret backend" + "unseal":"Unseals the vault server" + "version":"Prints the Vault version" + ) + + _describe -t commands 'vault command' commands && ret=0 +} + +local curcontext=$curcontext ret=1 +_arguments : \ + ${main_args[@]} \ + '*:: :->subcommands' && ret=0 +if ((CURRENT == 1 )); then + _vault_commands && ret=0 +fi +if [[ $state == subcommands ]]; then + # (( CURRENT -- )) + curcontext="${curcontext%:*:*}:vault-$words[1]:" + _call_function ret _vault_$words[1] +fi From 77f93f61c5ee6fea9131a1791bd3b106b4b8da4f Mon Sep 17 00:00:00 2001 From: Sebastian Gniazdowski Date: Thu, 7 Jan 2016 11:06:12 +0100 Subject: [PATCH 155/537] znt: optimizations for zsh<=5.2, use $BUFFER if cmd is not from history --- .../zsh-navigation-tools/.config/znt/n-cd.conf | 2 +- plugins/zsh-navigation-tools/README.md | 2 +- plugins/zsh-navigation-tools/n-history | 2 +- plugins/zsh-navigation-tools/n-list | 17 +++++++++++++---- plugins/zsh-navigation-tools/n-list-draw | 2 +- plugins/zsh-navigation-tools/n-list-input | 6 +++--- plugins/zsh-navigation-tools/znt-history-widget | 6 +++++- 7 files changed, 25 insertions(+), 12 deletions(-) diff --git a/plugins/zsh-navigation-tools/.config/znt/n-cd.conf b/plugins/zsh-navigation-tools/.config/znt/n-cd.conf index f8c49bfa..7ed7828e 100644 --- a/plugins/zsh-navigation-tools/.config/znt/n-cd.conf +++ b/plugins/zsh-navigation-tools/.config/znt/n-cd.conf @@ -1,4 +1,5 @@ # Hotlist +# Try to use $ZSH_VERSION, e.g. /usr/share/zsh/$ZSH_VERSION/functions local hotlist hotlist=( ~/.config/znt @@ -7,7 +8,6 @@ hotlist=( /usr/local/share/zsh/site-functions /usr/local/share/zsh /usr/local/bin - /usr/lib ) # Suppress adding (to directory stack) directories visited by n-cd diff --git a/plugins/zsh-navigation-tools/README.md b/plugins/zsh-navigation-tools/README.md index 4420dab8..32a86bba 100644 --- a/plugins/zsh-navigation-tools/README.md +++ b/plugins/zsh-navigation-tools/README.md @@ -25,7 +25,7 @@ widgets exist, znt-cd-widget and znt-kill-widget, they can be too assigned to key combinations (no need for autoload when using Oh My Zsh): zle -N znt-cd-widget - bindkey "^T" znt-cd-widget + bindkey "^A" znt-cd-widget zle -N znt-kill-widget bindkey "^Y" znt-kill-widget diff --git a/plugins/zsh-navigation-tools/n-history b/plugins/zsh-navigation-tools/n-history index c9e53316..9f1d6279 100644 --- a/plugins/zsh-navigation-tools/n-history +++ b/plugins/zsh-navigation-tools/n-history @@ -42,7 +42,7 @@ if [ "$REPLY" -gt 0 ]; then # ZLE? if [ "${(t)CURSOR}" = "integer-local-special" ]; then zle redisplay - zle kill-whole-line + zle kill-buffer zle -U "$selected" else print -zr "$selected" diff --git a/plugins/zsh-navigation-tools/n-list b/plugins/zsh-navigation-tools/n-list index 388712bd..50159b4a 100644 --- a/plugins/zsh-navigation-tools/n-list +++ b/plugins/zsh-navigation-tools/n-list @@ -1,6 +1,7 @@ # $1, $2, ... - elements of the list # $NLIST_NONSELECTABLE_ELEMENTS - array of indexes (1-based) that cannot be selected # $REPLY is the output variable - contains index (1-based) or -1 when no selection +# $reply (array) is the second part of the output - use the index (REPLY) to get selected element # # Copy this file into /usr/share/zsh/site-functions/ # and add 'autoload n-list` to .zshrc @@ -164,6 +165,7 @@ integer current_difference=0 local prev_search_buffer="" integer prev_uniq_mode=0 integer prev_start_idx=-1 +local MBEGIN MEND MATCH mbegin mend match # Ability to remember the list between calls if [[ -z "$NLIST_REMEMBER_STATE" || "$NLIST_REMEMBER_STATE" -eq 0 || "$NLIST_REMEMBER_STATE" -eq 2 ]]; then @@ -264,11 +266,15 @@ while (( 1 )); do local search_pattern="" local colsearch_pattern="" if [ -n "$search_buffer" ]; then - # Patterns will be *foo*~^*bar* and foo|bar) + # Patterns will be *foo*~^*bar* and (foo|bar) search_pattern="${search_buffer// ##/*~^*}" colsearch_pattern="${search_buffer// ##/|}" - list=( "${(@M)list:#(#i)*$~search_pattern*}" ) + # The repeat will make the matching work on a fresh heap + repeat 1; do + list=( "${(@M)list:#(#i)*$~search_pattern*}" ) + done + last_element="$#list" fi @@ -287,7 +293,10 @@ while (( 1 )); do if [ -n "$colsearch_pattern" ]; then local red=$'\x1b[00;31m' reset=$'\x1b[00;00m' - disp_list=( "${(@)disp_list//(#mi)($~colsearch_pattern)/$red${MATCH}$reset}" ) + # The repeat will make the matching work on a fresh heap + repeat 1; do + disp_list=( "${(@)disp_list//(#mi)($~colsearch_pattern)/$red${MATCH}$reset}" ) + done fi # We have display list, lets replace newlines with "\n" when needed (1/2) @@ -380,7 +389,7 @@ while (( 1 )); do # Get the special (i.e. "keypad") key or regular key if [ -n "$key" ]; then - final_key="$key" + final_key="$key" elif [ -n "$keypad" ]; then final_key="$keypad" else diff --git a/plugins/zsh-navigation-tools/n-list-draw b/plugins/zsh-navigation-tools/n-list-draw index 1b2571fb..2f8b1d0d 100644 --- a/plugins/zsh-navigation-tools/n-list-draw +++ b/plugins/zsh-navigation-tools/n-list-draw @@ -98,7 +98,7 @@ shift 7 integer max_text_len=page_width-x_offset [ "$bold" = "0" ] && bold="" || bold="+bold" -[[ "$active_text" = "underline" || "$active_text" = "reverse" ]] || active_text="reverse" +[[ "$active_text" = "underline" || "$active_text" = "reverse" ]] || local active_text="reverse" # With Linux terminal underline won't work properly [ "$TERM" = "linux" ] && active_text="reverse" diff --git a/plugins/zsh-navigation-tools/n-list-input b/plugins/zsh-navigation-tools/n-list-input index 380acdc0..957cd5a0 100644 --- a/plugins/zsh-navigation-tools/n-list-input +++ b/plugins/zsh-navigation-tools/n-list-input @@ -44,7 +44,7 @@ case "$key" in [ "$current_idx" -lt "$last_element" ] && current_idx=current_idx+1; _nlist_compute_first_to_show_idx ;; - (PPAGE) + (PPAGE|$'\b'|$'\C-?'|BACKSPACE) current_idx=current_idx-page_height [ "$current_idx" -lt 1 ] && current_idx=1; _nlist_compute_first_to_show_idx @@ -72,7 +72,7 @@ case "$key" in current_idx=last_element _nlist_compute_first_to_show_idx ;; - ($'\n') + ($'\n'|ENTER) # Is that element selectable? # Check for this only when there is no search if [[ "$NLIST_SEARCH_BUFFER" != "" || "$NLIST_IS_UNIQ_MODE" -eq 1 || @@ -137,7 +137,7 @@ esac else case "$key" in - ($'\n') + ($'\n'|ENTER) search=0 _nlist_cursor_visibility 0 ;; diff --git a/plugins/zsh-navigation-tools/znt-history-widget b/plugins/zsh-navigation-tools/znt-history-widget index 9ddae606..a4a26cbf 100644 --- a/plugins/zsh-navigation-tools/znt-history-widget +++ b/plugins/zsh-navigation-tools/znt-history-widget @@ -1,7 +1,11 @@ autoload znt-usetty-wrapper n-history local NLIST_START_IN_SEARCH_MODE=1 local NLIST_START_IN_UNIQ_MODE=1 -local NLIST_SET_SEARCH_TO="$BUFFER" + +# Only if current $BUFFER doesn't come from history +if [ "$HISTCMD" = "$HISTNO" ]; then + local NLIST_SET_SEARCH_TO="$BUFFER" +fi znt-usetty-wrapper n-history "$@" From 7daa207dbc92afc9bf1ea5bc41ff3e7611409f52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Larivi=C3=A8re?= Date: Sat, 4 Apr 2015 20:24:24 -0400 Subject: [PATCH 156/537] Adding support for stdin input in the encode64 plugin --- plugins/encode64/encode64.plugin.zsh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/plugins/encode64/encode64.plugin.zsh b/plugins/encode64/encode64.plugin.zsh index 53de6478..979e0674 100644 --- a/plugins/encode64/encode64.plugin.zsh +++ b/plugins/encode64/encode64.plugin.zsh @@ -1,4 +1,17 @@ -encode64(){ printf '%s' $1 | base64 } -decode64(){ printf '%s' $1 | base64 --decode } +encode64() { + if [[ $# -eq 0 ]]; then + cat | base64 + else + printf '%s' $1 | base64 + fi +} + +decode64() { + if [[ $# -eq 0 ]]; then + cat | base64 --decode + else + printf '%s' $1 | base64 --decode + fi +} alias e64=encode64 alias d64=decode64 From 494b07b093aaaf3bdc05946cd5daae64847d4744 Mon Sep 17 00:00:00 2001 From: low-ghost Date: Wed, 23 Dec 2015 08:47:05 -0500 Subject: [PATCH 157/537] Update gitignore.plugin: comma separated arguments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Seems like this is more like the intended effect, splits arguments with commas for proper gitignore.io api request. Thanks for teaching me about custom compdef completions! Updated with zsh join operator by Marc Cornellà --- plugins/gitignore/gitignore.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/gitignore/gitignore.plugin.zsh b/plugins/gitignore/gitignore.plugin.zsh index 481d487b..ba1b3871 100644 --- a/plugins/gitignore/gitignore.plugin.zsh +++ b/plugins/gitignore/gitignore.plugin.zsh @@ -1,4 +1,4 @@ -function gi() { curl -sL https://www.gitignore.io/api/$@ ;} +function gi() { curl -sL https://www.gitignore.io/api/${(j:,:)@} } _gitignoreio_get_command_list() { curl -sL https://www.gitignore.io/api/list | tr "," "\n" From 5464fe3e4ad02a33243f42bcd8c91a287bc26185 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Mon, 18 Jan 2016 22:04:16 +0100 Subject: [PATCH 158/537] Center Oh My Zsh logo Also, fix a couple of typos / style issues. --- README.markdown | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.markdown b/README.markdown index 33128ef9..843c0c6b 100644 --- a/README.markdown +++ b/README.markdown @@ -1,21 +1,21 @@ -![Oh My Zsh](https://s3.amazonaws.com/ohmyzsh/oh-my-zsh-logo.png) - +

+ Oh My Zsh +

Oh My Zsh is an open source, community-driven framework for managing your [zsh](http://www.zsh.org/) configuration. That sounds boring. Let's try this again. __Oh My Zsh is a way of life!__ Once installed, your terminal prompt will become the talk of the town _or your money back!_ Each time you interact with your command prompt, you'll be able to take advantage of the hundreds of bundled plugins and pretty themes. Strangers will come up to you in cafés and ask you, _"that is amazing. are you some sort of genius?"_ Finally, you'll begin to get the sort of attention that you always felt that you deserved. ...or maybe you'll just use the time that you saved to start flossing more often. -To learn more, visit [ohmyz.sh](http://ohmyz.sh) and/or follow [ohmyzsh](https://twitter.com/ohmyzsh) on Twitter. +To learn more, visit [ohmyz.sh](http://ohmyz.sh) and follow [@ohmyzsh](https://twitter.com/ohmyzsh) on Twitter. ## Getting Started - ### Prerequisites __Disclaimer:__ _Oh My Zsh works best on Mac OS X and Linux._ * Unix-based operating system (Mac OS X or Linux) -* [Zsh](http://www.zsh.org) should be installed (v4.3.9 or more recent). If not pre-installed (`zsh --version` to confirm), check the following instruction here: [Installing-ZSH](https://github.com/robbyrussell/oh-my-zsh/wiki/Installing-ZSH) +* [Zsh](http://www.zsh.org) should be installed (v4.3.9 or more recent). If not pre-installed (`zsh --version` to confirm), check the following instruction here: [Installing ZSH](https://github.com/robbyrussell/oh-my-zsh/wiki/Installing-ZSH) * `curl` or `wget` should be installed * `git` should be installed From a6ad7a0c8d3a2d4be5ad0d70358c4bdbe47ace9b Mon Sep 17 00:00:00 2001 From: Anton Rieder Date: Fri, 29 Jan 2016 13:04:53 +0100 Subject: [PATCH 159/537] Add missing alias to README of bundler plugin --- plugins/bundler/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/bundler/README.md b/plugins/bundler/README.md index edd95ccc..04d55144 100644 --- a/plugins/bundler/README.md +++ b/plugins/bundler/README.md @@ -6,6 +6,7 @@ - `bl` aliased to `bundle list` - `bp` aliased to `bundle package` - `bo` aliased to `bundle open` + - `bout` aliased to `bundle outdated` - `bu` aliased to `bundle update` - `bi` aliased to `bundle install --jobs=` (only for bundler `>= 1.4.0`) - adds a wrapper for common gems: From 78bf3dd9b2dc25fe14dbdb9ec8ab2b29e05f6237 Mon Sep 17 00:00:00 2001 From: Eddie Dunn Date: Sun, 7 Feb 2016 21:31:25 +0100 Subject: [PATCH 160/537] pylint.plugin.zsh: Remove include-ids=y The flag `--include-ids` is soon to be deprecated for Pylint. This pull request removes that option from pylint-quick --- plugins/pylint/pylint.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/pylint/pylint.plugin.zsh b/plugins/pylint/pylint.plugin.zsh index 6760c67b..57c7c0ac 100644 --- a/plugins/pylint/pylint.plugin.zsh +++ b/plugins/pylint/pylint.plugin.zsh @@ -1,3 +1,3 @@ # Aliases -alias pylint-quick='pylint --reports=n --include-ids=y' -compdef _pylint-quick pylint-quick='pylint --reports=n --include-ids=y' \ No newline at end of file +alias pylint-quick='pylint --reports=n' +compdef _pylint-quick pylint-quick='pylint --reports=n' From db39afe95bab90b8f312a925eb849a64f10141f5 Mon Sep 17 00:00:00 2001 From: Glenn / devalias Date: Tue, 9 Feb 2016 15:43:17 +1100 Subject: [PATCH 161/537] Update _brew to match latest Updated _brew to match latest in https://github.com/Homebrew/homebrew/blob/master/Library/Contributions/brew_zsh_completion.zsh --- plugins/brew/_brew | 56 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 46 insertions(+), 10 deletions(-) diff --git a/plugins/brew/_brew b/plugins/brew/_brew index 4c99a383..5a5bd6b2 100644 --- a/plugins/brew/_brew +++ b/plugins/brew/_brew @@ -1,7 +1,13 @@ #compdef brew #autoload -# imported from the latest homebrew contributions +# imported from https://github.com/Homebrew/homebrew/blob/master/Library/Contributions/brew_zsh_completion.zsh + +# Brew ZSH completion function +# Drop this somewhere in your $fpath (like /usr/share/zsh/site-functions) +# and rename it _brew +# +# altered from _fink _brew_all_formulae() { formulae=(`brew search`) @@ -15,6 +21,14 @@ _brew_installed_taps() { installed_taps=(`brew tap`) } +_brew_official_taps() { + official_taps=(`brew tap --list-official`) +} + +_brew_pinned_taps() { + pinned_taps=(`brew tap --list-pinned`) +} + _brew_outdated_formulae() { outdated_formulae=(`brew outdated`) } @@ -25,8 +39,10 @@ _1st_arguments=( 'cat:display formula file for a formula' 'cleanup:uninstall unused and old versions of packages' 'commands:show a list of commands' + 'config:show homebrew and system configuration' 'create:create a new formula' - 'deps:list dependencies of a formula' + 'deps:list dependencies and dependants of a formula' + 'desc:display a description of a formula' 'doctor:audits your installation for common issues' 'edit:edit a formula' 'fetch:download formula resources to the cache' @@ -37,40 +53,45 @@ _1st_arguments=( 'reinstall:install a formula anew; re-using its current options' 'leaves:show installed formulae that are not dependencies of another installed formula' 'link:link a formula' + 'linkapps:symlink .app bundles provided by formulae into /Applications' '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.' + 'migrate:migrate renamed formula to new name' 'outdated:list formulae for which a newer version is available' 'pin:pin specified formulae' 'postinstall:perform post_install for a given formula' 'prune:remove dead links' 'remove:remove a formula' 'search:search for a formula (/regex/ or string)' - 'switch:switch linkage between installed versions of a formula' + 'switch:switch between different versions of a formula' 'tap:tap a new formula repository from GitHub, or list existing taps' + 'tap-info:information about a tap' + 'tap-pin:pin a tap' + 'tap-unpin:unpin a tap' 'test-bot:test a formula and build a bottle' 'uninstall:uninstall a formula' 'unlink:unlink a formula' + 'unlinkapps:remove symlinked .app bundles provided by formulae from /Applications' 'unpin:unpin specified formulae' 'untap:remove a tapped repository' - 'update:pull latest repository' + 'update:fetch latest version of Homebrew and all formulae' 'upgrade:upgrade outdated formulae' 'uses:show formulae which depend on a formula' + `brew commands --quiet --include-aliases` ) local expl -local -a formulae installed_formulae installed_taps outdated_formulae +local -a formulae installed_formulae installed_taps official_taps outdated_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]' \ - '(--force)--force[brew force]' \ '*:: :->subcmds' && return 0 if (( CURRENT == 1 )); then @@ -79,9 +100,18 @@ if (( CURRENT == 1 )); then fi case "$words[1]" in - install|reinstall|audit|home|homepage|log|info|abv|uses|cat|deps|edit|options) + install|reinstall|audit|home|homepage|log|info|abv|uses|cat|deps|desc|edit|options|switch) _brew_all_formulae _wanted formulae expl 'all formulae' compadd -a formulae ;; + linkapps|unlinkapps) + _arguments \ + '(--local)--local[operate on ~/Applications instead of /Applications]' \ + '1: :->forms' && return 0 + + if [[ "$state" == forms ]]; then + _brew_installed_formulae + _wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae + fi ;; list|ls) _arguments \ '(--unbrewed)--unbrewed[files in brew --prefix not controlled by brew]' \ @@ -100,9 +130,15 @@ case "$words[1]" in _arguments \ '(--macports)--macports[search the macports repository]' \ '(--fink)--fink[search the fink repository]' ;; - untap) + untap|tap-info|tap-pin) _brew_installed_taps - _wanted installed_taps expl 'installed taps' compadd -a installed_taps ;; + _wanted installed_taps expl 'installed taps' compadd -a installed_taps ;; + tap) + _brew_official_taps + _wanted official_taps expl 'official taps' compadd -a official_taps ;; + tap-unpin) + _brew_pinned_taps + _wanted pinned_taps expl 'pinned taps' compadd -a pinned_taps ;; upgrade) _brew_outdated_formulae _wanted outdated_formulae expl 'outdated formulae' compadd -a outdated_formulae ;; From 2a0be1aad4606031c00ba98ea24ca4a1d1109b7f Mon Sep 17 00:00:00 2001 From: Glenn / devalias Date: Wed, 10 Feb 2016 10:17:18 +1100 Subject: [PATCH 162/537] Add hash imported from --- plugins/brew/_brew | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/brew/_brew b/plugins/brew/_brew index 5a5bd6b2..1f24bd67 100644 --- a/plugins/brew/_brew +++ b/plugins/brew/_brew @@ -1,7 +1,7 @@ #compdef brew #autoload -# imported from https://github.com/Homebrew/homebrew/blob/master/Library/Contributions/brew_zsh_completion.zsh +# imported from https://github.com/Homebrew/homebrew/blob/29f73d2212c2b202fe25f69dcbf440d8391fa4c9/Library/Contributions/brew_zsh_completion.zsh # Brew ZSH completion function # Drop this somewhere in your $fpath (like /usr/share/zsh/site-functions) From 52737b18280b94a044bac44a04e5c0739459dbd7 Mon Sep 17 00:00:00 2001 From: Filippo Valsorda Date: Wed, 10 Feb 2016 18:31:49 +0000 Subject: [PATCH 163/537] git.plugin: remove the conflicting gvt alias See FiloSottile/gvt#19 and FiloSottile/gvt#4 --- plugins/git/git.plugin.zsh | 2 -- 1 file changed, 2 deletions(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index b851fb97..4291da7b 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -213,7 +213,5 @@ alias gup='git pull --rebase' alias gupv='git pull --rebase -v' alias glum='git pull upstream master' -alias gvt='git verify-tag' - alias gwch='git whatchanged -p --abbrev-commit --pretty=medium' alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit -m "--wip--"' From ee86f1a627d805c5fd035172f29e866508d2f0bf Mon Sep 17 00:00:00 2001 From: George Machitidze Date: Sun, 19 Jan 2014 20:54:11 -0800 Subject: [PATCH 164/537] Create dnf plugin Adds some useful aliases --- plugins/dnf/dnf.plugin.zsh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 plugins/dnf/dnf.plugin.zsh diff --git a/plugins/dnf/dnf.plugin.zsh b/plugins/dnf/dnf.plugin.zsh new file mode 100644 index 00000000..9a6abef4 --- /dev/null +++ b/plugins/dnf/dnf.plugin.zsh @@ -0,0 +1,15 @@ +## Aliases + +alias dnfl="dnf list" # List packages +alias dnfli="dnf list installed" # List installed packages +alias dnfgl="dnf grouplist" # List package groups +alias dnfmc="dnf makecache" # Generate metadata cache +alias dnfp="dnf info" # Show package information +alias dnfs="dnf search" # Search package + +alias dnfu="sudo dnf update" # Upgrade package +alias dnfi="sudo dnf install" # Install package +alias dnfgi="sudo dnf groupinstall" # Install package group +alias dnfr="sudo dnf erase" # Remove package +alias dnfgr="sudo dnf groupremove" # Remove package group +alias dnfc="sudo dnf clean all" # Clean cache From c0b12523feb43a81dbf970054eb69b5c60626936 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 11 Feb 2016 21:38:10 +0100 Subject: [PATCH 165/537] Fix deprecated dnf commands Update -> upgrade Erase -> remove --- plugins/dnf/dnf.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/dnf/dnf.plugin.zsh b/plugins/dnf/dnf.plugin.zsh index 9a6abef4..653ce7dd 100644 --- a/plugins/dnf/dnf.plugin.zsh +++ b/plugins/dnf/dnf.plugin.zsh @@ -7,9 +7,9 @@ alias dnfmc="dnf makecache" # Generate metadata cache alias dnfp="dnf info" # Show package information alias dnfs="dnf search" # Search package -alias dnfu="sudo dnf update" # Upgrade package +alias dnfu="sudo dnf upgrade" # Upgrade package alias dnfi="sudo dnf install" # Install package alias dnfgi="sudo dnf groupinstall" # Install package group -alias dnfr="sudo dnf erase" # Remove package +alias dnfr="sudo dnf remove" # Remove package alias dnfgr="sudo dnf groupremove" # Remove package group alias dnfc="sudo dnf clean all" # Clean cache From 624518054b9aa52bf81f9813f33d08985efe4a78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 11 Feb 2016 21:38:40 +0100 Subject: [PATCH 166/537] Add README to dnf plugin --- plugins/dnf/README.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 plugins/dnf/README.md diff --git a/plugins/dnf/README.md b/plugins/dnf/README.md new file mode 100755 index 00000000..f9ef496f --- /dev/null +++ b/plugins/dnf/README.md @@ -0,0 +1,25 @@ +## Description + +This plugin makes `dnf` usage easier by adding aliases for the most +common commands. + +`dnf` is the new package manager for RPM-based distributions, which +replaces `yum`. + +## Aliases + +| Alias | Command | Description | +|-------|-------------------------|--------------------------| +| dnfl | `dnf list` | List packages | +| dnfli | `dnf list installed` | List installed packages | +| dnfgl | `dnf grouplist` | List package groups | +| dnfmc | `dnf makecache` | Generate metadata cache | +| dnfp | `dnf info` | Show package information | +| dnfs | `dnf search` | Search package | +| **Use `sudo`** | +| dnfu | `sudo dnf upgrade` | Upgrade package | +| dnfi | `sudo dnf install` | Install package | +| dnfgi | `sudo dnf groupinstall` | Install package group | +| dnfr | `sudo dnf remove` | Remove package | +| dnfgr | `sudo dnf groupremove` | Remove package group | +| dnfc | `sudo dnf clean all` | Clean cache | From 20b8b6cc741b5c1e0284117eb131ec63b7299704 Mon Sep 17 00:00:00 2001 From: Nick Russo Date: Fri, 12 Feb 2016 01:20:47 -0800 Subject: [PATCH 167/537] Sets spacing to 1 when git is absent for consistency --- themes/robbyrussell.zsh-theme | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/themes/robbyrussell.zsh-theme b/themes/robbyrussell.zsh-theme index 24e1e8c5..60be409c 100644 --- a/themes/robbyrussell.zsh-theme +++ b/themes/robbyrussell.zsh-theme @@ -1,7 +1,7 @@ local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ %s)" -PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' +PROMPT='${ret_status}%{$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]%})" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%} " +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%}) " From 3d522ff3a6df86a0a3b3262d933e1c6c3dac9048 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Fri, 12 Feb 2016 23:39:47 +0100 Subject: [PATCH 168/537] Remove non-working symbols and tidy up logic --- themes/robbyrussell.zsh-theme | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/themes/robbyrussell.zsh-theme b/themes/robbyrussell.zsh-theme index 60be409c..f9eca6a8 100644 --- a/themes/robbyrussell.zsh-theme +++ b/themes/robbyrussell.zsh-theme @@ -1,7 +1,7 @@ -local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ %s)" -PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%}%{$reset_color%}' +local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )" +PROMPT='${ret_status} %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)' -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_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" From 07424c92a82a228d032bbddca34f13b1eb6b8750 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Sun, 14 Feb 2016 03:44:31 -0500 Subject: [PATCH 169/537] Update kennethreitz.zsh-theme --- themes/kennethreitz.zsh-theme | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/themes/kennethreitz.zsh-theme b/themes/kennethreitz.zsh-theme index 109be0c2..2041b897 100644 --- a/themes/kennethreitz.zsh-theme +++ b/themes/kennethreitz.zsh-theme @@ -1,6 +1,6 @@ local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" -PROMPT='%{$fg[green]%}%c \ +PROMPT='%{%}%{$fg[green]%}%c \ $(git_prompt_info)\ %{$fg[red]%}%(!.#.»)%{$reset_color%} ' PROMPT2='%{$fg[red]%}\ %{$reset_color%}' @@ -10,4 +10,3 @@ 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 568f4812f268de5526de20b43abc53a01fc80d62 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Sun, 14 Feb 2016 04:19:46 -0500 Subject: [PATCH 170/537] update kennethreitz.zsh-theme --- themes/kennethreitz.zsh-theme | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/themes/kennethreitz.zsh-theme b/themes/kennethreitz.zsh-theme index 2041b897..b255a8d6 100644 --- a/themes/kennethreitz.zsh-theme +++ b/themes/kennethreitz.zsh-theme @@ -1,12 +1,15 @@ local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" -PROMPT='%{%}%{$fg[green]%}%c \ +PROMPT='$(virtualenv_prompt_info)%{%}%{$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_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]%}" +ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX="%{$reset_color%}%{%}%{$fg[blue]%}" +ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX="!%{$reset_color%} " \ No newline at end of file From eee6f08421c0fad26cef0b5e7fca75753ddd84b8 Mon Sep 17 00:00:00 2001 From: Gautam Kotian Date: Mon, 15 Feb 2016 10:51:17 +0100 Subject: [PATCH 171/537] Minor README fixes --- plugins/github/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/github/README.md b/plugins/github/README.md index 21b7367f..fea60787 100644 --- a/plugins/github/README.md +++ b/plugins/github/README.md @@ -1,6 +1,6 @@ # github -This plugin supports working with GitHub the command line. It provides a few things: +This plugin supports working with GitHub from the command line. It provides a few things: * Sets up the `hub` wrapper and completions for the `git` command if you have `hub` installed. * Completion for the `github` Ruby gem. @@ -37,7 +37,7 @@ See `man hub` for more details. ### Homebrew installation note -If you have installed `hub` using Homebrew, its completions may not be on your `$FPATH` if you are using the system `zsh`. Homebrew installs `zsh` completion definitions to `/usr/local/share/zsh/site-functions`, which on `$FPATH` for the Homebrew-installed `zsh`, but not for the system `zsh`. If you want it to work with the system `zsh`, add this to your `~/.zshrc` before it sources `oh-my-zsh.sh`. +If you have installed `hub` using Homebrew, its completions may not be on your `$FPATH` if you are using the system `zsh`. Homebrew installs `zsh` completion definitions to `/usr/local/share/zsh/site-functions`, which will be on `$FPATH` for the Homebrew-installed `zsh`, but not for the system `zsh`. If you want it to work with the system `zsh`, add this to your `~/.zshrc` before it sources `oh-my-zsh.sh`. ```zsh if (( ! ${fpath[(I)/usr/local/share/zsh/site-functions]} )); then From 31614f8c40787fda8d717f51bc7d97239782e82d Mon Sep 17 00:00:00 2001 From: Marvin Frommhold Date: Thu, 18 Feb 2016 15:47:42 +0100 Subject: [PATCH 172/537] fix terminal color pollution, see issue https://github.com/robbyrussell/oh-my-zsh/issues/4856 --- plugins/mvn/mvn.plugin.zsh | 40 +++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index 865b1523..8324c495 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -1,24 +1,24 @@ # mvn-color based on https://gist.github.com/1027800 -export BOLD=`tput bold` -export UNDERLINE_ON=`tput smul` -export UNDERLINE_OFF=`tput rmul` -export TEXT_BLACK=`tput setaf 0` -export TEXT_RED=`tput setaf 1` -export TEXT_GREEN=`tput setaf 2` -export TEXT_YELLOW=`tput setaf 3` -export TEXT_BLUE=`tput setaf 4` -export TEXT_MAGENTA=`tput setaf 5` -export TEXT_CYAN=`tput setaf 6` -export TEXT_WHITE=`tput setaf 7` -export BACKGROUND_BLACK=`tput setab 0` -export BACKGROUND_RED=`tput setab 1` -export BACKGROUND_GREEN=`tput setab 2` -export BACKGROUND_YELLOW=`tput setab 3` -export BACKGROUND_BLUE=`tput setab 4` -export BACKGROUND_MAGENTA=`tput setab 5` -export BACKGROUND_CYAN=`tput setab 6` -export BACKGROUND_WHITE=`tput setab 7` -export RESET_FORMATTING=`tput sgr0` +BOLD=`tput bold` +UNDERLINE_ON=`tput smul` +UNDERLINE_OFF=`tput rmul` +TEXT_BLACK=`tput setaf 0` +TEXT_RED=`tput setaf 1` +TEXT_GREEN=`tput setaf 2` +TEXT_YELLOW=`tput setaf 3` +TEXT_BLUE=`tput setaf 4` +TEXT_MAGENTA=`tput setaf 5` +TEXT_CYAN=`tput setaf 6` +TEXT_WHITE=`tput setaf 7` +BACKGROUND_BLACK=`tput setab 0` +BACKGROUND_RED=`tput setab 1` +BACKGROUND_GREEN=`tput setab 2` +BACKGROUND_YELLOW=`tput setab 3` +BACKGROUND_BLUE=`tput setab 4` +BACKGROUND_MAGENTA=`tput setab 5` +BACKGROUND_CYAN=`tput setab 6` +BACKGROUND_WHITE=`tput setab 7` +RESET_FORMATTING=`tput sgr0` # Wrapper function for Maven's mvn command. From aeca2ad899eed0235921dc6f1d7a3415bc851143 Mon Sep 17 00:00:00 2001 From: Yad Smood Date: Sun, 21 Feb 2016 01:16:21 +0800 Subject: [PATCH 173/537] Optimize the ys.zsh-theme make it more expressive --- themes/ys.zsh-theme | 50 ++++++++++++++++----------------------------- 1 file changed, 18 insertions(+), 32 deletions(-) diff --git a/themes/ys.zsh-theme b/themes/ys.zsh-theme index fd8adc41..d0845335 100644 --- a/themes/ys.zsh-theme +++ b/themes/ys.zsh-theme @@ -1,18 +1,9 @@ # Clean, simple, compatible and meaningful. # Tested on Linux, Unix and Windows under ANSI colors. -# It is recommended to use with a dark background and the font Inconsolata. +# It is recommended to use with a dark background. # Colors: black, red, green, yellow, *blue, magenta, cyan, and white. -# -# http://ysmood.org/wp/2013/03/my-ys-terminal-theme/ -# Mar 2013 ys - -# Machine name. -function box_name { - [ -f ~/.box-name ] && cat ~/.box-name || echo $HOST -} - -# Directory info. -local current_dir='${PWD/#$HOME/~}' +# +# Mar 2013 Yad Smood # VCS YS_VCS_PROMPT_PREFIX1=" %{$fg[white]%}on%{$reset_color%} " @@ -21,7 +12,7 @@ YS_VCS_PROMPT_SUFFIX="%{$reset_color%}" YS_VCS_PROMPT_DIRTY=" %{$fg[red]%}x" YS_VCS_PROMPT_CLEAN=" %{$fg[green]%}o" -# Git info. +# Git info local git_info='$(git_prompt_info)' ZSH_THEME_GIT_PROMPT_PREFIX="${YS_VCS_PROMPT_PREFIX1}git${YS_VCS_PROMPT_PREFIX2}" ZSH_THEME_GIT_PROMPT_SUFFIX="$YS_VCS_PROMPT_SUFFIX" @@ -44,29 +35,24 @@ ys_hg_prompt_info() { fi } -# Prompt format: \n # USER at MACHINE in DIRECTORY on git:BRANCH STATE [TIME] \n $ -PROMPT=" -%{$terminfo[bold]$fg[blue]%}#%{$reset_color%} \ -%{$fg[cyan]%}%n \ -%{$fg[white]%}at \ -%{$fg[green]%}$(box_name) \ -%{$fg[white]%}in \ -%{$terminfo[bold]$fg[yellow]%}${current_dir}%{$reset_color%}\ -${hg_info}\ -${git_info} \ -%{$fg[white]%}[%*] -%{$terminfo[bold]$fg[red]%}$ %{$reset_color%}" -if [[ "$USER" == "root" ]]; then +# Prompt format: +# +# PRIVILEGES USER @ MACHINE in DIRECTORY on git:BRANCH STATE [TIME] L:SHELL_LEVEL N:LINE_NUM +# $ COMMAND +# +# For example: +# +# % ys @ ys-mbp in ~/.oh-my-zsh on git:master x [21:47:42] tty:s000 L:1 N:12 +# $ PROMPT=" %{$terminfo[bold]$fg[blue]%}#%{$reset_color%} \ -%{$bg[yellow]%}%{$fg[cyan]%}%n%{$reset_color%} \ -%{$fg[white]%}at \ -%{$fg[green]%}$(box_name) \ +%(#,%{$bg[yellow]%}%{$fg[black]%}%n%{$reset_color%},%{$fg[cyan]%}%n) \ +%{$fg[white]%}@ \ +%{$fg[green]%}%m \ %{$fg[white]%}in \ -%{$terminfo[bold]$fg[yellow]%}${current_dir}%{$reset_color%}\ +%{$terminfo[bold]$fg[yellow]%}%~%{$reset_color%}\ ${hg_info}\ ${git_info} \ -%{$fg[white]%}[%*] +%{$fg[white]%}[%*] tty:%l L:%L N:%i %{$terminfo[bold]$fg[red]%}$ %{$reset_color%}" -fi From 9a2376bd29682d9b1c42eb4e0223aacbb784f0fb Mon Sep 17 00:00:00 2001 From: Yad Smood Date: Sun, 21 Feb 2016 02:42:42 +0800 Subject: [PATCH 174/537] add: exit code --- themes/ys.zsh-theme | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/themes/ys.zsh-theme b/themes/ys.zsh-theme index d0845335..737b506b 100644 --- a/themes/ys.zsh-theme +++ b/themes/ys.zsh-theme @@ -35,15 +35,16 @@ ys_hg_prompt_info() { fi } +local exit_code="%(?,%?,%{$fg[red]%}%?%{$reset_color%})" # Prompt format: # -# PRIVILEGES USER @ MACHINE in DIRECTORY on git:BRANCH STATE [TIME] L:SHELL_LEVEL N:LINE_NUM +# PRIVILEGES USER @ MACHINE in DIRECTORY on git:BRANCH STATE [TIME] tty:$TTY L:$SHELL_LEVEL N:LINE_NUM C:LAST_EXIT_CODE # $ COMMAND # # For example: # -# % ys @ ys-mbp in ~/.oh-my-zsh on git:master x [21:47:42] tty:s000 L:1 N:12 +# % ys @ ys-mbp in ~/.oh-my-zsh on git:master x [21:47:42] tty:s000 L:1 N:12 C:0 # $ PROMPT=" %{$terminfo[bold]$fg[blue]%}#%{$reset_color%} \ @@ -53,6 +54,7 @@ PROMPT=" %{$fg[white]%}in \ %{$terminfo[bold]$fg[yellow]%}%~%{$reset_color%}\ ${hg_info}\ -${git_info} \ -%{$fg[white]%}[%*] tty:%l L:%L N:%i +${git_info}\ + \ +%{$fg[white]%}[%*] tty:%l L:%L N:%i C:$exit_code %{$terminfo[bold]$fg[red]%}$ %{$reset_color%}" From 480ad804a62cf1af4bdb05d177c805f5473914ee Mon Sep 17 00:00:00 2001 From: Will Mendes Date: Mon, 22 Feb 2016 00:09:27 +1100 Subject: [PATCH 175/537] Fix bug in compass docs search --- plugins/frontend-search/README.md | 2 +- plugins/frontend-search/_frontend-search.sh | 4 ++-- plugins/frontend-search/frontend-search.plugin.zsh | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/plugins/frontend-search/README.md b/plugins/frontend-search/README.md index d0bc5589..4d956e38 100644 --- a/plugins/frontend-search/README.md +++ b/plugins/frontend-search/README.md @@ -38,7 +38,7 @@ Available search contexts are: | bootsnipp | `http://bootsnipp.com/search?q=` | | caniuse | `http://caniuse.com/#search=` | | codepen | `http://codepen.io/search?q=` | -| compass | `http://compass-style.org/search?q=` | +| compassdoc | `http://compass-style.org/search?q=` | | cssflow | `http://www.cssflow.com/search?q=` | | dartlang | `https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart:` | | emberjs | `http://emberjs.com/api/#stp=1&stq=` | diff --git a/plugins/frontend-search/_frontend-search.sh b/plugins/frontend-search/_frontend-search.sh index b12f829a..9aad76f7 100644 --- a/plugins/frontend-search/_frontend-search.sh +++ b/plugins/frontend-search/_frontend-search.sh @@ -19,7 +19,7 @@ function _frontend() { commands=( 'jquery: Search in jQuery website' 'mdn: Search in MDN website' - 'compass: Search in COMPASS website' + 'compassdoc: Search in COMPASS website' 'html5please: Search in HTML5 Please website' 'caniuse: Search in Can I Use website' 'aurajs: Search in AuraJs website' @@ -57,7 +57,7 @@ function _frontend() { mdn) _describe -t points "Warp points" frontend_points && ret=0 ;; - compass) + compassdoc) _describe -t points "Warp points" frontend_points && ret=0 ;; html5please) diff --git a/plugins/frontend-search/frontend-search.plugin.zsh b/plugins/frontend-search/frontend-search.plugin.zsh index 2fd5416b..3fd49ab8 100644 --- a/plugins/frontend-search/frontend-search.plugin.zsh +++ b/plugins/frontend-search/frontend-search.plugin.zsh @@ -4,7 +4,7 @@ alias bem='frontend bem' alias bootsnipp='frontend bootsnipp' alias caniuse='frontend caniuse' alias codepen='frontend codepen' -alias compass='frontend compass' +alias compassdoc='frontend compassdoc' alias cssflow='frontend cssflow' alias dartlang='frontend dartlang' alias emberjs='frontend emberjs' @@ -32,7 +32,7 @@ function frontend() { bootsnipp 'http://bootsnipp.com/search?q=' caniuse 'http://caniuse.com/#search=' codepen 'http://codepen.io/search?q=' - compass 'http://compass-style.org/search?q=' + compassdoc 'http://compass-style.org/search?q=' cssflow 'http://www.cssflow.com/search?q=' dartlang 'https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart:' emberjs 'http://emberjs.com/api/#stp=1&stq=' @@ -57,7 +57,7 @@ function frontend() { print -P "%Uterm%u and what follows is what will be searched for in the %Ucontext%u website," print -P "and %Ucontext%u is one of the following:" print -P "" - print -P " angularjs, aurajs, bem, bootsnipp, caniuse, codepen, compass, cssflow," + print -P " angularjs, aurajs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow," print -P " dartlang, emberjs, fontello, html5please, jquery, lodash, mdn, npmjs," print -P " qunit, reactjs, smacss, stackoverflow, unheap" print -P "" @@ -73,7 +73,7 @@ function frontend() { echo "" echo "Valid contexts are:" echo "" - echo " angularjs, aurajs, bem, bootsnipp, caniuse, codepen, compass, cssflow, " + echo " angularjs, aurajs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow, " echo " dartlang, emberjs, fontello, html5please, jquery, lodash, mdn, npmjs, " echo " qunit, reactjs, smacss, stackoverflow, unheap" echo "" From 9c362484396560119e8ff7a5de0696a9765cb2c7 Mon Sep 17 00:00:00 2001 From: "L.C. Karssen" Date: Mon, 27 Jul 2015 12:03:50 +0200 Subject: [PATCH 176/537] Better visible colours in avit for Ubuntu terminal Make some colours in the avit theme bold for better visibility in the default Ubuntu terminal theme. --- themes/avit.zsh-theme | 1 + 1 file changed, 1 insertion(+) diff --git a/themes/avit.zsh-theme b/themes/avit.zsh-theme index 3d097a24..54cb357d 100644 --- a/themes/avit.zsh-theme +++ b/themes/avit.zsh-theme @@ -8,6 +8,7 @@ PROMPT2='%{$fg[$CARETCOLOR]%}◀%{$reset_color%} ' RPROMPT='$(_vi_status)%{$(echotc UP 1)%}$(_git_time_since_commit) $(git_prompt_status) ${_return_status}%{$(echotc DO 1)%}' +local _current_dir="%{$fg_bold[blue]%}%3~%{$reset_color%} " local _return_status="%{$fg_bold[red]%}%(?..⍉)%{$reset_color%}" local _hist_no="%{$fg[grey]%}%h%{$reset_color%}" From 55fed4f8cdfcf7791fd22b28ef65b00dcc9e1a5f Mon Sep 17 00:00:00 2001 From: "L.C. Karssen" Date: Mon, 27 Jul 2015 12:03:02 +0200 Subject: [PATCH 177/537] Fix use of CARETCOLOR in avit theme MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit $CARETCOLOR was not to actually colour the caret, so change to root user wouldn't show in the prompt. Now both ▶ and ◀ follow $CARETCOLOR. --- themes/avit.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/avit.zsh-theme b/themes/avit.zsh-theme index 54cb357d..87d5be30 100644 --- a/themes/avit.zsh-theme +++ b/themes/avit.zsh-theme @@ -1,7 +1,7 @@ # AVIT ZSH Theme PROMPT=' -$(_user_host)$(_current_dir) $(git_prompt_info) $(_ruby_version) +$(_user_host)${_current_dir} $(git_prompt_info) $(_ruby_version) %{$fg[$CARETCOLOR]%}▶%{$resetcolor%} ' PROMPT2='%{$fg[$CARETCOLOR]%}◀%{$reset_color%} ' From d189236f757b59262bd8c98abd0c48cd04bc9ec2 Mon Sep 17 00:00:00 2001 From: "Johan K. Jensen" Date: Tue, 8 Mar 2016 13:17:23 +0100 Subject: [PATCH 178/537] Add iTerm2 v3 support --- plugins/osx/osx.plugin.zsh | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh index a1516dcc..c92b6556 100644 --- a/plugins/osx/osx.plugin.zsh +++ b/plugins/osx/osx.plugin.zsh @@ -46,6 +46,16 @@ EOF end tell EOF + elif [[ "$the_app" == 'iTerm2' ]]; then + osascript <&2 false @@ -100,6 +123,19 @@ function split_tab() { end tell EOF + elif [[ "$the_app" == 'iTerm2' ]]; then + osascript <&2 false From 8ac1859f377b5292597f11f5973bae1ebc8e2dce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sat, 19 Mar 2016 20:46:36 +0100 Subject: [PATCH 179/537] Update GitHub download URLs in README From `raw.github.com' to `raw.githubusercontent.com' Fixes #4933 --- README.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.markdown b/README.markdown index 843c0c6b..b7d30411 100644 --- a/README.markdown +++ b/README.markdown @@ -26,13 +26,13 @@ Oh My Zsh is installed by running one of the following commands in your terminal #### via curl ```shell -sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" +sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" ``` #### via wget ```shell -sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)" +sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)" ``` ## Using Oh My Zsh From 097cc70f7bf375b8ed9cff73e0c23e5dabd825c7 Mon Sep 17 00:00:00 2001 From: "Antonis Karamitros @antouank" Date: Thu, 24 Mar 2016 07:28:26 +0000 Subject: [PATCH 180/537] [feature/npm-outdated] - add alias for "npm outdated" to check outdated npm modules --- plugins/npm/npm.plugin.zsh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/npm/npm.plugin.zsh b/plugins/npm/npm.plugin.zsh index 3f6fe0fb..38e699ea 100644 --- a/plugins/npm/npm.plugin.zsh +++ b/plugins/npm/npm.plugin.zsh @@ -17,3 +17,6 @@ alias npmD="npm i -D " # Execute command from node_modules folder based on current directory # i.e npmE gulp alias npmE='PATH="$(npm bin)":"$PATH"' + +# Check which npm modules are outdated +alias npmO="npm outdated" From 9cc3e8bf29f08f89279ee1e2e86f89759c02ad4f Mon Sep 17 00:00:00 2001 From: Yad Smood Date: Thu, 24 Mar 2016 15:29:24 +0800 Subject: [PATCH 181/537] Optimize the ys.zsh-theme make it simpler --- themes/ys.zsh-theme | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/themes/ys.zsh-theme b/themes/ys.zsh-theme index 737b506b..89d5355d 100644 --- a/themes/ys.zsh-theme +++ b/themes/ys.zsh-theme @@ -35,16 +35,16 @@ ys_hg_prompt_info() { fi } -local exit_code="%(?,%?,%{$fg[red]%}%?%{$reset_color%})" +local exit_code="%(?,,C:%{$fg[red]%}%?%{$reset_color%})" # Prompt format: # -# PRIVILEGES USER @ MACHINE in DIRECTORY on git:BRANCH STATE [TIME] tty:$TTY L:$SHELL_LEVEL N:LINE_NUM C:LAST_EXIT_CODE +# PRIVILEGES USER @ MACHINE in DIRECTORY on git:BRANCH STATE [TIME] C:LAST_EXIT_CODE # $ COMMAND # # For example: # -# % ys @ ys-mbp in ~/.oh-my-zsh on git:master x [21:47:42] tty:s000 L:1 N:12 C:0 +# % ys @ ys-mbp in ~/.oh-my-zsh on git:master x [21:47:42] C:0 # $ PROMPT=" %{$terminfo[bold]$fg[blue]%}#%{$reset_color%} \ @@ -56,5 +56,5 @@ PROMPT=" ${hg_info}\ ${git_info}\ \ -%{$fg[white]%}[%*] tty:%l L:%L N:%i C:$exit_code +%{$fg[white]%}[%*] $exit_code %{$terminfo[bold]$fg[red]%}$ %{$reset_color%}" From e0246ed5b7c210d4a395a77a5befb44248501989 Mon Sep 17 00:00:00 2001 From: Aaron Brager Date: Thu, 24 Mar 2016 10:53:49 -0500 Subject: [PATCH 182/537] Remove "Mac" from "Mac OS X" --- README.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.markdown b/README.markdown index b7d30411..ca18bc9b 100644 --- a/README.markdown +++ b/README.markdown @@ -12,9 +12,9 @@ To learn more, visit [ohmyz.sh](http://ohmyz.sh) and follow [@ohmyzsh](https://t ### Prerequisites -__Disclaimer:__ _Oh My Zsh works best on Mac OS X and Linux._ +__Disclaimer:__ _Oh My Zsh works best on OS X and Linux._ -* Unix-based operating system (Mac OS X or Linux) +* Unix-based operating system (OS X or Linux) * [Zsh](http://www.zsh.org) should be installed (v4.3.9 or more recent). If not pre-installed (`zsh --version` to confirm), check the following instruction here: [Installing ZSH](https://github.com/robbyrussell/oh-my-zsh/wiki/Installing-ZSH) * `curl` or `wget` should be installed * `git` should be installed From 186f009ecc2362bb8c44eacfdd0adaa27f6b866a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 24 Mar 2016 23:34:41 +0100 Subject: [PATCH 183/537] Update README.markdown --- README.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index ca18bc9b..0cbea72c 100644 --- a/README.markdown +++ b/README.markdown @@ -104,7 +104,7 @@ The default location is `~/.oh-my-zsh` (hidden in your home directory) If you'd like to change the install directory with the `ZSH` environment variable, either by running `export ZSH=/your/path` before installing, or by setting it before the end of the install pipeline like this: ```shell -export ZSH="$HOME/.dotfiles/oh-my-zsh"; sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" +export ZSH="$HOME/.dotfiles/oh-my-zsh"; sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" ``` #### Manual Installation From fc897734138475ac3a6548b856ddf4741ef40c07 Mon Sep 17 00:00:00 2001 From: Matthew Lewin Date: Fri, 25 Mar 2016 11:57:09 -0700 Subject: [PATCH 184/537] Update 'tm' function to take multiple files on the command-line --- plugins/textmate/textmate.plugin.zsh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/plugins/textmate/textmate.plugin.zsh b/plugins/textmate/textmate.plugin.zsh index 02813de9..17451101 100644 --- a/plugins/textmate/textmate.plugin.zsh +++ b/plugins/textmate/textmate.plugin.zsh @@ -1,13 +1,14 @@ # If the tm command is called without an argument, open TextMate in the current directory # If tm is passed a directory, cd to it and open it in TextMate -# If tm is passed a file, open it in TextMate +# If tm is passed anything else (i.e., a list of files and/or options), pass them all along +# This allows easy opening of multiple files. function tm() { if [[ -z $1 ]]; then mate . - else + elif [[ -d $1 ]]; then mate $1 - if [[ -d $1 ]]; then - cd $1 - fi + cd $1 + else + mate "$@" fi } From 616ac67924212df2f75139c94ca323f13f249dc6 Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Wed, 30 Mar 2016 02:05:07 -0400 Subject: [PATCH 185/537] Add 'asdf' plugin --- plugins/asdf/README.md | 27 +++++++++++++++++++++++++++ plugins/asdf/asdf.plugin.zsh | 7 +++++++ 2 files changed, 34 insertions(+) create mode 100644 plugins/asdf/README.md create mode 100644 plugins/asdf/asdf.plugin.zsh diff --git a/plugins/asdf/README.md b/plugins/asdf/README.md new file mode 100644 index 00000000..e8aa976b --- /dev/null +++ b/plugins/asdf/README.md @@ -0,0 +1,27 @@ +## asdf + +**Maintainer:** [@RobLoach](https://github.com/RobLoach) + +Adds integration with [asdf](https://github.com/asdf-vm/asdf), the extendable version manager, with support for Ruby, Node.js, Elixir, Erlang and more. + +### Installation + +1. Enable the plugin by adding it to your `plugins` definition in `~/.zshrc`. + + ``` + plugins=(asdf) + ``` + +2. [Install asdf](https://github.com/asdf-vm/asdf#setup) by running the following: + ``` + git clone https://github.com/asdf-vm/asdf.git ~/.asdf + ``` + +### Usage + +See the [asdf usage documentation](https://github.com/asdf-vm/asdf#usage) for information on how to use asdf: + +``` +asdf plugin-add nodejs git@github.com:asdf-vm/asdf-nodejs.git +asdf install nodejs 5.9.1 +``` diff --git a/plugins/asdf/asdf.plugin.zsh b/plugins/asdf/asdf.plugin.zsh new file mode 100644 index 00000000..8736d2ff --- /dev/null +++ b/plugins/asdf/asdf.plugin.zsh @@ -0,0 +1,7 @@ +# Find where asdf should be installed. +ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}" + +# Load asdf, if found. +if [ -f $ASDF_DIR/asdf.sh ]; then + . $ASDF_DIR/asdf.sh +fi From e8a9d0ee1a97033fb4aa371263889b77200b6d62 Mon Sep 17 00:00:00 2001 From: "Jon-Erik Johnzon (TorrentKatten)" Date: Wed, 30 Mar 2016 21:46:39 +0200 Subject: [PATCH 186/537] localization support for clock in candy theme Now uses 12-hour clock or 24-hour clock depending on user locale --- themes/candy.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/candy.zsh-theme b/themes/candy.zsh-theme index bc125c5c..40e6d411 100644 --- a/themes/candy.zsh-theme +++ b/themes/candy.zsh-theme @@ -1,4 +1,4 @@ -PROMPT=$'%{$fg_bold[green]%}%n@%m %{$fg[blue]%}%D{[%I:%M:%S]} %{$reset_color%}%{$fg[white]%}[%~]%{$reset_color%} $(git_prompt_info)\ +PROMPT=$'%{$fg_bold[green]%}%n@%m %{$fg[blue]%}%D{[%X]} %{$reset_color%}%{$fg[white]%}[%~]%{$reset_color%} $(git_prompt_info)\ %{$fg[blue]%}->%{$fg_bold[blue]%} %#%{$reset_color%} ' ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}[" From 69e1506ad9fed9771b9f7d1e478ac2ff05fc3604 Mon Sep 17 00:00:00 2001 From: Aesop Wolf Date: Thu, 31 Mar 2016 14:16:46 -0700 Subject: [PATCH 187/537] Add git user profile functions for prompt display --- lib/git.zsh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/git.zsh b/lib/git.zsh index f91b516b..1c76d588 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -188,6 +188,18 @@ function git_compare_version() { echo 0 } +# Outputs the name of the current user +# Usage example: $(git_current_user_name) +function git_current_user_name() { + command git config user.name 2>/dev/null +} + +# Outputs the email of the current user +# Usage example: $(git_current_user_email) +function git_current_user_email() { + command git config user.email 2>/dev/null +} + # This is unlikely to change so make it all statically assigned POST_1_7_2_GIT=$(git_compare_version "1.7.2") # Clean up the namespace slightly by removing the checker function From e1b04cfecd87d1e39656be07df8f73a4ea113b8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Mon, 4 Apr 2016 20:39:10 +0200 Subject: [PATCH 188/537] Fix logic of bureau_git_status function This separates the gathering of file status, repository status and stash. --- themes/bureau.zsh-theme | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/themes/bureau.zsh-theme b/themes/bureau.zsh-theme index c6296500..9b1759c1 100644 --- a/themes/bureau.zsh-theme +++ b/themes/bureau.zsh-theme @@ -22,10 +22,12 @@ bureau_git_branch () { echo "${ref#refs/heads/}" } -bureau_git_status () { +bureau_git_status() { _STATUS="" - if [[ $(command git status --short 2> /dev/null) != "" ]]; then - _INDEX=$(command git status --porcelain -b 2> /dev/null) + + # check status of files + _INDEX=$(command git status --porcelain 2> /dev/null) + if [[ -n "$_INDEX" ]]; then if $(echo "$_INDEX" | command grep '^[AMRD]. ' &> /dev/null); then _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_STAGED" fi @@ -38,22 +40,26 @@ bureau_git_status () { if $(echo "$_INDEX" | command grep '^UU ' &> /dev/null); then _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNMERGED" fi - if $(command git rev-parse --verify refs/stash >/dev/null 2>&1); then - _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_STASHED" - fi - if $(echo "$_INDEX" | command grep '^## .*ahead' &> /dev/null); then - _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_AHEAD" - fi - if $(echo "$_INDEX" | command grep '^## .*behind' &> /dev/null); then - _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_BEHIND" - fi - if $(echo "$_INDEX" | command grep '^## .*diverged' &> /dev/null); then - _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_DIVERGED" - fi else _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_CLEAN" fi + # check status of local repository + _INDEX=$(command git status --porcelain -b 2> /dev/null) + if $(echo "$_INDEX" | command grep '^## .*ahead' &> /dev/null); then + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_AHEAD" + fi + if $(echo "$_INDEX" | command grep '^## .*behind' &> /dev/null); then + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_BEHIND" + fi + if $(echo "$_INDEX" | command grep '^## .*diverged' &> /dev/null); then + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_DIVERGED" + fi + + if $(command git rev-parse --verify refs/stash &> /dev/null); then + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_STASHED" + fi + echo $_STATUS } From 82a4587427ea8246bf74858ace489c81690c3c28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Mon, 4 Apr 2016 23:06:08 +0200 Subject: [PATCH 189/537] Use `grep -q` for silent behavior --- themes/bureau.zsh-theme | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/themes/bureau.zsh-theme b/themes/bureau.zsh-theme index 9b1759c1..3b3bdc80 100644 --- a/themes/bureau.zsh-theme +++ b/themes/bureau.zsh-theme @@ -28,16 +28,16 @@ bureau_git_status() { # check status of files _INDEX=$(command git status --porcelain 2> /dev/null) if [[ -n "$_INDEX" ]]; then - if $(echo "$_INDEX" | command grep '^[AMRD]. ' &> /dev/null); then + if $(echo "$_INDEX" | command grep -q '^[AMRD]. '); then _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_STAGED" fi - if $(echo "$_INDEX" | command grep '^.[MTD] ' &> /dev/null); then + if $(echo "$_INDEX" | command grep -q '^.[MTD] '); then _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNSTAGED" fi - if $(echo "$_INDEX" | command grep -E '^\?\? ' &> /dev/null); then + if $(echo "$_INDEX" | command grep -q -E '^\?\? '); then _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED" fi - if $(echo "$_INDEX" | command grep '^UU ' &> /dev/null); then + if $(echo "$_INDEX" | command grep -q '^UU '); then _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNMERGED" fi else @@ -46,13 +46,13 @@ bureau_git_status() { # check status of local repository _INDEX=$(command git status --porcelain -b 2> /dev/null) - if $(echo "$_INDEX" | command grep '^## .*ahead' &> /dev/null); then + if $(echo "$_INDEX" | command grep -q '^## .*ahead'); then _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_AHEAD" fi - if $(echo "$_INDEX" | command grep '^## .*behind' &> /dev/null); then + if $(echo "$_INDEX" | command grep -q '^## .*behind'); then _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_BEHIND" fi - if $(echo "$_INDEX" | command grep '^## .*diverged' &> /dev/null); then + if $(echo "$_INDEX" | command grep -q '^## .*diverged'); then _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_DIVERGED" fi From f28c0a81b7041e1c834dd551691ce03d10994192 Mon Sep 17 00:00:00 2001 From: Sharat M R Date: Sat, 16 Apr 2016 06:52:58 +0530 Subject: [PATCH 190/537] Moved git.io url to https git.io now redirects to https. So the current function break. Changing it to https fixes the issue. --- plugins/github/github.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/github/github.plugin.zsh b/plugins/github/github.plugin.zsh index ca19901f..0ab399c9 100644 --- a/plugins/github/github.plugin.zsh +++ b/plugins/github/github.plugin.zsh @@ -71,7 +71,7 @@ exist_gh() { # [DIRECTORY] # git.io() { emulate -L zsh - curl -i -s http://git.io -F "url=$1" | grep "Location" | cut -f 2 -d " " + curl -i -s https://git.io -F "url=$1" | grep "Location" | cut -f 2 -d " " } # End Functions ############################################################# From 19769fded2d95b1e81a72ee7ebd3d9bd53f0d422 Mon Sep 17 00:00:00 2001 From: Sebastian Gniazdowski Date: Wed, 20 Apr 2016 07:33:10 +0200 Subject: [PATCH 191/537] Don't leave positional parameters being set --- plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh b/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh index 16247b8d..4aa3aa4b 100755 --- a/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh +++ b/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh @@ -23,6 +23,9 @@ for i; do fi done +# Don't leave positional parameters being set +set -- + # # Load functions # From c1ed14189bc8f3d27a6b10e4b5feab7a2984e4a6 Mon Sep 17 00:00:00 2001 From: Tony Han Date: Wed, 20 Apr 2016 23:09:52 +0800 Subject: [PATCH 192/537] add files completion to mix test --- plugins/mix/_mix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/mix/_mix b/plugins/mix/_mix index 319932b3..3b3887b1 100644 --- a/plugins/mix/_mix +++ b/plugins/mix/_mix @@ -73,6 +73,10 @@ case $state in case $line[1] in (help) _arguments ':feature:__task_list' + ;; + (test) + _files + ;; esac ;; esac From 3524fc8de58780fd42f84b0ab543f3afc6f30a87 Mon Sep 17 00:00:00 2001 From: Nicolas Charpentier Date: Tue, 26 Apr 2016 13:08:13 -0400 Subject: [PATCH 193/537] JIRA Plugin will open rapidboard instead of dashboard if JIRA_RAPID_BOARD is true --- plugins/jira/jira.plugin.zsh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/jira/jira.plugin.zsh b/plugins/jira/jira.plugin.zsh index 341e23ec..67c98945 100644 --- a/plugins/jira/jira.plugin.zsh +++ b/plugins/jira/jira.plugin.zsh @@ -38,7 +38,11 @@ function jira() { _jira_query $@ elif [[ "$action" == "dashboard" ]]; then echo "Opening dashboard" - open_command "${jira_url}/secure/Dashboard.jspa" + if [[ "$JIRA_RAPID_BOARD" == "true" ]]; then + open_command "${jira_url}/secure/RapidBoard.jspa" + else + open_command "${jira_url}/secure/Dashboard.jspa" + fi elif [[ "$action" == "dumpconfig" ]]; then echo "JIRA_URL=$jira_url" echo "JIRA_PREFIX=$jira_prefix" @@ -99,4 +103,3 @@ function _jira_query() { query="${lookup}+%3D+%22${jira_name}%22+AND+resolution+%3D+unresolved+ORDER+BY+priority+DESC%2C+created+ASC" open_command "${jira_url}/secure/IssueNavigator.jspa?reset=true&jqlQuery=${query}" } - From 244d6b1df91e2b366eac2cf8bc86a7b9e80b55a4 Mon Sep 17 00:00:00 2001 From: Tomas Norre Mikkelsen Date: Tue, 10 May 2016 08:09:12 +0200 Subject: [PATCH 194/537] [TASK] Vagrant plugin: Add missing vagrant snapshot command Fixes issue #5022 --- plugins/vagrant/_vagrant | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/vagrant/_vagrant b/plugins/vagrant/_vagrant index 764f8954..35377bd9 100644 --- a/plugins/vagrant/_vagrant +++ b/plugins/vagrant/_vagrant @@ -26,6 +26,7 @@ _1st_arguments=( 'rsync:Syncs rsync synced folders to remote machine' 'rsync-auto:Syncs rsync synced folders automatically when files change' 'share:Shares your Vagrant environment with anyone in the world' + 'snapshot:Manage snapshots with the guest machine' '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' From 2bce3b1f588ef2a5245e7a3f4b1693c2c07d1dbc Mon Sep 17 00:00:00 2001 From: jgmdev Date: Tue, 10 May 2016 13:23:23 -0300 Subject: [PATCH 195/537] Added fossil plugin. --- plugins/fossil/README.md | 7 +++ plugins/fossil/fossil.plugin.zsh | 89 ++++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+) create mode 100644 plugins/fossil/README.md create mode 100644 plugins/fossil/fossil.plugin.zsh diff --git a/plugins/fossil/README.md b/plugins/fossil/README.md new file mode 100644 index 00000000..5bb47b7d --- /dev/null +++ b/plugins/fossil/README.md @@ -0,0 +1,7 @@ +## Fossil Plugin + +This plugin adds completion support and prompt for fossil repositories. +The prompt will display the current branch and status been dirty or clean. + +### CONTRIBUTOR + - Jefferson González ([jgmdev](https://github.com/jgmdev)) diff --git a/plugins/fossil/fossil.plugin.zsh b/plugins/fossil/fossil.plugin.zsh new file mode 100644 index 00000000..1ae166e6 --- /dev/null +++ b/plugins/fossil/fossil.plugin.zsh @@ -0,0 +1,89 @@ +_FOSSIL_PROMPT="" + +# Prefix at the very beginning of the prompt, before the branch name +ZSH_THEME_FOSSIL_PROMPT_PREFIX="%{$fg_bold[blue]%}fossil:(%{$fg_bold[red]%}" + +# At the very end of the prompt +ZSH_THEME_FOSSIL_PROMPT_SUFFIX="%{$fg_bold[blue]%})" + +# Text to display if the branch is dirty +ZSH_THEME_FOSSIL_PROMPT_DIRTY=" %{$fg_bold[red]%}✖" + +# Text to display if the branch is clean +ZSH_THEME_FOSSIL_PROMPT_CLEAN=" %{$fg_bold[green]%}✔" + +function fossil_prompt_info () { + local _OUTPUT=`fossil branch 2>&1` + local _STATUS=`echo $_OUTPUT | grep "use --repo"` + if [ "$_STATUS" = "" ]; then + local _EDITED=`fossil changes` + local _EDITED_SYM="$ZSH_THEME_FOSSIL_PROMPT_CLEAN" + local _BRANCH=`echo $_OUTPUT | grep "* " | sed 's/* //g'` + + if [ "$_EDITED" != "" ]; then + _EDITED_SYM="$ZSH_THEME_FOSSIL_PROMPT_DIRTY" + fi + + echo "$ZSH_THEME_FOSSIL_PROMPT_PREFIX" \ + "$_BRANCH" \ + "$ZSH_THEME_FOSSIL_PROMPT_SUFFIX" \ + "$_EDITED_SYM"\ + "%{$reset_color%}" + fi +} + +function _fossil_get_command_list () { + fossil help -a | grep -v "Usage|Common|This is" +} + +function _fossil () { + local context state state_descr line + typeset -A opt_args + + _arguments \ + '1: :->command'\ + '2: :->subcommand' + + case $state in + command) + local _OUTPUT=`fossil branch 2>&1 | grep "use --repo"` + if [ "$_OUTPUT" = "" ]; then + compadd `_fossil_get_command_list` + else + compadd clone init import help version + fi + ;; + subcommand) + if [ "$words[2]" = "help" ]; then + compadd `_fossil_get_command_list` + else + compcall -D + fi + ;; + esac +} + +function _fossil_prompt () { + local current=`echo $PROMPT $RPROMPT | grep fossil` + + if [ "$_FOSSIL_PROMPT" = "" -o "$current" = "" ]; then + local _prompt=${PROMPT} + local _rprompt=${RPROMPT} + + local is_prompt=`echo $PROMPT | grep git` + + if [ "$is_prompt" = "" ]; then + export RPROMPT="$_rprompt"'$(fossil_prompt_info)' + else + export PROMPT="$_prompt"'$(fossil_prompt_info) ' + fi + + _FOSSIL_PROMPT="1" + fi +} + +compdef _fossil fossil + +autoload -U add-zsh-hook + +add-zsh-hook precmd _fossil_prompt From ed484dfaf63c6d8789b2bd2e952a07bbbb9ad330 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 12 May 2016 13:22:27 +0200 Subject: [PATCH 196/537] Delete cdablevars option by default Fixes weird autocompletion of directories and named users. Fix #4864 --- lib/theme-and-appearance.zsh | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/theme-and-appearance.zsh b/lib/theme-and-appearance.zsh index ebb11fb3..8a564e4f 100644 --- a/lib/theme-and-appearance.zsh +++ b/lib/theme-and-appearance.zsh @@ -25,7 +25,6 @@ fi #setopt no_beep setopt auto_cd setopt multios -setopt cdablevars if [[ x$WINDOW != x ]] then From cc36063cfdb5e21bc18d127a09d5e0385ace68cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 12 May 2016 13:23:46 +0200 Subject: [PATCH 197/537] Cleanup theme-and-appearance.zsh --- lib/theme-and-appearance.zsh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/theme-and-appearance.zsh b/lib/theme-and-appearance.zsh index 8a564e4f..5c5bb0e6 100644 --- a/lib/theme-and-appearance.zsh +++ b/lib/theme-and-appearance.zsh @@ -11,9 +11,9 @@ then # otherwise, leave ls as is, because NetBSD's ls doesn't support -G gls --color -d . &>/dev/null 2>&1 && alias ls='gls --color=tty' elif [[ "$(uname -s)" == "OpenBSD" ]]; then - # On OpenBSD, "gls" (ls from GNU coreutils) and "colorls" (ls from base, - # with color and multibyte support) are available from ports. "colorls" - # will be installed on purpose and can't be pulled in by installing + # On OpenBSD, "gls" (ls from GNU coreutils) and "colorls" (ls from base, + # with color and multibyte support) are available from ports. "colorls" + # will be installed on purpose and can't be pulled in by installing # coreutils, so prefer it to "gls". gls --color -d . &>/dev/null 2>&1 && alias ls='gls --color=tty' colorls -G -d . &>/dev/null 2>&1 && alias ls='colorls -G' @@ -22,7 +22,6 @@ then fi fi -#setopt no_beep setopt auto_cd setopt multios From 2ad13bd94592b048602798ce270cc72ec906c13e Mon Sep 17 00:00:00 2001 From: manu Date: Wed, 23 Mar 2016 11:59:07 +0100 Subject: [PATCH 198/537] This plugin also includes tab completions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marc Cornellà --- plugins/wp-cli/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/wp-cli/README.md b/plugins/wp-cli/README.md index 1a79d60f..da398ed1 100644 --- a/plugins/wp-cli/README.md +++ b/plugins/wp-cli/README.md @@ -4,7 +4,9 @@ WordPress Command Line Interface (http://wp-cli.org/) -WP-CLI is a set of command-line tools for managing WordPress installations. You can update plugins, set up multisite installs and much more, without using a web browser. +WP-CLI is a set of command-line tools for managing WordPress installations. You can update plugins, set up multisite installs and much more, without using a web browser. + +This plugin adds [tab completion](http://wp-cli.org/#complete) for `wp-cli` as well as several aliases. ## List of Aliases From 863675f3d404e345693e8abd77f6136e171d7ed5 Mon Sep 17 00:00:00 2001 From: Vimal Raj Date: Sun, 10 Jan 2016 23:56:50 +0530 Subject: [PATCH 199/537] Add README file for mvn plugin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marc Cornellà --- plugins/mvn/README.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 plugins/mvn/README.md diff --git a/plugins/mvn/README.md b/plugins/mvn/README.md new file mode 100644 index 00000000..d521064c --- /dev/null +++ b/plugins/mvn/README.md @@ -0,0 +1,28 @@ +## The mvn Plugin + +The [mvn](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/mvn) plugin provides many [aliases](#Aliases). + +Enable it by adding _mvn_ to the [_plugins array_](https://github.com/robbyrussell/oh-my-zsh/blob/master/templates/zshrc.zsh-template#L48) before sourcing OMZ (see [Plugins](https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins)). + +## Aliases + +| Alias | Command | +|:---------------------|:------------------------------------------------------------------------------------------------------------------------------------------| +|mvncie|mvn clean install eclipse:eclipse| +|mvnci|mvn clean install| +|mvncist|mvn clean install -DskipTests| +|mvne|mvn eclipse:eclipse| +|mvnd|mvn deploy| +|mvnp|mvn package| +|mvnc|mvn clean| +|mvncom|mvn compile| +|mvnct|mvn clean test| +|mvnt|mvn test| +|mvnag|mvn archetype:generate| +|mvn-updates|mvn versions:display-dependency-updates| +|mvntc7|mvn tomcat7:run| +|mvnjetty|mvn jetty:run| +|mvndt|mvn dependency:tree| +|mvns|mvn site| +|mvnsrc|mvn dependency:sources| +|mvndocs|mvn dependency:resolve -Dclassifier=javadoc| From 30870d87ddc23b633fb99a6542768835c2a66551 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 12 May 2016 13:41:29 +0200 Subject: [PATCH 200/537] Reword and fix formatting of mvn plugin README --- plugins/mvn/README.md | 50 +++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/plugins/mvn/README.md b/plugins/mvn/README.md index d521064c..79192bb5 100644 --- a/plugins/mvn/README.md +++ b/plugins/mvn/README.md @@ -1,28 +1,32 @@ -## The mvn Plugin +## Introduction -The [mvn](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/mvn) plugin provides many [aliases](#Aliases). +The [mvn plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/mvn) provides many +[useful aliases](#aliases) as well as completion for the `mvn` command. -Enable it by adding _mvn_ to the [_plugins array_](https://github.com/robbyrussell/oh-my-zsh/blob/master/templates/zshrc.zsh-template#L48) before sourcing OMZ (see [Plugins](https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins)). +Enable it by adding `mvn` to the plugins array in your zshrc file: +```zsh +plugins=(... mvn) +``` ## Aliases -| Alias | Command | -|:---------------------|:------------------------------------------------------------------------------------------------------------------------------------------| -|mvncie|mvn clean install eclipse:eclipse| -|mvnci|mvn clean install| -|mvncist|mvn clean install -DskipTests| -|mvne|mvn eclipse:eclipse| -|mvnd|mvn deploy| -|mvnp|mvn package| -|mvnc|mvn clean| -|mvncom|mvn compile| -|mvnct|mvn clean test| -|mvnt|mvn test| -|mvnag|mvn archetype:generate| -|mvn-updates|mvn versions:display-dependency-updates| -|mvntc7|mvn tomcat7:run| -|mvnjetty|mvn jetty:run| -|mvndt|mvn dependency:tree| -|mvns|mvn site| -|mvnsrc|mvn dependency:sources| -|mvndocs|mvn dependency:resolve -Dclassifier=javadoc| +| Alias | Command | +|:---------------------|:------------------------------------------------| +| `mvncie` | `mvn clean install eclipse:eclipse` | +| `mvnci` | `mvn clean install` | +| `mvncist` | `mvn clean install -DskipTests` | +| `mvne` | `mvn eclipse:eclipse` | +| `mvnd` | `mvn deploy` | +| `mvnp` | `mvn package` | +| `mvnc` | `mvn clean` | +| `mvncom` | `mvn compile` | +| `mvnct` | `mvn clean test` | +| `mvnt` | `mvn test` | +| `mvnag` | `mvn archetype:generate` | +| `mvn-updates` | `mvn versions:display-dependency-updates` | +| `mvntc7` | `mvn tomcat7:run` | +| `mvnjetty` | `mvn jetty:run` | +| `mvndt` | `mvn dependency:tree` | +| `mvns` | `mvn site` | +| `mvnsrc` | `mvn dependency:sources` | +| `mvndocs` | `mvn dependency:resolve -Dclassifier=javadoc` | From 26a07b0ad87162805e69ce18c56627772a663aef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sun, 12 Apr 2015 00:37:35 +0200 Subject: [PATCH 201/537] Rename README.markdown to README.md for consistency --- README.markdown => README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename README.markdown => README.md (100%) diff --git a/README.markdown b/README.md similarity index 100% rename from README.markdown rename to README.md From 2198ff05e3b26532865f91a9ac1bac5fc673c05b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 12 May 2016 13:52:13 +0200 Subject: [PATCH 202/537] Rename license to LICENSE.txt for consistency --- MIT-LICENSE.txt => LICENSE.txt | 0 README.md | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename MIT-LICENSE.txt => LICENSE.txt (100%) diff --git a/MIT-LICENSE.txt b/LICENSE.txt similarity index 100% rename from MIT-LICENSE.txt rename to LICENSE.txt diff --git a/README.md b/README.md index 0cbea72c..5f152e4d 100644 --- a/README.md +++ b/README.md @@ -210,4 +210,4 @@ We have [stickers](http://shop.planetargon.com/products/ohmyzsh-stickers-set-of- ## License -Oh My Zsh is released under the [MIT license](MIT-LICENSE.txt). +Oh My Zsh is released under the [MIT license](LICENSE.txt). From 66e7e7d9ca78a5e62664abbb3c5c72e163119afb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 15 Dec 2015 11:16:02 +0100 Subject: [PATCH 203/537] Use .gitkeep files to keep cache/ and log/ directories Instead of .easter-egg files we now have empty .gitkeep files, like is done as an informal standard. --- .gitignore | 3 +++ cache/.easter-egg | 4 ---- cache/.gitkeep | 0 log/.easter-egg | 4 ---- log/.gitkeep | 0 5 files changed, 3 insertions(+), 8 deletions(-) delete mode 100644 cache/.easter-egg create mode 100644 cache/.gitkeep delete mode 100644 log/.easter-egg create mode 100644 log/.gitkeep diff --git a/.gitignore b/.gitignore index 8fa66f02..567cd4e4 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,6 @@ custom *.swp !custom/example.zshcache cache/ +!cache/.gitkeep +log/ +!log/.gitkeep diff --git a/cache/.easter-egg b/cache/.easter-egg deleted file mode 100644 index 4b6164ed..00000000 --- a/cache/.easter-egg +++ /dev/null @@ -1,4 +0,0 @@ -This file is only here so that Git will keep a cache directory as .gitignore is ignoring all the files within it. - -Feel free to add love notes for people here. - diff --git a/cache/.gitkeep b/cache/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/log/.easter-egg b/log/.easter-egg deleted file mode 100644 index 2533149e..00000000 --- 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. - diff --git a/log/.gitkeep b/log/.gitkeep new file mode 100644 index 00000000..e69de29b From 54ace41f3ce890f76cc455aac3aea0b10a467411 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sat, 1 Aug 2015 14:47:36 +0200 Subject: [PATCH 204/537] Tidy up gitignore file - `custom/example.zshcache` doesn't exist anymore: it's safe to ignore. - `*.swp` files are ignored for no apparent reason. There's nothing in the codebase that generates them. This was introduced by @lepht in commit f78218f6 on 24 May 2011. - Files `locals.zsh` and `projects.zsh` are no longer supported for putting custom configuration there. This is since commit 8debd09 where files were put in a lib/ folder, but failed to modify the .gitignore file as well. The init script was modified as well, so those files aren't even being sourced: they are safe to be deleted or ported into a custom script. --- .gitignore | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 567cd4e4..b2022081 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,8 @@ -locals.zsh -log/.zsh_history -projects.zsh -custom +# custom files +custom/ !custom/plugins/example !custom/example.zsh -*.swp -!custom/example.zshcache + +# temp files directories cache/ -!cache/.gitkeep log/ -!log/.gitkeep From 7a0d299e96a8a1707630d59859f048e9ebde9456 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 12 May 2016 13:59:10 +0200 Subject: [PATCH 205/537] Reword and clarify example.zsh custom file --- custom/example.zsh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/custom/example.zsh b/custom/example.zsh index 28ffcae2..c505a967 100644 --- a/custom/example.zsh +++ b/custom/example.zsh @@ -1,5 +1,10 @@ -# Add yourself some shortcuts to projects you often work on -# Example: +# You can put files here to add functionality separated per file, which +# will be ignored by git. +# Files on the custom/ directory will be automatically loaded by the init +# script, in alphabetical order. + +# For example: add yourself some shortcuts to projects you often work on. +# +# brainstormr=~/Projects/development/planetargon/brainstormr +# cd $brainstormr # -# brainstormr=/Users/robbyrussell/Projects/development/planetargon/brainstormr -# \ No newline at end of file From edf89bffdcf58ed2b4d530db1d3912b66bad0c4a Mon Sep 17 00:00:00 2001 From: Juan David Pastas Date: Fri, 3 Jul 2015 12:06:30 -0500 Subject: [PATCH 206/537] Add meteor plugin aliases MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marc Cornellà --- plugins/meteor/meteor.plugin.zsh | 33 ++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 plugins/meteor/meteor.plugin.zsh diff --git a/plugins/meteor/meteor.plugin.zsh b/plugins/meteor/meteor.plugin.zsh new file mode 100644 index 00000000..db55e367 --- /dev/null +++ b/plugins/meteor/meteor.plugin.zsh @@ -0,0 +1,33 @@ +# Aliases in alphabetical order + +alias ma='meteor add' # Add a package to this project. +alias map='meteor add-platform' # Add a platform to this project. +alias mad='meteor admin' # Administrative commands. +alias mau='meteor authorized' # View or change authorized users and organizations for a site. +alias mb='meteor build' # Build this project for all platforms. +alias mcl='meteor claim' # Claim a site deployed with an old Meteor version. +alias mca='meteor configure-android' # Run the Android configuration tool from Meteor's ADK environment. +alias mc='meteor create' # Create a new project. +alias mdb='meteor debug' # Run the project, but suspend the server process for debugging. +alias mde='meteor deploy' # Deploy this project to Meteor. +alias mis='meteor install-sdk' # Installs SDKs for a platform. +alias ml='meteor list' # List the packages explicitly used by your project. +alias mlp='meteor list-platforms' # List the platforms added to your project. +alias mls='meteor list-sites' # List sites for which you are authorized. +alias mli='meteor login' # Log in to your Meteor developer account. +alias mlo='meteor logout' # Log out of your Meteor developer account. +alias mlog='meteor logs' # Show logs for specified site. +alias mm='meteor mongo' # Connect to the Mongo database for the specified site. +alias mp='meteor publish' # Publish a new version of a package to the package server. +alias mpa='meteor publish-for-arch' # Builds an already-published package for a new platform. +alias mpr='meteor publish-release' # Publish a new meteor release to the package server. +alias mr='meteor remove' # Remove a package from this project. +alias mrp='meteor remove-platform' # Remove a platform from this project. +alias mre='meteor reset' # Reset the project state. Erases the local database. +alias m='meteor run' # [default] Run this project in local development mode. +alias ms='meteor search' # Search through the package server database. +alias msh='meteor shell' # Launch a Node REPL for interactively evaluating server-side code. +alias msw='meteor show' # Show detailed information about a release or package. +alias mt='meteor test-packages' # Test one or more packages. +alias mu='meteor update' # Upgrade this project's dependencies to their latest versions. +alias mw='meteor whoami' # Prints the username of your Meteor developer account. From 52723876f95a5b9cd7e4a07c6596a6d42b6be56f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 12 May 2016 17:06:44 +0200 Subject: [PATCH 207/537] Add README to meteor plugin --- plugins/meteor/README.md | 45 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 plugins/meteor/README.md diff --git a/plugins/meteor/README.md b/plugins/meteor/README.md new file mode 100644 index 00000000..4bee87f8 --- /dev/null +++ b/plugins/meteor/README.md @@ -0,0 +1,45 @@ +## Introduction + +The [meteor plugin](https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/meteor) provides many +[useful aliases](#aliases) as well as completion for the `meteor` command. + +Enable it by adding `meteor` to the plugins array in your zshrc file: +```zsh +plugins=(... meteor) +``` + +## Aliases + +| Alias | Command | Description | +|---------|----------------------------|------------------------------------------------------------------| +| `ma` | `meteor add` | Add a package to this project | +| `map` | `meteor add-platform` | Add a platform to this project | +| `mad` | `meteor admin` | Administrative commands | +| `mau` | `meteor authorized` | View or change authorized users and organizations for a site | +| `mb` | `meteor build` | Build this project for all platforms | +| `mcl` | `meteor claim` | Claim a site deployed with an old Meteor version | +| `mca` | `meteor configure-android` | Run the Android configuration tool from Meteor's ADK environment | +| `mc` | `meteor create` | Create a new project | +| `mdb` | `meteor debug` | Run the project, but suspend the server process for debugging | +| `mde` | `meteor deploy` | Deploy this project to Meteor | +| `mis` | `meteor install-sdk` | Installs SDKs for a platform | +| `ml` | `meteor list` | List the packages explicitly used by your project | +| `mlp` | `meteor list-platforms` | List the platforms added to your project | +| `mls` | `meteor list-sites` | List sites for which you are authorized | +| `mli` | `meteor login` | Log in to your Meteor developer account | +| `mlo` | `meteor logout` | Log out of your Meteor developer account | +| `mlog` | `meteor logs` | Show logs for specified site | +| `mm` | `meteor mongo` | Connect to the Mongo database for the specified site | +| `mp` | `meteor publish` | Publish a new version of a package to the package server | +| `mpa` | `meteor publish-for-arch` | Builds an already-published package for a new platform | +| `mpr` | `meteor publish-release` | Publish a new meteor release to the package server | +| `mr` | `meteor remove` | Remove a package from this project | +| `mrp` | `meteor remove-platform` | Remove a platform from this project | +| `mre` | `meteor reset` | Reset the project state. Erases the local database | +| `m` | `meteor run` | **[default]** Run this project in local development mode | +| `ms` | `meteor search` | Search through the package server database | +| `msh` | `meteor shell` | Launch a Node REPL for interactively evaluating server-side code | +| `msw` | `meteor show` | Show detailed information about a release or package | +| `mt` | `meteor test-packages` | Test one or more packages | +| `mu` | `meteor update` | Upgrade this project's dependencies to their latest versions | +| `mw` | `meteor whoami` | Prints the username of your Meteor developer account | From 5aa7e0f60049b6501d3587dcd4355706ce1cbe34 Mon Sep 17 00:00:00 2001 From: Shang Yehua Date: Sat, 14 May 2016 18:14:34 +0800 Subject: [PATCH 208/537] Add mvn options to ignore test failures (#5092) add "-Dmaven.test.failure.ignore=true" . This option will not ignore all tests but ignore the failures when run tests. See http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#testFailureIgnore --- plugins/mvn/mvn.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index 8324c495..7aaab0e1 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -171,7 +171,7 @@ function listMavenCompletions { gwt:browser gwt:clean gwt:compile gwt:compile-report gwt:css gwt:debug gwt:eclipse gwt:eclipseTest gwt:generateAsync gwt:help gwt:i18n gwt:mergewebxml gwt:resources gwt:run gwt:sdkInstall gwt:source-jar gwt:soyc gwt:test # options - -Dmaven.test.skip=true -DskipTests -Dmaven.surefire.debug -DenableCiProfile -Dpmd.skip=true -Dcheckstyle.skip=true -Dtycho.mode=maven + -Dmaven.test.skip=true -DskipTests -Dmaven.surefire.debug -DenableCiProfile -Dpmd.skip=true -Dcheckstyle.skip=true -Dtycho.mode=maven -Dmaven.test.failure.ignore=true # arguments -am -amd -B -C -c -cpu -D -e -emp -ep -f -fae -ff -fn -gs -h -l -N -npr -npu -nsu -o -P -pl -q -rf -s -T -t -U -up -V -v -X From 615af65087d94fd6474f666c1ab0e11efc65a7f5 Mon Sep 17 00:00:00 2001 From: Wanbok Choi Date: Sat, 14 May 2016 20:45:55 +0900 Subject: [PATCH 209/537] Add 'gcn!' for the '--no-edit' option. (#4830) Remove the '-s' option from 'gcan!' Add 'gcans!'. It is the same as the current 'gcan! -s'. --- plugins/git/git.plugin.zsh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 95ce1ae2..220bf259 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -58,9 +58,11 @@ alias gbss='git bisect start' alias gc='git commit -v' alias gc!='git commit -v --amend' +alias gcn!='git commit -v --no-edit --amend' alias gca='git commit -v -a' alias gca!='git commit -v -a --amend' -alias gcan!='git commit -v -a -s --no-edit --amend' +alias gcan!='git commit -v -a --no-edit --amend' +alias gcans!='git commit -v -a -s --no-edit --amend' alias gcam='git commit -a -m' alias gcb='git checkout -b' alias gcf='git config --list' From 621eb21139512cb0e00fbc5a9b9d215308eba720 Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Sat, 14 May 2016 17:19:26 +0200 Subject: [PATCH 210/537] Fix deprecated usage (#5050) When using the command alias `sfcontainer` or `sfrouter`, the following warning occurs: > ! [CAUTION] The use of "container:debug" command is deprecated since version 2.7 and will be removed in 3.0. Use the > ! "debug:container" instead. --- plugins/symfony2/symfony2.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/symfony2/symfony2.plugin.zsh b/plugins/symfony2/symfony2.plugin.zsh index fe236a29..c2a1affa 100644 --- a/plugins/symfony2/symfony2.plugin.zsh +++ b/plugins/symfony2/symfony2.plugin.zsh @@ -22,8 +22,8 @@ alias sf='`_symfony_console`' alias sfcl='sf cache:clear' alias sfsr='sf server:run -vvv' alias sfcw='sf cache:warmup' -alias sfroute='sf router:debug' -alias sfcontainer='sf container:debug' +alias sfroute='sf debug:router' +alias sfcontainer='sf debug:container' alias sfgb='sf generate:bundle' alias sfdev='sf --env=dev' alias sfprod='sf --env=prod' From b1ab13d9e63b3c7cc1f30d2712a44c50e5acccf8 Mon Sep 17 00:00:00 2001 From: Pierre Dimitrou Date: Sat, 14 May 2016 22:05:35 +0200 Subject: [PATCH 211/537] Add rbenv support for ruby version display --- themes/avit.zsh-theme | 2 ++ 1 file changed, 2 insertions(+) diff --git a/themes/avit.zsh-theme b/themes/avit.zsh-theme index 87d5be30..4f0dcbcc 100644 --- a/themes/avit.zsh-theme +++ b/themes/avit.zsh-theme @@ -41,6 +41,8 @@ function _vi_status() { function _ruby_version() { if {echo $fpath | grep -q "plugins/rvm"}; then echo "%{$fg[grey]%}$(rvm_prompt_info)%{$reset_color%}" + elif {echo $fpath | grep -q "plugins/rbenv"}; then + echo "%{$fg[grey]%}$(rbenv_prompt_info)%{$reset_color%}" fi } From e2d157d5895717e983e5cc4e5df792a6a5dbe0ac Mon Sep 17 00:00:00 2001 From: Sebastian Gniazdowski Date: Sat, 30 Apr 2016 15:16:00 +0200 Subject: [PATCH 212/537] znt: update to v2.1.15 --- .../.config/znt/n-aliases.conf | 34 +- .../.config/znt/n-cd.conf | 52 ++- .../.config/znt/n-env.conf | 35 +- .../.config/znt/n-functions.conf | 37 +- .../.config/znt/n-history.conf | 37 +- .../.config/znt/n-kill.conf | 39 ++- .../.config/znt/n-list.conf | 54 ++- .../.config/znt/n-options.conf | 35 +- .../.config/znt/n-panelize.conf | 35 +- plugins/zsh-navigation-tools/README.md | 81 ++++- plugins/zsh-navigation-tools/_n-kill | 41 +++ plugins/zsh-navigation-tools/n-aliases | 4 +- plugins/zsh-navigation-tools/n-cd | 17 +- plugins/zsh-navigation-tools/n-env | 4 +- plugins/zsh-navigation-tools/n-functions | 4 +- plugins/zsh-navigation-tools/n-help | 96 +++++ plugins/zsh-navigation-tools/n-history | 331 +++++++++++++++++- plugins/zsh-navigation-tools/n-kill | 4 +- plugins/zsh-navigation-tools/n-list | 139 ++++++-- plugins/zsh-navigation-tools/n-list-draw | 14 +- plugins/zsh-navigation-tools/n-list-input | 157 ++++++++- plugins/zsh-navigation-tools/n-options | 4 +- plugins/zsh-navigation-tools/n-panelize | 4 +- .../zsh-navigation-tools/znt-history-widget | 8 + .../zsh-navigation-tools.plugin.zsh | 23 +- 25 files changed, 1178 insertions(+), 111 deletions(-) create mode 100644 plugins/zsh-navigation-tools/_n-kill create mode 100644 plugins/zsh-navigation-tools/n-help diff --git a/plugins/zsh-navigation-tools/.config/znt/n-aliases.conf b/plugins/zsh-navigation-tools/.config/znt/n-aliases.conf index 98f4625f..047b017e 100644 --- a/plugins/zsh-navigation-tools/.config/znt/n-aliases.conf +++ b/plugins/zsh-navigation-tools/.config/znt/n-aliases.conf @@ -1,5 +1,33 @@ # How should be current element of the list drawn. Possible values: reverse, -# underline. Default (without option set) is reverse +# underline. # On Linux virtual terminal this will be enforced to reverse (because of poor -# underline support on that terminal) -# local active_text=underline +# underline support on that terminal). The same for screen/tmux. +local active_text=reverse + + + + + + +# +# Zshrc integration. All below variables can +# be set in zshrc and will have precedence +# over config files +# + +# 1. znt_aliases_active_text +active_text=${znt_aliases_active_text:-$active_text} + +# 2. znt_aliases_nlist_coloring_pattern +NLIST_COLORING_PATTERN=${znt_aliases_nlist_coloring_pattern:-$NLIST_COLORING_PATTERN} + +# 3. znt_aliases_nlist_coloring_color +NLIST_COLORING_COLOR=${znt_aliases_nlist_coloring_color:-$NLIST_COLORING_COLOR} + +# 4. znt_aliases_nlist_coloring_match_multiple +NLIST_COLORING_MATCH_MULTIPLE=${znt_aliases_nlist_coloring_match_multiple:-$NLIST_COLORING_MATCH_MULTIPLE} + +# 5. znt_aliases_keywords (array) +if (( ${+znt_aliases_keywords} )); then + keywords=( "${znt_aliases_keywords[@]}" ) +fi diff --git a/plugins/zsh-navigation-tools/.config/znt/n-cd.conf b/plugins/zsh-navigation-tools/.config/znt/n-cd.conf index 7ed7828e..8271e5d9 100644 --- a/plugins/zsh-navigation-tools/.config/znt/n-cd.conf +++ b/plugins/zsh-navigation-tools/.config/znt/n-cd.conf @@ -1,6 +1,6 @@ # Hotlist -# Try to use $ZSH_VERSION, e.g. /usr/share/zsh/$ZSH_VERSION/functions -local hotlist +# Can use e.g. $ZSH_VERSION, e.g. /usr/share/zsh/$ZSH_VERSION/functions +local -a hotlist hotlist=( ~/.config/znt /usr/share/zsh/site-functions @@ -8,6 +8,7 @@ hotlist=( /usr/local/share/zsh/site-functions /usr/local/share/zsh /usr/local/bin + /usr/lib ) # Suppress adding (to directory stack) directories visited by n-cd @@ -15,12 +16,53 @@ hotlist=( local NCD_DONT_PUSHD=0 # How should be current element of the list drawn. Possible values: reverse, -# underline. Default (without option set) is reverse +# underline. # On Linux virtual terminal this will be enforced to reverse (because of poor -# underline support on that terminal) -# local active_text=underline +# underline support on that terminal). The same for screen/tmux. +local active_text=reverse # Colorize last segments of the paths # (#s) is ^, (#e) is $, # is *, ## is + (comparing to regex) local NLIST_COLORING_PATTERN="[a-zA-Z0-9 ._-]##/#(#e)" local NLIST_COLORING_COLOR=$'\x1b[00;33m' + +# Search keywords, iterated with F2 or Ctrl-X or Ctrl-/ +local -a keywords +keywords=( "zsh" "local" "git" ) + + + + + + + +# +# Zshrc integration. All below variables can +# be set in zshrc and will have precedence +# over config files +# + +# 1. znt_cd_hotlist (array) +if (( ${+znt_cd_hotlist} )); then + hotlist=( "${znt_cd_hotlist[@]}" ) +fi + +# 2. znt_cd_dont_pushd +NCD_DONT_PUSHD=${znt_cd_dont_pushd:-$NCD_DONT_PUSHD} + +# 3. znt_cd_active_text +active_text=${znt_cd_active_text:-$active_text} + +# 4. znt_cd_nlist_coloring_pattern +NLIST_COLORING_PATTERN=${znt_cd_nlist_coloring_pattern:-$NLIST_COLORING_PATTERN} + +# 5. znt_cd_nlist_coloring_color +NLIST_COLORING_COLOR=${znt_cd_nlist_coloring_color:-$NLIST_COLORING_COLOR} + +# 6. znt_cd_nlist_coloring_match_multiple +NLIST_COLORING_MATCH_MULTIPLE=${znt_cd_nlist_coloring_match_multiple:-$NLIST_COLORING_MATCH_MULTIPLE} + +# 7. znt_cd_keywords (array) +if (( ${+znt_cd_keywords} )); then + keywords=( "${znt_cd_keywords[@]}" ) +fi diff --git a/plugins/zsh-navigation-tools/.config/znt/n-env.conf b/plugins/zsh-navigation-tools/.config/znt/n-env.conf index 0c4bdce6..85dda05e 100644 --- a/plugins/zsh-navigation-tools/.config/znt/n-env.conf +++ b/plugins/zsh-navigation-tools/.config/znt/n-env.conf @@ -1,9 +1,38 @@ # How should be current element of the list drawn. Possible values: reverse, -# underline. Default (without option set) is reverse +# underline. # On Linux virtual terminal this will be enforced to reverse (because of poor -# underline support on that terminal) -# local active_text=underline +# underline support on that terminal). The same for screen/tmux. +local active_text=reverse # (#s) is ^, (#e) is $, # is *, ## is + (comparing to regex) local NLIST_COLORING_PATTERN="[a-zA-Z0-9_]##" local NLIST_COLORING_MATCH_MULTIPLE=0 + + + + + + + +# +# Zshrc integration. All below variables can +# be set in zshrc and will have precedence +# over config files +# + +# 1. znt_env_active_text +active_text=${znt_env_active_text:-$active_text} + +# 2. znt_env_nlist_coloring_pattern +NLIST_COLORING_PATTERN=${znt_env_nlist_coloring_pattern:-$NLIST_COLORING_PATTERN} + +# 3. znt_env_nlist_coloring_color +NLIST_COLORING_COLOR=${znt_env_nlist_coloring_color:-$NLIST_COLORING_COLOR} + +# 4. znt_env_nlist_coloring_match_multiple +NLIST_COLORING_MATCH_MULTIPLE=${znt_env_nlist_coloring_match_multiple:-$NLIST_COLORING_MATCH_MULTIPLE} + +# 5. znt_env_keywords (array) +if (( ${+znt_env_keywords} )); then + keywords=( "${znt_env_keywords[@]}" ) +fi diff --git a/plugins/zsh-navigation-tools/.config/znt/n-functions.conf b/plugins/zsh-navigation-tools/.config/znt/n-functions.conf index 93d31e8f..d032e278 100644 --- a/plugins/zsh-navigation-tools/.config/znt/n-functions.conf +++ b/plugins/zsh-navigation-tools/.config/znt/n-functions.conf @@ -4,7 +4,38 @@ local feditor="zed" # local feditor="vared" # How should be current element of the list drawn. Possible values: reverse, -# underline. Default (without option set) is reverse +# underline. # On Linux virtual terminal this will be enforced to reverse (because of poor -# underline support on that terminal) -# local active_text=underline +# underline support on that terminal). The same for screen/tmux. +local active_text=reverse + + + + + + +# +# Zshrc integration. All below variables can +# be set in zshrc and will have precedence +# over config files +# + +# 1. znt_functions_feditor +feditor=${znt_functions_feditor:-$feditor} + +# 2. znt_functions_active_text +active_text=${znt_functions_active_text:-$active_text} + +# 3. znt_functions_nlist_coloring_pattern +NLIST_COLORING_PATTERN=${znt_functions_nlist_coloring_pattern:-$NLIST_COLORING_PATTERN} + +# 4. znt_functions_nlist_coloring_color +NLIST_COLORING_COLOR=${znt_functions_nlist_coloring_color:-$NLIST_COLORING_COLOR} + +# 5. znt_functions_nlist_coloring_match_multiple +NLIST_COLORING_MATCH_MULTIPLE=${znt_functions_nlist_coloring_match_multiple:-$NLIST_COLORING_MATCH_MULTIPLE} + +# 6. znt_functions_keywords (array) +if (( ${+znt_functions_keywords} )); then + keywords=( "${znt_functions_keywords[@]}" ) +fi diff --git a/plugins/zsh-navigation-tools/.config/znt/n-history.conf b/plugins/zsh-navigation-tools/.config/znt/n-history.conf index 5d4bad82..d7c69e15 100644 --- a/plugins/zsh-navigation-tools/.config/znt/n-history.conf +++ b/plugins/zsh-navigation-tools/.config/znt/n-history.conf @@ -1,10 +1,43 @@ # How should be current element of the list drawn. Possible values: reverse, -# underline. Default (without option set) is reverse +# underline. # On Linux virtual terminal this will be enforced to reverse (because of poor -# underline support on that terminal) +# underline support on that terminal). The same for screen/tmux. local active_text=underline # Highlight a few keywords local NLIST_COLORING_PATTERN="(while|for |sudo|make|(#s)git|vim(#e)|vim |emacs(#e)|emacs )" local NLIST_COLORING_COLOR=$'\x1b[00;33m' local NLIST_COLORING_MATCH_MULTIPLE=1 + +# Search keywords, iterated with F2 or Ctrl-X or Ctrl-/ +local -a keywords +keywords=( "git" "vim" "mplayer" ) + + + + + + + +# +# Zshrc integration. All below variables can +# be set in zshrc and will have precedence +# over config files +# + +# 1. znt_history_active_text +active_text=${znt_history_active_text:-$active_text} + +# 2. znt_history_nlist_coloring_pattern +NLIST_COLORING_PATTERN=${znt_history_nlist_coloring_pattern:-$NLIST_COLORING_PATTERN} + +# 3. znt_history_nlist_coloring_color +NLIST_COLORING_COLOR=${znt_history_nlist_coloring_color:-$NLIST_COLORING_COLOR} + +# 4. znt_history_nlist_coloring_match_multiple +NLIST_COLORING_MATCH_MULTIPLE=${znt_history_nlist_coloring_match_multiple:-$NLIST_COLORING_MATCH_MULTIPLE} + +# 5. znt_history_keywords (array) +if (( ${+znt_history_keywords} )); then + keywords=( "${znt_history_keywords[@]}" ) +fi diff --git a/plugins/zsh-navigation-tools/.config/znt/n-kill.conf b/plugins/zsh-navigation-tools/.config/znt/n-kill.conf index f1c4f02d..deb2a3fd 100644 --- a/plugins/zsh-navigation-tools/.config/znt/n-kill.conf +++ b/plugins/zsh-navigation-tools/.config/znt/n-kill.conf @@ -1,8 +1,8 @@ # How should be current element of the list drawn. Possible values: reverse, -# underline. Default (without option set) is reverse +# underline. # On Linux virtual terminal this will be enforced to reverse (because of poor -# underline support on that terminal) -# local active_text=underline +# underline support on that terminal). The same for screen/tmux. +local active_text=reverse # Colorize first number column and last path segment # This doesn't cover scripts named "[0-9]## *", which should be very rare @@ -11,3 +11,36 @@ local NLIST_COLORING_PATTERN="((#s) #[0-9]## |[[][^]]#](#e)|[^ 0-9/?\\\\][^/\\\\]#(#e)|[^ /\\\\]##[^0-9/\\\\ ]##[^/\\\\]#(#e))" local NLIST_COLORING_COLOR=$'\x1b[00;33m' local NLIST_COLORING_MATCH_MULTIPLE=1 + +# Search keywords, iterated with F2 or Ctrl-X or Ctrl-/ +local -a keywords +keywords=( "vim" "git" "git commit" "firefox" "mplayer" ) + + + + + + + +# +# Zshrc integration. All below variables can +# be set in zshrc and will have precedence +# over config files +# + +# 1. znt_kill_active_text +active_text=${znt_kill_active_text:-$active_text} + +# 2. znt_kill_nlist_coloring_pattern +NLIST_COLORING_PATTERN=${znt_kill_nlist_coloring_pattern:-$NLIST_COLORING_PATTERN} + +# 3. znt_kill_nlist_coloring_color +NLIST_COLORING_COLOR=${znt_kill_nlist_coloring_color:-$NLIST_COLORING_COLOR} + +# 4. znt_kill_nlist_coloring_match_multiple +NLIST_COLORING_MATCH_MULTIPLE=${znt_kill_nlist_coloring_match_multiple:-$NLIST_COLORING_MATCH_MULTIPLE} + +# 5. znt_kill_keywords (array) +if (( ${+znt_kill_keywords} )); then + keywords=( "${znt_kill_keywords[@]}" ) +fi diff --git a/plugins/zsh-navigation-tools/.config/znt/n-list.conf b/plugins/zsh-navigation-tools/.config/znt/n-list.conf index cf9d2a3b..68f5668f 100644 --- a/plugins/zsh-navigation-tools/.config/znt/n-list.conf +++ b/plugins/zsh-navigation-tools/.config/znt/n-list.conf @@ -1,3 +1,55 @@ # Should the list (text, borders) be drawn in bold # Value 1 is the default -local bold=1 +local bold=0 + +# Main color pair (foreground/background) +local colorpair="white/black" + +# Should draw the border? +local border=1 + +# Combinations of colors to try out with Ctrl-T and Ctrl-G +# The last number is the bold option, 0 or 1 +local -a themes +themes=( "white/black/1" "green/black/0" "green/black/1" "white/blue/0" "white/blue/1" + "magenta/black/0" "magenta/black/1" ) + +# Uncomment when using new (>5.2) Zsh version that supports 256 colors in zcurses +#themes=( "white/17/0" "10/17/1" "white/24/1" "white/22/0" "white/22/1" "white/25/0" "white/25/1" +# "white/59/0" "white/59/1" "white/60/0" "white/60/1" "white/61/0" "white/61/1" "black/65/0" +# "black/244/0" ) + +# When 1, pressing enter when in search mode will not +# only leave the mode, but also do selection and leave +# n-history +local NLIST_INSTANT_SELECT=0 + + + + + + + +# +# Zshrc integration. All below variables can +# be set in zshrc and will have precedence +# over config files +# + +# 1. znt_list_bold +bold=${znt_list_bold:-$bold} + +# 2. znt_list_colorpair +colorpair=${znt_list_colorpair:-$colorpair} + +# 3. znt_list_border +border=${znt_list_border:-$border} + +# 4. znt_list_themes (array) +if (( ${+znt_list_themes} )); then + themes=( "${znt_list_themes[@]}" ) +fi + +# 5. znt_list_instant_select +NLIST_INSTANT_SELECT=${znt_list_instant_select:-$NLIST_INSTANT_SELECT} + diff --git a/plugins/zsh-navigation-tools/.config/znt/n-options.conf b/plugins/zsh-navigation-tools/.config/znt/n-options.conf index 98f4625f..29c5e089 100644 --- a/plugins/zsh-navigation-tools/.config/znt/n-options.conf +++ b/plugins/zsh-navigation-tools/.config/znt/n-options.conf @@ -1,5 +1,34 @@ # How should be current element of the list drawn. Possible values: reverse, -# underline. Default (without option set) is reverse +# underline. # On Linux virtual terminal this will be enforced to reverse (because of poor -# underline support on that terminal) -# local active_text=underline +# underline support on that terminal). The same for screen/tmux. +local active_text=reverse + + + + + + + +# +# Zshrc integration. All below variables can +# be set in zshrc and will have precedence +# over config files +# + +# 1. znt_options_active_text +active_text=${znt_options_active_text:-$active_text} + +# 2. znt_options_nlist_coloring_pattern +NLIST_COLORING_PATTERN=${znt_options_nlist_coloring_pattern:-$NLIST_COLORING_PATTERN} + +# 3. znt_options_nlist_coloring_color +NLIST_COLORING_COLOR=${znt_options_nlist_coloring_color:-$NLIST_COLORING_COLOR} + +# 4. znt_options_nlist_coloring_match_multiple +NLIST_COLORING_MATCH_MULTIPLE=${znt_options_nlist_coloring_match_multiple:-$NLIST_COLORING_MATCH_MULTIPLE} + +# 5. znt_options_keywords (array) +if (( ${+znt_options_keywords} )); then + keywords=( "${znt_options_keywords[@]}" ) +fi diff --git a/plugins/zsh-navigation-tools/.config/znt/n-panelize.conf b/plugins/zsh-navigation-tools/.config/znt/n-panelize.conf index 98f4625f..58ce1b62 100644 --- a/plugins/zsh-navigation-tools/.config/znt/n-panelize.conf +++ b/plugins/zsh-navigation-tools/.config/znt/n-panelize.conf @@ -1,5 +1,34 @@ # How should be current element of the list drawn. Possible values: reverse, -# underline. Default (without option set) is reverse +# underline. # On Linux virtual terminal this will be enforced to reverse (because of poor -# underline support on that terminal) -# local active_text=underline +# underline support on that terminal). The same for screen/tmux. +local active_text=reverse + + + + + + + +# +# Zshrc integration. All below variables can +# be set in zshrc and will have precedence +# over config files +# + +# 1. znt_panelize_active_text +active_text=${znt_panelize_active_text:-$active_text} + +# 2. znt_panelize_nlist_coloring_pattern +NLIST_COLORING_PATTERN=${znt_panelize_nlist_coloring_pattern:-$NLIST_COLORING_PATTERN} + +# 3. znt_panelize_nlist_coloring_color +NLIST_COLORING_COLOR=${znt_panelize_nlist_coloring_color:-$NLIST_COLORING_COLOR} + +# 4. znt_panelize_nlist_coloring_match_multiple +NLIST_COLORING_MATCH_MULTIPLE=${znt_panelize_nlist_coloring_match_multiple:-$NLIST_COLORING_MATCH_MULTIPLE} + +# 5. znt_panelize_keywords (array) +if (( ${+znt_panelize_keywords} )); then + keywords=( "${znt_panelize_keywords[@]}" ) +fi diff --git a/plugins/zsh-navigation-tools/README.md b/plugins/zsh-navigation-tools/README.md index 32a86bba..7a679fe6 100644 --- a/plugins/zsh-navigation-tools/README.md +++ b/plugins/zsh-navigation-tools/README.md @@ -1,6 +1,6 @@ # Zsh Navigation Tools -http://imageshack.com/a/img633/7967/ps6rKR.png +https://raw.githubusercontent.com/psprint/zsh-navigation-tools/master/doc/img/n-history2.png Set of tools like n-history – multi-word history searcher, n-cd – directory bookmark manager, n-kill – htop like kill utility, and more. Based on @@ -32,6 +32,26 @@ to key combinations (no need for autoload when using Oh My Zsh): Oh My Zsh stores history into ~/.zsh_history. When you switch to OMZ you could want to copy your previous data (from e.g. ~/.zhistory) into the new location. +## News + +* 30-04-2016 + - New feature: color themes. Use Ctrl-T and Ctrl-G to browse predefined + themes. They are listed in ~/.config/znt/n-list.conf. Use the file to + permanently set a color scheme. Also, I sent a patch to Zsh developers + and starting from Zsh > 5.2 (not yet released) supported will be 256 colors. + The file ~/.config/znt/n-list.conf already has set of 256-color themes prepared :) + +* 29-04-2016 + - New feature: private history – n-history tracks selected history entries, + exposes them via new view (activated with F1) + +* 28-04-2016 + - New features: + 1. New n-history view (activated with F1): Most Frequent History Words + 2. Predefined search keywords – use F2 to quickly search for chosen + keywords (video: [https://youtu.be/DN9QqssAYB8](https://youtu.be/DN9QqssAYB8)) + 3. Configuration option for doing instant selection in search mode + ## Introduction The tools are: @@ -60,6 +80,65 @@ cursors. Other keys are: - Ctrl-w (in incremental search) - delete whole word - Ctrl-k (in incremental search) - delete whole line +## Configuration + +`ZNT` has configuration files located in `~/.config/znt`. The files are: + +``` +n-aliases.conf +n-cd.conf +n-env.conf +n-functions.conf +n-history.conf +n-kill.conf +n-list.conf +n-options.conf +n-panelize.conf +``` + +`n-list.conf` contains main configuration variables: + +```zsh +# Should the list (text, borders) be drawn in bold +local bold=0 + +# Main color pair (foreground/background) +local colorpair="white/black" + +# Should draw the border? +local border=1 + +# Combinations of colors to try out with Ctrl-T and Ctrl-G +# The last number is the bold option, 0 or 1 +local -a themes +themes=( "white/black/1" "green/black/0" "green/black/1" "white/blue/0" "white/blue/1" + "magenta/black/0" "magenta/black/1" ) +``` + +Read remaining configuration files to see what's in them. Nevertheless, configuration +can be also set from `zshrc`. There are `5` standard `zshrc` configuration variables: + +``` +znt_history_active_text - underline or reverse - how should be active element highlighted +znt_history_nlist_coloring_pattern - pattern that can be used to colorize elements +znt_history_nlist_coloring_color - color with which to colorize +znt_history_nlist_coloring_match_multiple - should multiple matches be colorized (0 or 1) +znt_history_keywords (array) - search keywords activated with `Ctrl-X` +``` + +Above variables will work for `n-history` tool. For other tools, change `_history_` to +e.g. `_cd_`, for the `n-cd` tool. The same works for all `8` tools. + +Common configuration of the tools uses variables with `_list_` in them: + +``` +znt_list_bold - should draw text in bold (0 or 1) +znt_list_colorpair - main pair of colors to be used, e.g "green/black" +znt_list_border - should draw borders around windows (0 or 1) +znt_list_themes (array) - list of themes to try out with Ctrl-T, e.g. ( "white/black/1" "green/black/0" ) +znt_list_instant_select - should pressing enter in search mode leave tool (0 or 1) +``` + ## Programming The function n-list is used as follows: diff --git a/plugins/zsh-navigation-tools/_n-kill b/plugins/zsh-navigation-tools/_n-kill new file mode 100644 index 00000000..8a4ec9da --- /dev/null +++ b/plugins/zsh-navigation-tools/_n-kill @@ -0,0 +1,41 @@ +#compdef n-kill + +local context ret=1 + +typeset -a list linewords +typeset -aU words wordbits +local line word +integer cygwin=0 + +local IFS=" +" + +case "$(uname)" in + CYGWIN*) list=( `command ps -Wa` ); cygwin=1 ;; + *) list=( `command ps -o pid,uid,command -A` ) ;; +esac + +shift list + +IFS=" " +for line in "${list[@]}"; do + linewords=( $=line ) + if [ "$cygwin" = "1" ]; then + linewords=( "${(@)linewords[8,-1]}" ) + else + linewords=( "${(@)linewords[3,-1]}" ) + fi + for word in "${linewords[@]}"; do + if [ "$cygwin" = "1" ]; then + wordbits=( "${(@s:\:)word}" ) + else + wordbits=( "${(@s:/:)word}" ) + fi + words+=( "${wordbits[@]}" ) + done +done + +_wanted bits expl "Processes' name bits" \ + compadd "$@" -a - words && ret=0 + +return "$ret" diff --git a/plugins/zsh-navigation-tools/n-aliases b/plugins/zsh-navigation-tools/n-aliases index d81db925..f8c1c372 100644 --- a/plugins/zsh-navigation-tools/n-aliases +++ b/plugins/zsh-navigation-tools/n-aliases @@ -16,8 +16,8 @@ local IFS=" unset NLIST_COLORING_PATTERN -[ -f ~/.config/znt/n-list.conf ] && . ~/.config/znt/n-list.conf -[ -f ~/.config/znt/n-aliases.conf ] && . ~/.config/znt/n-aliases.conf +[ -f ~/.config/znt/n-list.conf ] && builtin source ~/.config/znt/n-list.conf +[ -f ~/.config/znt/n-aliases.conf ] && builtin source ~/.config/znt/n-aliases.conf local list local selected diff --git a/plugins/zsh-navigation-tools/n-cd b/plugins/zsh-navigation-tools/n-cd index b1ac5b15..48c6dbf4 100644 --- a/plugins/zsh-navigation-tools/n-cd +++ b/plugins/zsh-navigation-tools/n-cd @@ -16,8 +16,8 @@ local IFS=" # Unset before configuration is read unset NLIST_COLORING_PATTERN -[ -f ~/.config/znt/n-list.conf ] && . ~/.config/znt/n-list.conf -[ -f ~/.config/znt/n-cd.conf ] && . ~/.config/znt/n-cd.conf +[ -f ~/.config/znt/n-list.conf ] && builtin source ~/.config/znt/n-list.conf +[ -f ~/.config/znt/n-cd.conf ] && builtin source ~/.config/znt/n-cd.conf local list local selected @@ -53,13 +53,16 @@ if [ "$REPLY" -gt 0 ]; then (( NCD_DONT_PUSHD )) && setopt NO_AUTO_PUSHD cd "$selected" + local code=$? (( NCD_DONT_PUSHD )) && setopt AUTO_PUSHD - # ZLE? - if [ "${(t)CURSOR}" = "integer-local-special" ]; then - zle -M "You have selected $selected" - else - echo "You have selected $selected" + if [ "$code" -eq "0" ]; then + # ZLE? + if [ "${(t)CURSOR}" = "integer-local-special" ]; then + zle -M "You have selected $selected" + else + echo "You have selected $selected" + fi fi else [ "${(t)CURSOR}" = "integer-local-special" ] && zle redisplay diff --git a/plugins/zsh-navigation-tools/n-env b/plugins/zsh-navigation-tools/n-env index 612796c0..c003b63a 100644 --- a/plugins/zsh-navigation-tools/n-env +++ b/plugins/zsh-navigation-tools/n-env @@ -15,8 +15,8 @@ zmodload zsh/curses local IFS=" " -[ -f ~/.config/znt/n-list.conf ] && . ~/.config/znt/n-list.conf -[ -f ~/.config/znt/n-env.conf ] && . ~/.config/znt/n-env.conf +[ -f ~/.config/znt/n-list.conf ] && builtin source ~/.config/znt/n-list.conf +[ -f ~/.config/znt/n-env.conf ] && builtin source ~/.config/znt/n-env.conf local list local selected diff --git a/plugins/zsh-navigation-tools/n-functions b/plugins/zsh-navigation-tools/n-functions index 6f10a3de..1748cbc9 100644 --- a/plugins/zsh-navigation-tools/n-functions +++ b/plugins/zsh-navigation-tools/n-functions @@ -16,8 +16,8 @@ local IFS=" unset NLIST_COLORING_PATTERN -[ -f ~/.config/znt/n-list.conf ] && . ~/.config/znt/n-list.conf -[ -f ~/.config/znt/n-functions.conf ] && . ~/.config/znt/n-functions.conf +[ -f ~/.config/znt/n-list.conf ] && builtin source ~/.config/znt/n-list.conf +[ -f ~/.config/znt/n-functions.conf ] && builtin source ~/.config/znt/n-functions.conf local list local selected diff --git a/plugins/zsh-navigation-tools/n-help b/plugins/zsh-navigation-tools/n-help new file mode 100644 index 00000000..415050a8 --- /dev/null +++ b/plugins/zsh-navigation-tools/n-help @@ -0,0 +1,96 @@ +autoload colors +colors + +local h1="$fg_bold[cyan]" +local h2="$fg_bold[green]" +local h3="$fg_bold[blue]" +local h4="$fg_bold[yellow]" +local h5="$fg_bold[magenta]" +local rst="$reset_color" + +LESS="-iRc" less <<<" +${h1}Key Bindings${rst} + +${h2}H${rst}, ${h2}?${rst} (from n-history) - run n-help +${h2}Ctrl-A${rst} - rotate entered words (1+2+3 -> 3+1+2) +${h2}Ctrl-F${rst} - fix mode (approximate matching) +${h2}Ctrl-L${rst} - redraw of whole display +${h2}Ctrl-T${rst} - browse themes (next theme) +${h2}Ctrl-G${rst} - browse themes (previous theme) +${h2}Ctrl-U${rst} - half page up +${h2}Ctrl-D${rst} - half page down +${h2}Ctrl-P${rst} - previous element (also done with vim's k) +${h2}Ctrl-N${rst} - next element (also done with vim's j) +${h2}[${rst}, ${h2}]${rst} - jump directory bookmarks in n-cd and typical signals in n-kill +${h2}g, ${h2}G${rst} - beginning and end of the list +${h2}/${rst} - show incremental search +${h2}F3${rst} - show/hide incremental search +${h2}Esc${rst} - exit incremental search, clearing filter +${h2}Ctrl-W${rst} (in incremental search) - delete whole word +${h2}Ctrl-K${rst} (in incremental search) - delete whole line +${h2}Ctrl-O, ${h2}o${rst} - enter uniq mode (no duplicate lines) +${h2}Ctrl-E, ${h2}e${rst} - edit private history (when in private history view) +${h2}F1${rst} - (in n-history) - switch view +${h2}F2${rst}, ${h2}Ctrl-X${rst}, ${h2}Ctrl-/${rst} - search predefined keywords (defined in config files) + +${h1}Configuration files${rst} + +Location of the files is ${h3}~/.config/znt${rst}. Skeletons are copied there +when using ${h3}zsh-navigation-tools.plugin.zsh${rst} file (sourcing it or using +a plugin manager). There's a main config file ${h3}n-list.conf${rst} and files +for each tool. + +To have a skeleton copied again into ${h3}~/.config/znt${rst}, delete it from +there and restart Zsh a few times (3-7 or so; there's a random check +that optimizes startup time). + +${h1}Predefined search keywords${rst} + +Following block of code in e.g. ${h3}~/.config/znt/n-history.conf${rst} defines +set of keywords that can be invoked (i.e. searched for) via ${h2}F2${rst}, ${h2}Ctrl-X${rst} +or ${h2}Ctrl-/${rst}: + + ${h4}# Search keywords, iterated with F2 or Ctrl-X or Ctrl-/${rst} + ${h2}local${rst} -a keywords + keywords=( ${h2}\"git\" \"vim\" \"mplayer\"${rst} ) + +${h1}Search query rotation${rst} + +When searching, after pressing ${h2}Ctrl-A${rst}, words 1 2 3 will become 3 1 2, etc. +This can be used to edit some not-last word. + +${h1}Fix mode${rst} + +Approximate matching - pressing ${h2}f${rst} or ${h2}Ctrl-F${rst} will enter "FIX" mode, in which +1 or 2 errors are allowed in what's searched. This utilizes original Zsh +approximate matching features and is intended to be used after entering +search query, when a typo is discovered. + +${h1}Color themes${rst} + +Following block of code in ${h3}~/.config/znt/n-list.conf${rst} defines set of +themes that can be browsed with ${h2}Ctrl-T${rst} and ${h2}Ctrl-G${rst}: + + ${h4}# Combinations of colors to try out with Ctrl-T and Ctrl-G + # The last number is the bold option, 0 or 1${rst} + ${h2}local${rst} -a themes + themes=( ${h2}\"white/black/1\" \"green/black/0\" \"green/black/1\"${rst} + ${h2}\"white/blue/0\" \"white/blue/1\" \"magenta/black/0\"${rst} + ${h2}\"magenta/black/1\"${rst} ) + +It's \"foreground/background/bold\". There's support for 256-color themes +for Zsh > 5.2, defined like e.g.: + + themes=( ${h2}\"white/17/0\" \"10/17/1\" \"white/24/1\"${rst} ) + +i.e. with use of numbers, from 0 to 254. + +${h1}Private history${rst} + +N-history stores what's selected in its own history file. It can be +edited. Use ${h2}e${rst} or ${h2}Ctrl-E${rst} for that when in n-history. Your \$EDITOR will +start. This is a way to have handy set of bookmarks prepared in private +history's file. + +Private history is instantly shared among sessions. +" diff --git a/plugins/zsh-navigation-tools/n-history b/plugins/zsh-navigation-tools/n-history index 9f1d6279..68370f6e 100644 --- a/plugins/zsh-navigation-tools/n-history +++ b/plugins/zsh-navigation-tools/n-history @@ -15,27 +15,323 @@ zmodload zsh/parameter local IFS=" " -unset NLIST_COLORING_PATTERN +# Variables to save list's state when switching views +# The views are: history and "most frequent history words" +local one_NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN +local one_NLIST_CURRENT_IDX +local one_NLIST_IS_SEARCH_MODE +local one_NLIST_SEARCH_BUFFER +local one_NLIST_TEXT_OFFSET +local one_NLIST_IS_UNIQ_MODE +local one_NLIST_IS_F_MODE +local one_NLIST_GREP_STRING +local one_NLIST_NONSELECTABLE_ELEMENTS +local one_NLIST_REMEMBER_STATE +local one_NLIST_ENABLED_EVENTS -[ -f ~/.config/znt/n-list.conf ] && . ~/.config/znt/n-list.conf -[ -f ~/.config/znt/n-history.conf ] && . ~/.config/znt/n-history.conf +local two_NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN +local two_NLIST_CURRENT_IDX +local two_NLIST_IS_SEARCH_MODE +local two_NLIST_SEARCH_BUFFER +local two_NLIST_TEXT_OFFSET +local two_NLIST_IS_UNIQ_MODE +local two_NLIST_IS_F_MODE +local two_NLIST_GREP_STRING +local two_NLIST_NONSELECTABLE_ELEMENTS +local two_NLIST_REMEMBER_STATE +local two_NLIST_ENABLED_EVENTS + +local three_NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN +local three_NLIST_CURRENT_IDX +local three_NLIST_IS_SEARCH_MODE +local three_NLIST_SEARCH_BUFFER +local three_NLIST_TEXT_OFFSET +local three_NLIST_IS_UNIQ_MODE +local three_NLIST_IS_F_MODE +local three_NLIST_GREP_STRING +local three_NLIST_NONSELECTABLE_ELEMENTS +local three_NLIST_REMEMBER_STATE +local three_NLIST_ENABLED_EVENTS + +# history view +integer active_view=0 + +# Lists are "0", "1", "2" - 1st, 2nd, 3rd +# Switching is done in cyclic manner +# i.e. 0 -> 1, 1 -> 2, 2 -> 0 +_nhistory_switch_lists_states() { + # First argument is current, newly selected list, i.e. $active_view + # This implies that we are switching from previous view + + if [ "$1" = "0" ]; then + # Switched to 1st list, save 3rd list's state + three_NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN=$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN + three_NLIST_CURRENT_IDX=$NLIST_CURRENT_IDX + three_NLIST_IS_SEARCH_MODE=$NLIST_IS_SEARCH_MODE + three_NLIST_SEARCH_BUFFER=$NLIST_SEARCH_BUFFER + three_NLIST_TEXT_OFFSET=$NLIST_TEXT_OFFSET + three_NLIST_IS_UNIQ_MODE=$NLIST_IS_UNIQ_MODE + three_NLIST_IS_F_MODE=$NLIST_IS_F_MODE + three_NLIST_GREP_STRING=$NLIST_GREP_STRING + three_NLIST_NONSELECTABLE_ELEMENTS=( ${NLIST_NONSELECTABLE_ELEMENTS[@]} ) + three_NLIST_REMEMBER_STATE=$NLIST_REMEMBER_STATE + three_NLIST_ENABLED_EVENTS=( ${NLIST_ENABLED_EVENTS[@]} ) + + # ..and restore 1st list's state + NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN=$one_NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN + NLIST_CURRENT_IDX=$one_NLIST_CURRENT_IDX + NLIST_IS_SEARCH_MODE=$one_NLIST_IS_SEARCH_MODE + NLIST_SEARCH_BUFFER=$one_NLIST_SEARCH_BUFFER + NLIST_TEXT_OFFSET=$one_NLIST_TEXT_OFFSET + NLIST_IS_UNIQ_MODE=$one_NLIST_IS_UNIQ_MODE + NLIST_IS_F_MODE=$one_NLIST_IS_F_MODE + NLIST_GREP_STRING=$one_NLIST_GREP_STRING + NLIST_NONSELECTABLE_ELEMENTS=( ${one_NLIST_NONSELECTABLE_ELEMENTS[@]} ) + NLIST_REMEMBER_STATE=$one_NLIST_REMEMBER_STATE + NLIST_ENABLED_EVENTS=( ${one_NLIST_ENABLED_EVENTS[@]} ) + elif [ "$1" = "1" ]; then + # Switched to 2nd list, save 1st list's state + one_NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN=$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN + one_NLIST_CURRENT_IDX=$NLIST_CURRENT_IDX + one_NLIST_IS_SEARCH_MODE=$NLIST_IS_SEARCH_MODE + one_NLIST_SEARCH_BUFFER=$NLIST_SEARCH_BUFFER + one_NLIST_TEXT_OFFSET=$NLIST_TEXT_OFFSET + one_NLIST_IS_UNIQ_MODE=$NLIST_IS_UNIQ_MODE + one_NLIST_IS_F_MODE=$NLIST_IS_F_MODE + one_NLIST_GREP_STRING=$NLIST_GREP_STRING + one_NLIST_NONSELECTABLE_ELEMENTS=( ${NLIST_NONSELECTABLE_ELEMENTS[@]} ) + one_NLIST_REMEMBER_STATE=$NLIST_REMEMBER_STATE + one_NLIST_ENABLED_EVENTS=( ${NLIST_ENABLED_EVENTS[@]} ) + + # ..and restore 2nd list's state + NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN=$two_NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN + NLIST_CURRENT_IDX=$two_NLIST_CURRENT_IDX + NLIST_IS_SEARCH_MODE=$two_NLIST_IS_SEARCH_MODE + NLIST_SEARCH_BUFFER=$two_NLIST_SEARCH_BUFFER + NLIST_TEXT_OFFSET=$two_NLIST_TEXT_OFFSET + NLIST_IS_UNIQ_MODE=$two_NLIST_IS_UNIQ_MODE + NLIST_IS_F_MODE=$two_NLIST_IS_F_MODE + NLIST_GREP_STRING=$two_NLIST_GREP_STRING + NLIST_NONSELECTABLE_ELEMENTS=( ${two_NLIST_NONSELECTABLE_ELEMENTS[@]} ) + NLIST_REMEMBER_STATE=$two_NLIST_REMEMBER_STATE + NLIST_ENABLED_EVENTS=( ${two_NLIST_ENABLED_EVENTS[@]} ) + elif [ "$1" = "2" ]; then + # Switched to 3rd list, save 2nd list's state + two_NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN=$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN + two_NLIST_CURRENT_IDX=$NLIST_CURRENT_IDX + two_NLIST_IS_SEARCH_MODE=$NLIST_IS_SEARCH_MODE + two_NLIST_SEARCH_BUFFER=$NLIST_SEARCH_BUFFER + two_NLIST_TEXT_OFFSET=$NLIST_TEXT_OFFSET + two_NLIST_IS_UNIQ_MODE=$NLIST_IS_UNIQ_MODE + two_NLIST_IS_F_MODE=$NLIST_IS_F_MODE + two_NLIST_GREP_STRING=$NLIST_GREP_STRING + two_NLIST_NONSELECTABLE_ELEMENTS=( ${NLIST_NONSELECTABLE_ELEMENTS[@]} ) + two_NLIST_REMEMBER_STATE=$NLIST_REMEMBER_STATE + two_NLIST_ENABLED_EVENTS=( ${NLIST_ENABLED_EVENTS[@]} ) + + # ..and restore 3rd list's state + NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN=$three_NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN + NLIST_CURRENT_IDX=$three_NLIST_CURRENT_IDX + NLIST_IS_SEARCH_MODE=$three_NLIST_IS_SEARCH_MODE + NLIST_SEARCH_BUFFER=$three_NLIST_SEARCH_BUFFER + NLIST_TEXT_OFFSET=$three_NLIST_TEXT_OFFSET + NLIST_IS_UNIQ_MODE=$three_NLIST_IS_UNIQ_MODE + NLIST_IS_F_MODE=$three_NLIST_IS_F_MODE + NLIST_GREP_STRING=$three_NLIST_GREP_STRING + NLIST_NONSELECTABLE_ELEMENTS=( ${three_NLIST_NONSELECTABLE_ELEMENTS[@]} ) + NLIST_REMEMBER_STATE=$three_NLIST_REMEMBER_STATE + NLIST_ENABLED_EVENTS=( ${three_NLIST_ENABLED_EVENTS[@]} ) + fi +} + +local most_frequent_db="$HOME/.config/znt/mostfrequent.db" +_nhistory_generate_most_frequent() { + local title=$'\x1b[00;31m'"Most frequent history words:"$'\x1b[00;00m\0' + + typeset -A uniq + for k in "${historywords[@]}"; do + uniq[$k]=$(( ${uniq[$k]:-0} + 1 )) + done + vk=() + for k v in ${(kv)uniq}; do + vk+="$v"$'\t'"$k" + done + + print -rl "$title" "${(On)vk[@]}" > "$most_frequent_db" +} + +# Load configuration +unset NLIST_COLORING_PATTERN +[ -f ~/.config/znt/n-list.conf ] && builtin source ~/.config/znt/n-list.conf +[ -f ~/.config/znt/n-history.conf ] && builtin source ~/.config/znt/n-history.conf local list local selected - -NLIST_REMEMBER_STATE=0 - -list=( "$history[@]" ) -list=( "${(@M)list:#(#i)*$1*}" ) - -if [ "$#list" -eq 0 ]; then - echo "No matching history entries" - return 1 -fi +local private_history_db="$HOME/.config/znt/privhist.db" local NLIST_GREP_STRING="$1" +# 2 is: init once, then remember +local NLIST_REMEMBER_STATE=2 +two_NLIST_REMEMBER_STATE=2 +three_NLIST_REMEMBER_STATE=2 + +# Only Private history has EDIT +local -a NLIST_ENABLED_EVENTS +NLIST_ENABLED_EVENTS=( "F1" "HELP" ) +two_NLIST_ENABLED_EVENTS=( "F1" "EDIT" "HELP" ) +three_NLIST_ENABLED_EVENTS=( "F1" "HELP" ) + +# All view should attempt to replace new lines with \n local NLIST_REPLACE_NEWLINES="1" -n-list "${list[@]}" +two_NLIST_REPLACE_NEWLINES="1" +three_NLIST_REPLACE_NEWLINES="1" + +# Only second and third view has non-selectable first entry +local -a NLIST_NONSELECTABLE_ELEMENTS +NLIST_NONSELECTABLE_ELEMENTS=( ) +two_NLIST_NONSELECTABLE_ELEMENTS=( 1 ) +three_NLIST_NONSELECTABLE_ELEMENTS=( 1 ) + +while (( 1 )); do + + # + # View 1 - history + # + if [ "$active_view" = "0" ]; then + list=( "$history[@]" ) + list=( "${(@M)list:#(#i)*$NLIST_GREP_STRING*}" ) + + if [ "$#list" -eq 0 ]; then + echo "No matching history entries" + return 1 + fi + + n-list "${list[@]}" + + # Selection or quit? + if [[ "$REPLY" = -(#c0,1)[0-9]## && ("$REPLY" -lt 0 || "$REPLY" -gt 0) ]]; then + break + fi + + # View change? + if [ "$REPLY" = "F1" ]; then + # Target view: 2 + active_view=1 + _nhistory_switch_lists_states "1" + elif [ "$REPLY" = "HELP" ]; then + n-help + fi + + # + # View 3 - most frequent words in history + # + elif [ "$active_view" = "2" ]; then + local -a dbfile + dbfile=( $most_frequent_db(Nm+1) ) + + # Compute most frequent history words + if [[ "${#NHISTORY_WORDS}" -eq "0" || "${#dbfile}" -ne "0" ]]; then + # Read the list if it's there + local -a list + list=() + [ -s "$most_frequent_db" ] && list=( ${(f)"$(<$most_frequent_db)"} ) + + # Will wait for the data? + local message=0 + if [[ "${#list}" -eq 0 ]]; then + message=1 + _nlist_alternate_screen 1 + zcurses init + zcurses delwin info 2>/dev/null + zcurses addwin info "$term_height" "$term_width" 0 0 + zcurses bg info white/black + zcurses string info "Computing most frequent history words..."$'\n' + zcurses string info "(This is done once per day, from now on transparently)"$'\n' + zcurses refresh info + sleep 3 + fi + + # Start periodic list regeneration? + if [[ "${#list}" -eq 0 || "${#dbfile}" -ne "0" ]]; then + # Mark the file with current time, to prevent double + # regeneration (on quick double change of view) + print >> "$most_frequent_db" + (_nhistory_generate_most_frequent &) &> /dev/null + fi + + # Ensure we got the list, wait for it if needed + while [[ "${#list}" -eq 0 ]]; do + zcurses string info "." + zcurses refresh info + LANG=C sleep 0.5 + [ -s "$most_frequent_db" ] && list=( ${(f)"$(<$most_frequent_db)"} ) + done + + NHISTORY_WORDS=( "${list[@]}" ) + + if [ "$message" -eq "1" ]; then + zcurses delwin info 2>/dev/null + zcurses refresh + zcurses end + _nlist_alternate_screen 0 + fi + else + # Reuse most frequent history words + local -a list + list=( "${NHISTORY_WORDS[@]}" ) + fi + + n-list "${list[@]}" + + if [ "$REPLY" = "F1" ]; then + # Target view: 1 + active_view=0 + _nhistory_switch_lists_states "0" + elif [[ "$REPLY" = -(#c0,1)[0-9]## && "$REPLY" -lt 0 ]]; then + break + elif [[ "$REPLY" = -(#c0,1)[0-9]## && "$REPLY" -gt 0 ]]; then + local word="${reply[REPLY]#(#s) #[0-9]##$'\t'}" + one_NLIST_SEARCH_BUFFER="$word" + one_NLIST_SEARCH_BUFFER="${one_NLIST_SEARCH_BUFFER## ##}" + + # Target view: 1 + active_view=0 + _nhistory_switch_lists_states "0" + elif [ "$REPLY" = "HELP" ]; then + n-help + fi + + # + # View 2 - private history + # + elif [ "$active_view" = "1" ]; then + if [ -s "$private_history_db" ]; then + local title=$'\x1b[00;32m'"Private history:"$'\x1b[00;00m\0' + () { fc -ap -R "$private_history_db"; list=( "$title" ${history[@]} ) } + else + list=( "Private history - history entries selected via this tool will be put here" ) + fi + + n-list "${list[@]}" + + # Selection or quit? + if [[ "$REPLY" = -(#c0,1)[0-9]## && ("$REPLY" -lt 0 || "$REPLY" -gt 0) ]]; then + break + fi + + # View change? + if [ "$REPLY" = "F1" ]; then + # Target view: 3 + active_view=2 + _nhistory_switch_lists_states "2" + # Edit of the history? + elif [ "$REPLY" = "EDIT" ]; then + "${EDITOR:-vim}" "$private_history_db" + elif [ "$REPLY" = "HELP" ]; then + n-help + fi + fi +done if [ "$REPLY" -gt 0 ]; then selected="$reply[REPLY]" @@ -43,7 +339,12 @@ if [ "$REPLY" -gt 0 ]; then if [ "${(t)CURSOR}" = "integer-local-special" ]; then zle redisplay zle kill-buffer - zle -U "$selected" + LBUFFER+="$selected" + + # Append to private history + local newline=$'\n' + selected="${selected//$newline/\\$newline}" + [ "$active_view" = "0" ] && print -r "$selected" >> "$private_history_db" else print -zr "$selected" fi diff --git a/plugins/zsh-navigation-tools/n-kill b/plugins/zsh-navigation-tools/n-kill index e5208228..0d10565e 100644 --- a/plugins/zsh-navigation-tools/n-kill +++ b/plugins/zsh-navigation-tools/n-kill @@ -13,8 +13,8 @@ zmodload zsh/curses local IFS=" " -[ -f ~/.config/znt/n-list.conf ] && . ~/.config/znt/n-list.conf -[ -f ~/.config/znt/n-kill.conf ] && . ~/.config/znt/n-kill.conf +[ -f ~/.config/znt/n-list.conf ] && builtin source ~/.config/znt/n-list.conf +[ -f ~/.config/znt/n-kill.conf ] && builtin source ~/.config/znt/n-kill.conf typeset -A signals signals=( diff --git a/plugins/zsh-navigation-tools/n-list b/plugins/zsh-navigation-tools/n-list index 50159b4a..d3a8da30 100644 --- a/plugins/zsh-navigation-tools/n-list +++ b/plugins/zsh-navigation-tools/n-list @@ -29,7 +29,7 @@ _nlist_exit() { setopt localoptions setopt extendedglob - [[ "$REPLY" = -(#c0,1)[0-9]## ]] || REPLY="-1" + [[ "$REPLY" = -(#c0,1)[0-9]## || "$REPLY" = F<-> || "$REPLY" = "EDIT" || "$REPLY" = "HELP" ]] || REPLY="-1" zcurses 2>/dev/null delwin inner zcurses 2>/dev/null delwin main zcurses 2>/dev/null refresh @@ -167,6 +167,26 @@ integer prev_uniq_mode=0 integer prev_start_idx=-1 local MBEGIN MEND MATCH mbegin mend match +# Iteration over predefined keywords +integer curkeyword nkeywords +local keywordisfresh="0" +if [[ "${(t)keywords}" != *array* ]]; then + local -a keywords + keywords=() +fi +curkeyword=0 +nkeywords=${#keywords} + +# Iteration over themes +integer curtheme nthemes +local themeisfresh="0" +if [[ "${(t)themes}" != *array* ]]; then + local -a themes + themes=() +fi +curtheme=0 +nthemes=${#themes} + # Ability to remember the list between calls if [[ -z "$NLIST_REMEMBER_STATE" || "$NLIST_REMEMBER_STATE" -eq 0 || "$NLIST_REMEMBER_STATE" -eq 2 ]]; then NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN=1 @@ -175,6 +195,7 @@ if [[ -z "$NLIST_REMEMBER_STATE" || "$NLIST_REMEMBER_STATE" -eq 0 || "$NLIST_REM NLIST_SEARCH_BUFFER="" NLIST_TEXT_OFFSET=0 NLIST_IS_UNIQ_MODE=0 + NLIST_IS_F_MODE=0 # Zero - because it isn't known, unless we # confirm that first element is selectable @@ -207,12 +228,19 @@ zcurses delwin main 2>/dev/null zcurses delwin inner 2>/dev/null zcurses addwin main "$term_height" "$term_width" 0 0 zcurses addwin inner "$inner_height" "$inner_width" 1 2 -zcurses bg main white/black -zcurses bg inner white/black +# From n-list.conf +[ "$colorpair" = "" ] && colorpair="white/black" +[ "$border" = "0" ] || border="1" +local background="${colorpair#*/}" +local backuptheme="$colorpair/$bold" +zcurses bg main "$colorpair" +zcurses bg inner "$colorpair" if [ "$NLIST_IS_SEARCH_MODE" -ne 1 ]; then _nlist_cursor_visibility 0 fi +zcurses refresh + # # Listening for input # @@ -237,9 +265,12 @@ while (( 1 )); do # Do searching (filtering with string) if [ -n "$NLIST_SEARCH_BUFFER" ]; then # Compute new list? - if [[ "$NLIST_SEARCH_BUFFER" != "$prev_search_buffer" || "$NLIST_IS_UNIQ_MODE" -ne "$prev_uniq_mode" ]]; then + if [[ "$NLIST_SEARCH_BUFFER" != "$prev_search_buffer" || "$NLIST_IS_UNIQ_MODE" -ne "$prev_uniq_mode" + || "$NLIST_IS_F_MODE" -ne "$prev_f_mode" ]] + then prev_search_buffer="$NLIST_SEARCH_BUFFER" prev_uniq_mode="$NLIST_IS_UNIQ_MODE" + prev_f_mode="$NLIST_IS_F_MODE" # regenerating list -> regenerating disp_list prev_start_idx=-1 @@ -251,7 +282,9 @@ while (( 1 )); do # Remove non-selectable elements [ "$#NLIST_NONSELECTABLE_ELEMENTS" -gt 0 ] && for i in "${(nO)NLIST_NONSELECTABLE_ELEMENTS[@]}"; do - list[$i]=() + if [[ "$i" = <-> ]]; then + list[$i]=() + fi done # Remove duplicates @@ -266,13 +299,22 @@ while (( 1 )); do local search_pattern="" local colsearch_pattern="" if [ -n "$search_buffer" ]; then - # Patterns will be *foo*~^*bar* and (foo|bar) - search_pattern="${search_buffer// ##/*~^*}" - colsearch_pattern="${search_buffer// ##/|}" - # The repeat will make the matching work on a fresh heap repeat 1; do - list=( "${(@M)list:#(#i)*$~search_pattern*}" ) + if [ "$NLIST_IS_F_MODE" -eq "1" ]; then + search_pattern="${search_buffer// ##/*~^(#a1)*}" + colsearch_pattern="${search_buffer// ##/|(#a1)}" + list=( "${(@M)list:#(#ia1)*$~search_pattern*}" ) + elif [ "$NLIST_IS_F_MODE" -eq "2" ]; then + search_pattern="${search_buffer// ##/*~^(#a2)*}" + colsearch_pattern="${search_buffer// ##/|(#a2)}" + list=( "${(@M)list:#(#ia2)*$~search_pattern*}" ) + else + # Patterns will be *foo*~^*bar* and (foo|bar) + search_pattern="${search_buffer// ##/*~^*}" + colsearch_pattern="${search_buffer// ##/|}" + list=( "${(@M)list:#(#i)*$~search_pattern*}" ) + fi done last_element="$#list" @@ -295,7 +337,13 @@ while (( 1 )); do local red=$'\x1b[00;31m' reset=$'\x1b[00;00m' # The repeat will make the matching work on a fresh heap repeat 1; do - disp_list=( "${(@)disp_list//(#mi)($~colsearch_pattern)/$red${MATCH}$reset}" ) + if [ "$NLIST_IS_F_MODE" -eq "1" ]; then + disp_list=( "${(@)disp_list//(#mia1)($~colsearch_pattern)/$red${MATCH}$reset}" ) + elif [ "$NLIST_IS_F_MODE" -eq "2" ]; then + disp_list=( "${(@)disp_list//(#mia2)($~colsearch_pattern)/$red${MATCH}$reset}" ) + else + disp_list=( "${(@)disp_list//(#mi)($~colsearch_pattern)/$red${MATCH}$reset}" ) + fi done fi @@ -304,6 +352,7 @@ while (( 1 )); do fi # Output colored list + zcurses clear inner n-list-draw "$(( (NLIST_CURRENT_IDX-1) % page_height + 1 ))" \ "$page_height" "$page_width" 0 0 "$NLIST_TEXT_OFFSET" inner \ "$disp_list[@]" @@ -327,7 +376,9 @@ while (( 1 )); do # Remove non-selectable elements only when in uniq mode [ "$NLIST_IS_UNIQ_MODE" -eq 1 ] && [ "$#NLIST_NONSELECTABLE_ELEMENTS" -gt 0 ] && for i in "${(nO)NLIST_NONSELECTABLE_ELEMENTS[@]}"; do - list[$i]=() + if [[ "$i" = <-> ]]; then + list[$i]=() + fi done # Remove duplicates when in uniq mode @@ -355,29 +406,46 @@ while (( 1 )); do fi # Output the list + zcurses clear inner n-list-draw "$(( (NLIST_CURRENT_IDX-1) % page_height + 1 ))" \ "$page_height" "$page_width" 0 0 "$NLIST_TEXT_OFFSET" inner \ "$disp_list[@]" fi local status_msg_strlen - if [ "$NLIST_IS_SEARCH_MODE" = "1" ]; then - local _txt2="" - [ "$NLIST_IS_UNIQ_MODE" -eq 1 ] && _txt2="[-UNIQ-] " - _nlist_status_msg "${_txt2}Filtering with: ${NLIST_SEARCH_BUFFER// /+}" - elif [[ ${NLIST_NONSELECTABLE_ELEMENTS[(r)$NLIST_CURRENT_IDX]} != $NLIST_CURRENT_IDX || - -n "$NLIST_SEARCH_BUFFER" || "$NLIST_IS_UNIQ_MODE" -eq 1 ]]; then - local _txt="" _txt2="" - [ -n "$NLIST_GREP_STRING" ] && _txt=" [$NLIST_GREP_STRING]" - [ "$NLIST_IS_UNIQ_MODE" -eq 1 ] && _txt2="[-UNIQ-] " - _nlist_status_msg "${_txt2}Current #$NLIST_USER_CURRENT_IDX (of #$NLIST_USER_LAST_ELEMENT entries)$_txt" - else - _nlist_status_msg "" + local keywordmsg="" + if [ "$keywordisfresh" = "1" ]; then + keywordmsg="($curkeyword/$nkeywords) " + keywordisfresh="0" fi - zcurses border main + local thememsg="" + if [ "$themeisfresh" = "1" ]; then + local theme="$backuptheme" + [ "$curtheme" -gt 0 ] && theme="${themes[curtheme]}" + thememsg="($curtheme/$nthemes $theme) " + themeisfresh="0" + fi - local top_msg="${(C)ZSH_NAME} $ZSH_VERSION, shell level $SHLVL, $USER" + local _txt2="" _txt3="" + [ "$NLIST_IS_UNIQ_MODE" -eq 1 ] && _txt2="[-UNIQ-] " + [ "$NLIST_IS_F_MODE" -eq 1 ] && _txt3="[-FIX-] " + [ "$NLIST_IS_F_MODE" -eq 2 ] && _txt3="[-FIX2-] " + + if [ "$NLIST_IS_SEARCH_MODE" = "1" ]; then + _nlist_status_msg "${_txt2}${_txt3}${keywordmsg}${thememsg}Filtering with: ${NLIST_SEARCH_BUFFER// /+}" + elif [[ ${NLIST_NONSELECTABLE_ELEMENTS[(r)$NLIST_CURRENT_IDX]} != $NLIST_CURRENT_IDX || + -n "$NLIST_SEARCH_BUFFER" || "$NLIST_IS_UNIQ_MODE" -eq 1 ]]; then + local _txt="" + [ -n "$NLIST_GREP_STRING" ] && _txt=" [$NLIST_GREP_STRING]" + _nlist_status_msg "${_txt2}${_txt3}${keywordmsg}${thememsg}Current #$NLIST_USER_CURRENT_IDX (of #$NLIST_USER_LAST_ELEMENT entries)$_txt" + else + _nlist_status_msg "${keywordmsg}${thememsg}" + fi + + [ "$border" = "1" ] && zcurses border main + + local top_msg=" F1-change view, ${(C)ZSH_NAME} $ZSH_VERSION, shell level $SHLVL " zcurses move main 0 $(( term_width / 2 - $#top_msg / 2 )) zcurses string main $top_msg @@ -400,7 +468,7 @@ while (( 1 )); do n-list-input "$NLIST_CURRENT_IDX" "$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN" \ "$page_height" "$page_width" "$last_element" "$NLIST_TEXT_OFFSET" \ "$final_key" "$NLIST_IS_SEARCH_MODE" "$NLIST_SEARCH_BUFFER" \ - "$NLIST_IS_UNIQ_MODE" + "$NLIST_IS_UNIQ_MODE" "$NLIST_IS_F_MODE" selection="$reply[1]" action="$reply[2]" @@ -410,8 +478,11 @@ while (( 1 )); do NLIST_IS_SEARCH_MODE="$reply[6]" NLIST_SEARCH_BUFFER="$reply[7]" NLIST_IS_UNIQ_MODE="$reply[8]" + NLIST_IS_F_MODE="$reply[9]" - if [ "$action" = "SELECT" ]; then + if [ -z "$action" ]; then + continue + elif [ "$action" = "SELECT" ]; then REPLY="$selection" reply=( "$list[@]" ) break @@ -422,6 +493,18 @@ while (( 1 )); do elif [ "$action" = "REDRAW" ]; then zcurses clear main redraw zcurses clear inner redraw + elif [[ "$action" = F<-> ]]; then + REPLY="$action" + reply=( "$list[@]" ) + break + elif [[ "$action" = "EDIT" ]]; then + REPLY="EDIT" + reply=( "$list[@]" ) + break + elif [[ "$action" = "HELP" ]]; then + REPLY="HELP" + reply=( "$list[@]" ) + break fi done diff --git a/plugins/zsh-navigation-tools/n-list-draw b/plugins/zsh-navigation-tools/n-list-draw index 2f8b1d0d..ae1e0115 100644 --- a/plugins/zsh-navigation-tools/n-list-draw +++ b/plugins/zsh-navigation-tools/n-list-draw @@ -79,9 +79,9 @@ _nlist_print_with_ansi() { if (( no_match == 0 )); then if (( col >= 30 && col <= 37 )); then - zcurses attr "$win" $c[col-29]/black + zcurses attr "$win" $c[col-29]/"$background" elif [[ "$col" -eq 0 ]]; then - zcurses attr "$win" white/black + zcurses attr "$win" "$colorpair" fi fi done @@ -97,17 +97,19 @@ local win="$7" shift 7 integer max_text_len=page_width-x_offset -[ "$bold" = "0" ] && bold="" || bold="+bold" +[[ "$bold" = "0" || "$bold" = "-bold" ]] && bold="-bold" || bold="+bold" [[ "$active_text" = "underline" || "$active_text" = "reverse" ]] || local active_text="reverse" -# With Linux terminal underline won't work properly -[ "$TERM" = "linux" ] && active_text="reverse" +# Linux has ncv 18, screen* has ncv 3 - underline won't work properly +(( ${terminfo[ncv]:-0} & 2 )) && active_text="reverse" +# FreeBSD uses TERM=xterm for newcons but doesn't actually support underline +[[ "$TERM" = "xterm" && -z "$DISPLAY" ]] && active_text="reverse" integer max_idx=page_height integer end_idx=max_idx [ "$end_idx" -gt "$#" ] && end_idx="$#" integer y=y_offset -zcurses attr "$win" $bold white/black +zcurses attr "$win" "$bold" "$colorpair" integer i text_len local text diff --git a/plugins/zsh-navigation-tools/n-list-input b/plugins/zsh-navigation-tools/n-list-input index 957cd5a0..9bafc51b 100644 --- a/plugins/zsh-navigation-tools/n-list-input +++ b/plugins/zsh-navigation-tools/n-list-input @@ -14,6 +14,52 @@ _nlist_compute_first_to_show_idx() { from_what_idx_list_is_shown=0+((current_idx-1)/page_height)*page_height+1 } +_nlist_update_from_keywords() { + keywordisfresh="1" + if [ "$nkeywords" -gt 0 ]; then + curkeyword=$(( (curkeyword+1) % (nkeywords+1) )) + if [ "$curkeyword" -eq "0" ]; then + buffer="" + else + buffer="${keywords[curkeyword]}" + fi + fi +} + +_nlist_iterate_theme() { + themeisfresh="1" + if [ "$1" = "1" ]; then + curtheme=$(( (curtheme+1) % (nthemes+1) )) + else + curtheme=curtheme-1 + [ "$curtheme" -lt 0 ] && curtheme=nthemes + fi + + if [ "$nthemes" -gt 0 ]; then + local theme=${themes[curtheme]} + [ "$curtheme" -eq "0" ] && theme="$backuptheme" + + colorpair="${theme%/*}" + bold="${theme##*/}" + background="${colorpair#*/}" + zcurses bg main "$colorpair" + zcurses bg inner "$colorpair" + fi +} + +_nlist_rotate_buffer() { + setopt localoptions noglob + + local -a words + words=( ${(s: :)buffer} ) + words=( ${words[-1]} ${words[1,-2]} ) + + local space="" + [ "${buffer[-1]}" = " " ] && space=" " + + buffer="${(j: :)words}$space" +} + typeset -ga reply reply=( -1 '' ) integer current_idx="$1" @@ -26,6 +72,7 @@ local key="$7" integer search="$8" local buffer="$9" integer uniq_mode="$10" +integer f_mode="$11" # # Listening for input @@ -79,21 +126,36 @@ case "$key" in ${NLIST_NONSELECTABLE_ELEMENTS[(r)$current_idx]} != $current_idx ]] then # Save current element in the result variable - reply=( $current_idx SELECT ) + reply=( $current_idx "SELECT" ) fi ;; + (H|'?') + # This event needs to be enabled + if [[ "${NLIST_ENABLED_EVENTS[(r)HELP]}" = "HELP" ]]; then + reply=( -1 "HELP" ) + fi + ;; + (F1) + # This event needs to be enabled + if [[ "${NLIST_ENABLED_EVENTS[(r)F1]}" = "F1" ]]; then + reply=( -1 "$key" ) + fi + ;; + (F4|F5|F6|F7|F8|F9|F10|DC) + # ignore; F2, F3 are used below + ;; (q) - reply=( -1 QUIT ) + reply=( -1 "QUIT" ) ;; (/) search=1 _nlist_cursor_visibility 1 ;; ($'\t') - reply=( $current_idx LEAVE ) + reply=( $current_idx "LEAVE" ) ;; ($'\C-L') - reply=( -1 REDRAW ) + reply=( -1 "REDRAW" ) ;; (\]) [[ "${(t)NLIST_HOP_INDEXES}" = "array" || "${(t)NLIST_HOP_INDEXES}" = "array-local" ]] && @@ -127,9 +189,41 @@ case "$key" in ($'\E') buffer="" ;; + (F3) + if [ "$search" = "1" ]; then + search=0 + _nlist_cursor_visibility 0 + else + search=1 + _nlist_cursor_visibility 1 + fi + ;; (o|$'\C-O') uniq_mode=1-uniq_mode ;; + (f|$'\C-F') + (( f_mode=(f_mode+1) % 3 )) + ;; + ($'\x1F'|F2|$'\C-X') + search=1 + _nlist_cursor_visibility 1 + _nlist_update_from_keywords + ;; + ($'\C-T') + _nlist_iterate_theme 1 + ;; + ($'\C-G') + _nlist_iterate_theme 0 + ;; + ($'\C-E'|e) + # This event needs to be enabled + if [[ "${NLIST_ENABLED_EVENTS[(r)EDIT]}" = "EDIT" ]]; then + reply=( -1 "EDIT" ) + fi + ;; + ($'\C-A') + _nlist_rotate_buffer + ;; (*) ;; esac @@ -138,11 +232,19 @@ else case "$key" in ($'\n'|ENTER) - search=0 - _nlist_cursor_visibility 0 + if [ "$NLIST_INSTANT_SELECT" = "1" ]; then + if [[ "$NLIST_SEARCH_BUFFER" != "" || "$NLIST_IS_UNIQ_MODE" -eq 1 || + ${NLIST_NONSELECTABLE_ELEMENTS[(r)$current_idx]} != $current_idx ]] + then + reply=( $current_idx "SELECT" ) + fi + else + search=0 + _nlist_cursor_visibility 0 + fi ;; ($'\C-L') - reply=( -1 REDRAW ) + reply=( -1 "REDRAW" ) ;; # @@ -192,8 +294,14 @@ case "$key" in (RIGHT) hscroll+=7 ;; - (F1|F2|F3|F4|F5|F6|F7|F8|F9|F10) - # ignore + (F1) + # This event needs to be enabled + if [[ "${NLIST_ENABLED_EVENTS[(r)F1]}" = "F1" ]]; then + reply=( -1 "$key" ) + fi + ;; + (F4|F5|F6|F7|F8|F9|F10|DC) + # ignore; F2, F3 are used below ;; # @@ -214,9 +322,39 @@ case "$key" in search=0 _nlist_cursor_visibility 0 ;; + (F3) + if [ "$search" = "1" ]; then + search=0 + _nlist_cursor_visibility 0 + else + search=1 + _nlist_cursor_visibility 1 + fi + ;; ($'\C-O') uniq_mode=1-uniq_mode ;; + ($'\C-F') + (( f_mode=(f_mode+1) % 3 )) + ;; + ($'\x1F'|F2|$'\C-X') + _nlist_update_from_keywords + ;; + ($'\C-T') + _nlist_iterate_theme 1 + ;; + ($'\C-G') + _nlist_iterate_theme 0 + ;; + ($'\C-E') + # This event needs to be enabled + if [[ "${NLIST_ENABLED_EVENTS[(r)EDIT]}" = "EDIT" ]]; then + reply=( -1 "EDIT" ) + fi + ;; + ($'\C-A') + _nlist_rotate_buffer + ;; (*) if [[ $#key == 1 && $((#key)) -lt 31 ]]; then # ignore all other control keys @@ -234,5 +372,6 @@ reply[5]="$hscroll" reply[6]="$search" reply[7]="$buffer" reply[8]="$uniq_mode" +reply[9]="$f_mode" # vim: set filetype=zsh: diff --git a/plugins/zsh-navigation-tools/n-options b/plugins/zsh-navigation-tools/n-options index 91589bd4..b1a93401 100644 --- a/plugins/zsh-navigation-tools/n-options +++ b/plugins/zsh-navigation-tools/n-options @@ -14,8 +14,8 @@ local IFS=" unset NLIST_COLORING_PATTERN -[ -f ~/.config/znt/n-list.conf ] && . ~/.config/znt/n-list.conf -[ -f ~/.config/znt/n-options.conf ] && . ~/.config/znt/n-options.conf +[ -f ~/.config/znt/n-list.conf ] && builtin source ~/.config/znt/n-list.conf +[ -f ~/.config/znt/n-options.conf ] && builtin source ~/.config/znt/n-options.conf # TODO restore options unsetopt localoptions diff --git a/plugins/zsh-navigation-tools/n-panelize b/plugins/zsh-navigation-tools/n-panelize index 01d01cb9..e2b567f2 100644 --- a/plugins/zsh-navigation-tools/n-panelize +++ b/plugins/zsh-navigation-tools/n-panelize @@ -17,8 +17,8 @@ local IFS=" unset NLIST_COLORING_PATTERN -[ -f ~/.config/znt/n-list.conf ] && . ~/.config/znt/n-list.conf -[ -f ~/.config/znt/n-panelize.conf ] && . ~/.config/znt/n-panelize.conf +[ -f ~/.config/znt/n-list.conf ] && builtin source ~/.config/znt/n-list.conf +[ -f ~/.config/znt/n-panelize.conf ] && builtin source ~/.config/znt/n-panelize.conf local list local selected diff --git a/plugins/zsh-navigation-tools/znt-history-widget b/plugins/zsh-navigation-tools/znt-history-widget index a4a26cbf..479c2211 100644 --- a/plugins/zsh-navigation-tools/znt-history-widget +++ b/plugins/zsh-navigation-tools/znt-history-widget @@ -4,6 +4,14 @@ local NLIST_START_IN_UNIQ_MODE=1 # Only if current $BUFFER doesn't come from history if [ "$HISTCMD" = "$HISTNO" ]; then + () { + setopt localoptions extendedglob + local -a match mbegin mend + local MATCH; integer MBEGIN MEND + + [ -n "$BUFFER" ] && BUFFER="${BUFFER%% ##} " + } + local NLIST_SET_SEARCH_TO="$BUFFER" fi diff --git a/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh b/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh index 4aa3aa4b..b2654915 100755 --- a/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh +++ b/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh @@ -15,13 +15,21 @@ if ! test -d "$CONFIG_DIR"; then mkdir "$CONFIG_DIR" fi +# 9 files set n-aliases.conf n-env.conf n-history.conf n-list.conf n-panelize.conf n-cd.conf n-functions.conf n-kill.conf n-options.conf -for i; do - if ! test -f "$CONFIG_DIR/$i"; then - cp "$REPO_DIR/.config/znt/$i" "$CONFIG_DIR" - fi -done +# Check for random 2 files if they exist +# This will shift 0 - 7 elements +shift $(( RANDOM % 8 )) +if ! test -f "$CONFIG_DIR/$1" || ! test -f "$CONFIG_DIR/$2"; then + # Something changed - examine every file + set n-aliases.conf n-env.conf n-history.conf n-list.conf n-panelize.conf n-cd.conf n-functions.conf n-kill.conf n-options.conf + for i; do + if ! test -f "$CONFIG_DIR/$i"; then + cp "$REPO_DIR/.config/znt/$i" "$CONFIG_DIR" + fi + done +fi # Don't leave positional parameters being set set -- @@ -30,12 +38,13 @@ set -- # Load functions # -autoload n-aliases n-cd n-env n-functions n-history n-kill n-list n-list-draw n-list-input n-options n-panelize +autoload n-aliases n-cd n-env n-functions n-history n-kill n-list n-list-draw n-list-input n-options n-panelize n-help autoload znt-usetty-wrapper znt-history-widget znt-cd-widget znt-kill-widget alias naliases=n-aliases ncd=n-cd nenv=n-env nfunctions=n-functions nhistory=n-history -alias nkill=n-kill noptions=n-options npanelize=n-panelize +alias nkill=n-kill noptions=n-options npanelize=n-panelize nhelp=n-help zle -N znt-history-widget bindkey '^R' znt-history-widget setopt AUTO_PUSHD HIST_IGNORE_DUPS PUSHD_IGNORE_DUPS +zstyle ':completion::complete:n-kill::bits' matcher 'r:|=** l:|=*' From 0b5d18a247c440891251f9a80e7301b42c0dc981 Mon Sep 17 00:00:00 2001 From: Felipe Contreras Date: Tue, 17 May 2016 20:23:20 -0500 Subject: [PATCH 213/537] gitfast: update to upstream v2.0 Signed-off-by: Felipe Contreras --- plugins/gitfast/git-prompt.sh | 72 ++++++++++++++++++++++++++++++----- 1 file changed, 62 insertions(+), 10 deletions(-) diff --git a/plugins/gitfast/git-prompt.sh b/plugins/gitfast/git-prompt.sh index 54489080..9d684b10 100644 --- a/plugins/gitfast/git-prompt.sh +++ b/plugins/gitfast/git-prompt.sh @@ -207,7 +207,16 @@ __git_ps1_show_upstream () p=" u+${count#* }-${count% *}" ;; esac if [[ -n "$count" && -n "$name" ]]; then - p="$p $(git rev-parse --abbrev-ref "$upstream" 2>/dev/null)" + __git_ps1_upstream_name=$(git rev-parse \ + --abbrev-ref "$upstream" 2>/dev/null) + if [ $pcmode = yes ] && [ $ps1_expanded = yes ]; then + p="$p \${__git_ps1_upstream_name}" + else + p="$p ${__git_ps1_upstream_name}" + # not needed anymore; keep user's + # environment clean + unset __git_ps1_upstream_name + fi fi fi @@ -259,7 +268,7 @@ __git_ps1_colorize_gitstring () r="$c_clear$r" } -eread () +__git_eread () { f="$1" shift @@ -297,6 +306,43 @@ __git_ps1 () ;; esac + # ps1_expanded: This variable is set to 'yes' if the shell + # subjects the value of PS1 to parameter expansion: + # + # * bash does unless the promptvars option is disabled + # * zsh does not unless the PROMPT_SUBST option is set + # * POSIX shells always do + # + # If the shell would expand the contents of PS1 when drawing + # the prompt, a raw ref name must not be included in PS1. + # This protects the user from arbitrary code execution via + # specially crafted ref names. For example, a ref named + # 'refs/heads/$(IFS=_;cmd=sudo_rm_-rf_/;$cmd)' might cause the + # shell to execute 'sudo rm -rf /' when the prompt is drawn. + # + # Instead, the ref name should be placed in a separate global + # variable (in the __git_ps1_* namespace to avoid colliding + # with the user's environment) and that variable should be + # referenced from PS1. For example: + # + # __git_ps1_foo=$(do_something_to_get_ref_name) + # PS1="...stuff...\${__git_ps1_foo}...stuff..." + # + # If the shell does not expand the contents of PS1, the raw + # ref name must be included in PS1. + # + # The value of this variable is only relevant when in pcmode. + # + # Assume that the shell follows the POSIX specification and + # expands PS1 unless determined otherwise. (This is more + # likely to be correct if the user has a non-bash, non-zsh + # shell and safer than the alternative if the assumption is + # incorrect.) + # + local ps1_expanded=yes + [ -z "$ZSH_VERSION" ] || [[ -o PROMPT_SUBST ]] || ps1_expanded=no + [ -z "$BASH_VERSION" ] || shopt -q promptvars || ps1_expanded=no + local repo_info rev_parse_exit_code repo_info="$(git rev-parse --git-dir --is-inside-git-dir \ --is-bare-repository --is-inside-work-tree \ @@ -328,9 +374,9 @@ __git_ps1 () local step="" local total="" if [ -d "$g/rebase-merge" ]; then - eread "$g/rebase-merge/head-name" b - eread "$g/rebase-merge/msgnum" step - eread "$g/rebase-merge/end" total + __git_eread "$g/rebase-merge/head-name" b + __git_eread "$g/rebase-merge/msgnum" step + __git_eread "$g/rebase-merge/end" total if [ -f "$g/rebase-merge/interactive" ]; then r="|REBASE-i" else @@ -338,10 +384,10 @@ __git_ps1 () fi else if [ -d "$g/rebase-apply" ]; then - eread "$g/rebase-apply/next" step - eread "$g/rebase-apply/last" total + __git_eread "$g/rebase-apply/next" step + __git_eread "$g/rebase-apply/last" total if [ -f "$g/rebase-apply/rebasing" ]; then - eread "$g/rebase-apply/head-name" b + __git_eread "$g/rebase-apply/head-name" b r="|REBASE" elif [ -f "$g/rebase-apply/applying" ]; then r="|AM" @@ -365,7 +411,7 @@ __git_ps1 () b="$(git symbolic-ref HEAD 2>/dev/null)" else local head="" - if ! eread "$g/HEAD" head; then + if ! __git_eread "$g/HEAD" head; then if [ $pcmode = yes ]; then PS1="$ps1pc_start$ps1pc_end" fi @@ -445,8 +491,14 @@ __git_ps1 () __git_ps1_colorize_gitstring fi + b=${b##refs/heads/} + if [ $pcmode = yes ] && [ $ps1_expanded = yes ]; then + __git_ps1_branch_name=$b + b="\${__git_ps1_branch_name}" + fi + local f="$w$i$s$u" - local gitstring="$c${b##refs/heads/}${f:+$z$f}$r$p" + local gitstring="$c$b${f:+$z$f}$r$p" if [ $pcmode = yes ]; then if [ "${__git_printf_supports_v-}" != yes ]; then From 169cd8b6ca803721071795c6a207aa97265c8528 Mon Sep 17 00:00:00 2001 From: Felipe Contreras Date: Wed, 18 May 2016 03:07:09 -0500 Subject: [PATCH 214/537] gitfast: update to upstream v2.4 Signed-off-by: Felipe Contreras --- plugins/gitfast/_git | 1 + plugins/gitfast/git-completion.bash | 129 +++++++++++++++++++++------- plugins/gitfast/git-prompt.sh | 41 ++++++--- 3 files changed, 129 insertions(+), 42 deletions(-) diff --git a/plugins/gitfast/_git b/plugins/gitfast/_git index c75b0be7..7ed3e3c2 100644 --- a/plugins/gitfast/_git +++ b/plugins/gitfast/_git @@ -104,6 +104,7 @@ __git_zsh_bash_func () local expansion=$(__git_aliased_command "$command") if [ -n "$expansion" ]; then + words[1]=$expansion completion_func="_git_${expansion//-/_}" declare -f $completion_func >/dev/null && $completion_func fi diff --git a/plugins/gitfast/git-completion.bash b/plugins/gitfast/git-completion.bash index 9525343f..5944c824 100644 --- a/plugins/gitfast/git-completion.bash +++ b/plugins/gitfast/git-completion.bash @@ -16,11 +16,17 @@ # # To use these routines: # -# 1) Copy this file to somewhere (e.g. ~/.git-completion.sh). +# 1) Copy this file to somewhere (e.g. ~/.git-completion.bash). # 2) Add the following line to your .bashrc/.zshrc: -# source ~/.git-completion.sh +# source ~/.git-completion.bash # 3) Consider changing your PS1 to also show the current branch, # see git-prompt.sh for details. +# +# If you use complex aliases of form '!f() { ... }; f', you can use the null +# command ':' as the first command in the function body to declare the desired +# completion style. For example '!f() { : git commit ; ... }; f' will +# tell the completion to use commit completion. This also works with aliases +# of form "!sh -c '...'". For example, "!sh -c ': git commit ; ... '". case "$COMP_WORDBREAKS" in *:*) : great ;; @@ -180,7 +186,7 @@ fi __gitcompappend () { - local i=${#COMPREPLY[@]} + local x i=${#COMPREPLY[@]} for x in $1; do if [[ "$x" == "$3"* ]]; then COMPREPLY[i++]="$2$x$4" @@ -275,16 +281,12 @@ __gitcomp_file () # argument, and using the options specified in the second argument. __git_ls_files_helper () { - ( - test -n "${CDPATH+set}" && unset CDPATH - cd "$1" - if [ "$2" == "--committable" ]; then - git diff-index --name-only --relative HEAD - else - # NOTE: $2 is not quoted in order to support multiple options - git ls-files --exclude-standard $2 - fi - ) 2>/dev/null + if [ "$2" == "--committable" ]; then + git -C "$1" diff-index --name-only --relative HEAD + else + # NOTE: $2 is not quoted in order to support multiple options + git -C "$1" ls-files --exclude-standard $2 + fi 2>/dev/null } @@ -382,7 +384,8 @@ __git_refs () ;; *) echo "HEAD" - git for-each-ref --format="%(refname:short)" -- "refs/remotes/$dir/" | sed -e "s#^$dir/##" + git for-each-ref --format="%(refname:short)" -- \ + "refs/remotes/$dir/" 2>/dev/null | sed -e "s#^$dir/##" ;; esac } @@ -408,12 +411,9 @@ __git_refs_remotes () __git_remotes () { - local i IFS=$'\n' d="$(__gitdir)" + local d="$(__gitdir)" test -d "$d/remotes" && ls -1 "$d/remotes" - for i in $(git --git-dir="$d" config --get-regexp 'remote\..*\.url' 2>/dev/null); do - i="${i#remote.}" - echo "${i/.url*/}" - done + git --git-dir="$d" remote } __git_list_merge_strategies () @@ -516,7 +516,7 @@ __git_complete_index_file () ;; esac - __gitcomp_file "$(__git_index_files "$1" "$pfx")" "$pfx" "$cur_" + __gitcomp_file "$(__git_index_files "$1" ${pfx:+"$pfx"})" "$pfx" "$cur_" } __git_complete_file () @@ -781,6 +781,10 @@ __git_aliased_command () -*) : option ;; *=*) : setting env ;; git) : git itself ;; + \(\)) : skip parens of shell function definition ;; + {) : skip start of shell helper function ;; + :) : skip null command ;; + \'*) : skip opening quote after sh -c ;; *) echo "$word" return @@ -973,7 +977,7 @@ _git_branch () case "$cur" in --set-upstream-to=*) - __gitcomp "$(__git_refs)" "" "${cur##--set-upstream-to=}" + __gitcomp_nl "$(__git_refs)" "" "${cur##--set-upstream-to=}" ;; --*) __gitcomp " @@ -1041,7 +1045,7 @@ _git_checkout () _git_cherry () { - __gitcomp "$(__git_refs)" + __gitcomp_nl "$(__git_refs)" } _git_cherry_pick () @@ -1165,8 +1169,8 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --full-index --binary --abbrev --diff-filter= --find-copies-harder --text --ignore-space-at-eol --ignore-space-change - --ignore-all-space --exit-code --quiet --ext-diff - --no-ext-diff + --ignore-all-space --ignore-blank-lines --exit-code + --quiet --ext-diff --no-ext-diff --no-prefix --src-prefix= --dst-prefix= --inter-hunk-context= --patience --histogram --minimal @@ -1197,7 +1201,7 @@ _git_diff () } __git_mergetools_common="diffuse diffmerge ecmerge emerge kdiff3 meld opendiff - tkdiff vimdiff gvimdiff xxdiff araxis p4merge bc3 codecompare + tkdiff vimdiff gvimdiff xxdiff araxis p4merge bc codecompare " _git_difftool () @@ -1221,14 +1225,20 @@ _git_difftool () __git_complete_revlist_file } +__git_fetch_recurse_submodules="yes on-demand no" + __git_fetch_options=" --quiet --verbose --append --upload-pack --force --keep --depth= - --tags --no-tags --all --prune --dry-run + --tags --no-tags --all --prune --dry-run --recurse-submodules= " _git_fetch () { case "$cur" in + --recurse-submodules=*) + __gitcomp "$__git_fetch_recurse_submodules" "" "${cur##--recurse-submodules=}" + return + ;; --*) __gitcomp "$__git_fetch_options" return @@ -1292,7 +1302,7 @@ _git_gitk () } __git_match_ctag() { - awk "/^${1////\\/}/ { print \$1 }" "$2" + awk "/^${1//\//\\/}/ { print \$1 }" "$2" } _git_grep () @@ -1412,7 +1422,7 @@ __git_log_gitk_options=" # Options that go well for log and shortlog (not gitk) __git_log_shortlog_options=" --author= --committer= --grep= - --all-match + --all-match --invert-grep " __git_log_pretty_formats="oneline short medium full fuller email raw format:" @@ -1451,6 +1461,7 @@ _git_log () --abbrev-commit --abbrev= --relative-date --date= --pretty= --format= --oneline + --show-signature --cherry-pick --graph --decorate --decorate= @@ -1466,9 +1477,12 @@ _git_log () __git_complete_revlist } +# Common merge options shared by git-merge(1) and git-pull(1). __git_merge_options=" --no-commit --no-stat --log --no-log --squash --strategy --commit --stat --no-squash --ff --no-ff --ff-only --edit --no-edit + --verify-signatures --no-verify-signatures --gpg-sign + --quiet --verbose --progress --no-progress " _git_merge () @@ -1477,7 +1491,8 @@ _git_merge () case "$cur" in --*) - __gitcomp "$__git_merge_options" + __gitcomp "$__git_merge_options + --rerere-autoupdate --no-rerere-autoupdate --abort" return esac __gitcomp_nl "$(__git_refs)" @@ -1583,6 +1598,10 @@ _git_pull () __git_complete_strategy && return case "$cur" in + --recurse-submodules=*) + __gitcomp "$__git_fetch_recurse_submodules" "" "${cur##--recurse-submodules=}" + return + ;; --*) __gitcomp " --rebase --no-rebase @@ -1595,22 +1614,55 @@ _git_pull () __git_complete_remote_or_refspec } +__git_push_recurse_submodules="check on-demand" + +__git_complete_force_with_lease () +{ + local cur_=$1 + + case "$cur_" in + --*=) + ;; + *:*) + __gitcomp_nl "$(__git_refs)" "" "${cur_#*:}" + ;; + *) + __gitcomp_nl "$(__git_refs)" "" "$cur_" + ;; + esac +} + _git_push () { case "$prev" in --repo) __gitcomp_nl "$(__git_remotes)" return + ;; + --recurse-submodules) + __gitcomp "$__git_push_recurse_submodules" + return + ;; esac case "$cur" in --repo=*) __gitcomp_nl "$(__git_remotes)" "" "${cur##--repo=}" return ;; + --recurse-submodules=*) + __gitcomp "$__git_push_recurse_submodules" "" "${cur##--recurse-submodules=}" + return + ;; + --force-with-lease=*) + __git_complete_force_with_lease "${cur##--force-with-lease=}" + return + ;; --*) __gitcomp " --all --mirror --tags --dry-run --force --verbose + --quiet --prune --delete --follow-tags --receive-pack= --repo= --set-upstream + --force-with-lease --force-with-lease= --recurse-submodules= " return ;; @@ -1638,6 +1690,7 @@ _git_rebase () --committer-date-is-author-date --ignore-date --ignore-whitespace --whitespace= --autosquash --fork-point --no-fork-point + --autostash " return @@ -1820,6 +1873,10 @@ _git_config () __gitcomp "$__git_send_email_suppresscc_options" return ;; + sendemail.transferencoding) + __gitcomp "7bit 8bit quoted-printable base64" + return + ;; --get|--get-all|--unset|--unset-all) __gitcomp_nl "$(__git_config_get_set_variables)" return @@ -1954,6 +2011,7 @@ _git_config () color.status.changed color.status.header color.status.nobranch + color.status.unmerged color.status.untracked color.status.updated color.ui @@ -2128,6 +2186,7 @@ _git_config () pull.octopus pull.twohead push.default + push.followTags rebase.autosquash rebase.stat receive.autogc @@ -2287,6 +2346,7 @@ _git_show () ;; --*) __gitcomp "--pretty= --format= --abbrev-commit --oneline + --show-signature $__git_diff_common_options " return @@ -2492,6 +2552,16 @@ _git_tag () __gitcomp_nl "$(__git_refs)" ;; esac + + case "$cur" in + --*) + __gitcomp " + --list --delete --verify --annotate --message --file + --sign --cleanup --local-user --force --column --sort + --contains --points-at + " + ;; + esac } _git_whatchanged () @@ -2547,6 +2617,7 @@ __git_main () local expansion=$(__git_aliased_command "$command") if [ -n "$expansion" ]; then + words[1]=$expansion completion_func="_git_${expansion//-/_}" declare -f $completion_func >/dev/null && $completion_func fi diff --git a/plugins/gitfast/git-prompt.sh b/plugins/gitfast/git-prompt.sh index 9d684b10..f18aedc7 100644 --- a/plugins/gitfast/git-prompt.sh +++ b/plugins/gitfast/git-prompt.sh @@ -84,6 +84,11 @@ # GIT_PS1_SHOWCOLORHINTS to a nonempty value. The colors are based on # the colored output of "git status -sb" and are available only when # using __git_ps1 for PROMPT_COMMAND or precmd. +# +# If you would like __git_ps1 to do nothing in the case when the current +# directory is set up to be ignored by git, then set +# GIT_PS1_HIDE_IF_PWD_IGNORED to a nonempty value. Override this on the +# repository level by setting bash.hideIfPwdIgnored to "false". # check whether printf supports -v __git_printf_supports_v= @@ -270,7 +275,7 @@ __git_ps1_colorize_gitstring () __git_eread () { - f="$1" + local f="$1" shift test -r "$f" && read "$@" <"$f" } @@ -288,6 +293,8 @@ __git_eread () # In this mode you can request colored hints using GIT_PS1_SHOWCOLORHINTS=true __git_ps1 () { + # preserve exit status + local exit=$? local pcmode=no local detached=no local ps1pc_start='\u@\h:\w ' @@ -299,10 +306,14 @@ __git_ps1 () ps1pc_start="$1" ps1pc_end="$2" printf_format="${3:-$printf_format}" + # set PS1 to a plain prompt so that we can + # simply return early if the prompt should not + # be decorated + PS1="$ps1pc_start$ps1pc_end" ;; 0|1) printf_format="${1:-$printf_format}" ;; - *) return + *) return $exit ;; esac @@ -350,11 +361,7 @@ __git_ps1 () rev_parse_exit_code="$?" if [ -z "$repo_info" ]; then - if [ $pcmode = yes ]; then - #In PC mode PS1 always needs to be set - PS1="$ps1pc_start$ps1pc_end" - fi - return + return $exit fi local short_sha @@ -369,6 +376,14 @@ __git_ps1 () local inside_gitdir="${repo_info##*$'\n'}" local g="${repo_info%$'\n'*}" + if [ "true" = "$inside_worktree" ] && + [ -n "${GIT_PS1_HIDE_IF_PWD_IGNORED-}" ] && + [ "$(git config --bool bash.hideIfPwdIgnored)" != "false" ] && + git check-ignore -q . + then + return $exit + fi + local r="" local b="" local step="" @@ -412,10 +427,7 @@ __git_ps1 () else local head="" if ! __git_eread "$g/HEAD" head; then - if [ $pcmode = yes ]; then - PS1="$ps1pc_start$ps1pc_end" - fi - return + return $exit fi # is it a symbolic ref? b="${head#ref: }" @@ -468,13 +480,14 @@ __git_ps1 () fi fi if [ -n "${GIT_PS1_SHOWSTASHSTATE-}" ] && - [ -r "$g/refs/stash" ]; then + git rev-parse --verify --quiet refs/stash >/dev/null + then s="$" fi if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ] && [ "$(git config --bool bash.showUntrackedFiles)" != "false" ] && - git ls-files --others --exclude-standard --error-unmatch -- '*' >/dev/null 2>/dev/null + git ls-files --others --exclude-standard --error-unmatch -- ':/*' >/dev/null 2>/dev/null then u="%${ZSH_VERSION+%}" fi @@ -510,4 +523,6 @@ __git_ps1 () else printf -- "$printf_format" "$gitstring" fi + + return $exit } From d2712d3180e7667ac028f8a40433b9967004cb90 Mon Sep 17 00:00:00 2001 From: Ivan Mironov Date: Wed, 18 May 2016 12:27:23 +0300 Subject: [PATCH 215/537] Add alias for oneline git tree with --all option --- 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 220bf259..34f69029 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -157,6 +157,7 @@ alias glo='git log --oneline --decorate' alias glol="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit" alias glola="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --all" alias glog='git log --oneline --decorate --graph' +alias gloga='git log --oneline --decorate --graph --all' alias glp="_git_log_prettily" compdef _git glp=git-log From eec3dc607c40b33a828938e396a459e70d8b01ed Mon Sep 17 00:00:00 2001 From: Felipe Contreras Date: Thu, 19 May 2016 23:27:30 -0500 Subject: [PATCH 216/537] gitfast: update to upstream v2.8 Signed-off-by: Felipe Contreras --- plugins/gitfast/git-completion.bash | 119 +++++++++++++++++----------- plugins/gitfast/git-prompt.sh | 13 +-- 2 files changed, 80 insertions(+), 52 deletions(-) diff --git a/plugins/gitfast/git-completion.bash b/plugins/gitfast/git-completion.bash index 5944c824..e3918c87 100644 --- a/plugins/gitfast/git-completion.bash +++ b/plugins/gitfast/git-completion.bash @@ -10,6 +10,7 @@ # *) local and remote tag names # *) .git/remotes file names # *) git 'subcommands' +# *) git email aliases for git-send-email # *) tree paths within 'ref:path/to/file' expressions # *) file paths within current working directory and index # *) common --long-options @@ -663,10 +664,11 @@ __git_list_porcelain_commands () check-mailmap) : plumbing;; check-ref-format) : plumbing;; checkout-index) : plumbing;; + column) : internal helper;; commit-tree) : plumbing;; count-objects) : infrequent;; - credential-cache) : credentials helper;; - credential-store) : credentials helper;; + credential) : credentials;; + credential-*) : credentials helper;; cvsexportcommit) : export;; cvsimport) : import;; cvsserver) : daemon;; @@ -735,35 +737,28 @@ __git_list_porcelain_commands () __git_porcelain_commands= __git_compute_porcelain_commands () { - __git_compute_all_commands test -n "$__git_porcelain_commands" || __git_porcelain_commands=$(__git_list_porcelain_commands) } +# Lists all set config variables starting with the given section prefix, +# with the prefix removed. +__git_get_config_variables () +{ + local section="$1" i IFS=$'\n' + for i in $(git --git-dir="$(__gitdir)" config --name-only --get-regexp "^$section\..*" 2>/dev/null); do + echo "${i#$section.}" + done +} + __git_pretty_aliases () { - local i IFS=$'\n' - for i in $(git --git-dir="$(__gitdir)" config --get-regexp "pretty\..*" 2>/dev/null); do - case "$i" in - pretty.*) - i="${i#pretty.}" - echo "${i/ */}" - ;; - esac - done + __git_get_config_variables "pretty" } __git_aliases () { - local i IFS=$'\n' - for i in $(git --git-dir="$(__gitdir)" config --get-regexp "alias\..*" 2>/dev/null); do - case "$i" in - alias.*) - i="${i#alias.}" - echo "${i/ */}" - ;; - esac - done + __git_get_config_variables "alias" } # __git_aliased_command requires 1 argument @@ -1114,7 +1109,7 @@ _git_commit () case "$cur" in --cleanup=*) - __gitcomp "default strip verbatim whitespace + __gitcomp "default scissors strip verbatim whitespace " "" "${cur##--cleanup=}" return ;; @@ -1174,7 +1169,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --no-prefix --src-prefix= --dst-prefix= --inter-hunk-context= --patience --histogram --minimal - --raw --word-diff + --raw --word-diff --word-diff-regex= --dirstat --dirstat= --dirstat-by-file --dirstat-by-file= --cumulative --diff-algorithm= @@ -1317,6 +1312,7 @@ _git_grep () --full-name --line-number --extended-regexp --basic-regexp --fixed-strings --perl-regexp + --threads --files-with-matches --name-only --files-without-match --max-depth @@ -1448,7 +1444,7 @@ _git_log () return ;; --decorate=*) - __gitcomp "long short" "" "${cur##--decorate=}" + __gitcomp "full short no" "" "${cur##--decorate=}" return ;; --*) @@ -1673,7 +1669,10 @@ _git_push () _git_rebase () { local dir="$(__gitdir)" - if [ -d "$dir"/rebase-apply ] || [ -d "$dir"/rebase-merge ]; then + if [ -f "$dir"/rebase-merge/interactive ]; then + __gitcomp "--continue --skip --abort --edit-todo" + return + elif [ -d "$dir"/rebase-apply ] || [ -d "$dir"/rebase-merge ]; then __gitcomp "--continue --skip --abort" return fi @@ -1689,8 +1688,12 @@ _git_rebase () --preserve-merges --stat --no-stat --committer-date-is-author-date --ignore-date --ignore-whitespace --whitespace= - --autosquash --fork-point --no-fork-point - --autostash + --autosquash --no-autosquash + --fork-point --no-fork-point + --autostash --no-autostash + --verify --no-verify + --keep-empty --root --force-rebase --no-ff + --exec " return @@ -1715,6 +1718,15 @@ __git_send_email_suppresscc_options="author self cc bodycc sob cccmd body all" _git_send_email () { + case "$prev" in + --to|--cc|--bcc|--from) + __gitcomp " + $(git --git-dir="$(__gitdir)" send-email --dump-aliases 2>/dev/null) + " + return + ;; + esac + case "$cur" in --confirm=*) __gitcomp " @@ -1739,6 +1751,12 @@ _git_send_email () " "" "${cur##--thread=}" return ;; + --to=*|--cc=*|--bcc=*|--from=*) + __gitcomp " + $(git --git-dir="$(__gitdir)" send-email --dump-aliases 2>/dev/null) + " "" "${cur#--*=}" + return + ;; --*) __gitcomp "--annotate --bcc --cc --cc-cmd --chain-reply-to --compose --confirm= --dry-run --envelope-sender @@ -1780,15 +1798,7 @@ __git_config_get_set_variables () c=$((--c)) done - git --git-dir="$(__gitdir)" config $config_file --list 2>/dev/null | - while read -r line - do - case "$line" in - *.*=*) - echo "${line/=*/}" - ;; - esac - done + git --git-dir="$(__gitdir)" config $config_file --name-only --list 2>/dev/null } _git_config () @@ -1803,7 +1813,7 @@ _git_config () return ;; branch.*.rebase) - __gitcomp "false true" + __gitcomp "false true preserve interactive" return ;; remote.pushdefault) @@ -1893,6 +1903,7 @@ _git_config () --get --get-all --get-regexp --add --unset --unset-all --remove-section --rename-section + --name-only " return ;; @@ -2049,6 +2060,7 @@ _git_config () core.sparseCheckout core.symlinks core.trustctime + core.untrackedCache core.warnAmbiguousRefs core.whitespace core.worktree @@ -2123,6 +2135,8 @@ _git_config () http.noEPSV http.postBuffer http.proxy + http.sslCipherList + http.sslVersion http.sslCAInfo http.sslCAPath http.sslCert @@ -2260,12 +2274,7 @@ _git_remote () __git_complete_remote_or_refspec ;; update) - local i c='' IFS=$'\n' - for i in $(git --git-dir="$(__gitdir)" config --get-regexp "remotes\..*" 2>/dev/null); do - i="${i#remotes.}" - c="$c ${i/ */}" - done - __gitcomp "$c" + __gitcomp "$(__git_get_config_variables "remotes")" ;; *) ;; @@ -2292,6 +2301,11 @@ _git_reset () _git_revert () { + local dir="$(__gitdir)" + if [ -f "$dir"/REVERT_HEAD ]; then + __gitcomp "--continue --quit --abort" + return + fi case "$cur" in --*) __gitcomp "--edit --mainline --no-edit --no-commit --signoff" @@ -2360,7 +2374,7 @@ _git_show_branch () case "$cur" in --*) __gitcomp " - --all --remotes --topo-order --current --more= + --all --remotes --topo-order --date-order --current --more= --list --independent --merge-base --no-name --color --no-color --sha1-name --sparse --topics --reflog @@ -2373,7 +2387,7 @@ _git_show_branch () _git_stash () { - local save_opts='--keep-index --no-keep-index --quiet --patch' + local save_opts='--all --keep-index --no-keep-index --quiet --patch --include-untracked' local subcommands='save list show apply clear drop pop create branch' local subcommand="$(__git_find_on_cmdline "$subcommands")" if [ -z "$subcommand" ]; then @@ -2395,9 +2409,20 @@ _git_stash () apply,--*|pop,--*) __gitcomp "--index --quiet" ;; - show,--*|drop,--*|branch,--*) + drop,--*) + __gitcomp "--quiet" ;; - show,*|apply,*|drop,*|pop,*|branch,*) + show,--*|branch,--*) + ;; + branch,*) + if [ $cword -eq 3 ]; then + __gitcomp_nl "$(__git_refs)"; + else + __gitcomp_nl "$(git --git-dir="$(__gitdir)" stash list \ + | sed -n -e 's/:.*//p')" + fi + ;; + show,*|apply,*|drop,*|pop,*) __gitcomp_nl "$(git --git-dir="$(__gitdir)" stash list \ | sed -n -e 's/:.*//p')" ;; diff --git a/plugins/gitfast/git-prompt.sh b/plugins/gitfast/git-prompt.sh index f18aedc7..64219e63 100644 --- a/plugins/gitfast/git-prompt.sh +++ b/plugins/gitfast/git-prompt.sh @@ -66,6 +66,10 @@ # git always compare HEAD to @{upstream} # svn always compare HEAD to your SVN upstream # +# You can change the separator between the branch name and the above +# state symbols by setting GIT_PS1_STATESEPARATOR. The default separator +# is SP. +# # By default, __git_ps1 will compare HEAD to your SVN upstream if it can # find one, or @{upstream} otherwise. Once you have set # GIT_PS1_SHOWUPSTREAM, you can override it on a per-repository basis by @@ -472,10 +476,9 @@ __git_ps1 () if [ -n "${GIT_PS1_SHOWDIRTYSTATE-}" ] && [ "$(git config --bool bash.showDirtyState)" != "false" ] then - git diff --no-ext-diff --quiet --exit-code || w="*" - if [ -n "$short_sha" ]; then - git diff-index --cached --quiet HEAD -- || i="+" - else + git diff --no-ext-diff --quiet || w="*" + git diff --no-ext-diff --cached --quiet || i="+" + if [ -z "$short_sha" ] && [ -z "$i" ]; then i="#" fi fi @@ -487,7 +490,7 @@ __git_ps1 () if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ] && [ "$(git config --bool bash.showUntrackedFiles)" != "false" ] && - git ls-files --others --exclude-standard --error-unmatch -- ':/*' >/dev/null 2>/dev/null + git ls-files --others --exclude-standard --directory --no-empty-directory --error-unmatch -- ':/*' >/dev/null 2>/dev/null then u="%${ZSH_VERSION+%}" fi From 079fef48dfc06b415423abb0a1e467f85e03b2c4 Mon Sep 17 00:00:00 2001 From: Felipe Contreras Date: Thu, 19 May 2016 23:32:44 -0500 Subject: [PATCH 217/537] gitfast: fix the prompt colour We can add colour in Zsh without the need of pcmode. Signed-off-by: Felipe Contreras --- plugins/gitfast/git-prompt.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/gitfast/git-prompt.sh b/plugins/gitfast/git-prompt.sh index 64219e63..0da14eee 100644 --- a/plugins/gitfast/git-prompt.sh +++ b/plugins/gitfast/git-prompt.sh @@ -502,9 +502,11 @@ __git_ps1 () local z="${GIT_PS1_STATESEPARATOR-" "}" - # NO color option unless in PROMPT_COMMAND mode - if [ $pcmode = yes ] && [ -n "${GIT_PS1_SHOWCOLORHINTS-}" ]; then - __git_ps1_colorize_gitstring + # NO color option unless in PROMPT_COMMAND mode or it's Zsh + if [ -n "${GIT_PS1_SHOWCOLORHINTS-}" ]; then + if [ $pcmode = yes ] || [ -n "${ZSH_VERSION-}" ]; then + __git_ps1_colorize_gitstring + fi fi b=${b##refs/heads/} From 36e29fbc193c32d14f0d63fbf6ae233a924b1d67 Mon Sep 17 00:00:00 2001 From: Felipe Contreras Date: Thu, 5 Jun 2014 18:15:47 -0500 Subject: [PATCH 218/537] completion: zsh: improve main function selection Sometimes we want to use the function directly (e.g. _git_checkout), for example when zsh has the option 'complete_aliases', this way, we can do something like: compdef _git gco=git_checkout Signed-off-by: Felipe Contreras --- plugins/gitfast/_git | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/gitfast/_git b/plugins/gitfast/_git index 7ed3e3c2..6d1b4ecc 100644 --- a/plugins/gitfast/_git +++ b/plugins/gitfast/_git @@ -214,8 +214,10 @@ _git () if (( $+functions[__${service}_zsh_main] )); then __${service}_zsh_main - else + elif (( $+functions[__${service}_main] )); then emulate ksh -c __${service}_main + elif (( $+functions[_${service}] )); then + emulate ksh -c _${service} fi let _ret && _default && _ret=0 From c2168d741f129efb52ff86e0c6bcd1efe191a58b Mon Sep 17 00:00:00 2001 From: Ivan Mironov Date: Sun, 22 May 2016 03:47:55 +0300 Subject: [PATCH 219/537] Arcanist plugin (#5106) * Add initial list of aliases * Add lint and diff aliases * Remove usage section --- plugins/arcanist/README.md | 5 +++++ plugins/arcanist/arcanist.plugin.zsh | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 plugins/arcanist/README.md create mode 100644 plugins/arcanist/arcanist.plugin.zsh diff --git a/plugins/arcanist/README.md b/plugins/arcanist/README.md new file mode 100644 index 00000000..4bb8c809 --- /dev/null +++ b/plugins/arcanist/README.md @@ -0,0 +1,5 @@ +## arcanist + +**Maintainer:** [@emzar](https://github.com/emzar) + +This plugin adds many useful aliases. diff --git a/plugins/arcanist/arcanist.plugin.zsh b/plugins/arcanist/arcanist.plugin.zsh new file mode 100644 index 00000000..90851ac6 --- /dev/null +++ b/plugins/arcanist/arcanist.plugin.zsh @@ -0,0 +1,21 @@ +# +# Aliases +# (sorted alphabetically) +# + +alias ara='arc amend' +alias arb='arc branch' +alias arc='arc cover' +alias arci='arc commit' + +alias ard='arc diff' +alias ardnu='arc diff --nounit' +alias ardnupc='arc diff --nounit --plan-changes' +alias ardpc='arc diff --plan-changes' + +alias are='arc export' +alias arh='arc help' +alias arl='arc land' +alias arli='arc lint' +alias arls='arc list' +alias arp='arc patch' From f2b1be0ddaa6603689d18630a62b468cdfc3246b Mon Sep 17 00:00:00 2001 From: Grant Regimbal Date: Sat, 21 May 2016 17:51:30 -0700 Subject: [PATCH 220/537] vagrant snapshot (#5032) --- plugins/vagrant/_vagrant | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/vagrant/_vagrant b/plugins/vagrant/_vagrant index 35377bd9..c5335e72 100644 --- a/plugins/vagrant/_vagrant +++ b/plugins/vagrant/_vagrant @@ -31,6 +31,7 @@ _1st_arguments=( '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' + 'snapshot:Used to manage snapshots with the guest machine' 'up:Creates the vagrant environment' 'version:Prints current and latest Vagrant version' '--help:[TASK] Describe available tasks or one specific task' From 670a470a85464e94420a562ab6a22871c20391e8 Mon Sep 17 00:00:00 2001 From: jordantwombly Date: Sat, 21 May 2016 20:51:48 -0400 Subject: [PATCH 221/537] fixed bower completion error from issue #2694 (#5056) --- plugins/bower/bower.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/bower/bower.plugin.zsh b/plugins/bower/bower.plugin.zsh index 68a67a3c..6019b9d3 100644 --- a/plugins/bower/bower.plugin.zsh +++ b/plugins/bower/bower.plugin.zsh @@ -72,6 +72,7 @@ _bower () compadd "$@" $(echo $bower_package_list) ;; *) + _arguments \ $_no_color \ ;; esac From 9ad9ac69a66cb3f61a642241b4723ae7e0789033 Mon Sep 17 00:00:00 2001 From: Alexander Berezovsky Date: Sat, 21 May 2016 17:52:11 -0700 Subject: [PATCH 222/537] Change vim command to $EDITOR for consistency (#5063) --- plugins/fasd/fasd.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/fasd/fasd.plugin.zsh b/plugins/fasd/fasd.plugin.zsh index b11f0b51..2c302f74 100644 --- a/plugins/fasd/fasd.plugin.zsh +++ b/plugins/fasd/fasd.plugin.zsh @@ -6,6 +6,6 @@ if [ $commands[fasd] ]; then # check if fasd is installed source "$fasd_cache" unset fasd_cache - alias v='f -e vim' + alias v="f -e $EDITOR" alias o='a -e open_command' fi From 9a0f9d7e8bcefb4d9895ca185a35c42366e19b00 Mon Sep 17 00:00:00 2001 From: Draniu Date: Wed, 18 May 2016 23:58:12 +0200 Subject: [PATCH 223/537] Better cake3 completion --- plugins/cakephp3/cakephp3.plugin.zsh | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/plugins/cakephp3/cakephp3.plugin.zsh b/plugins/cakephp3/cakephp3.plugin.zsh index 28d5af2e..2b0f5899 100644 --- a/plugins/cakephp3/cakephp3.plugin.zsh +++ b/plugins/cakephp3/cakephp3.plugin.zsh @@ -1,11 +1,30 @@ # CakePHP 3 basic command completion _cakephp3_get_command_list () { - cakephp3commands=($(bin/cake completion commands));printf "%s\n" "${cakephp3commands[@]}" + bin/cake Completion commands +} + +_cakephp3_get_sub_command_list () { + bin/cake Completion subcommands ${words[2]} +} + +_cakephp3_get_3rd_argument () { + bin/cake ${words[2]} ${words[3]} | grep '\-\ '| awk '{print $2}' } _cakephp3 () { + has3rdargument=("all" "controller" "fixture" "model" "template") if [ -f bin/cake ]; then - compadd `_cakephp3_get_command_list` + if (( CURRENT == 2 )); then + compadd `_cakephp3_get_command_list` + fi + if (( CURRENT == 3 )); then + compadd `_cakephp3_get_sub_command_list` + fi + if (( CURRENT == 4 )); then + if [[ ${has3rdargument[(i)${words[3]}]} -le ${#has3rdargument} ]] ; then ; + compadd `_cakephp3_get_3rd_argument` + fi + fi fi } @@ -14,6 +33,5 @@ compdef _cakephp3 cake #Alias alias c3='bin/cake' - alias c3cache='bin/cake orm_cache clear' alias c3migrate='bin/cake migrations migrate' From 87cbf3fcf1e295f11ef3e0b6f928861575854fe6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Mon, 23 May 2016 12:33:17 +0200 Subject: [PATCH 224/537] Fix styling in cakephp3 completion --- plugins/cakephp3/cakephp3.plugin.zsh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/plugins/cakephp3/cakephp3.plugin.zsh b/plugins/cakephp3/cakephp3.plugin.zsh index 2b0f5899..dbfbeba3 100644 --- a/plugins/cakephp3/cakephp3.plugin.zsh +++ b/plugins/cakephp3/cakephp3.plugin.zsh @@ -8,21 +8,22 @@ _cakephp3_get_sub_command_list () { } _cakephp3_get_3rd_argument () { - bin/cake ${words[2]} ${words[3]} | grep '\-\ '| awk '{print $2}' + bin/cake ${words[2]} ${words[3]} | \grep '\-\ '| \awk '{print $2}' } _cakephp3 () { - has3rdargument=("all" "controller" "fixture" "model" "template") - if [ -f bin/cake ]; then + local -a has3rdargument + has3rdargument=("all" "controller" "fixture" "model" "template") + if [ -f bin/cake ]; then if (( CURRENT == 2 )); then - compadd `_cakephp3_get_command_list` + compadd $(_cakephp3_get_command_list) fi if (( CURRENT == 3 )); then - compadd `_cakephp3_get_sub_command_list` + compadd $(_cakephp3_get_sub_command_list) fi if (( CURRENT == 4 )); then - if [[ ${has3rdargument[(i)${words[3]}]} -le ${#has3rdargument} ]] ; then ; - compadd `_cakephp3_get_3rd_argument` + if [[ ${has3rdargument[(i)${words[3]}]} -le ${#has3rdargument} ]]; then + compadd $(_cakephp3_get_3rd_argument) fi fi fi From 1e90f3618f1881d7ed5fb06fee1f2432be036350 Mon Sep 17 00:00:00 2001 From: Mateusz Jaje Date: Mon, 23 May 2016 18:43:15 +0200 Subject: [PATCH 225/537] added assembly alias (#5107) --- plugins/sbt/sbt.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/sbt/sbt.plugin.zsh b/plugins/sbt/sbt.plugin.zsh index 203c691f..15acfec4 100644 --- a/plugins/sbt/sbt.plugin.zsh +++ b/plugins/sbt/sbt.plugin.zsh @@ -21,3 +21,4 @@ alias sbr='sbt run' alias sbrm='sbt run-main' alias sbu='sbt update' alias sbx='sbt test' +alias sba='sbt assembly' From bdc82114d010b3f1ffdfc90b48fa80094176a0ca Mon Sep 17 00:00:00 2001 From: Wasif Hasan Baig Date: Thu, 26 May 2016 10:26:01 -0700 Subject: [PATCH 226/537] Changd `alias gsta='git stash'` to `alias gsta='git stash save'`. --- 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 34f69029..eb7bc803 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -199,7 +199,7 @@ alias gsps='git show --pretty=short --show-signature' alias gsr='git svn rebase' alias gss='git status -s' alias gst='git status' -alias gsta='git stash' +alias gsta='git stash save' alias gstaa='git stash apply' alias gstd='git stash drop' alias gstl='git stash list' From 73cca9432253ab06c8ad64f96f21effac5532a6d Mon Sep 17 00:00:00 2001 From: Alex Light Date: Fri, 27 May 2016 15:38:41 -0700 Subject: [PATCH 227/537] Add zsh completion plugin for rustc (#3159) --- plugins/rust/_rust | 191 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 191 insertions(+) create mode 100644 plugins/rust/_rust diff --git a/plugins/rust/_rust b/plugins/rust/_rust new file mode 100644 index 00000000..f4e8f6f7 --- /dev/null +++ b/plugins/rust/_rust @@ -0,0 +1,191 @@ +#compdef rustc + +local -a _rustc_opts_switches _rustc_opts_lint _rustc_opts_debug + +typeset -A opt_args + +_rustc_debuginfo_levels=( + "0[no debug info]" + "1[line-tables only (for stacktraces and breakpoints)]" + "2[full debug info with variable and type information (same as -g)]" +) + +_rustc_crate_types=( + 'bin' + 'lib' + 'rlib' + 'dylib' + 'staticlib' +) + +_rustc_emit_types=( + 'asm' + 'bc' + 'ir' + 'obj' + 'link' +) +_rustc_pretty_types=( + 'normal[un-annotated source]' + 'expanded[crates expanded]' + 'typed[crates expanded, with type annotations]' + 'identified[fully parenthesized, AST nodes and blocks with IDs]' + 'flowgraph=[graphviz formatted flowgraph for node]:NODEID:' +) +_rustc_color_types=( + 'auto[colorize, if output goes to a tty (default)]' + 'always[always colorize output]' + 'never[never colorize output]' +) + +_rustc_opts_vals=( + --crate-name='[Specify the name of the crate being built]' + --crate-type='[Comma separated list of types of crates for the compiler to emit]:TYPES:_values -s "," "Crate types" "$_rustc_crate_types[@]"' + --emit='[Comma separated list of types of output for the compiler to emit]:TYPES:_values -s "," "Emit Targets" "$_rustc_emit_types[@]"' + --debuginfo='[Emit DWARF debug info to the objects created]:LEVEL:_values "Debug Levels" "$_rustc_debuginfo_levels[@]"' + --dep-info='[Output dependency info to after compiling]::FILE:_files -/' + --sysroot='[Override the system root]:PATH:_files -/' + --cfg='[Configure the compilation environment]:SPEC:' + --out-dir='[Write output to compiler-chosen filename in . Ignored if -o is specified. (default the current directory)]:DIR:_files -/' + -o'[Write output to . Ignored if more than one --emit is specified.]:FILENAME:_files' + --opt-level='[Optimize with possible levels 0-3]:LEVEL:(0 1 2 3)' + --pretty='[Pretty-print the input instead of compiling]::TYPE:_values "TYPES" "$_rustc_pretty_types[@]"' + -L'[Add a directory to the library search path]:DIR:_files -/' + --target='[Target triple cpu-manufacturer-kernel\[-os\] to compile]:TRIPLE:' + --color='[Configure coloring of output]:CONF:_values "COLORS" "$_rustc_color_types[@]"' + {-v,--version}'[Print version info and exit]::VERBOSE:(verbose)' + --explain='[Provide a detailed explanation of an error message]:OPT:' + --extern'[Specify where an external rust library is located]:ARG:' +) + +_rustc_opts_switches=( + -g'[Equivalent to --debuginfo=2]' + {-h,--help}'[Display this message]' + --no-analysis'[Parse and expand the output, but run no analysis or produce output]' + --no-trans'[Run all passes except translation; no output]' + -O'[Equivalent to --opt-level=2]' + --parse-only'[Parse only; do not compile, assemble, or link]' + --print-crate-name'[Output the crate name and exit]' + --print-file-name'[Output the file(s) that would be written if compilation continued and exit]' + --test'[Build a test harness]' +) +_rustc_opts_codegen=( + 'ar=[Path to the archive utility to use when assembling archives.]:BIN:_path_files' + 'linker=[Path to the linker utility to use when linking libraries, executables, and objects.]:BIN:_path_files' + 'link-args=[A space-separated list of extra arguments to pass to the linker when the linker is invoked.]:ARGS:' + 'target-cpu=[Selects a target processor. If the value is "help", then a list of available CPUs is printed.]:CPU:' + 'target-feature=[A space-separated list of features to enable or disable for the target. A preceding "+" enables a feature while a preceding "-" disables it. Available features can be discovered through target-cpu=help.]:FEATURE:' + 'passes=[A space-separated list of extra LLVM passes to run. A value of "list" will cause rustc to print all known passes and exit. The passes specified are appended at the end of the normal pass manager.]:LIST:' + 'llvm-args=[A space-separated list of arguments to pass through to LLVM.]:ARGS:' + 'save-temps[If specified, the compiler will save more files (.bc, .o, .no-opt.bc) generated throughout compilation in the output directory.]' + 'rpath[If specified, then the rpath value for dynamic libraries will be set in either dynamic library or executable outputs.]' + 'no-prepopulate-passes[Suppresses pre-population of the LLVM pass manager that is run over the module.]' + 'no-vectorize-loops[Suppresses running the loop vectorization LLVM pass, regardless of optimization level.]' + 'no-vectorize-slp[Suppresses running the LLVM SLP vectorization pass, regardless of optimization level.]' + 'soft-float[Generates software floating point library calls instead of hardware instructions.]' + 'prefer-dynamic[Prefers dynamic linking to static linking.]' + "no-integrated-as[Force usage of an external assembler rather than LLVM's integrated one.]" + 'no-redzone[disable the use of the redzone]' + 'relocation-model=[The relocation model to use. (default: pic)]:MODEL:(pic static dynamic-no-pic)' + 'code-model=[choose the code model to use (llc -code-model for details)]:MODEL:' + 'metadata=[metadata to mangle symbol names with]:VAL:' + 'extra-filenames=[extra data to put in each output filename]:VAL:' + 'codegen-units=[divide crate into N units to optimize in parallel]:N:' + 'help[Show all codegen options]' +) + +_rustc_opts_lint=( + 'help[Show a list of all lints]' + 'experimental[detects use of #\[experimental\] items]' + 'heap-memory[use of any (Box type or @ type) heap memory]' + 'managed-heap-memory[use of managed (@ type) heap memory]' + 'missing-doc[detects missing documentation for public members]' + 'non-uppercase-statics[static constants should have uppercase identifiers]' + 'owned-heap-memory[use of owned (~ type) heap memory]' + 'unnecessary-qualification[detects unnecessarily qualified names]' + 'unsafe-block[usage of an `unsafe` block]' + 'unstable[detects use of #\[unstable\] items (incl. items with no stability attribute)]' + 'unused-result[unused result of an expression in a statement]' + 'variant-size-difference[detects enums with widely varying variant sizes]' + 'ctypes[proper use of libc types in foreign modules]' + 'dead-assignment[detect assignments that will never be read]' + 'dead-code[detect piece of code that will never be used]' + 'deprecated[detects use of #\[deprecated\] items]' + 'non-camel-case-types[types, variants and traits should have camel case names]' + 'non-snake-case[methods, functions, lifetime parameters and modules should have snake case names]' + 'path-statement[path statements with no effect]' + 'raw-pointer-deriving[uses of #\[deriving\] with raw pointers are rarely correct]' + 'type-limits[comparisons made useless by limits of the types involved]' + 'type-overflow[literal out of range for its type]' + 'unnecessary-allocation[detects unnecessary allocations that can be eliminated]' + 'unnecessary-parens[`if`, `match`, `while` and `return` do not need parentheses]' + 'unreachable-code[detects unreachable code]' + 'unrecognized-lint[unrecognized lint attribute]' + 'unsigned-negate[using an unary minus operator on unsigned type]' + 'unused-attribute[detects attributes that were not used by the compiler]' + 'unused-imports[imports that are never used]' + 'unused-must-use[unused result of a type flagged as #\[must_use\]]' + "unused-mut[detect mut variables which don't need to be mutable]" + 'unused-unsafe[unnecessary use of an `unsafe` block]' + 'unused-variable[detect variables which are not used in any way]' + 'visible-private-types[detect use of private types in exported type signatures]' + 'warnings[mass-change the level for lints which produce warnings]' + 'while-true[suggest using `loop { }` instead of `while true { }`]' + 'unknown-crate-type[unknown crate type found in #\[crate_type\] directive]' + 'unknown-features[unknown features found in crate-level #\[feature\] directives]' + 'bad-style[group of non_camel_case_types, non_snake_case, non_uppercase_statics]' + 'unused[group of unused_imports, unused_variable, dead_assignment, dead_code, unused_mut, unreachable_code]' +) + +_rustc_opts_debug=( + 'verbose[in general, enable more debug printouts]' + 'time-passes[measure time of each rustc pass]' + 'count-llvm-insns[count where LLVM instrs originate]' + 'time-llvm-passes[measure time of each LLVM pass]' + 'trans-stats[gather trans statistics]' + 'asm-comments[generate comments into the assembly (may change behavior)]' + 'no-verify[skip LLVM verification]' + 'borrowck-stats[gather borrowck statistics]' + 'no-landing-pads[omit landing pads for unwinding]' + 'debug-llvm[enable debug output from LLVM]' + 'show-span[show spans for compiler debugging]' + 'count-type-sizes[count the sizes of aggregate types]' + 'meta-stats[gather metadata statistics]' + 'no-opt[do not optimize, even if -O is passed]' + 'print-link-args[Print the arguments passed to the linker]' + 'gc[Garbage collect shared data (experimental)]' + 'print-llvm-passes[Prints the llvm optimization passes being run]' + 'lto[Perform LLVM link-time optimizations]' + 'ast-json[Print the AST as JSON and halt]' + 'ast-json-noexpand[Print the pre-expansion AST as JSON and halt]' + 'ls[List the symbols defined by a library crate]' + 'save-analysis[Write syntax and type analysis information in addition to normal output]' + 'flowgraph-print-loans[Include loan analysis data in --pretty flowgraph output]' + 'flowgraph-print-moves[Include move analysis data in --pretty flowgraph output]' + 'flowgraph-print-assigns[Include assignment analysis data in --pretty flowgraph output]' + 'flowgraph-print-all[Include all dataflow analysis data in --pretty flowgraph output]' +) + +_rustc_opts_fun_lint(){ + _values -s , 'options' \ + "$_rustc_opts_lint[@]" +} + +_rustc_opts_fun_debug(){ + _values 'options' "$_rustc_opts_debug[@]" +} + +_rustc_opts_fun_codegen(){ + _values 'options' "$_rustc_opts_codegen[@]" +} + +_arguments -s : \ + '(-W --warn)'{-W,--warn=}'[Set lint warnings]:lint options:_rustc_opts_fun_lint' \ + '(-A --allow)'{-A,--allow=}'[Set lint allowed]:lint options:_rustc_opts_fun_lint' \ + '(-D --deny)'{-D,--deny=}'[Set lint denied]:lint options:_rustc_opts_fun_lint' \ + '(-F --forbid)'{-F,--forbid=}'[Set lint forbidden]:lint options:_rustc_opts_fun_lint' \ + '*-Z[Set internal debugging options]:debug options:_rustc_opts_fun_debug' \ + '*-C[Set internal Codegen options]:codegen options:_rustc_opts_fun_codegen' \ + "$_rustc_opts_switches[@]" \ + "$_rustc_opts_vals[@]" \ + '::files:_files -g "*.rs"' From c1951892314592295b0d5865f8ef5c72f360d6d0 Mon Sep 17 00:00:00 2001 From: Victor Torres Date: Sun, 29 May 2016 06:25:17 -0300 Subject: [PATCH 228/537] Use default branch on recently created Mercurial repository. (#4985) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After `hg init` command, sometimes Mercurial does not create `.hg/branch` file so we'll use 'default' as fallback, which is the master branch in Mercurial repositories. Signed-off-by: Marc Cornellà --- plugins/branch/branch.plugin.zsh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/branch/branch.plugin.zsh b/plugins/branch/branch.plugin.zsh index a1e9ca31..2e5659bd 100644 --- a/plugins/branch/branch.plugin.zsh +++ b/plugins/branch/branch.plugin.zsh @@ -17,7 +17,12 @@ function branch_prompt_info() { # Mercurial repository if [[ -d "${current_dir}/.hg" ]] then - echo '☿' $(<"$current_dir/.hg/branch") + if [[ -f "$current_dir/.hg/branch" ]] + then + echo '☿' $(<"$current_dir/.hg/branch") + else + echo '☿ default' + fi return; fi # Defines path as parent directory and keeps looking for :) From 483f1208a5fc1fbe129958452388bdc3c3409e1e Mon Sep 17 00:00:00 2001 From: Andrew Janke Date: Mon, 30 May 2016 18:53:54 -0400 Subject: [PATCH 229/537] installer: fix ordering of cygwin msys git check (#4557) --- tools/install.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/install.sh b/tools/install.sh index 8cba5208..199d2941 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -53,11 +53,6 @@ main() { echo "Error: git is not installed" exit 1 } - env git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git $ZSH || { - printf "Error: git clone of oh-my-zsh repo failed\n" - exit 1 - } - # The Windows (MSYS) Git is not compatible with normal use on cygwin if [ "$OSTYPE" = cygwin ]; then if git --version | grep msysgit > /dev/null; then @@ -66,6 +61,11 @@ main() { exit 1 fi fi + env git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git $ZSH || { + printf "Error: git clone of oh-my-zsh repo failed\n" + exit 1 + } + printf "${BLUE}Looking for an existing zsh config...${NORMAL}\n" if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then From 5fa4d9d7606057ccb8e39a452db9a656b5f3caed Mon Sep 17 00:00:00 2001 From: wangzengdi Date: Tue, 31 May 2016 09:57:36 +0800 Subject: [PATCH 230/537] add alias gh=git help --- plugins/git/git.plugin.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index eb7bc803..3187cab7 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -137,6 +137,8 @@ compdef _git ggu=git-checkout alias ggpur='ggu' compdef _git ggpur=git-checkout +alias gh='git help' + alias gignore='git update-index --assume-unchanged' alias gignored='git ls-files -v | grep "^[[:lower:]]"' alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk' From e1e549ca504b18d3ee5d5ea22d2d99a45ac1f668 Mon Sep 17 00:00:00 2001 From: debbbbie Date: Tue, 31 May 2016 05:41:45 -0500 Subject: [PATCH 231/537] add plugin react-native (#4606) --- plugins/react-native/_react-native | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 plugins/react-native/_react-native diff --git a/plugins/react-native/_react-native b/plugins/react-native/_react-native new file mode 100644 index 00000000..47ee8c37 --- /dev/null +++ b/plugins/react-native/_react-native @@ -0,0 +1,23 @@ +#compdef react-native +#autoload + +local -a _1st_arguments +_1st_arguments=( + 'start:starts the webserver' + 'bundle:builds the javascript bundle for offline use' + 'new-library:generates a native library bridge' + 'android:generates an Android project for your app' + 'run-android:builds your app and starts it on a connected Android emulator or device' + 'upgrade:upgrade your apps template files to the latest version; run this after updating the react-native version in your package.json and running npm install' +) + + +_arguments \ + '(--version)--version[show version]' \ + '(--help)--help[show help]' \ + '*:: :->subcmds' && return 0 + +if (( CURRENT == 1 )); then + _describe -t commands "react-native subcommand" _1st_arguments + return +fi From dc222704dfac09f7b5eaa8befd7afc39c69e51c5 Mon Sep 17 00:00:00 2001 From: Ivan Mironov Date: Wed, 1 Jun 2016 13:23:20 +0300 Subject: [PATCH 232/537] Fix arcanist aliases (#5110) * Fix arc cover alias * Fix arc pacth alias --- plugins/arcanist/arcanist.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/arcanist/arcanist.plugin.zsh b/plugins/arcanist/arcanist.plugin.zsh index 90851ac6..3f4eb07f 100644 --- a/plugins/arcanist/arcanist.plugin.zsh +++ b/plugins/arcanist/arcanist.plugin.zsh @@ -5,7 +5,7 @@ alias ara='arc amend' alias arb='arc branch' -alias arc='arc cover' +alias arco='arc cover' alias arci='arc commit' alias ard='arc diff' @@ -18,4 +18,4 @@ alias arh='arc help' alias arl='arc land' alias arli='arc lint' alias arls='arc list' -alias arp='arc patch' +alias arpa='arc patch' From deb992b8aa493ecd4cb13ceb32aa848909bbcefa Mon Sep 17 00:00:00 2001 From: Bilal Budhani Date: Mon, 6 Jun 2016 04:39:42 +0530 Subject: [PATCH 233/537] Adds ReactNative plugin :iphone: (#5018) --- plugins/react-native/README.md | 14 ++++++++++++++ plugins/react-native/react-native.plugin.zsh | 6 ++++++ 2 files changed, 20 insertions(+) create mode 100644 plugins/react-native/README.md create mode 100644 plugins/react-native/react-native.plugin.zsh diff --git a/plugins/react-native/README.md b/plugins/react-native/README.md new file mode 100644 index 00000000..78bfb684 --- /dev/null +++ b/plugins/react-native/README.md @@ -0,0 +1,14 @@ +# React Native + +**Maintainer:** [BilalBudhani](https://github.com/BilalBudhani) + +### List of Aliases + +Alias | React Native command +------|--------------------- +**rnand** | *react-native run-android* +**rnios** | *react-native run-ios* +**rnios4s** | *react-native run-ios --simulator "iPhone 4s"* +**rnios5** | *react-native run-ios --simulator "iPhone 5"* +**rnios5s** | *react-native run-ios --simulator "iPhone 5s"* + diff --git a/plugins/react-native/react-native.plugin.zsh b/plugins/react-native/react-native.plugin.zsh new file mode 100644 index 00000000..7323f1d2 --- /dev/null +++ b/plugins/react-native/react-native.plugin.zsh @@ -0,0 +1,6 @@ +alias rnand='react-native run-android' +alias rnios4s='react-native run-ios --simulator "iPhone 4s"' +alias rnios5='react-native run-ios --simulator "iPhone 5"' +alias rnios5s='react-native run-ios --simulator "iPhone 5s"' +alias rnios='react-native run-ios' + From 2d7a451e0e9221e02c9b34e824dea959eaa6a079 Mon Sep 17 00:00:00 2001 From: Ben Cole Date: Mon, 6 Jun 2016 06:43:59 +0100 Subject: [PATCH 234/537] Add list-timers to systemd user commands (#5099) This is useful for listing "cron like" systemd jobs --- plugins/systemd/systemd.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/systemd/systemd.plugin.zsh b/plugins/systemd/systemd.plugin.zsh index b1979355..5a35ecbc 100644 --- a/plugins/systemd/systemd.plugin.zsh +++ b/plugins/systemd/systemd.plugin.zsh @@ -1,6 +1,6 @@ user_commands=( list-units is-active status show help list-unit-files - is-enabled list-jobs show-environment cat) + is-enabled list-jobs show-environment cat list-timers) sudo_commands=( start stop reload restart try-restart isolate kill From 80cac854191020cb874c04af862a6569e2156f8c Mon Sep 17 00:00:00 2001 From: kierandoonan Date: Wed, 8 Jun 2016 16:27:51 +0100 Subject: [PATCH 235/537] Fix: Plugin knife: Add relative local path for commands which upload files (#4240) * Added autocomplete support for local knife file uploads * Added option to allow for relative path resolution for cookbooks * Updated _chef_root function to use directory:h --- plugins/knife/_knife | 56 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 48 insertions(+), 8 deletions(-) diff --git a/plugins/knife/_knife b/plugins/knife/_knife index 16314926..0d61ff15 100644 --- a/plugins/knife/_knife +++ b/plugins/knife/_knife @@ -3,6 +3,9 @@ # You can override the path to knife.rb and your cookbooks by setting # KNIFE_CONF_PATH=/path/to/my/.chef/knife.rb # KNIFE_COOKBOOK_PATH=/path/to/my/chef/cookbooks +# If you want your local cookbooks path to be calculated relative to where you are then +# set the below option +# KNIFE_RELATIVE_PATH=true # Read around where these are used for more detail. # These flags should be available everywhere according to man knife @@ -119,7 +122,19 @@ _knife() { _arguments '4:Subsubsubcommands:($(_chef_$words[2]_$words[3]s_remote))' ;; file) - _arguments '*:file or directory:_files -g "*.(rb|json)"' + case $words[2] in + environment) + _arguments '*:files:_path_files -g "*.(rb|json)" -W "$(_chef_root)/environments"' + ;; + node) + _arguments '*:files:_path_files -g "*.(rb|json)" -W "$(_chef_root)/nodes"' + ;; + role) + _arguments '*:files:_path_files -g "*.(rb|json)" -W "$(_chef_root)/roles"' + ;; + *) + _arguments '*:Subsubcommands:($(_knife_options3))' + esac ;; list) compadd -a "$@" knife_general_flags @@ -132,11 +147,22 @@ _knife() { if (( versioncomp > 0 )); then compadd "$@" attributes definitions files libraries providers recipes resources templates else - _arguments '*:Subsubcommands:($(_knife_options2))' + case $words[5] in + file) + _arguments '*:directory:_path_files -/ -W "$(_chef_root)/data_bags" -qS \ ' + ;; + *) _arguments '*:Subsubcommands:($(_knife_options2))' + esac fi ;; knifesubcmd5) - _arguments '*:Subsubcommands:($(_knife_options3))' + case $words[5] in + file) + _arguments '*:files:_path_files -g "*.json" -W "$(_chef_root)/data_bags/$words[6]"' + ;; + *) + _arguments '*:Subsubcommands:($(_knife_options3))' + esac esac } @@ -184,12 +210,15 @@ _chef_environments_remote() { # The chef_x_local functions use the knife config to find the paths of relevant objects x to be uploaded to the server _chef_cookbooks_local() { - - local knife_rb=${KNIFE_CONF_PATH:-${HOME}/.chef/knife.rb} - if [ -f ./.chef/knife.rb ]; then - knife_rb="./.chef/knife.rb" + if [ $KNIFE_RELATIVE_PATH ]; then + local cookbook_path="$(_chef_root)/cookbooks" + else + local knife_rb=${KNIFE_CONF_PATH:-${HOME}/.chef/knife.rb} + if [ -f ./.chef/knife.rb ]; then + knife_rb="./.chef/knife.rb" + fi + local cookbook_path=${KNIFE_COOKBOOK_PATH:-$(grep cookbook_path $knife_rb | awk 'BEGIN {FS = "[" }; {print $2}' | sed 's/\,//g' | sed "s/'//g" | sed 's/\(.*\)]/\1/' )} fi - local cookbook_path=${KNIFE_COOKBOOK_PATH:-$(grep cookbook_path $knife_rb | awk 'BEGIN {FS = "[" }; {print $2}' | sed 's/\,//g' | sed "s/'//g" | sed 's/\(.*\)]/\1/' )} (for i in $cookbook_path; do ls $i; done) } @@ -198,4 +227,15 @@ _cookbook_versions() { (knife cookbook show $words[4] | grep -v $words[4] | grep -v -E '\]|\[|\{|\}' | sed 's/ //g' | sed 's/"//g') } +# Searches up from current directory to find the closest folder that has a .chef folder +# Useful for the knife upload/from file commands +_chef_root () { + directory="$PWD" + while [ $directory != '/' ] + do + test -e "$directory/.chef" && echo "$directory" && return + directory="${directory:h}" + done +} + _knife "$@" From 3ce22281db39279ad18477339b0ff3327b69564f Mon Sep 17 00:00:00 2001 From: Mikael RANDY Date: Thu, 9 Jun 2016 22:39:54 +0200 Subject: [PATCH 236/537] Mod: use new debug namespace to avoid deprecation warning (#4799) From 514ef607046e2c081de8e6c550360868cd91650f Mon Sep 17 00:00:00 2001 From: Christian Wolff Date: Tue, 14 Jun 2016 20:32:10 +0200 Subject: [PATCH 237/537] Replace _kitchen completion with the version from zsh-users (#5011) --- plugins/kitchen/_kitchen | 106 +++++++++++++++++++++++++++------------ 1 file changed, 75 insertions(+), 31 deletions(-) diff --git a/plugins/kitchen/_kitchen b/plugins/kitchen/_kitchen index 54105b61..dee5c580 100644 --- a/plugins/kitchen/_kitchen +++ b/plugins/kitchen/_kitchen @@ -1,41 +1,85 @@ -# author: Peter Eisentraut -# source: https://gist.github.com/petere/10307599 -# compdef kitchen +#compdef kitchen +# ------------------------------------------------------------------------------ +# Copyright (c) 2014 Github zsh-users - http://github.com/zsh-users +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of the zsh-users nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# Completion script for Test Kitchen (http://kitchen.ci/). +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * Peter Eisentraut (https://github.com/petere) +# +# ------------------------------------------------------------------------------ + _kitchen() { - local curcontext="$curcontext" state line - typeset -A opt_args + local curcontext="$curcontext" state line + typeset -A opt_args - _arguments '1: :->cmds'\ - '2: :->args' + _arguments '1: :->cmds'\ + '2: :->args' - case $state in - cmds) - _arguments "1:Commands:(console converge create destroy diagnose driver help init list login setup test verify version)" - ;; - args) - case $line[1] in - converge|create|destroy|diagnose|list|setup|test|verify) - compadd "$@" all - _kitchen_instances - ;; - login) - _kitchen_instances - ;; - esac - ;; - esac + case $state in + cmds) + _kitchen_commands + ;; + args) + case $line[1] in + converge|create|destroy|diagnose|list|setup|test|verify) + compadd 'all' + _kitchen_instances + ;; + login) + _kitchen_instances + ;; + esac + ;; + esac +} + +_kitchen_commands() { + local commands + + commands=("${(@f)$(_call_program commands $service help | sed -n 's/^ kitchen \([[:alpha:]]*\) [ [].*# \(.*\)$/\1:\2/p')}") + _describe -t commands 'kitchen commands' commands } _kitchen_instances() { - if [[ $_kitchen_instances_cache_dir != $PWD ]]; then - unset _kitchen_instances_cache - fi - if [[ ${+_kitchen_instances_cache} -eq 0 ]]; then - _kitchen_instances_cache=(${(f)"$(bundle exec kitchen list -b 2>/dev/null || kitchen list -b 2>/dev/null)"}) - _kitchen_instances_cache_dir=$PWD - fi - compadd -a _kitchen_instances_cache + if [[ $_kitchen_instances_cache_dir != $PWD ]]; then + unset _kitchen_instances_cache + fi + if [[ ${+_kitchen_instances_cache} -eq 0 ]]; then + _kitchen_instances_cache=(${(f)"$(_call_program instances $service list -b 2>/dev/null)"}) + _kitchen_instances_cache_dir=$PWD + fi + _wanted instances expl 'instance' compadd -a _kitchen_instances_cache } _kitchen "$@" From 53acf21182a630e1f45feb49fca641e645ba8415 Mon Sep 17 00:00:00 2001 From: Harald Nordgren Date: Wed, 15 Jun 2016 00:12:24 +0200 Subject: [PATCH 238/537] Peepcode theme: Don't try to use RVM if it's not available (#5154) --- themes/peepcode.zsh-theme | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/themes/peepcode.zsh-theme b/themes/peepcode.zsh-theme index 96e4f119..9dc58294 100644 --- a/themes/peepcode.zsh-theme +++ b/themes/peepcode.zsh-theme @@ -41,4 +41,10 @@ PROMPT=' %~ ${smiley} %{$reset_color%}' -RPROMPT='%{$fg[white]%} $(~/.rvm/bin/rvm-prompt)$(git_prompt)%{$reset_color%}' +if [[ -d ~/.rvm ]] && [[ -e ~/.rvm/bin/rvm-prompt ]]; then + rvm_prompt='$(~/.rvm/bin/rvm-prompt)' +else + rvm_prompt='' +fi + +RPROMPT='%{$fg[white]%} $rvm_prompt$(git_prompt)%{$reset_color%}' From 3f2dd807730e8588c84fb6491d243e51c265f5eb Mon Sep 17 00:00:00 2001 From: intsilence Date: Wed, 15 Jun 2016 11:42:48 +0800 Subject: [PATCH 239/537] add 'mvn clean install -DskipTests --offline' alias to speed up maven compile (#5153) * add 'mvn clean install -DskipTests --offline' to speed up maven compile * update maven plugin README --- plugins/mvn/README.md | 1 + plugins/mvn/mvn.plugin.zsh | 1 + 2 files changed, 2 insertions(+) diff --git a/plugins/mvn/README.md b/plugins/mvn/README.md index 79192bb5..ffc5f683 100644 --- a/plugins/mvn/README.md +++ b/plugins/mvn/README.md @@ -15,6 +15,7 @@ plugins=(... mvn) | `mvncie` | `mvn clean install eclipse:eclipse` | | `mvnci` | `mvn clean install` | | `mvncist` | `mvn clean install -DskipTests` | +| `mvncisto` | `mvn clean install -DskipTests --offline` | | `mvne` | `mvn eclipse:eclipse` | | `mvnd` | `mvn deploy` | | `mvnp` | `mvn package` | diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh index 7aaab0e1..068963ac 100644 --- a/plugins/mvn/mvn.plugin.zsh +++ b/plugins/mvn/mvn.plugin.zsh @@ -45,6 +45,7 @@ mvn-color() alias mvncie='mvn clean install eclipse:eclipse' alias mvnci='mvn clean install' alias mvncist='mvn clean install -DskipTests' +alias mvncisto='mvn clean install -DskipTests --offline' alias mvne='mvn eclipse:eclipse' alias mvnce='mvn clean eclipse:clean eclipse:eclipse' alias mvnd='mvn deploy' From 623ea2381871d41c788270f75b54cad212de8159 Mon Sep 17 00:00:00 2001 From: mssalvatore Date: Wed, 15 Jun 2016 17:17:03 -0400 Subject: [PATCH 240/537] Add ofd() to OSX plugin to open finder on current directory (#5164) * Add ofd() to OSX plugin to open finder on current directory * Change `pwd` to $PWD in osx.plugin.zsh Suggested by mcornella --- plugins/osx/osx.plugin.zsh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh index c92b6556..99d66f25 100644 --- a/plugins/osx/osx.plugin.zsh +++ b/plugins/osx/osx.plugin.zsh @@ -151,6 +151,14 @@ function pfd() { EOF } +function ofd() { + osascript 2>/dev/null </dev/null < Date: Wed, 15 Jun 2016 18:03:37 -0400 Subject: [PATCH 241/537] Open finder to PWD - part 2 (#5165) * Modifies ofd to use alias to open_command instead of shell function with AppleScript --- plugins/osx/osx.plugin.zsh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh index 99d66f25..a80b1992 100644 --- a/plugins/osx/osx.plugin.zsh +++ b/plugins/osx/osx.plugin.zsh @@ -5,6 +5,9 @@ # VERSION: 1.1.0 # ------------------------------------------------------------------------------ +# Open the current directory in a Finder window +alias ofd='open_command $PWD' + function _omz_osx_get_frontmost_app() { local the_app=$( osascript 2>/dev/null < Date: Thu, 16 Jun 2016 00:23:09 +0200 Subject: [PATCH 242/537] Add README for OSX plugin and refactor plugin file --- plugins/osx/README.md | 27 +++++++++++++++++++++++++++ plugins/osx/_man-preview | 5 ----- plugins/osx/osx.plugin.zsh | 16 +--------------- 3 files changed, 28 insertions(+), 20 deletions(-) create mode 100644 plugins/osx/README.md delete mode 100644 plugins/osx/_man-preview diff --git a/plugins/osx/README.md b/plugins/osx/README.md new file mode 100644 index 00000000..a06184a4 --- /dev/null +++ b/plugins/osx/README.md @@ -0,0 +1,27 @@ +# OSX plugin + +## Description + +This plugin provides a few utilities to make it more enjoyable on OSX. + +To start using it, add the `osx` plugin to your plugins array in `~/.zshrc`: + +```zsh +plugins=(... osx) +``` + +Original author: [Sorin Ionescu](https://github.com/sorin-ionescu) + + +## Commands + +| Command | Description | +|:--------------|:-----------------------------------------------| +| `tab` | Open the current directory in a new tab | +| `ofd` | Open the current directory in a Finder window | +| `pfd` | Return the path of the frontmost Finder window | +| `pfs` | Return the current Finder selection | +| `cdf` | `cd` to the current Finder directory | +| `pushdf` | `pushd` to the current Finder directory | +| `quick-look` | Quick-Look a specified file | +| `man-preview` | Open a specified man page in Preview app | diff --git a/plugins/osx/_man-preview b/plugins/osx/_man-preview deleted file mode 100644 index 6cc344ad..00000000 --- a/plugins/osx/_man-preview +++ /dev/null @@ -1,5 +0,0 @@ -#compdef man-preview -#autoload - -_man - diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh index a80b1992..c66325cd 100644 --- a/plugins/osx/osx.plugin.zsh +++ b/plugins/osx/osx.plugin.zsh @@ -1,10 +1,3 @@ -# ------------------------------------------------------------------------------ -# FILE: osx.plugin.zsh -# DESCRIPTION: oh-my-zsh plugin file. -# AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com) -# VERSION: 1.1.0 -# ------------------------------------------------------------------------------ - # Open the current directory in a Finder window alias ofd='open_command $PWD' @@ -154,14 +147,6 @@ function pfd() { EOF } -function ofd() { - osascript 2>/dev/null </dev/null < Date: Thu, 16 Jun 2016 12:56:34 -0700 Subject: [PATCH 243/537] Remove undesirable hardcoding of PATH into zshrc (#4925) See robbyrussell@b67961d --- templates/zshrc.zsh-template | 2 +- tools/install.sh | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template index 44e8b0d1..63249013 100644 --- a/templates/zshrc.zsh-template +++ b/templates/zshrc.zsh-template @@ -53,7 +53,7 @@ plugins=(git) # User configuration -export PATH=$HOME/bin:/usr/local/bin:$PATH +# export PATH="/usr/bin:/bin:/usr/sbin:/sbin:$PATH" # export MANPATH="/usr/local/man:$MANPATH" source $ZSH/oh-my-zsh.sh diff --git a/tools/install.sh b/tools/install.sh index 199d2941..3f4de868 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -80,12 +80,6 @@ main() { " ~/.zshrc > ~/.zshrc-omztemp mv -f ~/.zshrc-omztemp ~/.zshrc - printf "${BLUE}Copying your current PATH and adding it to the end of ~/.zshrc for you.${NORMAL}\n" - sed "/export PATH=/ c\\ - export PATH=\"$PATH\" - " ~/.zshrc > ~/.zshrc-omztemp - mv -f ~/.zshrc-omztemp ~/.zshrc - # If this user's login shell is not already "zsh", attempt to switch. TEST_CURRENT_SHELL=$(expr "$SHELL" : '.*/\(.*\)') if [ "$TEST_CURRENT_SHELL" != "zsh" ]; then From b1561c662b8629a33f5ffc89fd1be93b65e5c541 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Fri, 17 Jun 2016 11:43:08 +0200 Subject: [PATCH 244/537] Update taskwarrior completion to 2.5.1 (#5171) --- plugins/taskwarrior/_task | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins/taskwarrior/_task b/plugins/taskwarrior/_task index afa30d45..46628be9 100644 --- a/plugins/taskwarrior/_task +++ b/plugins/taskwarrior/_task @@ -1,6 +1,6 @@ #compdef task # -# Copyright 2010 - 2015 Johannes Schlatow +# Copyright 2010 - 2016 Johannes Schlatow # Copyright 2009 P.C. Shyamshankar # # Permission is hereby granted, free of charge, to any person obtaining a copy @@ -26,7 +26,6 @@ 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_zshids=( ${(f)"$(task _zshids)"} ) _task_config=($(task _config)) _task_columns=($(task _columns)) @@ -139,8 +138,10 @@ task_dates=( ) local -a task_zshids -_regex_words values 'task IDs' $_task_zshids -task_zshids=("$reply[@]") +if (( $#_task_zshids )); then + _regex_words values 'task IDs' $_task_zshids + task_zshids=("$reply[@]") +fi _regex_words values 'task frequencies' \ 'daily:Every day' \ From d7c06131a251ec9e9c715383f33eec977c72b6ea Mon Sep 17 00:00:00 2001 From: Jordan Gwyn Date: Fri, 17 Jun 2016 03:12:59 -0700 Subject: [PATCH 245/537] emacs plugin tweak to open buffer from stdin (#5126) --- plugins/emacs/emacsclient.sh | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/plugins/emacs/emacsclient.sh b/plugins/emacs/emacsclient.sh index 625201a1..d61ebb15 100755 --- a/plugins/emacs/emacsclient.sh +++ b/plugins/emacs/emacsclient.sh @@ -1,12 +1,27 @@ #!/bin/sh -# get list of available X windows. -x=`emacsclient --alternate-editor '' --eval '(x-display-list)' 2>/dev/null` +function _emacsfun +{ + # get list of available X windows. + x=`emacsclient --alternate-editor '' --eval '(x-display-list)' 2>/dev/null` -if [ -z "$x" ] || [ "$x" = "nil" ] ;then - # Create one if there is no X window yet. - emacsclient --alternate-editor "" --create-frame "$@" + if [ -z "$x" ] || [ "$x" = "nil" ] ;then + # Create one if there is no X window yet. + emacsclient --alternate-editor "" --create-frame "$@" + else + # prevent creating another X frame if there is at least one present. + emacsclient --alternate-editor "" "$@" + fi +} + + +# adopted from https://github.com/davidshepherd7/emacs-read-stdin/blob/master/emacs-read-stdin.sh +# If the second argument is - then write stdin to a tempfile and open the +# tempfile. (first argument will be `--no-wait` passed in by the plugin.zsh) +if [[ $# -ge 2 ]] && [[ "$2" == - ]]; then + tempfile="$(mktemp emacs-stdin-$USER.XXXXXXX --tmpdir)" + cat - > "$tempfile" + _emacsfun --no-wait $tempfile else - # prevent creating another X frame if there is at least one present. - emacsclient --alternate-editor "" "$@" + _emacsfun "$@" fi From d012402dada1ec7d8796f2f4b04744d817137b4d Mon Sep 17 00:00:00 2001 From: psprint Date: Sat, 18 Jun 2016 11:48:21 +0200 Subject: [PATCH 246/537] znt: update to v2.2.1 (#5174) --- .../.config/znt/n-kill.conf | 2 +- .../.config/znt/n-list.conf | 2 +- plugins/zsh-navigation-tools/n-help | 43 ++++++++++++++++++- plugins/zsh-navigation-tools/n-history | 10 ++--- plugins/zsh-navigation-tools/n-list | 5 ++- 5 files changed, 52 insertions(+), 10 deletions(-) diff --git a/plugins/zsh-navigation-tools/.config/znt/n-kill.conf b/plugins/zsh-navigation-tools/.config/znt/n-kill.conf index deb2a3fd..59807b2c 100644 --- a/plugins/zsh-navigation-tools/.config/znt/n-kill.conf +++ b/plugins/zsh-navigation-tools/.config/znt/n-kill.conf @@ -8,7 +8,7 @@ local active_text=reverse # This doesn't cover scripts named "[0-9]## *", which should be very rare # (#s) is ^, (#e) is $, # is *, ## is + (comparing to regex) # | is alternative, but only in () -local NLIST_COLORING_PATTERN="((#s) #[0-9]## |[[][^]]#](#e)|[^ 0-9/?\\\\][^/\\\\]#(#e)|[^ /\\\\]##[^0-9/\\\\ ]##[^/\\\\]#(#e))" +local NLIST_COLORING_PATTERN="((#s) #[0-9]## |[[][^]]#](#e)|[^ 0-9/?\\\\][^/\\\\]#(#e))" local NLIST_COLORING_COLOR=$'\x1b[00;33m' local NLIST_COLORING_MATCH_MULTIPLE=1 diff --git a/plugins/zsh-navigation-tools/.config/znt/n-list.conf b/plugins/zsh-navigation-tools/.config/znt/n-list.conf index 68f5668f..096104df 100644 --- a/plugins/zsh-navigation-tools/.config/znt/n-list.conf +++ b/plugins/zsh-navigation-tools/.config/znt/n-list.conf @@ -6,7 +6,7 @@ local bold=0 local colorpair="white/black" # Should draw the border? -local border=1 +local border=0 # Combinations of colors to try out with Ctrl-T and Ctrl-G # The last number is the bold option, 0 or 1 diff --git a/plugins/zsh-navigation-tools/n-help b/plugins/zsh-navigation-tools/n-help index 415050a8..c7f6328b 100644 --- a/plugins/zsh-navigation-tools/n-help +++ b/plugins/zsh-navigation-tools/n-help @@ -1,11 +1,11 @@ autoload colors colors -local h1="$fg_bold[cyan]" +local h1="$fg_bold[magenta]" local h2="$fg_bold[green]" local h3="$fg_bold[blue]" local h4="$fg_bold[yellow]" -local h5="$fg_bold[magenta]" +local h5="$fg_bold[cyan]" local rst="$reset_color" LESS="-iRc" less <<<" @@ -93,4 +93,43 @@ start. This is a way to have handy set of bookmarks prepared in private history's file. Private history is instantly shared among sessions. + +${h1}Zshrc integration${rst} + +There are 5 standard configuration variables that can be set in zshrc: + +${h4}znt_history_active_text${rst} +\"underline\" or \"reverse\" - how should be active element highlighted +${h4}znt_history_nlist_coloring_pattern${rst} +Pattern that can be used to colorize elements +${h4}znt_history_nlist_coloring_color${rst} +Color with which to colorize via the pattern +${h4}znt_history_nlist_coloring_match_multiple${rst} +Should multiple matches be colorized (${h2}\"0\"${rst} or ${h2}\"1\"${rst}) +${h4}znt_history_keywords ${h2}(array)${rst} +Search keywords activated with Ctrl-X, F2, Ctrl-/, e.g. ( ${h2}\"git\"${rst} ${h2}\"vim\"${rst} ) + +Above variables will work for n-history tool. For other tools, change +\"_history_\" to e.g. \"_cd_\", for the n-cd tool. The same works for +all 8 tools. + +Common configuration of the tools uses variables with \"_list_\" in them: + +${h4}znt_list_bold${rst} +Should draw text in bold (${h2}\"0\"${rst} or ${h2}\"1\"${rst}) +${h4}znt_list_colorpair${rst} +Main pair of colors to be used, e.g ${h2}\"green/black\"${rst} +${h4}znt_list_border${rst} +Should draw borders around windows (${h2}\"0\"${rst} or ${h2}\"1\"${rst}) +${h4}znt_list_themes ${h2}(array)${rst} +List of themes to try out with Ctrl-T, e.g. ( ${h2}\"white/black/1\"${rst} +${h2}\"green/black/0\"${rst} ) +${h4}znt_list_instant_select${rst} +Should pressing enter in search mode leave tool (${h2}\"0\"${rst} or ${h2}\"1\"${rst}) + +If you used ZNT before v2.1.12 then remove old configuration files +${h3}~/.config/znt/*.conf${rst} so that ZNT can update them to the latest versions +that support integration with Zshrc. If you used installer then run it +again (after the remove of configuration files), that is not needed when +using as plugin. " diff --git a/plugins/zsh-navigation-tools/n-history b/plugins/zsh-navigation-tools/n-history index 68370f6e..af475dcb 100644 --- a/plugins/zsh-navigation-tools/n-history +++ b/plugins/zsh-navigation-tools/n-history @@ -157,7 +157,7 @@ _nhistory_generate_most_frequent() { vk+="$v"$'\t'"$k" done - print -rl "$title" "${(On)vk[@]}" > "$most_frequent_db" + print -rl -- "$title" "${(On)vk[@]}" > "$most_frequent_db" } # Load configuration @@ -337,16 +337,16 @@ if [ "$REPLY" -gt 0 ]; then selected="$reply[REPLY]" # ZLE? if [ "${(t)CURSOR}" = "integer-local-special" ]; then - zle redisplay - zle kill-buffer + zle .redisplay + zle .kill-buffer LBUFFER+="$selected" # Append to private history local newline=$'\n' selected="${selected//$newline/\\$newline}" - [ "$active_view" = "0" ] && print -r "$selected" >> "$private_history_db" + [ "$active_view" = "0" ] && print -r -- "$selected" >> "$private_history_db" else - print -zr "$selected" + print -zr -- "$selected" fi else [ "${(t)CURSOR}" = "integer-local-special" ] && zle redisplay diff --git a/plugins/zsh-navigation-tools/n-list b/plugins/zsh-navigation-tools/n-list index d3a8da30..f3d2e5b3 100644 --- a/plugins/zsh-navigation-tools/n-list +++ b/plugins/zsh-navigation-tools/n-list @@ -445,7 +445,10 @@ while (( 1 )); do [ "$border" = "1" ] && zcurses border main - local top_msg=" F1-change view, ${(C)ZSH_NAME} $ZSH_VERSION, shell level $SHLVL " + local top_msg=" ${(C)ZSH_NAME} $ZSH_VERSION, shell level $SHLVL " + if [[ "${NLIST_ENABLED_EVENTS[(r)F1]}" = "F1" ]]; then + top_msg=" F1-change view,$top_msg" + fi zcurses move main 0 $(( term_width / 2 - $#top_msg / 2 )) zcurses string main $top_msg From 909fcef0469a2706508c0197e14aa45654702044 Mon Sep 17 00:00:00 2001 From: hjpotter92 Date: Tue, 21 Jun 2016 00:45:55 +0530 Subject: [PATCH 247/537] Fix issue with `dash` as the default `/bin/sh` script executing program. (#5177) * `function` keyword removed * Fixup the `if` statement and operators --- plugins/emacs/emacsclient.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/emacs/emacsclient.sh b/plugins/emacs/emacsclient.sh index d61ebb15..41682512 100755 --- a/plugins/emacs/emacsclient.sh +++ b/plugins/emacs/emacsclient.sh @@ -1,6 +1,6 @@ #!/bin/sh -function _emacsfun +_emacsfun() { # get list of available X windows. x=`emacsclient --alternate-editor '' --eval '(x-display-list)' 2>/dev/null` @@ -18,7 +18,8 @@ function _emacsfun # adopted from https://github.com/davidshepherd7/emacs-read-stdin/blob/master/emacs-read-stdin.sh # If the second argument is - then write stdin to a tempfile and open the # tempfile. (first argument will be `--no-wait` passed in by the plugin.zsh) -if [[ $# -ge 2 ]] && [[ "$2" == - ]]; then +if [ "$#" -ge "2" -a "$2" = "-" ] +then tempfile="$(mktemp emacs-stdin-$USER.XXXXXXX --tmpdir)" cat - > "$tempfile" _emacsfun --no-wait $tempfile From 9a61336d33a8a6258c0fb838bfa3c9c488e7d898 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Mon, 20 Jun 2016 22:19:02 +0200 Subject: [PATCH 248/537] Fix man-preview completion definition Related: #5179 --- plugins/osx/osx.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh index c66325cd..4dbc7578 100644 --- a/plugins/osx/osx.plugin.zsh +++ b/plugins/osx/osx.plugin.zsh @@ -175,7 +175,7 @@ function quick-look() { function man-preview() { man -t "$@" | open -f -a Preview } -compdef man-preview=man +compdef _man man-preview function vncviewer() { open vnc://$@ From c62442f999854038e7d0911f60a4aff252913a7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Tue, 21 Jun 2016 01:06:21 +0200 Subject: [PATCH 249/537] Fix gfg function completion definition Related: #5179 --- 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 eb7bc803..c186a6e1 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -88,7 +88,7 @@ alias gdw='git diff --word-diff' alias gf='git fetch' alias gfa='git fetch --all --prune' function gfg() { git ls-files | grep $@ } -compdef gfg=grep +compdef _grep gfg alias gfo='git fetch origin' alias gg='git gui citool' From 7fabc8bca41d4ff7090325116a85513dac852236 Mon Sep 17 00:00:00 2001 From: Clemens Gruber Date: Tue, 21 Jun 2016 01:31:13 +0200 Subject: [PATCH 250/537] bundler plugin: Simplify retrieval of cpu count on OSX (#5180) Calling awk is not necessary here, sysctl has the -n flag to print the value. Signed-off-by: Clemens Gruber --- plugins/bundler/bundler.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index 382a1a47..c5284dbb 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -58,7 +58,7 @@ bundle_install() { if [[ $bundler_version > '1.4.0' || $bundler_version = '1.4.0' ]]; then if [[ "$OSTYPE" = darwin* ]] then - local cores_num="$(sysctl hw.ncpu | awk '{print $2}')" + local cores_num="$(sysctl -n hw.ncpu)" else local cores_num="$(nproc)" fi From af1ee2b9940de7f758669575560d8e32b9975cba Mon Sep 17 00:00:00 2001 From: Henrik Johansson Date: Sun, 19 Jun 2016 10:52:17 +0200 Subject: [PATCH 251/537] Add plugin for Gb completion (http://getgb.io) --- plugins/getgb/getgb.plugin.zsh | 114 +++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 plugins/getgb/getgb.plugin.zsh diff --git a/plugins/getgb/getgb.plugin.zsh b/plugins/getgb/getgb.plugin.zsh new file mode 100644 index 00000000..9efb00c9 --- /dev/null +++ b/plugins/getgb/getgb.plugin.zsh @@ -0,0 +1,114 @@ +function _gb_commands() { + local ret=1 state + _arguments -C ':command:->command' '*::options:->options' && ret=0 + + case $state in + (command) + + local -a subcommands + subcommands=( + "build:build a package" + "doc:show documentation for a package or symbol" + "env:print project environment variables" + "generate:generate Go files by processing source" + "help:displays the help" + "info:info returns information about this project" + "list:list the packages named by the importpaths" + "test:test packages" + "vendor:manage your vendored dependencies" + ) + _describe -t subcommands 'gb subcommands' subcommands && ret=0 + ;; + + (options) + case $line[1] in + (build) + _arguments \ + -f'[ignore cached packages]' \ + -F'[do not cache packages]' \ + -q'[decreases verbosity]' \ + -P'[the number of build jobs to run in parallel]' \ + -R'[sets the base of the project root search path]' \ + -dotfile'[output a dot formatted file of the build steps]' \ + -ldflags'["flag list" arguments to pass to the linker]' \ + -gcflags'["arg list" arguments to pass to the compiler]' \ + -race'[enable data race detection]' \ + -tags'["tag list" additional build tags]' + ;; + (list) + _arguments \ + -f'[alternate format for the list, using the syntax of package template]' \ + -s'[read format template from STDIN]' \ + -json'[prints output in structured JSON format]' + ;; + (test) + _arguments \ + -v'[print output from test subprocess]' \ + -ldflags'["flag list" arguments to pass to the linker]' \ + -gcflags'["arg list" arguments to pass to the compiler]' \ + -race'[enable data race detection]' \ + -tags'["tag list" additional build tags]' + ;; + (vendor) + __gb-vendor + esac + ;; + esac + + return ret +} + +compdef _gb_commands gb + +__gb-vendor () +{ + local curcontext="$curcontext" state line + + _arguments -C ':command:->command' '*::options:->options' + + case $state in + (command) + + local -a subcommands + subcommands=( + 'delete:deletes a local dependency' + 'fetch:fetch a remote dependency' + 'list:lists dependencies, one per line' + 'purge:remove all unreferenced dependencies' + 'restore:restore dependencies from the manifest' + 'update:update a local dependency' + ) + _describe -t subcommands 'gb vendor subcommands' subcommands && ret=0 + ;; + + (options) + case $line[1] in + (delete) + _arguments \ + -all'[remove all dependencies]' + ;; + (fetch) + _arguments \ + -branch'[fetch from a particular branch]' \ + -no-recurse'[do not fetch recursively]' \ + -tag'[fetch the specified tag]' \ + -revision'[fetch the specific revision from the branch (if supplied)]' \ + -precaire'[allow the use of insecure protocols]' \ + ;; + (list) + _arguments \ + -f'[controls the template used for printing each manifest entry]' + ;; + (restore) + _arguments \ + -precaire'[allow the use of insecure protocols]' + ;; + (update) + _arguments \ + -all'[update all dependencies in the manifest or supply a given dependency]' \ + -precaire'[allow the use of insecure protocols]' + ;; + esac + ;; + esac +} From 57a689ffd5dd54852afeea38e5c401d5a29b4493 Mon Sep 17 00:00:00 2001 From: Henrik Johansson Date: Tue, 28 Jun 2016 21:25:51 +0200 Subject: [PATCH 252/537] Add README to gb plugin --- plugins/getgb/README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 plugins/getgb/README.md diff --git a/plugins/getgb/README.md b/plugins/getgb/README.md new file mode 100644 index 00000000..b477b0f4 --- /dev/null +++ b/plugins/getgb/README.md @@ -0,0 +1,10 @@ +# *gb* plugin + +- aims to support completion for all *gb* commands +- also supports completion for *gb* plugins such as *vendor* + +See http://getgb.io for the full *gb* documentation + +## Caveats + +- The *git* plugin installs an alias *gb* that usually conflicts with the *gb* program From d0ea3f22b1099ce98e0fc02b6074d862478ae81a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sat, 2 Jul 2016 11:59:04 +0200 Subject: [PATCH 253/537] Add more information to the README --- plugins/getgb/README.md | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/plugins/getgb/README.md b/plugins/getgb/README.md index b477b0f4..88881cb2 100644 --- a/plugins/getgb/README.md +++ b/plugins/getgb/README.md @@ -1,10 +1,21 @@ -# *gb* plugin +# `gb` plugin -- aims to support completion for all *gb* commands -- also supports completion for *gb* plugins such as *vendor* +> A project based build tool for the Go programming language. -See http://getgb.io for the full *gb* documentation +See https://getgb.io for the full `gb` documentation + +* * * * + +- Adds completion support for all `gb` commands. +- Also supports completion for the [`gb-vendor` plugin](https://godoc.org/github.com/constabulary/gb/cmd/gb-vendor). + +To use it, add `getgb` to your plugins array: +```sh +plugins=(... getgb) +``` ## Caveats -- The *git* plugin installs an alias *gb* that usually conflicts with the *gb* program +The `git` plugin defines an alias `gb` that usually conflicts with the `gb` program. +If you're having trouble with it, remove it by adding `unalias gb` at the end of your +zshrc file. From a29f8f76599e93653f006c2e074bd1dc47cc9b4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sat, 2 Jul 2016 16:24:02 +0200 Subject: [PATCH 254/537] Fix formatting of gb plugin completion --- plugins/getgb/getgb.plugin.zsh | 208 ++++++++++++++++----------------- 1 file changed, 101 insertions(+), 107 deletions(-) diff --git a/plugins/getgb/getgb.plugin.zsh b/plugins/getgb/getgb.plugin.zsh index 9efb00c9..726f0a24 100644 --- a/plugins/getgb/getgb.plugin.zsh +++ b/plugins/getgb/getgb.plugin.zsh @@ -1,114 +1,108 @@ -function _gb_commands() { - local ret=1 state - _arguments -C ':command:->command' '*::options:->options' && ret=0 - - case $state in - (command) - - local -a subcommands - subcommands=( - "build:build a package" - "doc:show documentation for a package or symbol" - "env:print project environment variables" - "generate:generate Go files by processing source" - "help:displays the help" - "info:info returns information about this project" - "list:list the packages named by the importpaths" - "test:test packages" - "vendor:manage your vendored dependencies" - ) - _describe -t subcommands 'gb subcommands' subcommands && ret=0 - ;; - - (options) - case $line[1] in - (build) - _arguments \ - -f'[ignore cached packages]' \ - -F'[do not cache packages]' \ - -q'[decreases verbosity]' \ - -P'[the number of build jobs to run in parallel]' \ - -R'[sets the base of the project root search path]' \ - -dotfile'[output a dot formatted file of the build steps]' \ - -ldflags'["flag list" arguments to pass to the linker]' \ - -gcflags'["arg list" arguments to pass to the compiler]' \ - -race'[enable data race detection]' \ - -tags'["tag list" additional build tags]' - ;; - (list) - _arguments \ - -f'[alternate format for the list, using the syntax of package template]' \ - -s'[read format template from STDIN]' \ - -json'[prints output in structured JSON format]' - ;; - (test) - _arguments \ - -v'[print output from test subprocess]' \ - -ldflags'["flag list" arguments to pass to the linker]' \ - -gcflags'["arg list" arguments to pass to the compiler]' \ - -race'[enable data race detection]' \ - -tags'["tag list" additional build tags]' - ;; - (vendor) - __gb-vendor - esac - ;; - esac - - return ret -} - -compdef _gb_commands gb - -__gb-vendor () -{ - local curcontext="$curcontext" state line - - _arguments -C ':command:->command' '*::options:->options' +_gb () { + local ret=1 state + _arguments -C ':command:->command' '*::options:->options' && ret=0 case $state in - (command) - - local -a subcommands - subcommands=( - 'delete:deletes a local dependency' - 'fetch:fetch a remote dependency' - 'list:lists dependencies, one per line' - 'purge:remove all unreferenced dependencies' - 'restore:restore dependencies from the manifest' - 'update:update a local dependency' - ) - _describe -t subcommands 'gb vendor subcommands' subcommands && ret=0 + (command) + local -a subcommands + subcommands=( + "build:build a package" + "doc:show documentation for a package or symbol" + "env:print project environment variables" + "generate:generate Go files by processing source" + "help:displays the help" + "info:info returns information about this project" + "list:list the packages named by the importpaths" + "test:test packages" + "vendor:manage your vendored dependencies" + ) + _describe -t subcommands 'gb subcommands' subcommands && ret=0 ;; + (options) + case $line[1] in + (build) + _arguments \ + -f'[ignore cached packages]' \ + -F'[do not cache packages]' \ + -q'[decreases verbosity]' \ + -P'[the number of build jobs to run in parallel]' \ + -R'[sets the base of the project root search path]' \ + -dotfile'[output a dot formatted file of the build steps]' \ + -ldflags'["flag list" arguments to pass to the linker]' \ + -gcflags'["arg list" arguments to pass to the compiler]' \ + -race'[enable data race detection]' \ + -tags'["tag list" additional build tags]' + ;; + (list) + _arguments \ + -f'[alternate format for the list, using the syntax of package template]' \ + -s'[read format template from STDIN]' \ + -json'[prints output in structured JSON format]' + ;; + (test) + _arguments \ + -v'[print output from test subprocess]' \ + -ldflags'["flag list" arguments to pass to the linker]' \ + -gcflags'["arg list" arguments to pass to the compiler]' \ + -race'[enable data race detection]' \ + -tags'["tag list" additional build tags]' + ;; + (vendor) + _gb-vendor + esac + ;; + esac - (options) - case $line[1] in - (delete) - _arguments \ - -all'[remove all dependencies]' - ;; - (fetch) - _arguments \ - -branch'[fetch from a particular branch]' \ - -no-recurse'[do not fetch recursively]' \ - -tag'[fetch the specified tag]' \ - -revision'[fetch the specific revision from the branch (if supplied)]' \ - -precaire'[allow the use of insecure protocols]' \ - ;; - (list) - _arguments \ - -f'[controls the template used for printing each manifest entry]' - ;; - (restore) - _arguments \ - -precaire'[allow the use of insecure protocols]' - ;; - (update) - _arguments \ - -all'[update all dependencies in the manifest or supply a given dependency]' \ - -precaire'[allow the use of insecure protocols]' - ;; - esac + return ret +} + +compdef _gb gb + +_gb-vendor () { + local curcontext="$curcontext" state line + _arguments -C ':command:->command' '*::options:->options' + + case $state in + (command) + local -a subcommands + subcommands=( + 'delete:deletes a local dependency' + 'fetch:fetch a remote dependency' + 'list:lists dependencies, one per line' + 'purge:remove all unreferenced dependencies' + 'restore:restore dependencies from the manifest' + 'update:update a local dependency' + ) + _describe -t subcommands 'gb vendor subcommands' subcommands && ret=0 + ;; + (options) + case $line[1] in + (delete) + _arguments \ + -all'[remove all dependencies]' + ;; + (fetch) + _arguments \ + -branch'[fetch from a particular branch]' \ + -no-recurse'[do not fetch recursively]' \ + -tag'[fetch the specified tag]' \ + -revision'[fetch the specific revision from the branch (if supplied)]' \ + -precaire'[allow the use of insecure protocols]' \ + ;; + (list) + _arguments \ + -f'[controls the template used for printing each manifest entry]' + ;; + (restore) + _arguments \ + -precaire'[allow the use of insecure protocols]' + ;; + (update) + _arguments \ + -all'[update all dependencies in the manifest or supply a given dependency]' \ + -precaire'[allow the use of insecure protocols]' + ;; + esac ;; esac } From cab6359173fb99c832617a5aa24ec734586ff055 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sun, 3 Jul 2016 23:27:33 +0200 Subject: [PATCH 255/537] Rename gb completion file to more conventional _gb --- plugins/getgb/{getgb.plugin.zsh => _gb} | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) rename plugins/getgb/{getgb.plugin.zsh => _gb} (99%) diff --git a/plugins/getgb/getgb.plugin.zsh b/plugins/getgb/_gb similarity index 99% rename from plugins/getgb/getgb.plugin.zsh rename to plugins/getgb/_gb index 726f0a24..8148adf1 100644 --- a/plugins/getgb/getgb.plugin.zsh +++ b/plugins/getgb/_gb @@ -1,3 +1,6 @@ +#compdef gb +#autoload + _gb () { local ret=1 state _arguments -C ':command:->command' '*::options:->options' && ret=0 @@ -56,8 +59,6 @@ _gb () { return ret } -compdef _gb gb - _gb-vendor () { local curcontext="$curcontext" state line _arguments -C ':command:->command' '*::options:->options' @@ -106,3 +107,5 @@ _gb-vendor () { ;; esac } + +_gb From dc0a884ea7b4298861cb081a4b76c9f0b42c7ebe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sun, 3 Jul 2016 23:29:00 +0200 Subject: [PATCH 256/537] Rename getgb plugin to gb --- plugins/{getgb => gb}/README.md | 4 ++-- plugins/{getgb => gb}/_gb | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename plugins/{getgb => gb}/README.md (88%) rename plugins/{getgb => gb}/_gb (100%) diff --git a/plugins/getgb/README.md b/plugins/gb/README.md similarity index 88% rename from plugins/getgb/README.md rename to plugins/gb/README.md index 88881cb2..822c29aa 100644 --- a/plugins/getgb/README.md +++ b/plugins/gb/README.md @@ -9,9 +9,9 @@ See https://getgb.io for the full `gb` documentation - Adds completion support for all `gb` commands. - Also supports completion for the [`gb-vendor` plugin](https://godoc.org/github.com/constabulary/gb/cmd/gb-vendor). -To use it, add `getgb` to your plugins array: +To use it, add `gb` to your plugins array: ```sh -plugins=(... getgb) +plugins=(... gb) ``` ## Caveats diff --git a/plugins/getgb/_gb b/plugins/gb/_gb similarity index 100% rename from plugins/getgb/_gb rename to plugins/gb/_gb From 96a2092e377139fbcd95d7b7ac703b740daa22f6 Mon Sep 17 00:00:00 2001 From: Steven Date: Fri, 15 Jul 2016 02:05:39 -0700 Subject: [PATCH 257/537] lib/git.zsh: Added git_commits_behind function (#4450) * Added git_commits_behind function * Added 'command' to git_commits_behind function * git_commits_behind code review changes --- lib/git.zsh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/git.zsh b/lib/git.zsh index 1c76d588..c79cc0d8 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -83,6 +83,13 @@ function git_commits_ahead() { fi } +# Gets the number of commits behind remote +function git_commits_behind() { + if $(command git rev-parse --git-dir > /dev/null 2>&1); then + echo $(git rev-list --count HEAD..@{upstream}) + fi +} + # Outputs if current branch is ahead of remote function git_prompt_ahead() { if [[ -n "$(command git rev-list origin/$(git_current_branch)..HEAD 2> /dev/null)" ]]; then From bfbfef9fcf87cfb8ecab8b3ee13a27a9f7e392ae Mon Sep 17 00:00:00 2001 From: Jesse Donat Date: Fri, 15 Jul 2016 14:30:09 -0500 Subject: [PATCH 258/537] Cleans up phing plugin. --- plugins/phing/phing.plugin.zsh | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/plugins/phing/phing.plugin.zsh b/plugins/phing/phing.plugin.zsh index 1f022047..60f59c3b 100644 --- a/plugins/phing/phing.plugin.zsh +++ b/plugins/phing/phing.plugin.zsh @@ -1,15 +1,6 @@ -_phing_does_target_list_need_generating () { - [ ! -f .phing_targets ] && return 0; - [ build.xml -nt .phing_targets ] && return 0; - return 1; -} - _phing () { if [ -f build.xml ]; then - if _phing_does_target_list_need_generating; then - phing -l|grep -v "\[property\]"|grep -v "Buildfile"|sed 1d|grep -v ":$" |grep -v "^\-*$"|awk '{print $1}' > .phing_targets - fi - compadd `cat .phing_targets` + compadd $(phing -l|grep -v "\[property\]"|grep -v "Buildfile"|sed 1d|grep -v ":$" |grep -v "^\-*$"|awk '{print $1}') fi } From c51823c04eee3889a17a957790ae5bf7f07fd5eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Lenart?= Date: Tue, 16 Dec 2014 08:34:50 +0100 Subject: [PATCH 259/537] Remove warning lines from phing completion Remove "Warning:" lines from phing targets list. Warning lines are returned by phing when a target has no tasks or dependencies. # Conflicts: # plugins/phing/phing.plugin.zsh --- plugins/phing/phing.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/phing/phing.plugin.zsh b/plugins/phing/phing.plugin.zsh index 60f59c3b..d5a2649b 100644 --- a/plugins/phing/phing.plugin.zsh +++ b/plugins/phing/phing.plugin.zsh @@ -1,6 +1,6 @@ _phing () { if [ -f build.xml ]; then - compadd $(phing -l|grep -v "\[property\]"|grep -v "Buildfile"|sed 1d|grep -v ":$" |grep -v "^\-*$"|awk '{print $1}') + compadd $(phing -l|grep -v "\[property\]"|grep -v "Buildfile"|sed 1d|grep -v ":$" |grep -v "^\-*$"|grep -v "Warning:"|awk '{print $1}') fi } From eb244d9ec03a5f83102efa89d8d2231282f3c408 Mon Sep 17 00:00:00 2001 From: soredake Date: Tue, 19 Jul 2016 01:20:59 +0300 Subject: [PATCH 260/537] Update emacs plugin. (#5201) - Updated minimal version from 23 to 24. - Added new aliases that fix unexpected close with -nw option. - Removed some old aliases. - Fixed line that detects open frames. --- plugins/emacs/emacs.plugin.zsh | 7 +++---- plugins/emacs/emacsclient.sh | 12 ++++++------ 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/plugins/emacs/emacs.plugin.zsh b/plugins/emacs/emacs.plugin.zsh index a3f0085a..c102a5a1 100644 --- a/plugins/emacs/emacs.plugin.zsh +++ b/plugins/emacs/emacs.plugin.zsh @@ -10,7 +10,7 @@ # - Configuration changes made at runtime are applied to all frames. -if "$ZSH/tools/require_tool.sh" emacs 23 2>/dev/null ; then +if "$ZSH/tools/require_tool.sh" emacs 24 2>/dev/null ; then export EMACS_PLUGIN_LAUNCHER="$ZSH/plugins/emacs/emacsclient.sh" # set EDITOR if not already defined. @@ -18,15 +18,14 @@ if "$ZSH/tools/require_tool.sh" emacs 23 2>/dev/null ; then alias emacs="$EMACS_PLUGIN_LAUNCHER --no-wait" alias e=emacs + # open terminal emacsclient + alias te="$EMACS_PLUGIN_LAUNCHER -nw" # same than M-x eval but from outside Emacs. alias eeval="$EMACS_PLUGIN_LAUNCHER --eval" # create a new X frame alias eframe='emacsclient --alternate-editor "" --create-frame' - # to code all night long - alias emasc=emacs - alias emcas=emacs # Write to standard output the path to the file # opened in the current buffer. diff --git a/plugins/emacs/emacsclient.sh b/plugins/emacs/emacsclient.sh index 41682512..26b28d49 100755 --- a/plugins/emacs/emacsclient.sh +++ b/plugins/emacs/emacsclient.sh @@ -2,15 +2,15 @@ _emacsfun() { - # get list of available X windows. - x=`emacsclient --alternate-editor '' --eval '(x-display-list)' 2>/dev/null` + # get list of emacs frames. + frameslist=`emacsclient --alternate-editor '' --eval '(frame-list)' 2>/dev/null | egrep -o '(frame)+'` - if [ -z "$x" ] || [ "$x" = "nil" ] ;then - # Create one if there is no X window yet. - emacsclient --alternate-editor "" --create-frame "$@" - else + if [ "$(echo "$frameslist" | sed -n '$=')" -ge 2 ] ;then # prevent creating another X frame if there is at least one present. emacsclient --alternate-editor "" "$@" + else + # Create one if there is no X window yet. + emacsclient --alternate-editor "" --create-frame "$@" fi } From f4013053d302480b7663ad5c3a04d0442237a952 Mon Sep 17 00:00:00 2001 From: Julien Dubreuil Date: Tue, 19 Jul 2016 00:24:12 +0200 Subject: [PATCH 261/537] Updated _docker-compose to the latest version (from 0.1.0 to 1.5.0). (#5215) Also fixed formatting of markdown URL in README. --- plugins/docker-compose/README.md | 3 +- plugins/docker-compose/_docker-compose | 331 ++++++++++++++++++------- 2 files changed, 240 insertions(+), 94 deletions(-) diff --git a/plugins/docker-compose/README.md b/plugins/docker-compose/README.md index 567b8214..d3fcb29f 100644 --- a/plugins/docker-compose/README.md +++ b/plugins/docker-compose/README.md @@ -1,5 +1,4 @@ # Docker-compose plugin for oh my zsh -A copy of the completion script from the [docker-compose](1) git repo. +A copy of the completion script from the [docker-compose](https://github.com/docker/compose/blob/master/contrib/completion/zsh/_docker-compose) git repo. -[1]:[https://github.com/docker/compose/blob/master/contrib/completion/zsh/_docker-compose] diff --git a/plugins/docker-compose/_docker-compose b/plugins/docker-compose/_docker-compose index 19c06675..2947cef3 100644 --- a/plugins/docker-compose/_docker-compose +++ b/plugins/docker-compose/_docker-compose @@ -7,7 +7,7 @@ # ------------------------------------------------------------------------- # Version # ------- -# 0.1.0 +# 1.5.0 # ------------------------------------------------------------------------- # Authors # ------- @@ -19,58 +19,69 @@ # * @felixr docker zsh completion script : https://github.com/felixr/docker-zsh-completion # ------------------------------------------------------------------------- -# For compatibility reasons, Compose and therefore its completion supports several -# stack compositon files as listed here, in descending priority. -# Support for these filenames might be dropped in some future version. -__docker-compose_compose_file() { - local file - for file in docker-compose.y{,a}ml fig.y{,a}ml ; do - [ -e $file ] && { - echo $file - return - } - done - echo docker-compose.yml +__docker-compose_q() { + docker-compose 2>/dev/null $compose_options "$@" } -# Extracts all service names from docker-compose.yml. -___docker-compose_all_services_in_compose_file() { +# All services defined in docker-compose.yml +__docker-compose_all_services_in_compose_file() { local already_selected local -a services - already_selected=$(echo ${words[@]} | tr " " "|") - awk -F: '/^[a-zA-Z0-9]/{print $1}' "${compose_file:-$(__docker-compose_compose_file)}" 2>/dev/null | grep -Ev "$already_selected" + already_selected=$(echo $words | tr " " "|") + __docker-compose_q config --services \ + | grep -Ev "^(${already_selected})$" } # All services, even those without an existing container __docker-compose_services_all() { - services=$(___docker-compose_all_services_in_compose_file) - _alternative "args:services:($services)" + [[ $PREFIX = -* ]] && return 1 + integer ret=1 + services=$(__docker-compose_all_services_in_compose_file) + _alternative "args:services:($services)" && ret=0 + + return ret } # All services that have an entry with the given key in their docker-compose.yml section -___docker-compose_services_with_key() { +__docker-compose_services_with_key() { local already_selected local -a buildable - already_selected=$(echo ${words[@]} | tr " " "|") + already_selected=$(echo $words | tr " " "|") # flatten sections to one line, then filter lines containing the key and return section name. - awk '/^[a-zA-Z0-9]/{printf "\n"};{printf $0;next;}' "${compose_file:-$(__docker-compose_compose_file)}" 2>/dev/null | awk -F: -v key=": +$1:" '$0 ~ key {print $1}' 2>/dev/null | grep -Ev "$already_selected" + __docker-compose_q config \ + | sed -n -e '/^services:/,/^[^ ]/p' \ + | sed -n 's/^ //p' \ + | awk '/^[a-zA-Z0-9]/{printf "\n"};{printf $0;next;}' \ + | grep " \+$1:" \ + | cut -d: -f1 \ + | grep -Ev "^(${already_selected})$" } # All services that are defined by a Dockerfile reference __docker-compose_services_from_build() { - buildable=$(___docker-compose_services_with_key build) - _alternative "args:buildable services:($buildable)" + [[ $PREFIX = -* ]] && return 1 + integer ret=1 + buildable=$(__docker-compose_services_with_key build) + _alternative "args:buildable services:($buildable)" && ret=0 + + return ret } # All services that are defined by an image __docker-compose_services_from_image() { - pullable=$(___docker-compose_services_with_key image) - _alternative "args:pullable services:($pullable)" + [[ $PREFIX = -* ]] && return 1 + integer ret=1 + pullable=$(__docker-compose_services_with_key image) + _alternative "args:pullable services:($pullable)" && ret=0 + + return ret } __docker-compose_get_services() { - local kind expl - declare -a running stopped lines args services + [[ $PREFIX = -* ]] && return 1 + integer ret=1 + local kind + declare -a running paused stopped lines args services docker_status=$(docker ps > /dev/null 2>&1) if [ $? -ne 0 ]; then @@ -80,64 +91,78 @@ __docker-compose_get_services() { kind=$1 shift - [[ $kind = (stopped|all) ]] && args=($args -a) + [[ $kind =~ (stopped|all) ]] && args=($args -a) - lines=(${(f)"$(_call_program commands docker ps ${args})"}) - services=(${(f)"$(_call_program commands docker-compose 2>/dev/null ${compose_file:+-f $compose_file} ${compose_project:+-p $compose_project} ps -q)"}) + lines=(${(f)"$(_call_program commands docker $docker_options ps $args)"}) + services=(${(f)"$(_call_program commands docker-compose 2>/dev/null $compose_options ps -q)"}) # Parse header line to find columns local i=1 j=1 k header=${lines[1]} declare -A begin end - while (( $j < ${#header} - 1 )) { - i=$(( $j + ${${header[$j,-1]}[(i)[^ ]]} - 1)) - j=$(( $i + ${${header[$i,-1]}[(i) ]} - 1)) - k=$(( $j + ${${header[$j,-1]}[(i)[^ ]]} - 2)) - begin[${header[$i,$(($j-1))]}]=$i - end[${header[$i,$(($j-1))]}]=$k - } + while (( j < ${#header} - 1 )); do + i=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 1 )) + j=$(( i + ${${header[$i,-1]}[(i) ]} - 1 )) + k=$(( j + ${${header[$j,-1]}[(i)[^ ]]} - 2 )) + begin[${header[$i,$((j-1))]}]=$i + end[${header[$i,$((j-1))]}]=$k + done lines=(${lines[2,-1]}) # Container ID local line s name local -a names for line in $lines; do - if [[ $services == *"${line[${begin[CONTAINER ID]},${end[CONTAINER ID]}]%% ##}"* ]]; then + if [[ ${services[@]} == *"${line[${begin[CONTAINER ID]},${end[CONTAINER ID]}]%% ##}"* ]]; then names=(${(ps:,:)${${line[${begin[NAMES]},-1]}%% *}}) for name in $names; do s="${${name%_*}#*_}:${(l:15:: :::)${${line[${begin[CREATED]},${end[CREATED]}]/ ago/}%% ##}}" s="$s, ${line[${begin[CONTAINER ID]},${end[CONTAINER ID]}]%% ##}" - s="$s, ${${${line[$begin[IMAGE],$end[IMAGE]]}/:/\\:}%% ##}" + s="$s, ${${${line[${begin[IMAGE]},${end[IMAGE]}]}/:/\\:}%% ##}" if [[ ${line[${begin[STATUS]},${end[STATUS]}]} = Exit* ]]; then stopped=($stopped $s) else + if [[ ${line[${begin[STATUS]},${end[STATUS]}]} = *\(Paused\)* ]]; then + paused=($paused $s) + fi running=($running $s) fi done fi done - [[ $kind = (running|all) ]] && _describe -t services-running "running services" running - [[ $kind = (stopped|all) ]] && _describe -t services-stopped "stopped services" stopped + [[ $kind =~ (running|all) ]] && _describe -t services-running "running services" running "$@" && ret=0 + [[ $kind =~ (paused|all) ]] && _describe -t services-paused "paused services" paused "$@" && ret=0 + [[ $kind =~ (stopped|all) ]] && _describe -t services-stopped "stopped services" stopped "$@" && ret=0 + + return ret +} + +__docker-compose_pausedservices() { + [[ $PREFIX = -* ]] && return 1 + __docker-compose_get_services paused "$@" } __docker-compose_stoppedservices() { + [[ $PREFIX = -* ]] && return 1 __docker-compose_get_services stopped "$@" } __docker-compose_runningservices() { + [[ $PREFIX = -* ]] && return 1 __docker-compose_get_services running "$@" } -__docker-compose_services () { +__docker-compose_services() { + [[ $PREFIX = -* ]] && return 1 __docker-compose_get_services all "$@" } __docker-compose_caching_policy() { - oldp=( "$1"(Nmh+1) ) # 1 hour + oldp=( "$1"(Nmh+1) ) # 1 hour (( $#oldp )) } -__docker-compose_commands () { +__docker-compose_commands() { local cache_policy zstyle -s ":completion:${curcontext}:" cache-policy cache_policy @@ -151,110 +176,204 @@ __docker-compose_commands () { local -a lines lines=(${(f)"$(_call_program commands docker-compose 2>&1)"}) _docker_compose_subcommands=(${${${lines[$((${lines[(i)Commands:]} + 1)),${lines[(I) *]}]}## #}/ ##/:}) - _store_cache docker_compose_subcommands _docker_compose_subcommands + (( $#_docker_compose_subcommands > 0 )) && _store_cache docker_compose_subcommands _docker_compose_subcommands fi _describe -t docker-compose-commands "docker-compose command" _docker_compose_subcommands } -__docker-compose_subcommand () { - local -a _command_args +__docker-compose_subcommand() { + local opts_help opts_force_recreate opts_no_recreate opts_no_build opts_remove_orphans opts_timeout opts_no_color opts_no_deps + + opts_help='(: -)--help[Print usage]' + opts_force_recreate="(--no-recreate)--force-recreate[Recreate containers even if their configuration and image haven't changed. Incompatible with --no-recreate.]" + opts_no_recreate="(--force-recreate)--no-recreate[If containers already exist, don't recreate them. Incompatible with --force-recreate.]" + opts_no_build="(--build)--no-build[Don't build an image, even if it's missing.]" + opts_remove_orphans="--remove-orphans[Remove containers for services not defined in the Compose file]" + opts_timeout=('(-t --timeout)'{-t,--timeout}"[Specify a shutdown timeout in seconds. (default: 10)]:seconds: ") + opts_no_color='--no-color[Produce monochrome output.]' + opts_no_deps="--no-deps[Don't start linked services.]" + integer ret=1 + case "$words[1]" in (build) _arguments \ - '--no-cache[Do not use cache when building the image]' \ + $opts_help \ + '--force-rm[Always remove intermediate containers.]' \ + '--no-cache[Do not use cache when building the image.]' \ + '--pull[Always attempt to pull a newer version of the image.]' \ '*:services:__docker-compose_services_from_build' && ret=0 ;; + (bundle) + _arguments \ + $opts_help \ + '(--output -o)'{--output,-o}'[Path to write the bundle file to. Defaults to ".dab".]:file:_files' && ret=0 + ;; + (config) + _arguments \ + $opts_help \ + '(--quiet -q)'{--quiet,-q}"[Only validate the configuration, don't print anything.]" \ + '--services[Print the service names, one per line.]' && ret=0 + ;; + (create) + _arguments \ + $opts_help \ + $opts_force_recreate \ + $opts_no_recreate \ + $opts_no_build \ + "(--no-build)--build[Build images before creating containers.]" \ + '*:services:__docker-compose_services_all' && ret=0 + ;; + (down) + _arguments \ + $opts_help \ + "--rmi[Remove images. Type must be one of: 'all': Remove all images used by any service. 'local': Remove only images that don't have a custom tag set by the \`image\` field.]:type:(all local)" \ + '(-v --volumes)'{-v,--volumes}"[Remove named volumes declared in the \`volumes\` section of the Compose file and anonymous volumes attached to containers.]" \ + $opts_remove_orphans && ret=0 + ;; + (events) + _arguments \ + $opts_help \ + '--json[Output events as a stream of json objects]' \ + '*:services:__docker-compose_services_all' && ret=0 + ;; + (exec) + _arguments \ + $opts_help \ + '-d[Detached mode: Run command in the background.]' \ + '--privileged[Give extended privileges to the process.]' \ + '--user=[Run the command as this user.]:username:_users' \ + '-T[Disable pseudo-tty allocation. By default `docker-compose exec` allocates a TTY.]' \ + '--index=[Index of the container if there are multiple instances of a service \[default: 1\]]:index: ' \ + '(-):running services:__docker-compose_runningservices' \ + '(-):command: _command_names -e' \ + '*::arguments: _normal' && ret=0 + ;; (help) _arguments ':subcommand:__docker-compose_commands' && ret=0 ;; (kill) _arguments \ + $opts_help \ '-s[SIGNAL to send to the container. Default signal is SIGKILL.]:signal:_signals' \ '*:running services:__docker-compose_runningservices' && ret=0 ;; (logs) _arguments \ - '--no-color[Produce monochrome output.]' \ + $opts_help \ + '(-f --follow)'{-f,--follow}'[Follow log output]' \ + $opts_no_color \ + '--tail=[Number of lines to show from the end of the logs for each container.]:number of lines: ' \ + '(-t --timestamps)'{-t,--timestamps}'[Show timestamps]' \ '*:services:__docker-compose_services_all' && ret=0 ;; - (migrate-to-labels) + (pause) _arguments \ - '(-):Recreate containers to add labels' && ret=0 + $opts_help \ + '*:running services:__docker-compose_runningservices' && ret=0 ;; (port) _arguments \ - '--protocol=-[tcp or udap (defaults to tcp)]:protocol:(tcp udp)' \ - '--index=-[index of the container if there are mutiple instances of a service (defaults to 1)]:index: ' \ + $opts_help \ + '--protocol=[tcp or udp \[default: tcp\]]:protocol:(tcp udp)' \ + '--index=[index of the container if there are multiple instances of a service \[default: 1\]]:index: ' \ '1:running services:__docker-compose_runningservices' \ '2:port:_ports' && ret=0 ;; (ps) _arguments \ + $opts_help \ '-q[Only display IDs]' \ '*:services:__docker-compose_services_all' && ret=0 ;; (pull) _arguments \ - '--allow-insecure-ssl[Allow insecure connections to the docker registry]' \ + $opts_help \ + '--ignore-pull-failures[Pull what it can and ignores images with pull failures.]' \ '*:services:__docker-compose_services_from_image' && ret=0 ;; + (push) + _arguments \ + $opts_help \ + '--ignore-push-failures[Push what it can and ignores images with push failures.]' \ + '*:services:__docker-compose_services' && ret=0 + ;; (rm) _arguments \ + $opts_help \ '(-f --force)'{-f,--force}"[Don't ask to confirm removal]" \ - '-v[Remove volumes associated with containers]' \ + '-v[Remove any anonymous volumes attached to containers]' \ '*:stopped services:__docker-compose_stoppedservices' && ret=0 ;; (run) _arguments \ - '--allow-insecure-ssl[Allow insecure connections to the docker registry]' \ + $opts_help \ '-d[Detached mode: Run container in the background, print new container name.]' \ - '--entrypoint[Overwrite the entrypoint of the image.]:entry point: ' \ '*-e[KEY=VAL Set an environment variable (can be used multiple times)]:environment variable KEY=VAL: ' \ - '(-u --user)'{-u,--user=-}'[Run as specified username or uid]:username or uid:_users' \ - "--no-deps[Don't start linked services.]" \ + '--entrypoint[Overwrite the entrypoint of the image.]:entry point: ' \ + '--name=[Assign a name to the container]:name: ' \ + $opts_no_deps \ + '(-p --publish)'{-p,--publish=}"[Publish a container's port(s) to the host]" \ '--rm[Remove container after run. Ignored in detached mode.]' \ "--service-ports[Run command with the service's ports enabled and mapped to the host.]" \ '-T[Disable pseudo-tty allocation. By default `docker-compose run` allocates a TTY.]' \ + '(-u --user)'{-u,--user=}'[Run as specified username or uid]:username or uid:_users' \ + '(-w --workdir)'{-w,--workdir=}'[Working directory inside the container]:workdir: ' \ '(-):services:__docker-compose_services' \ '(-):command: _command_names -e' \ '*::arguments: _normal' && ret=0 ;; (scale) - _arguments '*:running services:__docker-compose_runningservices' && ret=0 + _arguments \ + $opts_help \ + $opts_timeout \ + '*:running services:__docker-compose_runningservices' && ret=0 ;; (start) - _arguments '*:stopped services:__docker-compose_stoppedservices' && ret=0 + _arguments \ + $opts_help \ + '*:stopped services:__docker-compose_stoppedservices' && ret=0 ;; (stop|restart) _arguments \ - '(-t --timeout)'{-t,--timeout}"[Specify a shutdown timeout in seconds. (default: 10)]:seconds: " \ + $opts_help \ + $opts_timeout \ '*:running services:__docker-compose_runningservices' && ret=0 ;; + (unpause) + _arguments \ + $opts_help \ + '*:paused services:__docker-compose_pausedservices' && ret=0 + ;; (up) _arguments \ - '--allow-insecure-ssl[Allow insecure connections to the docker registry]' \ - '-d[Detached mode: Run containers in the background, print new container names.]' \ - '--no-color[Produce monochrome output.]' \ - "--no-deps[Don't start linked services.]" \ - "--no-recreate[If containers already exist, don't recreate them.]" \ - "--no-build[Don't build an image, even if it's missing]" \ - '(-t --timeout)'{-t,--timeout}"[Specify a shutdown timeout in seconds. (default: 10)]:seconds: " \ - "--x-smart-recreate[Only recreate containers whose configuration or image needs to be updated. (EXPERIMENTAL)]" \ + $opts_help \ + '(--abort-on-container-exit)-d[Detached mode: Run containers in the background, print new container names. Incompatible with --abort-on-container-exit.]' \ + $opts_no_color \ + $opts_no_deps \ + $opts_force_recreate \ + $opts_no_recreate \ + $opts_no_build \ + "(--no-build)--build[Build images before starting containers.]" \ + "(-d)--abort-on-container-exit[Stops all containers if any container was stopped. Incompatible with -d.]" \ + '(-t --timeout)'{-t,--timeout}"[Use this timeout in seconds for container shutdown when attached or when containers are already running. (default: 10)]:seconds: " \ + $opts_remove_orphans \ '*:services:__docker-compose_services_all' && ret=0 ;; (version) _arguments \ + $opts_help \ "--short[Shows only Compose's version number.]" && ret=0 ;; (*) - _message 'Unknown sub command' + _message 'Unknown sub command' && ret=1 + ;; esac return ret } -_docker-compose () { +_docker-compose() { # Support for subservices, which allows for `compdef _docker docker-shell=_docker_containers`. # Based on /usr/share/zsh/functions/Completion/Unix/_git without support for `ret`. if [[ $service != docker-compose ]]; then @@ -262,34 +381,62 @@ _docker-compose () { return fi - local curcontext="$curcontext" state line ret=1 + local curcontext="$curcontext" state line + integer ret=1 typeset -A opt_args _arguments -C \ '(- :)'{-h,--help}'[Get help]' \ - '--verbose[Show more output]' \ - '(- :)'{-v,--version}'[Print version and exit]' \ '(-f --file)'{-f,--file}'[Specify an alternate docker-compose file (default: docker-compose.yml)]:file:_files -g "*.yml"' \ '(-p --project-name)'{-p,--project-name}'[Specify an alternate project name (default: directory name)]:project name:' \ + '--verbose[Show more output]' \ + '(- :)'{-v,--version}'[Print version and exit]' \ + '(-H --host)'{-H,--host}'[Daemon socket to connect to]:host:' \ + '--tls[Use TLS; implied by --tlsverify]' \ + '--tlscacert=[Trust certs signed only by this CA]:ca path:' \ + '--tlscert=[Path to TLS certificate file]:client cert path:' \ + '--tlskey=[Path to TLS key file]:tls key path:' \ + '--tlsverify[Use TLS and verify the remote]' \ + "--skip-hostname-check[Don't check the daemon's hostname against the name specified in the client certificate (for example if your docker host is an IP address)]" \ '(-): :->command' \ '(-)*:: :->option-or-argument' && ret=0 - local counter=1 - #local compose_file compose_project - while [ $counter -lt ${#words[@]} ]; do - case "${words[$counter]}" in - -f|--file) - (( counter++ )) - compose_file="${words[$counter]}" - ;; - -p|--project-name) - (( counter++ )) - compose_project="${words[$counter]}" - ;; - *) - ;; - esac - (( counter++ )) + local -a relevant_compose_flags relevant_docker_flags compose_options docker_options + + relevant_compose_flags=( + "--file" "-f" + "--host" "-H" + "--project-name" "-p" + "--tls" + "--tlscacert" + "--tlscert" + "--tlskey" + "--tlsverify" + "--skip-hostname-check" + ) + + relevant_docker_flags=( + "--host" "-H" + "--tls" + "--tlscacert" + "--tlscert" + "--tlskey" + "--tlsverify" + ) + + for k in "${(@k)opt_args}"; do + if [[ -n "${relevant_docker_flags[(r)$k]}" ]]; then + docker_options+=$k + if [[ -n "$opt_args[$k]" ]]; then + docker_options+=$opt_args[$k] + fi + fi + if [[ -n "${relevant_compose_flags[(r)$k]}" ]]; then + compose_options+=$k + if [[ -n "$opt_args[$k]" ]]; then + compose_options+=$opt_args[$k] + fi + fi done case $state in From cc8285b1f708c33338d280bbb5481dc93bafa458 Mon Sep 17 00:00:00 2001 From: Adam Glenn Date: Tue, 19 Jul 2016 12:01:00 -0700 Subject: [PATCH 262/537] adding python virtualenv support to the prompt (#5031) adding python virtualenv support to muse theme --- themes/muse.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/muse.zsh-theme b/themes/muse.zsh-theme index 4bd8fb82..55a37574 100644 --- a/themes/muse.zsh-theme +++ b/themes/muse.zsh-theme @@ -13,7 +13,7 @@ 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%} ' +PROMPT='%{$PROMPT_SUCCESS_COLOR%}%~%{$reset_color%} %{$GIT_PROMPT_INFO%}$(git_prompt_info) $(virtualenv_prompt_info)%{$GIT_DIRTY_COLOR%}$(git_prompt_status) %{$reset_color%}%{$PROMPT_PROMPT%}ᐅ%{$reset_color%} ' #RPS1="${return_code}" From a7e30b26baa94bac99d9d05cf642bd1942ae1787 Mon Sep 17 00:00:00 2001 From: Anton Date: Fri, 22 Jul 2016 17:04:35 +0400 Subject: [PATCH 263/537] Fix hg call when missing on archlinux with command-not-found (#5218) --- themes/agnoster.zsh-theme | 1 + 1 file changed, 1 insertion(+) diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme index 103041ee..da1f9b6e 100644 --- a/themes/agnoster.zsh-theme +++ b/themes/agnoster.zsh-theme @@ -128,6 +128,7 @@ prompt_git() { } prompt_hg() { + (( $+commands[hg] )) || return local rev status if $(hg id >/dev/null 2>&1); then if $(hg prompt >/dev/null 2>&1); then From 61981951b1380c431e464a63d394ce890e751b97 Mon Sep 17 00:00:00 2001 From: Steven Date: Mon, 1 Aug 2016 08:48:46 -0700 Subject: [PATCH 264/537] Updated git_commits_ahead function (#5247) * Function wasn't returning correct value * Updated underlying git command * Kept echo command from previous function for backwards compatibility * Kept function consistent with git_commits_behind --- lib/git.zsh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/git.zsh b/lib/git.zsh index c79cc0d8..648a766b 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -76,9 +76,8 @@ function git_current_branch() { # Gets the number of commits ahead from remote function git_commits_ahead() { - if $(echo "$(command git log @{upstream}..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then - local COMMITS - COMMITS=$(command git log @{upstream}..HEAD | grep '^commit' | wc -l | tr -d ' ') + if $(command git rev-parse --git-dir > /dev/null 2>&1); then + local COMMITS="$(git rev-list --count @{upstream}..HEAD)" echo "$ZSH_THEME_GIT_COMMITS_AHEAD_PREFIX$COMMITS$ZSH_THEME_GIT_COMMITS_AHEAD_SUFFIX" fi } From 508b80c1e131ffb5ca6a858345c27eb2400122c9 Mon Sep 17 00:00:00 2001 From: nklmish Date: Mon, 1 Aug 2016 18:05:01 +0200 Subject: [PATCH 265/537] support for startpage search engine in web-search plugin (#5245) --- plugins/web-search/web-search.plugin.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/web-search/web-search.plugin.zsh b/plugins/web-search/web-search.plugin.zsh index d3bf97d7..3b5478ca 100644 --- a/plugins/web-search/web-search.plugin.zsh +++ b/plugins/web-search/web-search.plugin.zsh @@ -10,6 +10,7 @@ function web_search() { bing "https://www.bing.com/search?q=" yahoo "https://search.yahoo.com/search?p=" duckduckgo "https://www.duckduckgo.com/?q=" + startpage "https://www.startpage.com/do/search?q=" yandex "https://yandex.ru/yandsearch?text=" github "https://github.com/search?q=" baidu "https://www.baidu.com/s?wd=" @@ -41,6 +42,7 @@ alias bing='web_search bing' alias google='web_search google' alias yahoo='web_search yahoo' alias ddg='web_search duckduckgo' +alias sp='web_search startpage' alias yandex='web_search yandex' alias github='web_search github' alias baidu='web_search baidu' From f5537241a4fe7f48a5f7f49fff52db9f0247a5cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Malard?= Date: Mon, 1 Aug 2016 18:16:54 +0200 Subject: [PATCH 266/537] Fix gbda alias to support `color.ui = always` + exclude dev branches (#4304) * Fix gbda alias to support git config color.ui = always * Update gbda alias to exclude develop and dev branches --- 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 c186a6e1..01c29e14 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -46,7 +46,7 @@ alias gapa='git add --patch' alias gb='git branch' alias gba='git branch -a' -alias gbda='git branch --merged | command grep -vE "^(\*|\s*master\s*$)" | command xargs -n 1 git branch -d' +alias gbda='git branch --no-color --merged | command grep -vE "^(\*|\s*(master|develop|dev)\s*$)" | command xargs -n 1 git branch -d' alias gbl='git blame -b -w' alias gbnm='git branch --no-merged' alias gbr='git branch --remote' From 7654b16b3963844e5079a8935eb93f108c52f273 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sun, 7 Aug 2016 18:30:57 +0200 Subject: [PATCH 267/537] [git plugin] Fix indentation and organise aliases --- plugins/git/git.plugin.zsh | 67 ++++++++++++++++++++++---------------- 1 file changed, 39 insertions(+), 28 deletions(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 01c29e14..0cee136c 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -81,62 +81,73 @@ alias gd='git diff' alias gdca='git diff --cached' alias gdct='git describe --tags `git rev-list --tags --max-count=1`' alias gdt='git diff-tree --no-commit-id --name-only -r' +alias gdw='git diff --word-diff' + gdv() { git diff -w "$@" | view - } compdef _git gdv=git-diff -alias gdw='git diff --word-diff' alias gf='git fetch' alias gfa='git fetch --all --prune' +alias gfo='git fetch origin' + function gfg() { git ls-files | grep $@ } compdef _grep gfg -alias gfo='git fetch origin' alias gg='git gui citool' alias gga='git gui citool --amend' + ggf() { -[[ "$#" != 1 ]] && local b="$(git_current_branch)" -git push --force origin "${b:=$1}" + [[ "$#" != 1 ]] && local b="$(git_current_branch)" + git push --force origin "${b:=$1}" } compdef _git ggf=git-checkout + ggl() { -if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then -git pull origin "${*}" -else -[[ "$#" == 0 ]] && local b="$(git_current_branch)" -git pull origin "${b:=$1}" -fi + if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then + git pull origin "${*}" + else + [[ "$#" == 0 ]] && local b="$(git_current_branch)" + git pull origin "${b:=$1}" + fi } compdef _git ggl=git-checkout -alias ggpull='git pull origin $(git_current_branch)' -compdef _git ggpull=git-checkout + ggp() { -if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then -git push origin "${*}" -else -[[ "$#" == 0 ]] && local b="$(git_current_branch)" -git push origin "${b:=$1}" -fi + if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then + git push origin "${*}" + else + [[ "$#" == 0 ]] && local b="$(git_current_branch)" + git push origin "${b:=$1}" + fi } compdef _git ggp=git-checkout -alias ggpush='git push origin $(git_current_branch)' -compdef _git ggpush=git-checkout + ggpnp() { -if [[ "$#" == 0 ]]; then -ggl && ggp -else -ggl "${*}" && ggp "${*}" -fi + if [[ "$#" == 0 ]]; then + ggl && ggp + else + ggl "${*}" && ggp "${*}" + fi } compdef _git ggpnp=git-checkout -alias ggsup='git branch --set-upstream-to=origin/$(git_current_branch)' + ggu() { -[[ "$#" != 1 ]] && local b="$(git_current_branch)" -git pull --rebase origin "${b:=$1}" + [[ "$#" != 1 ]] && local b="$(git_current_branch)" + git pull --rebase origin "${b:=$1}" } compdef _git ggu=git-checkout + alias ggpur='ggu' compdef _git ggpur=git-checkout +alias ggpull='git pull origin $(git_current_branch)' +compdef _git ggpull=git-checkout + +alias ggpush='git push origin $(git_current_branch)' +compdef _git ggpush=git-checkout + +alias ggsup='git branch --set-upstream-to=origin/$(git_current_branch)' + alias gignore='git update-index --assume-unchanged' alias gignored='git ls-files -v | grep "^[[:lower:]]"' alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk' From a7de0fabd7ebbf1776942a8c7fde8ee33ed681b0 Mon Sep 17 00:00:00 2001 From: Luke Childs Date: Sun, 7 Aug 2016 18:36:44 +0100 Subject: [PATCH 268/537] nvm plugin improvements (#5265) * Export $NVM_DIR if it doesn't exist and use it when looking for nvm * Use $NVM_DIR when looking for nvm for completion * Use $NVM_DIR when looking for nvm in nvm_prompt_info --- lib/nvm.zsh | 2 +- plugins/nvm/_nvm | 2 +- plugins/nvm/nvm.plugin.zsh | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/nvm.zsh b/lib/nvm.zsh index 61d997fc..4a8b6811 100644 --- a/lib/nvm.zsh +++ b/lib/nvm.zsh @@ -1,6 +1,6 @@ # get the node.js version function nvm_prompt_info() { - [ -f "$HOME/.nvm/nvm.sh" ] || return + [[ -f "$NVM_DIR/nvm.sh" ]] || return local nvm_prompt nvm_prompt=$(node -v 2>/dev/null) [[ "${nvm_prompt}x" == "x" ]] && return diff --git a/plugins/nvm/_nvm b/plugins/nvm/_nvm index a95c9e37..1414dcbb 100644 --- a/plugins/nvm/_nvm +++ b/plugins/nvm/_nvm @@ -1,7 +1,7 @@ #compdef nvm #autoload -[[ -s ~/.nvm/nvm.sh ]] || return 0 +[[ -f "$NVM_DIR/nvm.sh" ]] || return 0 local -a _1st_arguments _1st_arguments=( diff --git a/plugins/nvm/nvm.plugin.zsh b/plugins/nvm/nvm.plugin.zsh index 9709719f..9dde3a26 100644 --- a/plugins/nvm/nvm.plugin.zsh +++ b/plugins/nvm/nvm.plugin.zsh @@ -1,3 +1,5 @@ -# The addition 'nvm install' attempts in ~/.profile +# Set NVM_DIR if it isn't already defined +[[ -z "$NVM_DIR" ]] && export NVM_DIR="$HOME/.nvm" -[[ -s ~/.nvm/nvm.sh ]] && . ~/.nvm/nvm.sh +# Load nvm if it exists +[[ -f "$NVM_DIR/nvm.sh" ]] && source "$NVM_DIR/nvm.sh" From 9772f8e10d07ce982a45fcce9b074e9084ad76cb Mon Sep 17 00:00:00 2001 From: Fredrik Fornwall Date: Tue, 9 Aug 2016 02:39:11 +0200 Subject: [PATCH 269/537] Replace /bin/sh with sh for portability (#5291) This makes things work even on system lacking /bin/sh, such as on non-rooted Android systems. --- lib/functions.zsh | 4 ++-- tools/check_for_upgrade.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/functions.zsh b/lib/functions.zsh index f9d4a971..9f11318d 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -3,11 +3,11 @@ function zsh_stats() { } function uninstall_oh_my_zsh() { - env ZSH=$ZSH /bin/sh $ZSH/tools/uninstall.sh + env ZSH=$ZSH sh $ZSH/tools/uninstall.sh } function upgrade_oh_my_zsh() { - env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh + env ZSH=$ZSH sh $ZSH/tools/upgrade.sh } function take() { diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh index 881bc6c4..bd9aba8b 100644 --- a/tools/check_for_upgrade.sh +++ b/tools/check_for_upgrade.sh @@ -11,7 +11,7 @@ function _update_zsh_update() { } function _upgrade_zsh() { - env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh + env ZSH=$ZSH sh $ZSH/tools/upgrade.sh # update the zsh file _update_zsh_update } From 4505a438e4829e0335484c08b71244378081d7b7 Mon Sep 17 00:00:00 2001 From: Dominic Motuka Date: Thu, 11 Aug 2016 03:14:52 +0300 Subject: [PATCH 270/537] update alias of get a list of packages installed locally (#5276) --- plugins/ubuntu/ubuntu.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/ubuntu/ubuntu.plugin.zsh b/plugins/ubuntu/ubuntu.plugin.zsh index f0885364..d924f886 100644 --- a/plugins/ubuntu/ubuntu.plugin.zsh +++ b/plugins/ubuntu/ubuntu.plugin.zsh @@ -63,7 +63,7 @@ alias kclean='sudo aptitude remove -P ?and(~i~nlinux-(ima|hea) \ # Misc. ##################################################################### # print all installed packages -alias allpkgs='aptitude search -F "%p" --disable-columns ~i' +alias allpkgs='dpkg --get-selections | grep -v deinstall' # Create a basic .deb package alias mydeb='time dpkg-buildpackage -rfakeroot -us -uc' From a9428b137f14969bd44a5787c0080297d81ea0b7 Mon Sep 17 00:00:00 2001 From: Kyle Scully Date: Wed, 10 Aug 2016 17:28:56 -0700 Subject: [PATCH 271/537] added mix autocompletion support for phoenix (#4967) --- plugins/mix/_mix | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/plugins/mix/_mix b/plugins/mix/_mix index 3b3887b1..57fdf808 100644 --- a/plugins/mix/_mix +++ b/plugins/mix/_mix @@ -38,6 +38,15 @@ _1st_arguments=( 'local.hex:Install hex locally' 'local.rebar:Install rebar locally' 'new:Create a new Elixir project' + 'phoenix.digest:Digests and compress static files' + 'phoenix.gen.channel:Generates a Phoenix channel' + 'phoenix.gen.html:Generates controller, model and views for an HTML based resource' + 'phoenix.gen.json:Generates a controller and model for a JSON based resource' + 'phoenix.gen.model:Generates an Ecto model' + 'phoenix.gen.secret:Generates a secret' + 'phoenix.new:Create a new Phoenix application' + 'phoenix.routes:Prints all routes' + 'phoenix.server:Starts applications and their servers' 'run:Run the given file or expression' "test:Run a project's tests" '--help:Describe available tasks' @@ -49,7 +58,7 @@ __task_list () local expl declare -a tasks - tasks=(app.start archive archive.build archive.install archive.uninstall clean cmd compile compile.protocols deps deps.clean deps.compile deps.get deps.unlock deps.update do escript.build help hex hex.config hex.docs hex.info hex.key hex.outdated hex.owner hex.publish hex.search hex.user loadconfig local local.hex local.rebar new run test) + tasks=(app.start archive archive.build archive.install archive.uninstall clean cmd compile compile.protocols deps deps.clean deps.compile deps.get deps.unlock deps.update do escript.build help hex hex.config hex.docs hex.info hex.key hex.outdated hex.owner hex.publish hex.search hex.user loadconfig local local.hex local.rebar new phoenix.digest phoenix.gen.channel phoenix.gen.html phoenix.gen.json phoenix.gen.model phoenix.gen.secret phoenix.new phoenix.routes phoenix.server run test) _wanted tasks expl 'help' compadd $tasks } @@ -80,4 +89,3 @@ case $state in esac ;; esac - From c09323098acb03a0678f87036fad10bd99b283b2 Mon Sep 17 00:00:00 2001 From: Shiv Venkatasubrahmanyam Date: Wed, 10 Aug 2016 17:44:00 -0700 Subject: [PATCH 272/537] Add shrink-path plugin to shorten directory paths (e.g. ~/f/b/quux) (#5262) * Add shrink-path plugin to shorten directory paths (e.g. ~/f/b/quux) * Add a README --- plugins/shrink-path/README.md | 68 +++++++++++ plugins/shrink-path/shrink-path.plugin.zsh | 127 +++++++++++++++++++++ 2 files changed, 195 insertions(+) create mode 100644 plugins/shrink-path/README.md create mode 100644 plugins/shrink-path/shrink-path.plugin.zsh diff --git a/plugins/shrink-path/README.md b/plugins/shrink-path/README.md new file mode 100644 index 00000000..51fa8a05 --- /dev/null +++ b/plugins/shrink-path/README.md @@ -0,0 +1,68 @@ +# A plugin to shrink directory paths for brevity and pretty-printing + + +## Examples + +For this directory tree: +``` + /home/ + me/ + foo/ + bar/ + quux/ + biz/ # The prefix b is ambiguous between bar and biz. +``` +here are the results of calling `shrink_path