Skip to content

Commit

Permalink
Improve tags browser and document it, also document param'' ice.
Browse files Browse the repository at this point in the history
  • Loading branch information
psprint committed Oct 26, 2022
1 parent df51997 commit d319676
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ You may safely assume a given ice works with both plugins and snippets unless ex
| `subst` | <div align="justify" style="text-align: justify;">Substitute the given string into another string when sourcing the plugin script, e.g.: `zinit subst'autoload → autoload -Uz' …`.</div> |
| `autoload` | <div align="justify" style="text-align: justify;">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'`.</div> |
| `link` | <div align="justify" style="text-align: justify;">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.***</div> |

| `param` | <div align="justify" style="text-align: justify;">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.</div> |
### Order of Execution<a name="order-of-execution"></a>

Order of execution of related Ice-mods: `atinit` -> `atpull!` -> `make'!!'` -> `mv` -> `cp` -> `make!` ->
Expand Down Expand Up @@ -929,6 +929,12 @@ Following commands are passed to `zinit ...` to obtain described effects.
| `module` | <div align="justify" style="text-align: justify;"> Manage binary Zsh module shipped with Zinit, see `zinit module help`.</div> |
| `add-fpath\|fpath` `[-f\|--front]` `{plg-spec}` `[subdirectory]` | <div align="justify" style="text-align: justify;">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.</div> |
| `run` `[-l]` `[plugin]` `{command}` | <div align="justify" style="text-align: justify;">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.</div> |
## 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<a name="updating-zinit-and-plugins"></a>

Expand Down
9 changes: 5 additions & 4 deletions zi-browse-symbol
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d319676

Please sign in to comment.