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/299] 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/299] 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/299] 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/299] 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 e2bf7cb3dfcbe42686beb038035d9870eeb0faa3 Mon Sep 17 00:00:00 2001 From: isqua Date: Sat, 26 Apr 2014 02:44:02 +0400 Subject: [PATCH 005/299] 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 006/299] 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 68e03a05923b65b0a0272f251ea1e72e3540f827 Mon Sep 17 00:00:00 2001 From: ju Date: Tue, 16 Jun 2015 08:44:50 +0200 Subject: [PATCH 007/299] 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 e66afc031833590d6077c029596f251ed247158a Mon Sep 17 00:00:00 2001 From: aioute Gao Date: Mon, 2 Nov 2015 16:12:38 +0900 Subject: [PATCH 008/299] 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 d853ec4b629f24c6622f414f312fbf83cec0990d Mon Sep 17 00:00:00 2001 From: atk91 Date: Fri, 25 Dec 2015 11:33:29 +0300 Subject: [PATCH 009/299] 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 010/299] 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 a67dfae72b5d52b7e94304083a51d57c5c718e97 Mon Sep 17 00:00:00 2001 From: "L.C. Karssen" Date: Wed, 8 Jan 2014 10:45:05 +0100 Subject: [PATCH 011/299] 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 012/299] 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 013/299] 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 014/299] 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 015/299] 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 016/299] =?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 a6ad7a0c8d3a2d4be5ad0d70358c4bdbe47ace9b Mon Sep 17 00:00:00 2001 From: Anton Rieder Date: Fri, 29 Jan 2016 13:04:53 +0100 Subject: [PATCH 017/299] 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 07424c92a82a228d032bbddca34f13b1eb6b8750 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Sun, 14 Feb 2016 03:44:31 -0500 Subject: [PATCH 018/299] 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 019/299] 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 020/299] 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 aeca2ad899eed0235921dc6f1d7a3415bc851143 Mon Sep 17 00:00:00 2001 From: Yad Smood Date: Sun, 21 Feb 2016 01:16:21 +0800 Subject: [PATCH 021/299] 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 022/299] 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 9c362484396560119e8ff7a5de0696a9765cb2c7 Mon Sep 17 00:00:00 2001 From: "L.C. Karssen" Date: Mon, 27 Jul 2015 12:03:50 +0200 Subject: [PATCH 023/299] 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 024/299] 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 025/299] 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 026/299] 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 027/299] [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 028/299] 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 029/299] 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 030/299] 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 031/299] 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 032/299] 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 033/299] 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 034/299] 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 035/299] 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 036/299] 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 037/299] 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 038/299] 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 039/299] 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 040/299] 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 041/299] [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 042/299] 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 043/299] 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 044/299] 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 045/299] 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 046/299] 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 047/299] 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 048/299] 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 049/299] 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 050/299] 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 051/299] 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 052/299] 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 053/299] 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 054/299] 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 055/299] 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 056/299] 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 057/299] 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 058/299] 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 059/299] 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 060/299] 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 061/299] 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 062/299] 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 063/299] 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 064/299] 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 065/299] 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 066/299] 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 067/299] 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 068/299] 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 069/299] 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 070/299] 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 071/299] 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 072/299] 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 073/299] 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 074/299] 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 075/299] 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 076/299] 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 077/299] 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 078/299] 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 079/299] 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 080/299] 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 081/299] 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 082/299] 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 083/299] 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 084/299] 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 085/299] 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 086/299] 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 087/299] 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 088/299] 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 089/299] 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 090/299] 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 091/299] 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 092/299] 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 093/299] 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 094/299] 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 095/299] 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 096/299] 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 097/299] 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 098/299] 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 099/299] 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 100/299] 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 101/299] 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 102/299] 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 103/299] 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 104/299] 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 105/299] 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 106/299] 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 107/299] 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 108/299] 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 109/299] 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 110/299] 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 111/299] 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 112/299] 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 113/299] 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 114/299] [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 115/299] 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 116/299] 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 117/299] 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 118/299] 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 119/299] 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