From d3196761d8b8753724d45de0950b74f68803e849 Mon Sep 17 00:00:00 2001 From: Sebastian Gniazdowski Date: Wed, 26 Oct 2022 10:04:43 +0059 Subject: [PATCH] Improve tags browser and document it, also document param'' ice. --- README.md | 8 +++++++- zi-browse-symbol | 9 +++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index d82a9ec3e..8909f1b03 100644 --- a/README.md +++ b/README.md @@ -836,7 +836,7 @@ You may safely assume a given ice works with both plugins and snippets unless ex | `subst` |
Substitute the given string into another string when sourcing the plugin script, e.g.: `zinit subst'autoload → autoload -Uz' …`.
| | `autoload` |
Autoload the given functions (from their files). Equvalent to calling `atinit'autoload the-function'`. Supports renaming of the function – pass `'… → new-name'` or `'… -> new-name'`, e.g.: `zinit autoload'fun → my-fun; fun2 → my-fun2'`.
| | `link` |
Use a symlink to cache a local snippet instead of copying into the snippets directory. Uses relative links if realpath >= 8.23 is found. ***Does not apply to URL-based snippets. Does not work with plugins.***
| - +| `param` |
Creates parameters (variables) for the time of loading a plugin only. The variables are separated from their values via `->` or `→`, e.g.:`param'CMD_COMMAND_PATH → ~/cmds; CMD_DIR → $HOME'`. Multiple vars can be created either via separating them by `;` or via multiple `param''` ices.
| ### Order of Execution Order of execution of related Ice-mods: `atinit` -> `atpull!` -> `make'!!'` -> `mv` -> `cp` -> `make!` -> @@ -929,6 +929,12 @@ Following commands are passed to `zinit ...` to obtain described effects. | `module` |
Manage binary Zsh module shipped with Zinit, see `zinit module help`.
| | `add-fpath\|fpath` `[-f\|--front]` `{plg-spec}` `[subdirectory]` |
Adds given plugin (not yet snippet) directory to `$fpath`. If the second argument is given, it is appended to the directory path. If the option `-f`/`--front` is given, the directory path is prepended instead of appended to `$fpath`. The `{plg-spec}` can be absolute path, i.e.: it's possible to also add regular directories.
| | `run` `[-l]` `[plugin]` `{command}` |
Runs the given command in the given plugin's directory. If the option `-l` will be given then the plugin should be skipped – the option will cause the previous plugin to be reused.
| +## An embedded TAGS browser + +Zinit comes via an embedded Ctags browser. Just create a `TAGS` file +via e.g.: `ctags -e -R .` and then press `Alt-Shift-q` to open the +browser. You can test the feature by generating TAGS for Zinit, via: +`cd $ZINIT[BIN_DIR]; make tags-emacs` and then opening the browser. ## Updating Zinit and Plugins diff --git a/zi-browse-symbol b/zi-browse-symbol index 1fdece4cc..846eb57a6 100644 --- a/zi-browse-symbol +++ b/zi-browse-symbol @@ -102,6 +102,8 @@ _tfind_error_msg() if [[ -z $TAG[repo-dir] || $TAG[repo-dir] == . ]]; then POSTDISPLAY=$'\n'"Symbol index NOT found, NO DATA to show, sleeping…" local search_buffer= + elif [[ $#__tfind_spe_found -eq 0 ]]; then + POSTDISPLAY=$'\n'"Didn't found any symbol." elif [[ $#__tfind_tag_data -eq 0 ]]; then POSTDISPLAY=$'\n'"The index file contains NO symbol data, forced sleeping..." local search_buffer= @@ -170,16 +172,15 @@ _tfind_main() { done fi - if [[ $#__tfind_spe_found -eq 0 ]]; then - _tfind_error_msg && return + if (( $#__tfind_spe_found == 0 )); then + _tfind_error_msg; return fi - # # Pagination, index value guards # integer page_size=$__tfind_page_size - integer max_index="$#__tfind_spe_found" + integer max_index=$#__tfind_spe_found [[ $page_size -gt $max_index ]] && page_size=$max_index [[ $__tfind_spe_index -le 0 ]] && __tfind_spe_index=$max_index [[ $__tfind_spe_index -gt $max_index ]] && __tfind_spe_index=1