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 02ece7f commit c352bad
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
- [Reports and Statistics<a name="reports-and-statistics"></a>](#reports-and-statisticsa-namereports-and-statisticsa)
- [Compiling<a name="compiling"></a>](#compilinga-namecompilinga)
- [Other<a name="other"></a>](#othera-nameothera)
- [An embedded TAGS browser](#an-embedded-tags-browser)
- [Updating Zinit and Plugins<a name="updating-zinit-and-plugins"></a>](#updating-zinit-and-pluginsa-nameupdating-zinit-and-pluginsa)
- [Completions<a name="completions-2"></a>](#completionsa-namecompletions-2a)
- [Calling `compinit` Without Turbo Mode<a name="calling-compinit-without-turbo-mode"></a>](#calling-compinit-without-turbo-modea-namecalling-compinit-without-turbo-modea)
Expand Down Expand Up @@ -836,6 +837,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>

Expand Down Expand Up @@ -930,6 +932,13 @@ Following commands are passed to `zinit ...` to obtain described effects.
| `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>

To update Zinit issue `zinit self-update` in the command line.
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 c352bad

Please sign in to comment.