From 068feca15d09dce6747d0fb6cab2027b938e82bd Mon Sep 17 00:00:00 2001 From: Philipp Schmitt Date: Fri, 24 Dec 2021 18:09:01 +0100 Subject: feat(zsh-navigation-tools)!: update to zdharma-continuum fork (#10402) BREAKING CHANGE: the `zsh-navigation-tools` plugin now bundles the version from the zdharma-continuum project, which republished the projects that psprint deleted (we don't yet know yet why). In theory this change doesn't break anything, but be aware of the change and that the upstream repository now lives somewhere else. Source: https://github.com/zdharma-continuum/zsh-navigation-tools/commit/67b24e1 --- .../zsh-navigation-tools/.config/znt/README.txt | 1 - plugins/zsh-navigation-tools/README.md | 37 ++-- .../zsh-navigation-tools/doc/generate_single_file | 35 ++++ .../zsh-navigation-tools/doc/img/n-history2.png | Bin 0 -> 108316 bytes plugins/zsh-navigation-tools/doc/install.sh | 70 +++++++ plugins/zsh-navigation-tools/doc/n-preview | 224 +++++++++++++++++++++ plugins/zsh-navigation-tools/doc/znt-tmux.zsh | 50 +++++ plugins/zsh-navigation-tools/znt-tmux.zsh | 50 ----- .../zsh-navigation-tools.plugin.zsh | 2 +- 9 files changed, 395 insertions(+), 74 deletions(-) delete mode 100644 plugins/zsh-navigation-tools/.config/znt/README.txt create mode 100755 plugins/zsh-navigation-tools/doc/generate_single_file create mode 100644 plugins/zsh-navigation-tools/doc/img/n-history2.png create mode 100755 plugins/zsh-navigation-tools/doc/install.sh create mode 100644 plugins/zsh-navigation-tools/doc/n-preview create mode 100755 plugins/zsh-navigation-tools/doc/znt-tmux.zsh delete mode 100755 plugins/zsh-navigation-tools/znt-tmux.zsh (limited to 'plugins/zsh-navigation-tools') diff --git a/plugins/zsh-navigation-tools/.config/znt/README.txt b/plugins/zsh-navigation-tools/.config/znt/README.txt deleted file mode 100644 index c3d6c821a..000000000 --- a/plugins/zsh-navigation-tools/.config/znt/README.txt +++ /dev/null @@ -1 +0,0 @@ -These are skeletons, configuration is read from ~/.config/znt/* diff --git a/plugins/zsh-navigation-tools/README.md b/plugins/zsh-navigation-tools/README.md index 7d2ce99f4..9fd2d5414 100644 --- a/plugins/zsh-navigation-tools/README.md +++ b/plugins/zsh-navigation-tools/README.md @@ -1,15 +1,14 @@ [![License (GPL version 3)](https://img.shields.io/badge/license-GNU%20GPL%20version%203-blue.svg?style=flat-square)](./LICENSE) [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](./LICENSE) ![ZSH 5.0.0](https://img.shields.io/badge/zsh-v5.0.0-orange.svg?style=flat-square) +[![Gitter][gitter-image]][gitter-link] ![znt logo](http://imageshack.com/a/img905/2629/WK9qjN.png) -[![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) - # Zsh Navigation Tools -Also check out [![ZCA](http://imageshack.com/a/img911/8084/qSpO8a.png) Zsh Command Architect](https://github.com/psprint/zsh-cmd-architect) -and [Zconvey](https://github.com/psprint/zconvey) +Also check out [![ZCA](http://imageshack.com/a/img911/8084/qSpO8a.png) Zsh Command Architect](https://github.com/zdharma-continuum/zsh-cmd-architect) +and [Zconvey](https://github.com/zdharma-continuum/zconvey) @@ -107,10 +106,10 @@ history management and various integrations with `Zsh`. * 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](https://github.com/psprint/zsh-navigation-tools/blob/master/.config/znt/n-list.conf). + themes. They are listed in [~/.config/znt/n-list.conf](https://github.com/zdharma-continuum/zsh-navigation-tools/blob/master/.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](https://github.com/psprint/zsh-navigation-tools/blob/master/.config/znt/n-list.conf) + The file [~/.config/znt/n-list.conf](https://github.com/zdharma-continuum/zsh-navigation-tools/blob/master/.config/znt/n-list.conf) already has set of 256-color themes prepared :) ![themes](http://imageshack.com/a/img924/4310/EbRh30.gif) @@ -130,7 +129,7 @@ history management and various integrations with `Zsh`. ## Installation ``` -sh -c "$(curl -fsSL https://raw.githubusercontent.com/psprint/zsh-navigation-tools/master/doc/install.sh)" +sh -c "$(curl -fsSL https://raw.githubusercontent.com/zdharma-continuum/zsh-navigation-tools/master/doc/install.sh)" ``` To update run the command again. @@ -140,16 +139,16 @@ will be updated with only `8` lines of code, which will be added at the bottom. After installing and reloading shell give `ZNT` a quick try with `Ctrl-R` – this keyboard shortcut will open `n-history`. -## Installation With [Zplugin](https://github.com/psprint/zplugin) -Add `zplugin load psprint/zsh-navigation-tools` to `.zshrc`. The config files will be in `~/.config/znt`. +## Installation With [Zinit](https://github.com/zdharma-continuum/zinit) +Add `zinit load zdharma-continuum/zsh-navigation-tools` to `.zshrc`. The config files will be in `~/.config/znt`. -## Installation With Zgen +## Installation With Zgenom/Zgen -Add `zgen load psprint/zsh-navigation-tools` to `.zshrc` and issue a `zgen reset` (this assumes that there is a proper `zgen save` construct in `.zshrc`). +Add `zgen load zdharma-continuum/zsh-navigation-tools` to `.zshrc` and issue a `zgen reset` (this assumes that there is a proper `zgen save` construct in `.zshrc`). The config files will be available in `~/.config/znt`. ## Installation With Antigen -Add `antigen bundle psprint/zsh-navigation-tools` to `.zshrc`. There also +Add `antigen bundle zdharma-continuum/zsh-navigation-tools` to `.zshrc`. There also should be `antigen apply`. The config files will be in `~/.config/znt`. ## Single File Manual Installation @@ -194,7 +193,7 @@ alias naliases=n-aliases ncd=n-cd nenv=n-env nfunctions=n-functions nhistory=n-h alias nkill=n-kill noptions=n-options npanelize=n-panelize nhelp=n-help ``` -Don't forget to copy [configuration files](https://github.com/psprint/zsh-navigation-tools/tree/master/.config/znt). They should go to `~/.config/znt`. Moreover, `n-cd` works together with option `AUTO_PUSHD` and you should have: +Don't forget to copy [configuration files](https://github.com/zdharma-continuum/zsh-navigation-tools/tree/master/.config/znt). They should go to `~/.config/znt`. Moreover, `n-cd` works together with option `AUTO_PUSHD` and you should have: ```zsh setopt AUTO_PUSHD @@ -397,15 +396,7 @@ The same with doing any non-typical Zsh Navigation Tools installation. ## More -- be aware of [this](https://github.com/psprint/zsh-navigation-tools/blob/f49f910d239ae5bc6e1a5bb34930307b4f4e3ffe/zsh-navigation-tools.plugin.zsh#L35-L49) - -## IRC Channel - -Channel `#zplugin@freenode` is a support place for all author's projects. Connect to: -[chat.freenode.net:6697](ircs://chat.freenode.net:6697/%23zplugin) (SSL) or [chat.freenode.net:6667](irc://chat.freenode.net:6667/%23zplugin) - and join #zplugin. - -Following is a quick access via Webchat [![IRC](https://kiwiirc.com/buttons/chat.freenode.net/zplugin.png)](https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin) +- be aware of [this](https://github.com/zdharma-continuum/zsh-navigation-tools/blob/f49f910d239ae5bc6e1a5bb34930307b4f4e3ffe/zsh-navigation-tools.plugin.zsh#L35-L49) # Fixing tmux, screen and linux vt @@ -429,3 +420,5 @@ It will not display underline properly, but will instead highlight by a color, which is quite nice. The same will not work for FreeBSD's vt, `ZNT` will detect if that vt is used and will revert to highlighting elements via `reverse` mode. +[gitter-image]: https://badges.gitter.im/zdharma-continuum/community.svg +[gitter-link]: https://gitter.im/zdharma-continuum/community diff --git a/plugins/zsh-navigation-tools/doc/generate_single_file b/plugins/zsh-navigation-tools/doc/generate_single_file new file mode 100755 index 000000000..d3d393834 --- /dev/null +++ b/plugins/zsh-navigation-tools/doc/generate_single_file @@ -0,0 +1,35 @@ +#!/bin/zsh + +local PLUGIN_FILE="doc/zshnavigationtools.plugin.zsh" + +[ -d doc ] || cd .. + +rm -vf "$PLUGIN_FILE" +echo "# The preamble comments apply when using ZNT as autoload functions" >>"$PLUGIN_FILE" +echo "# https://github.com/psprint/zsh-navigation-tools" >>"$PLUGIN_FILE" +echo "# License is GPLv3 and MIT" >>"$PLUGIN_FILE" +echo -n "# " >>"$PLUGIN_FILE" +git show-ref master | head -1 >>"$PLUGIN_FILE" +echo >>"$PLUGIN_FILE" + +for i in n-*(on); do + echo "$i() {" >>"$PLUGIN_FILE" + cat "$i" >>"$PLUGIN_FILE" + echo "}" >>"$PLUGIN_FILE" + echo "alias n${i#n-}=$i" >>"$PLUGIN_FILE" + echo >>"$PLUGIN_FILE" +done + +# Append znt-* files +for i in znt-*(on); do + echo "$i() {" >>"$PLUGIN_FILE" + cat "$i" >>"$PLUGIN_FILE" + echo "}" >>"$PLUGIN_FILE" + echo >>"$PLUGIN_FILE" +done + +# Append ^R bind +echo "zle -N znt-history-widget" >>"$PLUGIN_FILE" +echo "bindkey '^R' znt-history-widget" >>"$PLUGIN_FILE" +echo "setopt AUTO_PUSHD HIST_IGNORE_DUPS PUSHD_IGNORE_DUPS" >>"$PLUGIN_FILE" + diff --git a/plugins/zsh-navigation-tools/doc/img/n-history2.png b/plugins/zsh-navigation-tools/doc/img/n-history2.png new file mode 100644 index 000000000..fa23de00d Binary files /dev/null and b/plugins/zsh-navigation-tools/doc/img/n-history2.png differ diff --git a/plugins/zsh-navigation-tools/doc/install.sh b/plugins/zsh-navigation-tools/doc/install.sh new file mode 100755 index 000000000..2b71aa3b4 --- /dev/null +++ b/plugins/zsh-navigation-tools/doc/install.sh @@ -0,0 +1,70 @@ +#!/bin/sh + +if ! type git 2>/dev/null 1>&2; then + echo "Please install GIT first" + echo "Exiting" + exit 1 +fi + +# +# Clone or pull +# + +if ! test -d "$HOME/.config"; then + mkdir "$HOME/.config" +fi + +if ! test -d "$HOME/.config/znt"; then + mkdir "$HOME/.config/znt" +fi + +echo ">>> Downloading zsh-navigation-tools to ~/.config/znt" +if test -d ~/.config/znt/zsh-navigation-tools; then + cd ~/.config/znt/zsh-navigation-tools + git pull origin master +else + cd ~/.config/znt + git clone https://github.com/psprint/zsh-navigation-tools.git zsh-navigation-tools +fi +echo ">>> Done" + +# +# Copy configs +# + +echo ">>> Copying config files" + +cd ~/.config/znt + +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 "$i"; then + cp -v zsh-navigation-tools/.config/znt/$i . + fi +done + +echo ">>> Done" + +# +# Modify .zshrc +# + +echo ">>> Updating .zshrc" +if ! grep zsh-navigation-tools ~/.zshrc >/dev/null 2>&1; then + echo >> ~/.zshrc + echo "### ZNT's installer added snippet ###" >> ~/.zshrc + echo "fpath=( \"\$fpath[@]\" \"\$HOME/.config/znt/zsh-navigation-tools\" )" >> ~/.zshrc + echo "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" >> ~/.zshrc + echo "autoload znt-usetty-wrapper znt-history-widget znt-cd-widget znt-kill-widget" >> ~/.zshrc + echo "alias naliases=n-aliases ncd=n-cd nenv=n-env nfunctions=n-functions nhistory=n-history" >> ~/.zshrc + echo "alias nkill=n-kill noptions=n-options npanelize=n-panelize nhelp=n-help" >> ~/.zshrc + echo "zle -N znt-history-widget" >> ~/.zshrc + echo "bindkey '^R' znt-history-widget" >> ~/.zshrc + echo "setopt AUTO_PUSHD HIST_IGNORE_DUPS PUSHD_IGNORE_DUPS" >> ~/.zshrc + echo "zstyle ':completion::complete:n-kill::bits' matcher 'r:|=** l:|=*'" >> ~/.zshrc + echo "### END ###" >> ~/.zshrc + echo ">>> Done" +else + echo ">>> .zshrc already updated, not making changes" +fi diff --git a/plugins/zsh-navigation-tools/doc/n-preview b/plugins/zsh-navigation-tools/doc/n-preview new file mode 100644 index 000000000..2d8eea3fb --- /dev/null +++ b/plugins/zsh-navigation-tools/doc/n-preview @@ -0,0 +1,224 @@ +# Copy this file into /usr/share/zsh/site-functions/ +# and add 'autoload n-preview` to .zshrc +# +# This is partially a test if n-list-draw and n-list-input can be +# used multiple times to create multiple lists. It might become +# more usable if someone adds more features like previewing of +# archive contents. + +emulate -L zsh + +zmodload zsh/curses + +setopt typesetsilent extendedglob +trap "return" TERM INT QUIT +trap "_vpreview_exit" EXIT + +local IFS=" +" + +[ -f ~/.config/znt/n-list.conf ] && . ~/.config/znt/n-list.conf + +[[ "$colorpair" = "" ]] && colorpair="white/black" +local background="${colorpair#*/}" + +# Drawing and input +autoload n-list-draw n-list-input + +# Cleanup before any exit +_vpreview_exit() { + zcurses 2>/dev/null delwin files + zcurses 2>/dev/null delwin body + zcurses 2>/dev/null delwin status + zcurses 2>/dev/null refresh + zcurses end +} + +# Outputs a message in the bottom of the screen +_vpreview_status_msg() { + zcurses move status 1 2 + zcurses clear status eol + zcurses string status "$1" +} + +# Prefer tput, then module terminfo +_nlist_cursor_visibility() { + if type tput 2>/dev/null 1>&2; then + [ "$1" = "1" ] && tput cvvis + [ "$1" = "0" ] && tput civis + elif [ "$has_termcap" = "1" ]; then + [ "$1" = "1" ] && [ -n $terminfo[cvvis] ] && echo -n $terminfo[cvvis] + [ "$1" = "0" ] && [ -n $terminfo[civis] ] && echo -n $terminfo[civis] + fi +} + +# +# Main code +# + +integer term_height="$LINES" +integer term_width="$COLUMNS" +if [[ "$term_height" -lt 1 || "$term_width" -lt 1 ]]; then + local stty_out=$( stty size ) + term_height="${stty_out% *}" + term_width="${stty_out#* }" +fi + +integer status_height=3 +integer status_width=term_width +integer status_page_height=1 +integer status_page_width=term_width-2 + +integer files_height=term_height-status_height +integer files_width=term_width/5 +integer files_page_height=files_height-2 +integer files_page_width=files_width-2 + +integer body_height=term_height-status_height +integer body_width=term_width-files_width +integer body_page_height=body_height-2 +integer body_page_width=body_width + +integer _from_what_idx_list_is_shown_1=1 +integer current_1=1 + +integer _from_what_idx_list_is_shown_2=1 +integer current_2=1 +integer hscroll_2=0 + +integer active_window=0 + +local ansi_mode="ansi" +[ -f ~/.config/znt/n-preview.conf ] && . ~/.config/znt/n-preview.conf +typeset -a hcmd +#if type pygmentize 2>/dev/null 1>&2; then +# hcmd=( pygmentize -g ) +if type highlight 2>/dev/null 1>&2; then + hcmd=( highlight -q --force -O ansi ) +elif type source-highlight 2>/dev/null 1>&2; then + # Warning: source-highlight can have problems + hcmd=( source-highlight --failsafe -fesc -o STDOUT -i ) +else + ansi_mode="noansi" +fi + +zcurses init +zcurses addwin status "$status_height" "$status_width" $(( term_height - status_height )) 0 +zcurses addwin files "$files_height" "$files_width" 0 0 +zcurses addwin body "$body_height" "$body_width" 0 "$files_width" +zcurses bg status white/black +zcurses bg files white/black +zcurses bg body white/black + +# +# Listening for input +# + +local key keypad + +# Clear input buffer +zcurses timeout status 0 +zcurses input status key keypad +zcurses timeout status -1 +key="" +keypad="" + +typeset -a filenames +integer last_element_1 + +typeset -a body +integer last_element_2 + +filenames=( *(N) ) +filenames=( "${(@M)filenames:#(#i)*$1*}" ) + +local NLIST_GREP_STRING="$1" + +integer last_element_1="$#filenames" +integer last_element_2=0 + +local selection action final_key + +while (( 1 )); do + # Output the lists + integer end_idx=$(( _from_what_idx_list_is_shown_1 + files_page_height - 1 )) + [ "$end_idx" -gt "$last_element_1" ] && end_idx=last_element_1 + + n-list-draw "$(( (current_1 -1) % files_page_height + 1 ))" \ + "$files_page_height" "$files_page_width" 1 2 0 files \ + "${(@)filenames[_from_what_idx_list_is_shown_1, end_idx]}" + + if [ "$#body" -ge 1 ]; then + end_idx=$(( _from_what_idx_list_is_shown_2 + body_page_height - 1 )) + [ "$end_idx" -gt "$last_element_2" ] && end_idx=last_element_2 + + n-list-draw "$(( (current_2 -1) % body_page_height + 1 ))" \ + "$body_page_height" "$body_page_width" 1 0 "$hscroll_2" body \ + "${(@)body[_from_what_idx_list_is_shown_2, end_idx]}" + fi + + [[ "$active_window" -eq 0 ]] && zcurses border files + zcurses border status + zcurses refresh files body status + + # Wait for input + zcurses input status key keypad + + # Get the special (i.e. "keypad") key or regular key + if [ -n "$key" ]; then + final_key="$key" + elif [ -n "$keypad" ]; then + final_key="$keypad" + else + _vpreview_status_msg "Inproper input detected" + zcurses refresh status + fi + + if [ "$active_window" -eq 0 ]; then + zcurses clear files + n-list-input "$current_1" "$_from_what_idx_list_is_shown_1" "$files_page_height" \ + "$files_page_width" "$last_element_1" 0 "$final_key" + + selection="$reply[1]" + action="$reply[2]" + current_1="$reply[3]" + _from_what_idx_list_is_shown_1="$reply[4]" + + if [ "$action" = "SELECT" ]; then + # Load new file and refresh the displaying window + local filename="$filenames[$selection]" + if [ "$ansi_mode" = "ansi" ]; then + body=( "${(@f)"$( "$hcmd[@]" "$filename" )"}" ) + else + body=( "${(@f)"$(<$filename)"}" ) + fi + last_element_2="$#body" + current_2=1 + _from_what_idx_list_is_shown_2=1 + zcurses clear body + fi + elif [ "$active_window" -eq 1 ]; then + zcurses clear body + n-list-input "$current_2" "$_from_what_idx_list_is_shown_2" "$body_page_height" \ + "$body_page_width" "$last_element_2" "$hscroll_2" "$final_key" + + selection="$reply[1]" + action="$reply[2]" + current_2="$reply[3]" + _from_what_idx_list_is_shown_2="$reply[4]" + hscroll_2="$reply[5]" + + fi + + if [ "$action" = "LEAVE" ]; then + active_window=1-active_window + elif [ "$action" = "QUIT" ]; then + break + elif [ "$action" = "REDRAW" ]; then + zcurses clear files redraw + zcurses clear body redraw + zcurses clear status redraw + fi +done + +# vim: set filetype=zsh: diff --git a/plugins/zsh-navigation-tools/doc/znt-tmux.zsh b/plugins/zsh-navigation-tools/doc/znt-tmux.zsh new file mode 100755 index 000000000..309c11a0b --- /dev/null +++ b/plugins/zsh-navigation-tools/doc/znt-tmux.zsh @@ -0,0 +1,50 @@ +#!/usr/bin/env zsh + +# Copyright (c) 2016, Zsolt Lengyel +# Modifications copyright (c) 2016, Sebastian Gniazdowski + +# +# This script opens a new, temporary tmux pane and runs n-history. When +# a selection is made, the result (history entry) is pasted back into +# original tmux pane, and the temporary pane is closed. This allows to +# use local history on remote machines. +# +# To use, put this line to your ~/.tmux.conf. The tool is invoked with: +# Ctrl+b h +# +# bind h run-shell -b "$ZNT_REPO_DIR/doc/znt-tmux.zsh" +# + +# get and save the current active tmux pane id +active_pane=$(tmux display -p -F ':#{session_id}:#I:#P:#{pane_active}:#{window_active}:#{session_attached}' ) +a_active_pane=("${(@s/:/)active_pane}") + +active_session=${a_active_pane[2]//$} +active_window=$a_active_pane[3] +active_pane=$a_active_pane[4] + +# set variables for upcoming window +tmux setenv -t $active_session:$active_window.$active_pane "ZNT_TMUX_MODE" 1 +tmux setenv -t $active_session:$active_window.$active_pane "ZNT_TMUX_ORIGIN_SESSION" "$active_session" +tmux setenv -t $active_session:$active_window.$active_pane "ZNT_TMUX_ORIGIN_WINDOW" "$active_window" +tmux setenv -t $active_session:$active_window.$active_pane "ZNT_TMUX_ORIGIN_PANE" "$active_pane" + +# create a new window in the active session and call it znt-hist +tmux new-window -t $active_session: -n znt-hist + +# unset the variables, so only above single window has them +tmux setenv -u -t $active_session:$active_window.$active_pane "ZNT_TMUX_MODE" +tmux setenv -u -t $active_session:$active_window.$active_pane "ZNT_TMUX_ORIGIN_SESSION" +tmux setenv -u -t $active_session:$active_window.$active_pane "ZNT_TMUX_ORIGIN_WINDOW" +tmux setenv -u -t $active_session:$active_window.$active_pane "ZNT_TMUX_ORIGIN_PANE" + +# znt's session id +znt_active_pane=$(tmux display -p -F ':#{session_id}:#I:#P:#{pane_active}:#{window_active}:#{session_attached}' ) +znt_a_active_pane=("${(@s/:/)znt_active_pane}") + +znt_active_session=${znt_a_active_pane[2]//$} +znt_active_window=$znt_a_active_pane[3] +znt_active_pane=$znt_a_active_pane[4] + +# call znt +tmux send -t "$znt_active_session:$znt_active_window.$znt_active_pane" n-history ENTER diff --git a/plugins/zsh-navigation-tools/znt-tmux.zsh b/plugins/zsh-navigation-tools/znt-tmux.zsh deleted file mode 100755 index 6a96e97a1..000000000 --- a/plugins/zsh-navigation-tools/znt-tmux.zsh +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env zsh - -# Copyright (c) 2016, Zsolt Lengyel -# Modifications copyright (c) 2016, Sebastian Gniazdowski - -# -# This script opens a new, temporary tmux pane and runs n-history. When -# a selection is made, the result (history entry) is pasted back into -# original tmux pane, and the temporary pane is closed. This allows to -# use local history on remote machines. -# -# To use, put this line to your ~/.tmux.conf. The tool is invoked with: -# Ctrl+b h -# -# bind h run-shell -b "$ZNT_REPO_DIR/znt-tmux.zsh" -# - -# get and save the current active tmux pane id -active_pane=$(tmux display -p -F ':#{session_id}:#I:#P:#{pane_active}:#{window_active}:#{session_attached}' ) -a_active_pane=("${(@s/:/)active_pane}") - -active_session=${a_active_pane[2]//$} -active_window=$a_active_pane[3] -active_pane=$a_active_pane[4] - -# set variables for upcoming window -tmux setenv -t $active_session:$active_window.$active_pane "ZNT_TMUX_MODE" 1 -tmux setenv -t $active_session:$active_window.$active_pane "ZNT_TMUX_ORIGIN_SESSION" "$active_session" -tmux setenv -t $active_session:$active_window.$active_pane "ZNT_TMUX_ORIGIN_WINDOW" "$active_window" -tmux setenv -t $active_session:$active_window.$active_pane "ZNT_TMUX_ORIGIN_PANE" "$active_pane" - -# create a new window in the active session and call it znt-hist -tmux new-window -t $active_session: -n znt-hist - -# unset the variables, so only above single window has them -tmux setenv -u -t $active_session:$active_window.$active_pane "ZNT_TMUX_MODE" -tmux setenv -u -t $active_session:$active_window.$active_pane "ZNT_TMUX_ORIGIN_SESSION" -tmux setenv -u -t $active_session:$active_window.$active_pane "ZNT_TMUX_ORIGIN_WINDOW" -tmux setenv -u -t $active_session:$active_window.$active_pane "ZNT_TMUX_ORIGIN_PANE" - -# znt's session id -znt_active_pane=$(tmux display -p -F ':#{session_id}:#I:#P:#{pane_active}:#{window_active}:#{session_attached}' ) -znt_a_active_pane=("${(@s/:/)znt_active_pane}") - -znt_active_session=${znt_a_active_pane[2]//$} -znt_active_window=$znt_a_active_pane[3] -znt_active_pane=$znt_a_active_pane[4] - -# call znt -tmux send -t "$znt_active_session:$znt_active_window.$znt_active_pane" n-history ENTER diff --git a/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh b/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh index f015620f5..85ce87ca4 100644 --- a/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh +++ b/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh @@ -8,7 +8,7 @@ # # According to the standard: -# http://zdharma.org/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html +# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html 0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}" 0="${${(M)0:#/*}:-$PWD/$0}" export ZNT_REPO_DIR="${0:h}" -- cgit v1.2.3-70-g09d2 From 2d32e9be668672c110405aa2952ab8adaf374856 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Sat, 18 Dec 2021 14:53:49 -0600 Subject: refactor: handle `$0` according to the Zsh plugin standard (#10518) For details and rationale, see: https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html Closes #10518 --- plugins/cargo/cargo.plugin.zsh | 6 +++++- plugins/colemak/colemak.plugin.zsh | 5 +++++ plugins/colored-man-pages/colored-man-pages.plugin.zsh | 5 +++++ plugins/deno/deno.plugin.zsh | 5 +++++ plugins/emacs/emacs.plugin.zsh | 5 +++++ plugins/emoji/emoji.plugin.zsh | 5 +++++ plugins/emotty/emotty.plugin.zsh | 5 +++++ plugins/fnm/fnm.plugin.zsh | 5 +++++ plugins/gh/gh.plugin.zsh | 5 +++++ plugins/git-prompt/git-prompt.plugin.zsh | 5 +++++ plugins/gitfast/gitfast.plugin.zsh | 5 +++++ .../history-substring-search/history-substring-search.plugin.zsh | 6 +++++- plugins/hitchhiker/hitchhiker.plugin.zsh | 5 +++++ plugins/macos/macos.plugin.zsh | 5 +++++ plugins/rustup/rustup.plugin.zsh | 6 +++++- plugins/tmux/tmux.plugin.zsh | 5 +++++ plugins/wd/wd.plugin.zsh | 5 +++++ plugins/z/z.plugin.zsh | 5 +++++ plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh | 1 + 19 files changed, 91 insertions(+), 3 deletions(-) (limited to 'plugins/zsh-navigation-tools') diff --git a/plugins/cargo/cargo.plugin.zsh b/plugins/cargo/cargo.plugin.zsh index 51a80d4f1..20aeb6652 100644 --- a/plugins/cargo/cargo.plugin.zsh +++ b/plugins/cargo/cargo.plugin.zsh @@ -1,8 +1,12 @@ print ${(%):-'%F{yellow}The `cargo` plugin is deprecated and has been moved to the `rust` plugin.'} print ${(%):-'Please update your .zshrc to use the `%Brust%b` plugin instead.%f'} +# TODO: 2021-12-28: remove this block +# Handle $0 according to the standard: +# # https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html +0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}" +0="${${(M)0:#/*}:-$PWD/$0}" # Remove old generated completion file -# TODO: 2021-12-28: remove this line command rm -f "${0:A:h}/_cargo" (( ${fpath[(Ie)$ZSH/plugins/rust]} )) || { diff --git a/plugins/colemak/colemak.plugin.zsh b/plugins/colemak/colemak.plugin.zsh index 8d3393c44..de0b5b866 100644 --- a/plugins/colemak/colemak.plugin.zsh +++ b/plugins/colemak/colemak.plugin.zsh @@ -19,6 +19,11 @@ bindkey -a 'N' vi-join bindkey -a 'j' vi-forward-word-end bindkey -a 'J' vi-forward-blank-word-end +# Handle $0 according to the standard: +# # https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html +0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}" +0="${${(M)0:#/*}:-$PWD/$0}" + # New less versions will read this file directly export LESSKEYIN="${0:h:A}/colemak-less" diff --git a/plugins/colored-man-pages/colored-man-pages.plugin.zsh b/plugins/colored-man-pages/colored-man-pages.plugin.zsh index 37faed672..040e74fc9 100644 --- a/plugins/colored-man-pages/colored-man-pages.plugin.zsh +++ b/plugins/colored-man-pages/colored-man-pages.plugin.zsh @@ -16,6 +16,11 @@ less_termcap[se]="${reset_color}" less_termcap[us]="${fg_bold[green]}" less_termcap[ue]="${reset_color}" +# Handle $0 according to the standard: +# # https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html +0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}" +0="${${(M)0:#/*}:-$PWD/$0}" + # Absolute path to this file's directory. typeset __colored_man_pages_dir="${0:A:h}" diff --git a/plugins/deno/deno.plugin.zsh b/plugins/deno/deno.plugin.zsh index eb7191971..88df55af7 100644 --- a/plugins/deno/deno.plugin.zsh +++ b/plugins/deno/deno.plugin.zsh @@ -13,6 +13,11 @@ alias dup='deno upgrade' # COMPLETION FUNCTION if (( $+commands[deno] )); then + # Handle $0 according to the standard: + # # https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html + 0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}" + 0="${${(M)0:#/*}:-$PWD/$0}" + # remove old generated completion file command rm -f "${0:A:h}/_deno" diff --git a/plugins/emacs/emacs.plugin.zsh b/plugins/emacs/emacs.plugin.zsh index 027c7550f..258e57f24 100644 --- a/plugins/emacs/emacs.plugin.zsh +++ b/plugins/emacs/emacs.plugin.zsh @@ -13,6 +13,11 @@ autoload -Uz is-at-least is-at-least 24 "${${(Az)"$(emacsclient --version 2>/dev/null)"}[2]}" || return 0 +# Handle $0 according to the standard: +# # https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html +0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}" +0="${${(M)0:#/*}:-$PWD/$0}" + # Path to custom emacsclient launcher export EMACS_PLUGIN_LAUNCHER="${0:A:h}/emacsclient.sh" diff --git a/plugins/emoji/emoji.plugin.zsh b/plugins/emoji/emoji.plugin.zsh index f70e09320..60d00d976 100644 --- a/plugins/emoji/emoji.plugin.zsh +++ b/plugins/emoji/emoji.plugin.zsh @@ -4,6 +4,11 @@ # # See the README for documentation. +# Handle $0 according to the standard: +# # https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html +0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}" +0="${${(M)0:#/*}:-$PWD/$0}" + _omz_emoji_plugin_dir="${0:h}" () { diff --git a/plugins/emotty/emotty.plugin.zsh b/plugins/emotty/emotty.plugin.zsh index 4511275d6..959390a31 100644 --- a/plugins/emotty/emotty.plugin.zsh +++ b/plugins/emotty/emotty.plugin.zsh @@ -10,6 +10,11 @@ # % export emotty_set=nature # ------------------------------------------------------------------------------ +# Handle $0 according to the standard: +# # https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html +0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}" +0="${${(M)0:#/*}:-$PWD/$0}" + typeset -gAH _emotty_sets local _emotty_plugin_dir="${0:h}" source "$_emotty_plugin_dir/emotty_stellar_set.zsh" diff --git a/plugins/fnm/fnm.plugin.zsh b/plugins/fnm/fnm.plugin.zsh index c161b27cd..a5b0d0900 100644 --- a/plugins/fnm/fnm.plugin.zsh +++ b/plugins/fnm/fnm.plugin.zsh @@ -1,4 +1,9 @@ if (( $+commands[fnm] )); then + # Handle $0 according to the standard: + # # https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html + 0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}" + 0="${${(M)0:#/*}:-$PWD/$0}" + # remove old generated completion file command rm -f "${0:A:h}/_fnm" diff --git a/plugins/gh/gh.plugin.zsh b/plugins/gh/gh.plugin.zsh index 3e4cdee5e..3092bfa4a 100644 --- a/plugins/gh/gh.plugin.zsh +++ b/plugins/gh/gh.plugin.zsh @@ -1,5 +1,10 @@ # Autocompletion for the GitHub CLI (gh). if (( $+commands[gh] )); then + # Handle $0 according to the standard: + # # https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html + 0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}" + 0="${${(M)0:#/*}:-$PWD/$0}" + # remove old generated completion file command rm -f "${0:A:h}/_gh" diff --git a/plugins/git-prompt/git-prompt.plugin.zsh b/plugins/git-prompt/git-prompt.plugin.zsh index a4c952471..122542e65 100644 --- a/plugins/git-prompt/git-prompt.plugin.zsh +++ b/plugins/git-prompt/git-prompt.plugin.zsh @@ -1,3 +1,8 @@ +# Handle $0 according to the standard: +# # https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html +0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}" +0="${${(M)0:#/*}:-$PWD/$0}" + __GIT_PROMPT_DIR="${0:A:h}" ## Hook function definitions diff --git a/plugins/gitfast/gitfast.plugin.zsh b/plugins/gitfast/gitfast.plugin.zsh index 7b6b67e92..f28e3808c 100644 --- a/plugins/gitfast/gitfast.plugin.zsh +++ b/plugins/gitfast/gitfast.plugin.zsh @@ -1,3 +1,8 @@ +# Handle $0 according to the standard: +# # https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html +0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}" +0="${${(M)0:#/*}:-$PWD/$0}" + source "${0:A:h}/git-prompt.sh" function git_prompt_info() { diff --git a/plugins/history-substring-search/history-substring-search.plugin.zsh b/plugins/history-substring-search/history-substring-search.plugin.zsh index d2c749bc3..bac2c3ab9 100644 --- a/plugins/history-substring-search/history-substring-search.plugin.zsh +++ b/plugins/history-substring-search/history-substring-search.plugin.zsh @@ -1,4 +1,8 @@ -0=${(%):-%N} +# Handle $0 according to the standard: +# # https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html +0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}" +0="${${(M)0:#/*}:-$PWD/$0}" + source ${0:A:h}/history-substring-search.zsh diff --git a/plugins/hitchhiker/hitchhiker.plugin.zsh b/plugins/hitchhiker/hitchhiker.plugin.zsh index aeafaf01e..6d0e40052 100644 --- a/plugins/hitchhiker/hitchhiker.plugin.zsh +++ b/plugins/hitchhiker/hitchhiker.plugin.zsh @@ -1,3 +1,8 @@ +# Handle $0 according to the standard: +# # https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html +0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}" +0="${${(M)0:#/*}:-$PWD/$0}" + HITCHHIKER_DIR="${0:h}/fortunes" # Aliases diff --git a/plugins/macos/macos.plugin.zsh b/plugins/macos/macos.plugin.zsh index 6a91be336..144c17ab2 100644 --- a/plugins/macos/macos.plugin.zsh +++ b/plugins/macos/macos.plugin.zsh @@ -1,3 +1,8 @@ +# Handle $0 according to the standard: +# # https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html +0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}" +0="${${(M)0:#/*}:-$PWD/$0}" + # Open the current directory in a Finder window alias ofd='open_command $PWD' diff --git a/plugins/rustup/rustup.plugin.zsh b/plugins/rustup/rustup.plugin.zsh index 0ca745b7e..698c081e5 100644 --- a/plugins/rustup/rustup.plugin.zsh +++ b/plugins/rustup/rustup.plugin.zsh @@ -1,8 +1,12 @@ print ${(%):-'%F{yellow}The `rustup` plugin is deprecated and has been moved to the `rust` plugin.'} print ${(%):-'Please update your .zshrc to use the `%Brust%b` plugin instead.%f'} +# TODO: 2021-12-28: remove this block +# Handle $0 according to the standard: +# # https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html +0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}" +0="${${(M)0:#/*}:-$PWD/$0}" # Remove old generated completion file -# TODO: 2021-12-28: remove this line command rm -f "${0:A:h}/_rustup" (( ${fpath[(Ie)$ZSH/plugins/rust]} )) || { diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index 0ea3aa02a..648d12bbf 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -46,6 +46,11 @@ else export ZSH_TMUX_TERM=$ZSH_TMUX_FIXTERM_WITHOUT_256COLOR fi +# Handle $0 according to the standard: +# # https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html +0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}" +0="${${(M)0:#/*}:-$PWD/$0}" + # Set the correct local config file to use. if [[ "$ZSH_TMUX_ITERM2" == "false" && -e "$ZSH_TMUX_CONFIG" ]]; then export ZSH_TMUX_CONFIG diff --git a/plugins/wd/wd.plugin.zsh b/plugins/wd/wd.plugin.zsh index 87d1d0858..222a1483a 100644 --- a/plugins/wd/wd.plugin.zsh +++ b/plugins/wd/wd.plugin.zsh @@ -7,4 +7,9 @@ # # @github.com/mfaerevaag/wd +# Handle $0 according to the standard: +# # https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html +0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}" +0="${${(M)0:#/*}:-$PWD/$0}" + eval "wd() { source '${0:A:h}/wd.sh' }" diff --git a/plugins/z/z.plugin.zsh b/plugins/z/z.plugin.zsh index 96abee890..7ce13afa7 100644 --- a/plugins/z/z.plugin.zsh +++ b/plugins/z/z.plugin.zsh @@ -1 +1,6 @@ +# Handle $0 according to the standard: +# # https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html +0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}" +0="${${(M)0:#/*}:-$PWD/$0}" + source "${0:h}/z.sh" diff --git a/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh b/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh index 85ce87ca4..54c819810 100644 --- a/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh +++ b/plugins/zsh-navigation-tools/zsh-navigation-tools.plugin.zsh @@ -11,6 +11,7 @@ # https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html 0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}" 0="${${(M)0:#/*}:-$PWD/$0}" + export ZNT_REPO_DIR="${0:h}" export ZNT_CONFIG_DIR="$HOME/.config/znt" -- cgit v1.2.3-70-g09d2 From 376beafd17b5e9aeb5ef9975720e4ad3354c0f43 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Fri, 31 Dec 2021 20:01:03 +0100 Subject: docs(zsh-navigation-tools): remove installation steps from README (#10549) Fixes #10549 --- plugins/zsh-navigation-tools/README.md | 191 +++------------------------------ 1 file changed, 13 insertions(+), 178 deletions(-) (limited to 'plugins/zsh-navigation-tools') diff --git a/plugins/zsh-navigation-tools/README.md b/plugins/zsh-navigation-tools/README.md index 9fd2d5414..bdbfac976 100644 --- a/plugins/zsh-navigation-tools/README.md +++ b/plugins/zsh-navigation-tools/README.md @@ -3,204 +3,39 @@ ![ZSH 5.0.0](https://img.shields.io/badge/zsh-v5.0.0-orange.svg?style=flat-square) [![Gitter][gitter-image]][gitter-link] -![znt logo](http://imageshack.com/a/img905/2629/WK9qjN.png) +![znt logo](https://imageshack.com/a/img905/2629/WK9qjN.png) # Zsh Navigation Tools -Also check out [![ZCA](http://imageshack.com/a/img911/8084/qSpO8a.png) Zsh Command Architect](https://github.com/zdharma-continuum/zsh-cmd-architect) -and [Zconvey](https://github.com/zdharma-continuum/zconvey) - - - -Videos: -- [https://youtu.be/QwZ8IJEgXRE](https://youtu.be/QwZ8IJEgXRE) -- [https://youtu.be/DN9QqssAYB8](https://youtu.be/DN9QqssAYB8) - -Screenshots: - -![n-history](http://imageshack.com/a/img921/5046/bqr0mk.png) - -![n-history](http://imageshack.com/a/img633/9905/WzfSdl.gif) - -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 +Set of tools like `n-history` – multi-word history searcher, `n-cd` – directory +bookmark manager, `n-kill` – `htop` like kill utility, and more. Based on `n-list`, a tool generating selectable curses-based list of elements that has access to current `Zsh` session, i.e. has broad capabilities to work together with it. Feature highlights include incremental multi-word searching, approximate matching, ANSI coloring, themes, unique mode, horizontal scroll, grepping, advanced history management and various integrations with `Zsh`. -## News -* 06-10-2016 - - **Tmux-integration** – `Ctrl-B H` in Tmux to open `n-history` in new window. - Then select history entry, it will be copied to the original Tmux window. - Use this to execute local commands on remote hosts: - - ![tmux integration](http://imageshack.com/a/img922/4760/oyX7eN.gif) - - All that is needed is this line added to `~/.tmux.conf`: - - ``` - bind h run-shell -b "$ZNT_REPO_DIR/doc/znt-tmux.zsh" - ``` - - or – if Homebrew or other package manager is used: - - ``` - bind h run-shell -b "$ZNT_REPO_DIR/znt-tmux.zsh" - ``` - -* 16-05-2016 - - `n-kill` has completion. It proposes **words** from what's in `ps -A`. Giving `n-kill` - arguments means grepping – it will start only with matching `ps` entries. - -* 15-05-2016 - - Fixed problem where zsh-syntax-highlighting could render `n-history` slow (for - long history entries). - -* 14-05-2016 - - Configuration can be set from `zshrc` (starting from `v2.1.12`). Documentation is [below](#configuration). Example: - - ```zsh - znt_list_instant_select=1 - znt_list_border=0 - znt_list_bold=1 - znt_list_colorpair="green/black" - znt_functions_keywords=( "zplg" "zgen" "match" ) - znt_cd_active_text="underline" - znt_env_nlist_coloring_color=$'\x1b[00;33m' - znt_cd_hotlist=( "~/.config/znt" "/usr/share/zsh/site-functions" "/usr/share/zsh" - "/usr/local/share/zsh/site-functions" "/usr/local/share/zsh" - "/usr/local/bin" ) - ``` - -* 10-05-2016 - - Search query rotation – use `Ctrl-A` to rotate entered words right. - Words `1 2 3` become `3 1 2`. - -* 09-05-2016 - - New feature: n-help tool, available also from n-history via `H` key. It - displays help screen with various information on `ZNT`. - - ![n-help](http://imageshack.com/a/img922/7595/MvtJdI.gif) - -* 08-05-2016 - - Approximate matching – pressing `f` or `Ctrl-F` 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. - - ![fix mode](http://imageshack.com/a/img921/5756/64lFnv.gif) - -* 06-05-2016 - - Private history can be edited. Use `e` key or `Ctrl-E` 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. - - Border can be disabled. Use following snippet in `~/.config/znt/n-list.conf` - or any other tool-targetted config file: - - ```zsh - # Should draw the border? - local border=0 - ``` - -* 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](https://github.com/zdharma-continuum/zsh-navigation-tools/blob/master/.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](https://github.com/zdharma-continuum/zsh-navigation-tools/blob/master/.config/znt/n-list.conf) - already has set of 256-color themes prepared :) - - ![themes](http://imageshack.com/a/img924/4310/EbRh30.gif) - -* 29-04-2016 - - New feature: private history – n-history tracks selected history entries, - exposes them via new view (activated with `F1`). It is shared across all - sessions - -* 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 - -## Installation - -``` -sh -c "$(curl -fsSL https://raw.githubusercontent.com/zdharma-continuum/zsh-navigation-tools/master/doc/install.sh)" -``` - -To update run the command again. - -`ZNT` will be installed at `~/.config/znt/zsh-navigation-tools`, config files will be copied to `~/.config/znt`. `.zshrc` -will be updated with only `8` lines of code, which will be added at the bottom. - -After installing and reloading shell give `ZNT` a quick try with `Ctrl-R` – this keyboard shortcut will open `n-history`. - -## Installation With [Zinit](https://github.com/zdharma-continuum/zinit) -Add `zinit load zdharma-continuum/zsh-navigation-tools` to `.zshrc`. The config files will be in `~/.config/znt`. - -## Installation With Zgenom/Zgen - -Add `zgen load zdharma-continuum/zsh-navigation-tools` to `.zshrc` and issue a `zgen reset` (this assumes that there is a proper `zgen save` construct in `.zshrc`). -The config files will be available in `~/.config/znt`. - -## Installation With Antigen -Add `antigen bundle zdharma-continuum/zsh-navigation-tools` to `.zshrc`. There also -should be `antigen apply`. The config files will be in `~/.config/znt`. - -## Single File Manual Installation - -Running script `doc/generate_single_file` will create single-file version of `ZNT`. -It can be sourced from `.zshrc`. Don't forget about configuration files as described -above. - -## Manual Installation - -After extracting `ZNT` to `{some-directory}` add following two lines -to `~/.zshrc`: - -```zsh -fpath+=( {some-directory} ) -source "{some-directory}/zsh-navigation-tools.plugin.zsh" -``` - -As you can see, no plugin manager is needed to use the `*.plugin.zsh` -file. The above two lines of code are all that almost **all** plugin -managers do. In fact, what's actually needed is only: +To use it, add `zsh-navigation-tools` to the plugins array in your zshrc file: ```zsh -source "{some-directory}/zsh-navigation-tools.plugin.zsh" +plugins=(... zsh-navigation-tools) ``` -because `ZNT` detects if it is used by **any** plugin manager and can -handle `$fpath` update by itself. - -## Truly Manual Installation -Copy (or link) all `n-*` and `znt-*` files to **/usr/share/zsh/site-functions/** -(or **/usr/local/share/zsh/site-functions/**, check with `echo $fpath[1]`) and then add: +Also check out [![ZCA](https://imageshack.com/a/img911/8084/qSpO8a.png) Zsh Command Architect](https://github.com/zdharma-continuum/zsh-cmd-architect) +and [Zconvey](https://github.com/zdharma-continuum/zconvey) - autoload n-list n-cd n-env n-kill n-panelize n-options n-aliases n-functions n-history n-help -to `~/.zshrc`. -Create aliases to avoid typing of the minus sign "-": +Videos: +- [https://youtu.be/QwZ8IJEgXRE](https://youtu.be/QwZ8IJEgXRE) +- [https://youtu.be/DN9QqssAYB8](https://youtu.be/DN9QqssAYB8) -```zsh -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 nhelp=n-help -``` +Screenshots: -Don't forget to copy [configuration files](https://github.com/zdharma-continuum/zsh-navigation-tools/tree/master/.config/znt). They should go to `~/.config/znt`. Moreover, `n-cd` works together with option `AUTO_PUSHD` and you should have: +![n-history](https://imageshack.com/a/img921/5046/bqr0mk.png) -```zsh -setopt AUTO_PUSHD -``` +![n-history](https://imageshack.com/a/img633/9905/WzfSdl.gif) -in `.zshrc` (also recommend `PUSHD_IGNORE_DUPS`). Without the option `n-cd` -will just work as incremental searcher of directory bookmarks. ## History Widget -- cgit v1.2.3-70-g09d2