summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/arcanist/README.md5
-rw-r--r--plugins/arcanist/arcanist.plugin.zsh21
-rw-r--r--plugins/asdf/README.md27
-rw-r--r--plugins/asdf/asdf.plugin.zsh7
-rw-r--r--plugins/bower/bower.plugin.zsh1
-rw-r--r--plugins/branch/branch.plugin.zsh7
-rw-r--r--plugins/brew/_brew56
-rw-r--r--plugins/bundler/README.md1
-rw-r--r--plugins/cakephp3/cakephp3.plugin.zsh27
-rw-r--r--plugins/chruby/chruby.plugin.zsh6
-rw-r--r--plugins/command-not-found/command-not-found.plugin.zsh8
-rwxr-xr-xplugins/dnf/README.md25
-rw-r--r--plugins/dnf/dnf.plugin.zsh15
-rw-r--r--plugins/encode64/encode64.plugin.zsh17
-rw-r--r--plugins/fasd/fasd.plugin.zsh2
-rw-r--r--plugins/forklift/README.md8
-rw-r--r--plugins/fossil/README.md7
-rw-r--r--plugins/fossil/fossil.plugin.zsh89
-rw-r--r--plugins/frontend-search/README.md2
-rw-r--r--plugins/frontend-search/_frontend-search.sh4
-rw-r--r--plugins/frontend-search/frontend-search.plugin.zsh8
-rw-r--r--plugins/geeknote/README.md12
-rw-r--r--plugins/geeknote/_geeknote136
-rw-r--r--plugins/geeknote/geeknote.plugin.zsh2
-rw-r--r--plugins/git/git.plugin.zsh19
-rw-r--r--plugins/gitfast/_git5
-rw-r--r--plugins/gitfast/git-completion.bash246
-rw-r--r--plugins/gitfast/git-prompt.sh132
-rw-r--r--plugins/github/README.md4
-rw-r--r--plugins/github/github.plugin.zsh2
-rw-r--r--plugins/gitignore/gitignore.plugin.zsh2
-rw-r--r--plugins/jira/jira.plugin.zsh7
-rw-r--r--plugins/meteor/README.md45
-rw-r--r--plugins/meteor/meteor.plugin.zsh33
-rw-r--r--plugins/mix/_mix4
-rw-r--r--plugins/mvn/README.md32
-rw-r--r--plugins/mvn/mvn.plugin.zsh42
-rw-r--r--plugins/npm/npm.plugin.zsh3
-rw-r--r--plugins/osx/osx.plugin.zsh36
-rw-r--r--plugins/pylint/pylint.plugin.zsh4
-rw-r--r--plugins/rust/_rust191
-rw-r--r--plugins/sbt/sbt.plugin.zsh1
-rw-r--r--plugins/symfony2/symfony2.plugin.zsh6
-rw-r--r--plugins/textmate/textmate.plugin.zsh11
-rw-r--r--plugins/vagrant/_vagrant2
-rw-r--r--plugins/vault/README.md18
-rw-r--r--plugins/vault/_vault400
-rw-r--r--plugins/wp-cli/README.md4
-rw-r--r--plugins/zsh-navigation-tools/.config/znt/n-aliases.conf34
-rw-r--r--plugins/zsh-navigation-tools/.config/znt/n-cd.conf50
-rw-r--r--plugins/zsh-navigation-tools/.config/znt/n-env.conf35
-rw-r--r--plugins/zsh-navigation-tools/.config/znt/n-functions.conf37
-rw-r--r--plugins/zsh-navigation-tools/.config/znt/n-history.conf37
-rw-r--r--plugins/zsh-navigation-tools/.config/znt/n-kill.conf39
-rw-r--r--plugins/zsh-navigation-tools/.config/znt/n-list.conf54
-rw-r--r--plugins/zsh-navigation-tools/.config/znt/n-options.conf35
-rw-r--r--plugins/zsh-navigation-tools/.config/znt/n-panelize.conf35
-rw-r--r--plugins/zsh-navigation-tools/README.md83
-rw-r--r--plugins/zsh-navigation-tools/_n-kill41
-rw-r--r--plugins/zsh-navigation-tools/n-aliases4
-rw-r--r--plugins/zsh-navigation-tools/n-cd17
-rw-r--r--plugins/zsh-navigation-tools/n-env4
-rw-r--r--plugins/zsh-navigation-tools/n-functions4
-rw-r--r--plugins/zsh-navigation-tools/n-help96
-rw-r--r--plugins/zsh-navigation-tools/n-history331
-rw-r--r--plugins/zsh-navigation-tools/n-kill4
-rw-r--r--plugins/zsh-navigation-tools/n-list138
-rw-r--r--plugins/zsh-navigation-tools/n-list-draw16
-rw-r--r--plugins/zsh-navigation-tools/n-list-input163
-rw-r--r--plugins/zsh-navigation-tools/n-options4
-rw-r--r--plugins/zsh-navigation-tools/n-panelize4
-rw-r--r--plugins/zsh-navigation-tools/znt-history-widget14
-rwxr-xr-xplugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh26
73 files changed, 2753 insertions, 294 deletions
diff --git a/plugins/arcanist/README.md b/plugins/arcanist/README.md
new file mode 100644
index 000000000..4bb8c8090
--- /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 000000000..90851ac62
--- /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'
diff --git a/plugins/asdf/README.md b/plugins/asdf/README.md
new file mode 100644
index 000000000..e8aa976bc
--- /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 000000000..8736d2ff8
--- /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
diff --git a/plugins/bower/bower.plugin.zsh b/plugins/bower/bower.plugin.zsh
index 68a67a3cc..6019b9d37 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
diff --git a/plugins/branch/branch.plugin.zsh b/plugins/branch/branch.plugin.zsh
index a1e9ca31b..2e5659bdf 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 :)
diff --git a/plugins/brew/_brew b/plugins/brew/_brew
index 4c99a383a..1f24bd67b 100644
--- a/plugins/brew/_brew
+++ b/plugins/brew/_brew
@@ -1,7 +1,13 @@
#compdef brew
#autoload
-# imported from the latest homebrew contributions
+# imported from https://github.com/Homebrew/homebrew/blob/29f73d2212c2b202fe25f69dcbf440d8391fa4c9/Library/Contributions/brew_zsh_completion.zsh
+
+# Brew ZSH completion function
+# Drop this somewhere in your $fpath (like /usr/share/zsh/site-functions)
+# and rename it _brew
+#
+# altered from _fink
_brew_all_formulae() {
formulae=(`brew search`)
@@ -15,6 +21,14 @@ _brew_installed_taps() {
installed_taps=(`brew tap`)
}
+_brew_official_taps() {
+ official_taps=(`brew tap --list-official`)
+}
+
+_brew_pinned_taps() {
+ pinned_taps=(`brew tap --list-pinned`)
+}
+
_brew_outdated_formulae() {
outdated_formulae=(`brew outdated`)
}
@@ -25,8 +39,10 @@ _1st_arguments=(
'cat:display formula file for a formula'
'cleanup:uninstall unused and old versions of packages'
'commands:show a list of commands'
+ 'config:show homebrew and system configuration'
'create:create a new formula'
- 'deps:list dependencies of a formula'
+ 'deps:list dependencies and dependants of a formula'
+ 'desc:display a description of a formula'
'doctor:audits your installation for common issues'
'edit:edit a formula'
'fetch:download formula resources to the cache'
@@ -37,40 +53,45 @@ _1st_arguments=(
'reinstall:install a formula anew; re-using its current options'
'leaves:show installed formulae that are not dependencies of another installed formula'
'link:link a formula'
+ 'linkapps:symlink .app bundles provided by formulae into /Applications'
'list:list files in a formula or not-installed formulae'
'log:git commit log for a formula'
'missing:check all installed formuale for missing dependencies.'
+ 'migrate:migrate renamed formula to new name'
'outdated:list formulae for which a newer version is available'
'pin:pin specified formulae'
'postinstall:perform post_install for a given formula'
'prune:remove dead links'
'remove:remove a formula'
'search:search for a formula (/regex/ or string)'
- 'switch:switch linkage between installed versions of a formula'
+ 'switch:switch between different versions of a formula'
'tap:tap a new formula repository from GitHub, or list existing taps'
+ 'tap-info:information about a tap'
+ 'tap-pin:pin a tap'
+ 'tap-unpin:unpin a tap'
'test-bot:test a formula and build a bottle'
'uninstall:uninstall a formula'
'unlink:unlink a formula'
+ 'unlinkapps:remove symlinked .app bundles provided by formulae from /Applications'
'unpin:unpin specified formulae'
'untap:remove a tapped repository'
- 'update:pull latest repository'
+ 'update:fetch latest version of Homebrew and all formulae'
'upgrade:upgrade outdated formulae'
'uses:show formulae which depend on a formula'
+ `brew commands --quiet --include-aliases`
)
local expl
-local -a formulae installed_formulae installed_taps outdated_formulae
+local -a formulae installed_formulae installed_taps official_taps outdated_formulae
_arguments \
'(-v)-v[verbose]' \
'(--cellar)--cellar[brew cellar]' \
- '(--config)--config[brew configuration]' \
'(--env)--env[brew environment]' \
'(--repository)--repository[brew repository]' \
'(--version)--version[version information]' \
'(--prefix)--prefix[where brew lives on this system]' \
'(--cache)--cache[brew cache]' \
- '(--force)--force[brew force]' \
'*:: :->subcmds' && return 0
if (( CURRENT == 1 )); then
@@ -79,9 +100,18 @@ if (( CURRENT == 1 )); then
fi
case "$words[1]" in
- install|reinstall|audit|home|homepage|log|info|abv|uses|cat|deps|edit|options)
+ install|reinstall|audit|home|homepage|log|info|abv|uses|cat|deps|desc|edit|options|switch)
_brew_all_formulae
_wanted formulae expl 'all formulae' compadd -a formulae ;;
+ linkapps|unlinkapps)
+ _arguments \
+ '(--local)--local[operate on ~/Applications instead of /Applications]' \
+ '1: :->forms' && return 0
+
+ if [[ "$state" == forms ]]; then
+ _brew_installed_formulae
+ _wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae
+ fi ;;
list|ls)
_arguments \
'(--unbrewed)--unbrewed[files in brew --prefix not controlled by brew]' \
@@ -100,9 +130,15 @@ case "$words[1]" in
_arguments \
'(--macports)--macports[search the macports repository]' \
'(--fink)--fink[search the fink repository]' ;;
- untap)
+ untap|tap-info|tap-pin)
_brew_installed_taps
- _wanted installed_taps expl 'installed taps' compadd -a installed_taps ;;
+ _wanted installed_taps expl 'installed taps' compadd -a installed_taps ;;
+ tap)
+ _brew_official_taps
+ _wanted official_taps expl 'official taps' compadd -a official_taps ;;
+ tap-unpin)
+ _brew_pinned_taps
+ _wanted pinned_taps expl 'pinned taps' compadd -a pinned_taps ;;
upgrade)
_brew_outdated_formulae
_wanted outdated_formulae expl 'outdated formulae' compadd -a outdated_formulae ;;
diff --git a/plugins/bundler/README.md b/plugins/bundler/README.md
index edd95ccc2..04d551447 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=<cpu core count>` (only for bundler `>= 1.4.0`)
- adds a wrapper for common gems:
diff --git a/plugins/cakephp3/cakephp3.plugin.zsh b/plugins/cakephp3/cakephp3.plugin.zsh
index 28d5af2ea..dbfbeba3b 100644
--- a/plugins/cakephp3/cakephp3.plugin.zsh
+++ b/plugins/cakephp3/cakephp3.plugin.zsh
@@ -1,11 +1,31 @@
# 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 () {
- if [ -f bin/cake ]; then
- compadd `_cakephp3_get_command_list`
+ local -a has3rdargument
+ has3rdargument=("all" "controller" "fixture" "model" "template")
+ if [ -f bin/cake ]; then
+ 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 +34,5 @@ compdef _cakephp3 cake
#Alias
alias c3='bin/cake'
-
alias c3cache='bin/cake orm_cache clear'
alias c3migrate='bin/cake migrations migrate'
diff --git a/plugins/chruby/chruby.plugin.zsh b/plugins/chruby/chruby.plugin.zsh
index 164b4319f..758b4a56c 100644
--- a/plugins/chruby/chruby.plugin.zsh
+++ b/plugins/chruby/chruby.plugin.zsh
@@ -16,9 +16,6 @@
# rvm and rbenv plugins also provide this alias
alias rubies='chruby'
-local _chruby_path
-local _chruby_auto
-
_homebrew-installed() {
whence brew &> /dev/null
}
@@ -42,6 +39,9 @@ if _ruby-build_installed; then
fi
_source_from_omz_settings() {
+ local _chruby_path
+ local _chruby_auto
+
zstyle -s :omz:plugins:chruby path _chruby_path
zstyle -s :omz:plugins:chruby auto _chruby_auto
diff --git a/plugins/command-not-found/command-not-found.plugin.zsh b/plugins/command-not-found/command-not-found.plugin.zsh
index 797554a13..0e2f2133f 100644
--- a/plugins/command-not-found/command-not-found.plugin.zsh
+++ b/plugins/command-not-found/command-not-found.plugin.zsh
@@ -23,3 +23,11 @@ if [ -f /usr/libexec/pk-command-not-found ]; then
return $retval
}
fi
+
+# OSX command-not-found support
+# https://github.com/Homebrew/homebrew-command-not-found
+if type brew &> /dev/null; then
+ if brew command command-not-found-init > /dev/null 2>&1; then
+ eval "$(brew command-not-found-init)";
+ fi
+fi
diff --git a/plugins/dnf/README.md b/plugins/dnf/README.md
new file mode 100755
index 000000000..f9ef496fa
--- /dev/null
+++ b/plugins/dnf/README.md
@@ -0,0 +1,25 @@
+## Description
+
+This plugin makes `dnf` usage easier by adding aliases for the most
+common commands.
+
+`dnf` is the new package manager for RPM-based distributions, which
+replaces `yum`.
+
+## Aliases
+
+| Alias | Command | Description |
+|-------|-------------------------|--------------------------|
+| dnfl | `dnf list` | List packages |
+| dnfli | `dnf list installed` | List installed packages |
+| dnfgl | `dnf grouplist` | List package groups |
+| dnfmc | `dnf makecache` | Generate metadata cache |
+| dnfp | `dnf info` | Show package information |
+| dnfs | `dnf search` | Search package |
+| **Use `sudo`** |
+| dnfu | `sudo dnf upgrade` | Upgrade package |
+| dnfi | `sudo dnf install` | Install package |
+| dnfgi | `sudo dnf groupinstall` | Install package group |
+| dnfr | `sudo dnf remove` | Remove package |
+| dnfgr | `sudo dnf groupremove` | Remove package group |
+| dnfc | `sudo dnf clean all` | Clean cache |
diff --git a/plugins/dnf/dnf.plugin.zsh b/plugins/dnf/dnf.plugin.zsh
new file mode 100644
index 000000000..653ce7dda
--- /dev/null
+++ b/plugins/dnf/dnf.plugin.zsh
@@ -0,0 +1,15 @@
+## Aliases
+
+alias dnfl="dnf list" # List packages
+alias dnfli="dnf list installed" # List installed packages
+alias dnfgl="dnf grouplist" # List package groups
+alias dnfmc="dnf makecache" # Generate metadata cache
+alias dnfp="dnf info" # Show package information
+alias dnfs="dnf search" # Search package
+
+alias dnfu="sudo dnf upgrade" # Upgrade package
+alias dnfi="sudo dnf install" # Install package
+alias dnfgi="sudo dnf groupinstall" # Install package group
+alias dnfr="sudo dnf remove" # Remove package
+alias dnfgr="sudo dnf groupremove" # Remove package group
+alias dnfc="sudo dnf clean all" # Clean cache
diff --git a/plugins/encode64/encode64.plugin.zsh b/plugins/encode64/encode64.plugin.zsh
index 53de6478a..979e06742 100644
--- a/plugins/encode64/encode64.plugin.zsh
+++ b/plugins/encode64/encode64.plugin.zsh
@@ -1,4 +1,17 @@
-encode64(){ printf '%s' $1 | base64 }
-decode64(){ printf '%s' $1 | base64 --decode }
+encode64() {
+ if [[ $# -eq 0 ]]; then
+ cat | base64
+ else
+ printf '%s' $1 | base64
+ fi
+}
+
+decode64() {
+ if [[ $# -eq 0 ]]; then
+ cat | base64 --decode
+ else
+ printf '%s' $1 | base64 --decode
+ fi
+}
alias e64=encode64
alias d64=decode64
diff --git a/plugins/fasd/fasd.plugin.zsh b/plugins/fasd/fasd.plugin.zsh
index b11f0b511..2c302f74d 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
diff --git a/plugins/forklift/README.md b/plugins/forklift/README.md
index b452a357c..6c5cbab23 100644
--- a/plugins/forklift/README.md
+++ b/plugins/forklift/README.md
@@ -4,10 +4,12 @@ Plugin for ForkLift, an FTP application for OS X.
### Requirements
-* [ForkLift](http://forkliftapp.com/forklift/)
+* [ForkLift](http://www.binarynights.com/forklift/)
### Usage
-* If `fl` is called without arguments then the current folder is opened in ForkLift. Is equivalent to `fl .`
+<code>fl [*file_or_folder*]</code>
-* If `fl` is called with a directory as the argument, then that directory is opened in ForkLift \ No newline at end of file
+* If `fl` is called without arguments then the current folder is opened in ForkLift. This is equivalent to `fl .`.
+
+* If `fl` is called with a directory as the argument, then that directory is opened in ForkLift. If called with a non-directory file as the argument, then the file's parent directory is opened.
diff --git a/plugins/fossil/README.md b/plugins/fossil/README.md
new file mode 100644
index 000000000..5bb47b7d5
--- /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 000000000..1ae166e62
--- /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
diff --git a/plugins/frontend-search/README.md b/plugins/frontend-search/README.md
index d0bc5589f..4d956e38f 100644
--- a/plugins/frontend-search/README.md
+++ b/plugins/frontend-search/README.md
@@ -38,7 +38,7 @@ Available search contexts are:
| bootsnipp | `http://bootsnipp.com/search?q=` |
| caniuse | `http://caniuse.com/#search=` |
| codepen | `http://codepen.io/search?q=` |
-| compass | `http://compass-style.org/search?q=` |
+| compassdoc | `http://compass-style.org/search?q=` |
| cssflow | `http://www.cssflow.com/search?q=` |
| dartlang | `https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart:` |
| emberjs | `http://emberjs.com/api/#stp=1&stq=` |
diff --git a/plugins/frontend-search/_frontend-search.sh b/plugins/frontend-search/_frontend-search.sh
index b12f829a1..9aad76f76 100644
--- a/plugins/frontend-search/_frontend-search.sh
+++ b/plugins/frontend-search/_frontend-search.sh
@@ -19,7 +19,7 @@ function _frontend() {
commands=(
'jquery: Search in jQuery website'
'mdn: Search in MDN website'
- 'compass: Search in COMPASS website'
+ 'compassdoc: Search in COMPASS website'
'html5please: Search in HTML5 Please website'
'caniuse: Search in Can I Use website'
'aurajs: Search in AuraJs website'
@@ -57,7 +57,7 @@ function _frontend() {
mdn)
_describe -t points "Warp points" frontend_points && ret=0
;;
- compass)
+ compassdoc)
_describe -t points "Warp points" frontend_points && ret=0
;;
html5please)
diff --git a/plugins/frontend-search/frontend-search.plugin.zsh b/plugins/frontend-search/frontend-search.plugin.zsh
index 2fd5416b3..3fd49ab8e 100644
--- a/plugins/frontend-search/frontend-search.plugin.zsh
+++ b/plugins/frontend-search/frontend-search.plugin.zsh
@@ -4,7 +4,7 @@ alias bem='frontend bem'
alias bootsnipp='frontend bootsnipp'
alias caniuse='frontend caniuse'
alias codepen='frontend codepen'
-alias compass='frontend compass'
+alias compassdoc='frontend compassdoc'
alias cssflow='frontend cssflow'
alias dartlang='frontend dartlang'
alias emberjs='frontend emberjs'
@@ -32,7 +32,7 @@ function frontend() {
bootsnipp 'http://bootsnipp.com/search?q='
caniuse 'http://caniuse.com/#search='
codepen 'http://codepen.io/search?q='
- compass 'http://compass-style.org/search?q='
+ compassdoc 'http://compass-style.org/search?q='
cssflow 'http://www.cssflow.com/search?q='
dartlang 'https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart:'
emberjs 'http://emberjs.com/api/#stp=1&stq='
@@ -57,7 +57,7 @@ function frontend() {
print -P "%Uterm%u and what follows is what will be searched for in the %Ucontext%u website,"
print -P "and %Ucontext%u is one of the following:"
print -P ""
- print -P " angularjs, aurajs, bem, bootsnipp, caniuse, codepen, compass, cssflow,"
+ print -P " angularjs, aurajs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow,"
print -P " dartlang, emberjs, fontello, html5please, jquery, lodash, mdn, npmjs,"
print -P " qunit, reactjs, smacss, stackoverflow, unheap"
print -P ""
@@ -73,7 +73,7 @@ function frontend() {
echo ""
echo "Valid contexts are:"
echo ""
- echo " angularjs, aurajs, bem, bootsnipp, caniuse, codepen, compass, cssflow, "
+ echo " angularjs, aurajs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow, "
echo " dartlang, emberjs, fontello, html5please, jquery, lodash, mdn, npmjs, "
echo " qunit, reactjs, smacss, stackoverflow, unheap"
echo ""
diff --git a/plugins/geeknote/README.md b/plugins/geeknote/README.md
new file mode 100644
index 000000000..a6b50e27f
--- /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))
diff --git a/plugins/geeknote/_geeknote b/plugins/geeknote/_geeknote
new file mode 100644
index 000000000..cf1a187d2
--- /dev/null
+++ b/plugins/geeknote/_geeknote
@@ -0,0 +1,136 @@
+#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'
+ 'tag-remove'
+ '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]' \
+ '(-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]' \
+ )
+ ;;
+ 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-edit)
+ _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 000000000..8126d26b3
--- /dev/null
+++ b/plugins/geeknote/geeknote.plugin.zsh
@@ -0,0 +1,2 @@
+#Alias
+alias gn='geeknote'
diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh
index b851fb97d..eb7bc8034 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'
@@ -146,15 +148,16 @@ 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 gloga='git log --oneline --decorate --graph --all'
alias glp="_git_log_prettily"
compdef _git glp=git-log
@@ -196,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'
@@ -213,7 +216,5 @@ alias gup='git pull --rebase'
alias gupv='git pull --rebase -v'
alias glum='git pull upstream master'
-alias gvt='git verify-tag'
-
alias gwch='git whatchanged -p --abbrev-commit --pretty=medium'
alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit -m "--wip--"'
diff --git a/plugins/gitfast/_git b/plugins/gitfast/_git
index c75b0be7f..6d1b4ecc7 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
@@ -213,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
diff --git a/plugins/gitfast/git-completion.bash b/plugins/gitfast/git-completion.bash
index 9525343fc..e3918c87e 100644
--- a/plugins/gitfast/git-completion.bash
+++ b/plugins/gitfast/git-completion.bash
@@ -10,17 +10,24 @@
# *) 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
#
# 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 +187,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 +282,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 +385,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 +412,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 +517,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 ()
@@ -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)
}
-__git_pretty_aliases ()
+# Lists all set config variables starting with the given section prefix,
+# with the prefix removed.
+__git_get_config_variables ()
{
- 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
+ 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 ()
+{
+ __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
@@ -781,6 +776,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 +972,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 +1040,7 @@ _git_checkout ()
_git_cherry ()
{
- __gitcomp "$(__git_refs)"
+ __gitcomp_nl "$(__git_refs)"
}
_git_cherry_pick ()
@@ -1110,7 +1109,7 @@ _git_commit ()
case "$cur" in
--cleanup=*)
- __gitcomp "default strip verbatim whitespace
+ __gitcomp "default scissors strip verbatim whitespace
" "" "${cur##--cleanup=}"
return
;;
@@ -1165,12 +1164,12 @@ __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
- --raw --word-diff
+ --raw --word-diff --word-diff-regex=
--dirstat --dirstat= --dirstat-by-file
--dirstat-by-file= --cumulative
--diff-algorithm=
@@ -1197,7 +1196,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 +1220,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 +1297,7 @@ _git_gitk ()
}
__git_match_ctag() {
- awk "/^${1////\\/}/ { print \$1 }" "$2"
+ awk "/^${1//\//\\/}/ { print \$1 }" "$2"
}
_git_grep ()
@@ -1307,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
@@ -1412,7 +1418,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:"
@@ -1438,7 +1444,7 @@ _git_log ()
return
;;
--decorate=*)
- __gitcomp "long short" "" "${cur##--decorate=}"
+ __gitcomp "full short no" "" "${cur##--decorate=}"
return
;;
--*)
@@ -1451,6 +1457,7 @@ _git_log ()
--abbrev-commit --abbrev=
--relative-date --date=
--pretty= --format= --oneline
+ --show-signature
--cherry-pick
--graph
--decorate --decorate=
@@ -1466,9 +1473,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 +1487,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 +1594,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 +1610,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
;;
@@ -1621,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
@@ -1637,7 +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
+ --autosquash --no-autosquash
+ --fork-point --no-fork-point
+ --autostash --no-autostash
+ --verify --no-verify
+ --keep-empty --root --force-rebase --no-ff
+ --exec
"
return
@@ -1662,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 "
@@ -1686,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
@@ -1727,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 ()
@@ -1750,7 +1813,7 @@ _git_config ()
return
;;
branch.*.rebase)
- __gitcomp "false true"
+ __gitcomp "false true preserve interactive"
return
;;
remote.pushdefault)
@@ -1820,6 +1883,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
@@ -1836,6 +1903,7 @@ _git_config ()
--get --get-all --get-regexp
--add --unset --unset-all
--remove-section --rename-section
+ --name-only
"
return
;;
@@ -1954,6 +2022,7 @@ _git_config ()
color.status.changed
color.status.header
color.status.nobranch
+ color.status.unmerged
color.status.untracked
color.status.updated
color.ui
@@ -1991,6 +2060,7 @@ _git_config ()
core.sparseCheckout
core.symlinks
core.trustctime
+ core.untrackedCache
core.warnAmbiguousRefs
core.whitespace
core.worktree
@@ -2065,6 +2135,8 @@ _git_config ()
http.noEPSV
http.postBuffer
http.proxy
+ http.sslCipherList
+ http.sslVersion
http.sslCAInfo
http.sslCAPath
http.sslCert
@@ -2128,6 +2200,7 @@ _git_config ()
pull.octopus
pull.twohead
push.default
+ push.followTags
rebase.autosquash
rebase.stat
receive.autogc
@@ -2201,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")"
;;
*)
;;
@@ -2233,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"
@@ -2287,6 +2360,7 @@ _git_show ()
;;
--*)
__gitcomp "--pretty= --format= --abbrev-commit --oneline
+ --show-signature
$__git_diff_common_options
"
return
@@ -2300,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
@@ -2313,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
@@ -2335,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')"
;;
@@ -2492,6 +2577,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 +2642,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 54489080f..0da14eee9 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
@@ -84,6 +88,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=
@@ -207,7 +216,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,9 +277,9 @@ __git_ps1_colorize_gitstring ()
r="$c_clear$r"
}
-eread ()
+__git_eread ()
{
- f="$1"
+ local f="$1"
shift
test -r "$f" && read "$@" <"$f"
}
@@ -279,6 +297,8 @@ 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 '
@@ -290,13 +310,54 @@ __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
+ # 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 \
@@ -304,11 +365,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
@@ -323,14 +380,22 @@ __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=""
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 +403,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,11 +430,8 @@ __git_ps1 ()
b="$(git symbolic-ref HEAD 2>/dev/null)"
else
local head=""
- if ! eread "$g/HEAD" head; then
- if [ $pcmode = yes ]; then
- PS1="$ps1pc_start$ps1pc_end"
- fi
- return
+ if ! __git_eread "$g/HEAD" head; then
+ return $exit
fi
# is it a symbolic ref?
b="${head#ref: }"
@@ -414,21 +476,21 @@ __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
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 --directory --no-empty-directory --error-unmatch -- ':/*' >/dev/null 2>/dev/null
then
u="%${ZSH_VERSION+%}"
fi
@@ -440,13 +502,21 @@ __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/}
+ 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
@@ -458,4 +528,6 @@ __git_ps1 ()
else
printf -- "$printf_format" "$gitstring"
fi
+
+ return $exit
}
diff --git a/plugins/github/README.md b/plugins/github/README.md
index 21b7367f7..fea607876 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
diff --git a/plugins/github/github.plugin.zsh b/plugins/github/github.plugin.zsh
index ca19901fd..0ab399c97 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 #############################################################
diff --git a/plugins/gitignore/gitignore.plugin.zsh b/plugins/gitignore/gitignore.plugin.zsh
index 481d487ba..ba1b38711 100644
--- a/plugins/gitignore/gitignore.plugin.zsh
+++ b/plugins/gitignore/gitignore.plugin.zsh
@@ -1,4 +1,4 @@
-function gi() { curl -sL https://www.gitignore.io/api/$@ ;}
+function gi() { curl -sL https://www.gitignore.io/api/${(j:,:)@} }
_gitignoreio_get_command_list() {
curl -sL https://www.gitignore.io/api/list | tr "," "\n"
diff --git a/plugins/jira/jira.plugin.zsh b/plugins/jira/jira.plugin.zsh
index 341e23ec0..67c989457 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}"
}
-
diff --git a/plugins/meteor/README.md b/plugins/meteor/README.md
new file mode 100644
index 000000000..4bee87f8f
--- /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 |
diff --git a/plugins/meteor/meteor.plugin.zsh b/plugins/meteor/meteor.plugin.zsh
new file mode 100644
index 000000000..db55e367d
--- /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.
diff --git a/plugins/mix/_mix b/plugins/mix/_mix
index 319932b3f..3b3887b1f 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
diff --git a/plugins/mvn/README.md b/plugins/mvn/README.md
new file mode 100644
index 000000000..79192bb54
--- /dev/null
+++ b/plugins/mvn/README.md
@@ -0,0 +1,32 @@
+## Introduction
+
+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 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` |
diff --git a/plugins/mvn/mvn.plugin.zsh b/plugins/mvn/mvn.plugin.zsh
index 865b15235..7aaab0e18 100644
--- a/plugins/mvn/mvn.plugin.zsh
+++ b/plugins/mvn/mvn.plugin.zsh
@@ -1,24 +1,24 @@
# mvn-color based on https://gist.github.com/1027800
-export BOLD=`tput bold`
-export UNDERLINE_ON=`tput smul`
-export UNDERLINE_OFF=`tput rmul`
-export TEXT_BLACK=`tput setaf 0`
-export TEXT_RED=`tput setaf 1`
-export TEXT_GREEN=`tput setaf 2`
-export TEXT_YELLOW=`tput setaf 3`
-export TEXT_BLUE=`tput setaf 4`
-export TEXT_MAGENTA=`tput setaf 5`
-export TEXT_CYAN=`tput setaf 6`
-export TEXT_WHITE=`tput setaf 7`
-export BACKGROUND_BLACK=`tput setab 0`
-export BACKGROUND_RED=`tput setab 1`
-export BACKGROUND_GREEN=`tput setab 2`
-export BACKGROUND_YELLOW=`tput setab 3`
-export BACKGROUND_BLUE=`tput setab 4`
-export BACKGROUND_MAGENTA=`tput setab 5`
-export BACKGROUND_CYAN=`tput setab 6`
-export BACKGROUND_WHITE=`tput setab 7`
-export RESET_FORMATTING=`tput sgr0`
+BOLD=`tput bold`
+UNDERLINE_ON=`tput smul`
+UNDERLINE_OFF=`tput rmul`
+TEXT_BLACK=`tput setaf 0`
+TEXT_RED=`tput setaf 1`
+TEXT_GREEN=`tput setaf 2`
+TEXT_YELLOW=`tput setaf 3`
+TEXT_BLUE=`tput setaf 4`
+TEXT_MAGENTA=`tput setaf 5`
+TEXT_CYAN=`tput setaf 6`
+TEXT_WHITE=`tput setaf 7`
+BACKGROUND_BLACK=`tput setab 0`
+BACKGROUND_RED=`tput setab 1`
+BACKGROUND_GREEN=`tput setab 2`
+BACKGROUND_YELLOW=`tput setab 3`
+BACKGROUND_BLUE=`tput setab 4`
+BACKGROUND_MAGENTA=`tput setab 5`
+BACKGROUND_CYAN=`tput setab 6`
+BACKGROUND_WHITE=`tput setab 7`
+RESET_FORMATTING=`tput sgr0`
# Wrapper function for Maven's mvn command.
@@ -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
diff --git a/plugins/npm/npm.plugin.zsh b/plugins/npm/npm.plugin.zsh
index 3f6fe0fb3..38e699ea0 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"
diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh
index a1516dcce..c92b6556d 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 <<EOF
+ tell application "iTerm"
+ tell current window
+ create tab with default profile
+ tell current session to write text "${command}"
+ end tell
+ end tell
+EOF
+
else
echo "tab: unsupported terminal app: $the_app"
false
@@ -73,6 +83,19 @@ function vsplit_tab() {
end tell
EOF
+ elif [[ "$the_app" == 'iTerm2' ]]; then
+ osascript <<EOF
+ tell application "iTerm"
+ tell current session of first window
+ set newSession to (split vertically with same profile)
+ tell newSession
+ write text "${command}"
+ select
+ end tell
+ end tell
+ end tell
+EOF
+
else
echo "$0: unsupported terminal app: $the_app" >&2
false
@@ -100,6 +123,19 @@ function split_tab() {
end tell
EOF
+ elif [[ "$the_app" == 'iTerm2' ]]; then
+ osascript <<EOF
+ tell application "iTerm"
+ tell current session of first window
+ set newSession to (split horizontally with same profile)
+ tell newSession
+ write text "${command}"
+ select
+ end tell
+ end tell
+ end tell
+EOF
+
else
echo "$0: unsupported terminal app: $the_app" >&2
false
diff --git a/plugins/pylint/pylint.plugin.zsh b/plugins/pylint/pylint.plugin.zsh
index 6760c67b0..57c7c0ac5 100644
--- a/plugins/pylint/pylint.plugin.zsh
+++ b/plugins/pylint/pylint.plugin.zsh
@@ -1,3 +1,3 @@
# Aliases
-alias pylint-quick='pylint --reports=n --include-ids=y'
-compdef _pylint-quick pylint-quick='pylint --reports=n --include-ids=y' \ No newline at end of file
+alias pylint-quick='pylint --reports=n'
+compdef _pylint-quick pylint-quick='pylint --reports=n'
diff --git a/plugins/rust/_rust b/plugins/rust/_rust
new file mode 100644
index 000000000..f4e8f6f78
--- /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 <filename> 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 <dir>. Ignored if -o is specified. (default the current directory)]:DIR:_files -/'
+ -o'[Write output to <filename>. 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"'
diff --git a/plugins/sbt/sbt.plugin.zsh b/plugins/sbt/sbt.plugin.zsh
index 203c691f5..15acfec4f 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'
diff --git a/plugins/symfony2/symfony2.plugin.zsh b/plugins/symfony2/symfony2.plugin.zsh
index 98a2321db..c2a1affad 100644
--- a/plugins/symfony2/symfony2.plugin.zsh
+++ b/plugins/symfony2/symfony2.plugin.zsh
@@ -22,6 +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'
diff --git a/plugins/textmate/textmate.plugin.zsh b/plugins/textmate/textmate.plugin.zsh
index 02813de9e..174511019 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
}
diff --git a/plugins/vagrant/_vagrant b/plugins/vagrant/_vagrant
index 764f89545..c5335e72e 100644
--- a/plugins/vagrant/_vagrant
+++ b/plugins/vagrant/_vagrant
@@ -26,10 +26,12 @@ _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'
'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'
diff --git a/plugins/vault/README.md b/plugins/vault/README.md
new file mode 100644
index 000000000..0f61c9410
--- /dev/null
+++ b/plugins/vault/README.md
@@ -0,0 +1,18 @@
+## Vault (https://www.vaultproject.io) autocomplete plugin
+
+- Adds autocomplete options for all vault commands.
+
+####Show help for all commands
+![General Help](http://i.imgur.com/yv5Db1r.png "Help for all commands")
+
+
+####Create new Vault token
+![Create token](http://i.imgur.com/xMegNgh.png "Create token")
+
+
+####Enable audit backends
+![Audit backends](http://i.imgur.com/fKLeiSF.png "Audit backends")
+
+
+
+Crafted with <3 by Valentin Bud ([@valentinbud](https://twitter.com/valentinbud)) \ No newline at end of file
diff --git a/plugins/vault/_vault b/plugins/vault/_vault
new file mode 100644
index 000000000..c5338dffa
--- /dev/null
+++ b/plugins/vault/_vault
@@ -0,0 +1,400 @@
+#compdef vault
+
+typeset -a main_args
+main_args=(
+ '(-version)-version[Prints the Vault version]'
+ '(-help)-help[Prints Vault Help]'
+)
+
+typeset -a general_args
+general_args=(
+ '(-help)-help[Prints Help]'
+ '(-address)-address=-[The address of the Vault server. Overrides the VAULT_ADDR environment variable if set.]:address:'
+ '(-ca-cert)-ca-cert=-[Path to a PEM encoded CA cert file to use to verify the Vault server SSL certificate. Overrides the VAULT_CACERT environment variable if set.]:file:_files -g "*.pem"'
+ '(-ca-path)-ca-path=-[Path to a directory of PEM encoded CA cert files to verify the Vault server SSL certificate. If both -ca-cert and -ca-path are specified, -ca-path is used.Overrides the VAULT_CAPATH environment variable if set.]:directory:_directories'
+ '(-client-cert)-client-cert=-[Path to a PEM encoded client certificate for TLS authentication to the Vault server. Must also specify -client-key. Overrides the VAULT_CLIENT_CERT environment variable if set.]:file:_files -g "*.pem"'
+ '(-client-key)-client-key=-[Path to an unencrypted PEM encoded private key matching the client certificate from -client-cert. Overrides the VAULT_CLIENT_KEY environment variable if set.]:file:_files -g "*.pem"'
+ '(-tls-skip-verify)-tls-skip-verify[Do not verify TLS certificate. This is highly not recommended. Verification will also be skipped if VAULT_SKIP_VERIFY is set.]'
+)
+
+typeset -a audit_enable_args
+audit_enable_args=(
+ '(-description)-description=-[A human-friendly description for the backend. This shows up only when querying the enabled backends.]:description:'
+ '(-id)-id=-[Specify a unique ID for this audit backend. This is purely for referencing this audit backend. By default this will be the backend type.]:id:'
+)
+
+typeset -a auth_args
+auth_args=(
+ '(-method)-method=-[Outputs help for the authentication method with the given name for the remote server. If this authentication method is not available, exit with code 1.]:method:(cert ldap github userpass app-id)'
+ '(-method-help)-method-help[If set, the help for the selected method will be shown.]'
+ '(-methods)-methods[List the available auth methods.]'
+ '(-no-verify)-no-verify[Do not verify the token after creation; avoids a use count]'
+)
+
+typeset -a auth_enable_args
+auth_enable_args=(
+ '(-description)-description=-[Human-friendly description of the purpose for the auth provider. This shows up in the auth-list command.]:description:'
+ '(-path)-path=-[Mount point for the auth provider. This defaults to the type of the mount. This will make the auth provider available at "/auth/<path>"]:path:'
+)
+
+typeset -a init_args
+init_args=(
+ '(-key-shares)-key-shares=-[(default: 5) The number of key shares to split the master key into.]:keyshares:'
+ '(-key-threshold)-key-threshold=-[(default: 3) The number of key shares required to reconstruct the master key.]:keythreshold:'
+ '(-pgp-keys)-pgp-keys[If provided, must be a comma-separated list of files on disk containing binary- or base64-format public PGP keys. The number of files must match "key-shares". The output unseal keys will encrypted and hex-encoded, in order, with the given public keys. If you want to use them with the "vault unseal" command, you will need to hex decode and decrypt; this will be the plaintext unseal key.]:pgpkeys:_files'
+)
+
+typeset -a mount_tune_args
+mount_tune_args=(
+ '(-default-lease-ttl)-default-lease-ttl=-[Default lease time-to-live for this backend. If not specified, uses the system default, or the previously set value. Set to "system" to explicitly set it to use the system default.]:defaultleasettl:'
+ '(-max-lease-ttl)-max-lease-ttl=-[Max lease time-to-live for this backend. If not specified, uses the system default, or the previously set value. Set to "system" to explicitly set it to use the system default.]:maxleasettl:'
+)
+
+typeset -a mount_args
+mount_args=(
+ $mount_tune_args
+ '(-path)-path=-[Mount point for the logical backend. This defauls to the type of the mount.]:path:'
+ '(-description)-description=-[Human-friendly description of the purpose for the mount. This shows up in the mounts command.]:description:'
+)
+
+typeset -a rekey_args
+rekey_args=(
+ $init_args
+ '(-init)-init[Initialize the rekey operation by setting the desired number of shares and the key threshold. This can only be done if no rekey is already initiated.]:init:'
+ '(-cancel)-cancel[Reset the rekey process by throwing away prior keys and the rekey configuration.]:cancel:'
+ '(-status)-status[Prints the status of the current rekey operation. This can be used to see the status without attempting to provide an unseal key.]:status:'
+)
+
+typeset -a ssh_args
+ssh_args=(
+ '(-role)-role[Role to be used to create the key. ]:role:'
+ '(-no-exec)-no-exec[Shows the credentials but does not establish connection.]:noexec:'
+ '(-mount-point)-mount-point[Mount point of SSH backend. If the backend is mounted at "ssh", which is the default as well, this parameter can be skipped.]:mountpoint:'
+ '(-format)-format[If no-exec option is enabled, then the credentials will be printed out and SSH connection will not be established. The format of the output can be "json" or "table". JSON output is useful when writing scripts. Default is "table".]:format:(json table)'
+)
+
+typeset -a token_create_args
+token_create_args=(
+ '(-id)-id=-[The token value that clients will use to authenticate with vault. If not provided this defaults to a 36 character UUID. A root token is required to specify the ID of a token.]:id:'
+ '(-display-name)-display-name=-[A display name to associate with this token. This is a non-security sensitive value used to help identify created secrets, i.e. prefixes.]:displayname:'
+ '(-ttl)-ttl=-[TTL to associate with the token. This option enables the tokens to be renewable.]:ttl:'
+ '*-metadata=-[Metadata to associate with the token. This shows up in the audit log. This can be specified multiple times.]:metadata:'
+ '(-orphan)-orphan[If specified, the token will have no parent. Only root tokens can create orphan tokens. This prevents the new token from being revoked with your token.]:orphan:'
+ '(-no-default-policy)-no-default-policy[If specified, the token will not have the "default" policy included in its policy set.]:nodefaultpolicy:'
+ '*-policy=-[Policy to associate with this token. This can be specified multiple times.]:policy:__vault_policies'
+ '(-use-limit)-use-limit=-[The number of times this token can be used until it is automatically revoked.]:uselimit:'
+ '(-format)-format=-[The format for output. By default it is a whitespace-delimited table. This can also be json.]:format:(json table)'
+)
+
+typeset -a server_args
+server_args=(
+ '*-config=-[Path to the configuration file or directory. This can be specified multiple times. If it is a directory, all files with a ".hcl" or ".json" suffix will be loaded.]:config:_files'
+ '-dev[Enables Dev mode. In this mode, Vault is completely in-memory and unsealed. Do not run the Dev server in production!]:dev:'
+ '-log-level=-[Log verbosity. Defaults to "info", will be outputtedto stderr. Supported values: "trace", "debug", "info", "warn", "err"]:loglevel:(trace debug info warn err)'
+)
+
+_vault_audit-list() {
+ _arguments : \
+ ${general_args[@]} && ret=0
+}
+
+_vault_audit-disable() {
+ # vault audit-list doesn't print the backend id so for now
+ # no *smart* autocompletion for this subcommand.
+ _arguments : \
+ ${general_args[@]} \
+ ':::(file syslog)' && ret=0
+}
+
+_vault_audit-enable() {
+ _arguments : \
+ ${general_args[@]} \
+ ${audit_enable_args[@]} \
+ ': :->backends' \
+ '*:: :->backendconfig' && ret=0
+
+ case $state in
+ backends)
+ local -a backends
+ backends=(
+ 'file:The "file" audit backend writes audit logs to a file.'
+ 'syslog:The "syslog" audit backend writes audit logs to syslog.'
+ )
+ _describe -t backends 'vault audit backends' backends && ret=0
+ ;;
+ backendconfig)
+ case ${line[1]} in
+ file)
+ _values -w "Audit Backend File" \
+ 'path[(required) - The path to where the file will be written. If this path exists, the audit backend will append to it.]:file:_files' \
+ 'log_raw[(optional) Should security sensitive information be logged raw. Defaults to "false".]:log_raw:(true false)' && ret=0
+ ;;
+ syslog)
+ _values -w "Audit Backend Syslog" \
+ 'facility[(optional) - The syslog facility to use. Defaults to "AUTH".]:facility:(kern user mail daemon auth syslog lpr news uucp authpriv ftp cron local0 local1 local2 local3 local4 local5 local6 local7)' \
+ 'tag[(optional) - The syslog tag to use. Defaults to "vault".]:tag:' \
+ 'log_raw[(optional) Should security sensitive information be logged raw.]:log_raw:(true false)' && ret=0
+ ;;
+ esac
+ ;;
+ esac
+}
+
+_vault_auth() {
+ _arguments : \
+ ${general_args[@]} \
+ ${auth_args[@]} && ret=0
+}
+
+_vault_auth-enable() {
+ _arguments : \
+ ${general_args[@]} \
+ ${auth_enable_args[@]} \
+ ':::(cert ldap github userpass app-id)' && ret=0
+}
+
+__vault_auth_methods() {
+ local -a authmethods
+ authmethods=($(vault auth -methods | awk 'NR>1{split ($1,a,"/"); print a[1]":["$2"]"}'))
+ _describe -t authmethods 'authmethods' authmethods && ret=0
+}
+
+_vault_auth-disable() {
+ _arguments : \
+ ${general_args[@]} \
+ ':::__vault_auth_methods' && ret=0
+
+}
+
+_vault_init() {
+ _arguments : \
+ ${general_args[@]} \
+ ${init_args[@]} && ret=0
+}
+
+_vault_key-status() {
+ _arguments : \
+ ${general_args[@]} && ret=0
+}
+
+__vault_mounts() {
+ local -a mounts
+ mounts=($(vault mounts | awk 'NR>1{split ($1,a,"/"); print a[1]":["$2"]"}'))
+ _describe -t mounts 'mounts' mounts && ret=0
+}
+
+_vault_mounts() {
+ _arguments : \
+ ${general_args[@]} && ret=0
+}
+
+_vault_mount() {
+ # to find out how many types of backens are there
+ _arguments : \
+ ${general_args[@]} \
+ ${mount_args[@]} \
+ ':::(generic ssh)' && ret=0
+}
+
+_vault_mount-tune() {
+ _arguments : \
+ ${general_args[@]} \
+ ${mount_tune_args[@]} \
+ ':::__vault_mounts' && ret=0
+}
+
+_vault_unmount() {
+ _arguments : \
+ ${general_args[@]} \
+ ':::__vault_mounts' && ret=0
+}
+
+_vault_remount() {
+ _arguments : \
+ ${general_args[@]} \
+ ':::__vault_mounts' \
+ ':::' && ret=0
+}
+
+__vault_policies() {
+ local -a policies
+ policies=($(vault policies | awk '{print $1":["$1"]"}'))
+ _describe -t policies 'policies' policies && ret=0
+}
+
+_vault_policies() {
+ _arguments : \
+ ${general_args[@]} \
+ ':::__vault_policies' && ret=0
+}
+
+_vault_policy-delete() {
+ _arguments : \
+ ${general_args[@]} \
+ ':::__vault_policies' && ret=0
+}
+
+_vault_policy-write() {
+ _arguments : \
+ ${general_args[@]} \
+ ': ::' \
+ '::policy:_files' && ret=0
+}
+
+_vault_status() {
+ _arguments : \
+ ${general_args[@]} && ret=0
+}
+
+_vault_rekey() {
+ _arguments : \
+ ${general_args[@]} \
+ ${rekey_args[@]} \
+ ': ::' && ret=0
+}
+
+_vault_rotate() {
+ _arguments : \
+ ${general_args[@]} && ret=0
+}
+
+_vault_seal() {
+ _arguments : \
+ ${general_args[@]} && ret=0
+}
+
+_vault_ssh() {
+ _arguments : \
+ ${general_args[@]} \
+ ${ssh_args[@]} \
+ ': ::' && ret=0
+}
+
+_vault_token-create() {
+ _arguments : \
+ ${general_args[@]} \
+ ${token_create_args[@]} && ret=0
+}
+
+_vault_token-renew() {
+ _arguments : \
+ ${general_args[@]} \
+ '(-format)-format=-[The format for output. By default it is a whitespace-delimited table. This can also be json.]:format:(json table)' \
+ ': ::' \
+ ': ::' && ret=0
+}
+
+_vault_token-revoke() {
+ _arguments : \
+ ${general_args[@]} \
+ '(-mode)-mode=-[The type of revocation to do. See the documentation above for more information.]:mode:( orphan path)' \
+ ': ::' && ret=0
+}
+
+_vault_unseal() {
+ _arguments : \
+ ${general_args[@]} \
+ '(-reset)-reset[Reset the unsealing process by throwing away prior keys in process to unseal the vault.]:reset:' \
+ ': ::' && ret=0
+}
+
+_vault_version() {
+ # no args
+}
+
+_vault_delete() {
+ _arguments : \
+ ${general_args[@]} \
+ ': ::' && ret=0
+}
+
+_vault_path-help() {
+ _arguments : \
+ ${general_args[@]} \
+ ': ::' && ret=0
+}
+
+_vault_revoke() {
+ _arguments : \
+ ${general_args[@]} \
+ '(-format)-format=-[The format for output. By default it is a whitespace-delimited table. This can also be json.]:format:(json table)' \
+ ': ::' \
+ ': ::' && ret=0
+}
+
+_vault_server() {
+ _arguments : \
+ ${server_args[@]} && ret=0
+
+}
+
+_vault_write() {
+ _arguments : \
+ ${general_args[@]} \
+ '(-f -force)'{-f,-force}'[Force the write to continue without any data values specified. This allows writing to keys that do not need or expect any fields to be specified.]:force:' \
+ ': ::' \
+ ': ::' && ret=0
+}
+
+_vault_read() {
+ _arguments : \
+ ${general_args[@]} \
+ '(-format)-format=-[The format for output. By default it is a whitespace-delimited table. This can also be json.]:format:(json table)' \
+ '(-field)-field=-[If included, the raw value of the specified field will be output raw to stdout.]:field:' \
+ ': ::' && ret=0
+}
+
+_vault_commands() {
+ local -a commands
+
+ commands=(
+ "delete":"Delete operation on secrets in Vault"
+ "path-help":"Look up the help for a path"
+ "read":"Read data or secrets from Vault"
+ "renew":"Renew the lease of a secret"
+ "revoke":"Revoke a secret"
+ "server":"Start a Vault server"
+ "status":"Outputs status of whether Vault is sealed and if HA mode is enabled"
+ "write":"Write secrets or configuration into Vault"
+ "audit-disable":"Disable an audit backend"
+ "audit-enable":"Enable an audit backend"
+ "audit-list":"Lists enabled audit backends in Vault"
+ "auth":"Prints information about how to authenticate with Vault"
+ "auth-disable":"Disable an auth provider"
+ "auth-enable":"Enable a new auth provider"
+ "init":"Initialize a new Vault server"
+ "key-status":"Provides information about the active encryption key"
+ "mount":"Mount a logical backend"
+ "mount-tune":"Tune mount configuration parameters"
+ "mounts":"Lists mounted backends in Vault"
+ "policies":"List the policies on the server"
+ "policy-delete":"Delete a policy from the server"
+ "policy-write":"Write a policy to the server"
+ "rekey":"Rekeys Vault to generate new unseal keys"
+ "remount":"Remount a secret backend to a new path"
+ "rotate":"Rotates the backend encryption key used to persist data"
+ "seal":"Seals the vault server"
+ "ssh":"Initiate a SSH session"
+ "token-create":"Create a new auth token"
+ "token-renew":"Renew an auth token if there is an associated lease"
+ "token-revoke":"Revoke one or more auth tokens"
+ "unmount":"Unmount a secret backend"
+ "unseal":"Unseals the vault server"
+ "version":"Prints the Vault version"
+ )
+
+ _describe -t commands 'vault command' commands && ret=0
+}
+
+local curcontext=$curcontext ret=1
+_arguments : \
+ ${main_args[@]} \
+ '*:: :->subcommands' && ret=0
+if ((CURRENT == 1 )); then
+ _vault_commands && ret=0
+fi
+if [[ $state == subcommands ]]; then
+ # (( CURRENT -- ))
+ curcontext="${curcontext%:*:*}:vault-$words[1]:"
+ _call_function ret _vault_$words[1]
+fi
diff --git a/plugins/wp-cli/README.md b/plugins/wp-cli/README.md
index 1a79d60fc..da398ed1a 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
diff --git a/plugins/zsh-navigation-tools/.config/znt/n-aliases.conf b/plugins/zsh-navigation-tools/.config/znt/n-aliases.conf
index 98f4625f1..047b017eb 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 f8c49bfac..8271e5d98 100644
--- a/plugins/zsh-navigation-tools/.config/znt/n-cd.conf
+++ b/plugins/zsh-navigation-tools/.config/znt/n-cd.conf
@@ -1,5 +1,6 @@
# Hotlist
-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
@@ -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 0c4bdce64..85dda05ed 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 93d31e8fd..d032e2788 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 5d4bad822..d7c69e154 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 f1c4f02da..deb2a3fd9 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 cf9d2a3be..68f5668f9 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 98f4625f1..29c5e089a 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 98f4625f1..58ce1b620 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 4420dab82..7a679fe67 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
@@ -25,13 +25,33 @@ widgets exist, znt-cd-widget and znt-kill-widget, they can be too assigned
to key combinations (no need for autoload when using Oh My Zsh):
zle -N znt-cd-widget
- bindkey "^T" znt-cd-widget
+ bindkey "^A" znt-cd-widget
zle -N znt-kill-widget
bindkey "^Y" znt-kill-widget
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 000000000..8a4ec9da7
--- /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 d81db9253..f8c1c3727 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 b1ac5b159..48c6dbf4e 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 612796c00..c003b63a8 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 6f10a3dec..1748cbc90 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 000000000..415050a81
--- /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 c9e53316b..68370f6e5 100644
--- a/plugins/zsh-navigation-tools/n-history
+++ b/plugins/zsh-navigation-tools/n-history
@@ -15,35 +15,336 @@ 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 list
-local selected
+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
-NLIST_REMEMBER_STATE=0
+# history view
+integer active_view=0
-list=( "$history[@]" )
-list=( "${(@M)list:#(#i)*$1*}" )
+# 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[@]} )
-if [ "$#list" -eq 0 ]; then
- echo "No matching history entries"
- return 1
-fi
+ # ..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
+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]"
# ZLE?
if [ "${(t)CURSOR}" = "integer-local-special" ]; then
zle redisplay
- zle kill-whole-line
- zle -U "$selected"
+ 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"
else
print -zr "$selected"
fi
diff --git a/plugins/zsh-navigation-tools/n-kill b/plugins/zsh-navigation-tools/n-kill
index e52082282..0d10565e4 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 388712bd0..d3a8da302 100644
--- a/plugins/zsh-navigation-tools/n-list
+++ b/plugins/zsh-navigation-tools/n-list
@@ -1,6 +1,7 @@
# $1, $2, ... - elements of the list
# $NLIST_NONSELECTABLE_ELEMENTS - array of indexes (1-based) that cannot be selected
# $REPLY is the output variable - contains index (1-based) or -1 when no selection
+# $reply (array) is the second part of the output - use the index (REPLY) to get selected element
#
# Copy this file into /usr/share/zsh/site-functions/
# and add 'autoload n-list` to .zshrc
@@ -28,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
@@ -164,6 +165,27 @@ integer current_difference=0
local prev_search_buffer=""
integer prev_uniq_mode=0
integer prev_start_idx=-1
+local MBEGIN MEND MATCH mbegin mend match
+
+# 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
@@ -173,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
@@ -205,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
#
@@ -235,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
@@ -249,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
@@ -264,11 +299,24 @@ 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
+ 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
- list=( "${(@M)list:#(#i)*$~search_pattern*}" )
last_element="$#list"
fi
@@ -287,7 +335,16 @@ while (( 1 )); do
if [ -n "$colsearch_pattern" ]; then
local red=$'\x1b[00;31m' reset=$'\x1b[00;00m'
- disp_list=( "${(@)disp_list//(#mi)($~colsearch_pattern)/$red${MATCH}$reset}" )
+ # The repeat will make the matching work on a fresh heap
+ repeat 1; do
+ 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
# We have display list, lets replace newlines with "\n" when needed (1/2)
@@ -295,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[@]"
@@ -318,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
@@ -346,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
+ local keywordmsg=""
+ if [ "$keywordisfresh" = "1" ]; then
+ keywordmsg="($curkeyword/$nkeywords) "
+ keywordisfresh="0"
+ fi
+
+ local thememsg=""
+ if [ "$themeisfresh" = "1" ]; then
+ local theme="$backuptheme"
+ [ "$curtheme" -gt 0 ] && theme="${themes[curtheme]}"
+ thememsg="($curtheme/$nthemes $theme) "
+ themeisfresh="0"
+ fi
+
+ 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
- local _txt2=""
- [ "$NLIST_IS_UNIQ_MODE" -eq 1 ] && _txt2="[-UNIQ-] "
- _nlist_status_msg "${_txt2}Filtering with: ${NLIST_SEARCH_BUFFER// /+}"
+ _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="" _txt2=""
+ local _txt=""
[ -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"
+ _nlist_status_msg "${_txt2}${_txt3}${keywordmsg}${thememsg}Current #$NLIST_USER_CURRENT_IDX (of #$NLIST_USER_LAST_ELEMENT entries)$_txt"
else
- _nlist_status_msg ""
+ _nlist_status_msg "${keywordmsg}${thememsg}"
fi
- zcurses border main
+ [ "$border" = "1" ] && zcurses border main
- local top_msg="${(C)ZSH_NAME} $ZSH_VERSION, shell level $SHLVL, $USER"
+ 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
@@ -380,7 +457,7 @@ while (( 1 )); do
# Get the special (i.e. "keypad") key or regular key
if [ -n "$key" ]; then
- final_key="$key"
+ final_key="$key"
elif [ -n "$keypad" ]; then
final_key="$keypad"
else
@@ -391,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]"
@@ -401,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
@@ -413,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 1b2571fbd..ae1e0115f 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"
-[[ "$active_text" = "underline" || "$active_text" = "reverse" ]] || active_text="reverse"
-# With Linux terminal underline won't work properly
-[ "$TERM" = "linux" ] && active_text="reverse"
+[[ "$bold" = "0" || "$bold" = "-bold" ]] && bold="-bold" || bold="+bold"
+[[ "$active_text" = "underline" || "$active_text" = "reverse" ]] || local 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 380acdc00..9bafc51b6 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
@@ -44,7 +91,7 @@ case "$key" in
[ "$current_idx" -lt "$last_element" ] && current_idx=current_idx+1;
_nlist_compute_first_to_show_idx
;;
- (PPAGE)
+ (PPAGE|$'\b'|$'\C-?'|BACKSPACE)
current_idx=current_idx-page_height
[ "$current_idx" -lt 1 ] && current_idx=1;
_nlist_compute_first_to_show_idx
@@ -72,28 +119,43 @@ case "$key" in
current_idx=last_element
_nlist_compute_first_to_show_idx
;;
- ($'\n')
+ ($'\n'|ENTER)
# Is that element selectable?
# Check for this only when there is no search
if [[ "$NLIST_SEARCH_BUFFER" != "" || "$NLIST_IS_UNIQ_MODE" -eq 1 ||
${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
@@ -137,12 +231,20 @@ esac
else
case "$key" in
- ($'\n')
- search=0
- _nlist_cursor_visibility 0
+ ($'\n'|ENTER)
+ 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 91589bd45..b1a934015 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 01d01cb9e..e2b567f2e 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 9ddae606d..479c2211b 100644
--- a/plugins/zsh-navigation-tools/znt-history-widget
+++ b/plugins/zsh-navigation-tools/znt-history-widget
@@ -1,7 +1,19 @@
autoload znt-usetty-wrapper n-history
local NLIST_START_IN_SEARCH_MODE=1
local NLIST_START_IN_UNIQ_MODE=1
-local NLIST_SET_SEARCH_TO="$BUFFER"
+
+# Only if current $BUFFER doesn't come from history
+if [ "$HISTCMD" = "$HISTNO" ]; then
+ () {
+ setopt localoptions extendedglob
+ local -a match mbegin mend
+ local MATCH; integer MBEGIN MEND
+
+ [ -n "$BUFFER" ] && BUFFER="${BUFFER%% ##} "
+ }
+
+ local NLIST_SET_SEARCH_TO="$BUFFER"
+fi
znt-usetty-wrapper n-history "$@"
diff --git a/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh b/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh
index 16247b8db..b26549152 100755
--- a/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh
+++ b/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh
@@ -15,24 +15,36 @@ 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 --
#
# 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:|=*'