587b5545803a40bc5dcff81f7fa79d84879b27fd

Author
Marc Cornellà <marc.cornella@live.com>
Committer
Marc Cornellà <marc.cornella@live.com>
Date

Message

zsh-navigation-tools: update to 5937e57e

Fixes #8476

Diff

This diff is truncated to protect this page.

  1diff --git a/plugins/zsh-navigation-tools/LICENSE b/plugins/zsh-navigation-tools/LICENSE
  2index 4ee0281124479cb008426cdf12e7d0a12e786d06..075c80ccd2b537cbcc16186fc0fdd491c000557b 100644
  3--- a/plugins/zsh-navigation-tools/LICENSE
  4+++ b/plugins/zsh-navigation-tools/LICENSE
  5@@ -27,7 +27,7 @@ GPLv3  License
  6                     GNU GENERAL PUBLIC LICENSE
  7                        Version 3, 29 June 2007
  8 
  9- Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
 10+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
 11  Everyone is permitted to copy and distribute verbatim copies
 12  of this license document, but changing it is not allowed.
 13 
 14@@ -671,7 +671,7 @@ the "copyright" line and a pointer to where the full notice is found.
 15     GNU General Public License for more details.
 16 
 17     You should have received a copy of the GNU General Public License
 18-    along with this program.  If not, see <https://www.gnu.org/licenses/>.
 19+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 20 
 21 Also add information on how to contact you by electronic and paper mail.
 22 
 23@@ -690,11 +690,11 @@ might be different; for a GUI interface, you would use an "about box".
 24   You should also get your employer (if you work as a programmer) or school,
 25 if any, to sign a "copyright disclaimer" for the program, if necessary.
 26 For more information on this, and how to apply and follow the GNU GPL, see
 27-<https://www.gnu.org/licenses/>.
 28+<http://www.gnu.org/licenses/>.
 29 
 30   The GNU General Public License does not permit incorporating your program
 31 into proprietary programs.  If your program is a subroutine library, you
 32 may consider it more useful to permit linking proprietary applications with
 33 the library.  If this is what you want to do, use the GNU Lesser General
 34 Public License instead of this License.  But first, please read
 35-<https://www.gnu.org/philosophy/why-not-lgpl.html>.
 36+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
 37diff --git a/plugins/zsh-navigation-tools/Makefile b/plugins/zsh-navigation-tools/Makefile
 38new file mode 100644
 39index 0000000000000000000000000000000000000000..f34af0cc360ba9bbf1fb0408c99eb26e33cbc106
 40--- /dev/null
 41+++ b/plugins/zsh-navigation-tools/Makefile
 42@@ -0,0 +1,35 @@
 43+NAME=zsh-navigation-tools
 44+
 45+INSTALL?=install -c
 46+PREFIX?=/usr/local
 47+SHARE_DIR?=$(DESTDIR)$(PREFIX)/share/$(NAME)
 48+DOC_DIR?=$(DESTDIR)$(PREFIX)/share/doc/$(NAME)
 49+
 50+all:
 51+
 52+install:
 53+	$(INSTALL) -d $(SHARE_DIR)
 54+	$(INSTALL) -d $(SHARE_DIR)/.config
 55+	$(INSTALL) -d $(SHARE_DIR)/.config/znt
 56+	$(INSTALL) -d $(DOC_DIR)
 57+	cp zsh-navigation-tools.plugin.zsh _n-kill doc/znt-tmux.zsh $(SHARE_DIR)
 58+	cp README.md NEWS LICENSE doc/img/n-history2.png $(DOC_DIR)
 59+	if [ x"true" = x"`git rev-parse --is-inside-work-tree 2>/dev/null`" ]; then \
 60+		git rev-parse HEAD; \
 61+	else \
 62+		cat .revision-hash; \
 63+	fi > $(SHARE_DIR)/.revision-hash
 64+	:
 65+	for fname in n-*; do cp "$$fname" $(SHARE_DIR); done; \
 66+	for fname in znt-*; do cp "$$fname" $(SHARE_DIR); done; \
 67+	for fname in .config/znt/n-*; do cp "$$fname" $(SHARE_DIR)/.config/znt; done;
 68+
 69+uninstall:
 70+	rm -f $(SHARE_DIR)/.revision-hash $(SHARE_DIR)/_* $(SHARE_DIR)/zsh-* $(SHARE_DIR)/n-* $(SHARE_DIR)/znt-* $(SHARE_DIR)/.config/znt/n-*
 71+	[ -d $(SHARE_DIR)/.config/znt ] && rmdir $(SHARE_DIR)/.config/znt || true
 72+	[ -d $(SHARE_DIR)/.config ] && rmdir $(SHARE_DIR)/.config || true
 73+	[ -d $(SHARE_DIR) ] && rmdir $(SHARE_DIR) || true
 74+	rm -f $(DOC_DIR)/README.md $(DOC_DIR)/LICENSE $(DOC_DIR)/n-history2.png 
 75+	[ -d $(DOC_DIR) ] && rmdir $(DOC_DIR) || true
 76+
 77+.PHONY: all install uninstall
 78diff --git a/plugins/zsh-navigation-tools/README.md b/plugins/zsh-navigation-tools/README.md
 79index ed532a16157d5dbb6fd65685ce5ca11ca5cfe88b..7d2ce99f4e4a069704b6462926aed6ea5de78d6f 100644
 80--- a/plugins/zsh-navigation-tools/README.md
 81+++ b/plugins/zsh-navigation-tools/README.md
 82@@ -1,58 +1,68 @@
 83+[![License (GPL version 3)](https://img.shields.io/badge/license-GNU%20GPL%20version%203-blue.svg?style=flat-square)](./LICENSE)
 84+[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](./LICENSE)
 85+![ZSH 5.0.0](https://img.shields.io/badge/zsh-v5.0.0-orange.svg?style=flat-square)
 86+
 87+![znt logo](http://imageshack.com/a/img905/2629/WK9qjN.png)
 88+
 89+[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=D6XDCHDSBDSDG)
 90+
 91 # Zsh Navigation Tools
 92 
 93-https://raw.githubusercontent.com/psprint/zsh-navigation-tools/master/doc/img/n-history2.png
 94+Also check out [![ZCA](http://imageshack.com/a/img911/8084/qSpO8a.png) Zsh Command Architect](https://github.com/psprint/zsh-cmd-architect)
 95+and [Zconvey](https://github.com/psprint/zconvey)
 96 
 97-Set of tools like n-history – multi-word history searcher, n-cd – directory
 98-bookmark manager, n-kill – htop like kill utility, and more. Based on
 99-n-list, a tool generating selectable curses-based list of elements that has
100-access to current Zsh session, i.e. has broad capabilities to work together
101-with it. Feature highlights include incremental multi-word searching, ANSI
102-coloring, unique mode, horizontal scroll, non-selectable elements, grepping and
103-various integrations with Zsh.
104 
105-## History Widget
106 
107-To have n-history as multi-word incremental searcher bound to Ctrl-R copy znt-*
108-files into the */site-functions dir (unless you use Oh My Zsh) and
109-add:
110+Videos:
111+- [https://youtu.be/QwZ8IJEgXRE](https://youtu.be/QwZ8IJEgXRE)
112+- [https://youtu.be/DN9QqssAYB8](https://youtu.be/DN9QqssAYB8)
113 
114-    autoload znt-history-widget
115-    zle -N znt-history-widget
116-    bindkey "^R" znt-history-widget
117+Screenshots:
118 
119-to .zshrc. This is done automatically when using Oh My Zsh. Two other
120-widgets exist, znt-cd-widget and znt-kill-widget, they can be too assigned
121-to key combinations (no need for autoload when using Oh My Zsh):
122+![n-history](http://imageshack.com/a/img921/5046/bqr0mk.png)
123 
124-    zle -N znt-cd-widget
125-    bindkey "^A" znt-cd-widget
126-    zle -N znt-kill-widget
127-    bindkey "^Y" znt-kill-widget
128+![n-history](http://imageshack.com/a/img633/9905/WzfSdl.gif)
129 
130-Oh My Zsh stores history into ~/.zsh_history. When you switch to OMZ you could
131-want to copy your previous data (from e.g. ~/.zhistory) into the new location.
132+Set of tools like `n-history` – multi-word history searcher, `n-cd` – directory
133+bookmark manager, `n-kill` – `htop` like kill utility, and more. Based on
134+`n-list`, a tool generating selectable curses-based list of elements that has
135+access to current `Zsh` session, i.e. has broad capabilities to work together
136+with it. Feature highlights include incremental multi-word searching, approximate
137+matching, ANSI coloring, themes, unique mode, horizontal scroll, grepping, advanced
138+history management and various integrations with `Zsh`.
139 
140 ## News
141-
142 * 06-10-2016
143-  - Tmux-integration – Ctrl-b-h in Tmux to open n-history in new window.
144+  - **Tmux-integration** – `Ctrl-B H` in Tmux to open `n-history` in new window.
145     Then select history entry, it will be copied to the original Tmux window.
146-    Use this to execute local commands on remote hosts. All that is needed is
147-    this line added to ~/.tmux.conf:
148+    Use this to execute local commands on remote hosts:
149 
150+    ![tmux integration](http://imageshack.com/a/img922/4760/oyX7eN.gif)
151+
152+    All that is needed is this line added to `~/.tmux.conf`:
153+
154+    ```
155+    bind h run-shell -b "$ZNT_REPO_DIR/doc/znt-tmux.zsh"
156+    ```
157+
158+    or – if Homebrew or other package manager is used:
159+
160+    ```
161     bind h run-shell -b "$ZNT_REPO_DIR/znt-tmux.zsh"
162+    ```
163 
164 * 16-05-2016
165-  - n-kill has completion. It proposes *words* from what's in `ps -A`. Giving n-kill
166+  - `n-kill` has completion. It proposes **words** from what's in `ps -A`. Giving `n-kill`
167     arguments means grepping – it will start only with matching `ps` entries.
168 
169 * 15-05-2016
170-  - Fixed problem where zsh-syntax-highlighting could render n-history slow (for
171+  - Fixed problem where zsh-syntax-highlighting could render `n-history` slow (for
172     long history entries).
173 
174 * 14-05-2016
175-  - Configuration can be set from zshrc. Example:
176+  - Configuration can be set from `zshrc` (starting from `v2.1.12`). Documentation is [below](#configuration). Example:
177 
178+    ```zsh
179     znt_list_instant_select=1
180     znt_list_border=0
181     znt_list_bold=1
182diff --git a/plugins/zsh-navigation-tools/_n-kill b/plugins/zsh-navigation-tools/_n-kill
183index 6f5d47971954345c42a9f6a267da02b7f3e42d27..9da68b9ec9b8d16f53faca6ae3ab8c30dc68ed01 100644
184--- a/plugins/zsh-navigation-tools/_n-kill
185+++ b/plugins/zsh-navigation-tools/_n-kill
186@@ -10,8 +10,8 @@ integer cygwin=0
187 local IFS="
188 "
189 
190-case "$OSTYPE" in
191-    cygwin*) list=( `command ps -Wa` ); cygwin=1 ;;
192+case "$(uname)" in
193+    CYGWIN*) list=( `command ps -Wa` ); cygwin=1 ;;
194     *) list=( `command ps -o pid,uid,command -A` ) ;;
195 esac
196 
197@@ -36,6 +36,6 @@ for line in "${list[@]}"; do
198 done
199 
200 _wanted bits expl "Processes' name bits" \
201-    compadd "$@" -a - words && ret=0
202+    compadd -M 'm:{a-z}={A-Z}' "$@" -a - words && ret=0
203 
204 return "$ret"
205diff --git a/plugins/zsh-navigation-tools/n-kill b/plugins/zsh-navigation-tools/n-kill
206index 76050f9694726852e9bd5e70c2181c12500987b2..0d10565e4f9b1ce45d7474a845842c0e04dbc51c 100644
207--- a/plugins/zsh-navigation-tools/n-kill
208+++ b/plugins/zsh-navigation-tools/n-kill
209@@ -42,8 +42,8 @@ NLIST_NONSELECTABLE_ELEMENTS=( 1 )
210 
211 type ps 2>/dev/null 1>&2 || { echo >&2 "Error: \`ps' not found"; return 1 }
212 
213-case "$OSTYPE" in
214-    cygwin*) list=( `command ps -Wa` )  ;;
215+case "$(uname)" in
216+    CYGWIN*) list=( `command ps -Wa` )  ;;
217     *) list=( `command ps -o pid,uid,command -A` ) ;;
218 esac
219 
220diff --git a/plugins/zsh-navigation-tools/n-list b/plugins/zsh-navigation-tools/n-list
221index 3fe5542a67906d919ab4f52733d43daf96fdf4bb..f25db8f60fb610b95afd8f0431a78e9429d76ce9 100644
222--- a/plugins/zsh-navigation-tools/n-list
223+++ b/plugins/zsh-navigation-tools/n-list
224@@ -261,6 +261,8 @@ done
225 
226 last_element="$#list"
227 
228+zcurses clear main redraw
229+zcurses clear inner redraw
230 while (( 1 )); do
231     # Do searching (filtering with string)
232     if [ -n "$NLIST_SEARCH_BUFFER" ]; then
233diff --git a/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh b/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh
234index 32b4ca0647f764bf674676df01a2df6ab5941928..f015620f583b44d951d65a3cb2d1452b614d7c90 100644
235--- a/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh
236+++ b/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh
237@@ -1,9 +1,30 @@
238 #!/usr/bin/env zsh
239 
240-0="${(%):-%N}" # this gives immunity to functionargzero being unset
241-export ZNT_REPO_DIR="${0%/*}"
242+#
243+# No plugin manager is needed to use this file. All that is needed is adding:
244+#   source {where-znt-is}/zsh-navigation-tools.plugin.zsh
245+#
246+# to ~/.zshrc.
247+#
248+
249+# According to the standard:
250+# http://zdharma.org/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
251+0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
252+0="${${(M)0:#/*}:-$PWD/$0}"
253+export ZNT_REPO_DIR="${0:h}"
254 export ZNT_CONFIG_DIR="$HOME/.config/znt"
255 
256+#
257+# Update FPATH if:
258+# 1. Not loading with a plugin manager
259+# 2. Not having fpath already updated
260+#
261+
262+if [[ ${zsh_loaded_plugins[-1]} != */zsh-navigation-tools && -z ${fpath[(r)${0:h}]} ]]
263+then
264+    fpath+=( "${0:h}" )
265+fi
266+
267 #
268 # Copy configs
269 #