Skip to content

Commit

Permalink
docs: describe hash -d trick in readme
Browse files Browse the repository at this point in the history
  • Loading branch information
psprint committed Jan 17, 2023
1 parent b721461 commit f3a3909
Showing 1 changed file with 86 additions and 0 deletions.
86 changes: 86 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,59 @@
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*

- [Zinit<a name="zinit"></a>](#zinita-namezinita)
- [Zinit Wiki<a name="zinit-wiki"></a>](#zinit-wikia-namezinit-wikia)
- [Install<a name="install"></a>](#installa-nameinstalla)
- [Automatic<a name="automatic"></a>](#automatica-nameautomatica)
- [Manual<a name="manual"></a>](#manuala-namemanuala)
- [Usage<a name="usage"></a>](#usagea-nameusagea)
- [Introduction<a name="introduction"></a>](#introductiona-nameintroductiona)
- [Plugins and snippets<a name="plugins-and-snippets"></a>](#plugins-and-snippetsa-nameplugins-and-snippetsa)
- [Upgrade Zinit and plugins<a name="upgrade-zinit-and-plugins"></a>](#upgrade-zinit-and-pluginsa-nameupgrade-zinit-and-pluginsa)
- [Turbo and lucid<a name="turbo-and-lucid"></a>](#turbo-and-lucida-nameturbo-and-lucida)
- [Migration<a name="migration"></a>](#migrationa-namemigrationa)
- [Frequently Asked Questions<a name="frequently-asked-questions"></a>](#frequently-asked-questionsa-namefrequently-asked-questionsa)
- [Use `zi ice svn` if a plugin/snippet requires an entire subdirectory<a name="use-zi-ice-svn-if-a-pluginsnippet-requires-an-entire-subdirectory"></a>](#use-zi-ice-svn-if-a-pluginsnippet-requires-an-entire-subdirectorya-nameuse-zi-ice-svn-if-a-pluginsnippet-requires-an-entire-subdirectorya)
- [Use `zi ice as'completion'` to directly add single file completion snippets<a name="use-zi-ice-ascompletion-to-directly-add-single-file-completion-snippets"></a>](#use-zi-ice-ascompletion-to-directly-add-single-file-completion-snippetsa-nameuse-zi-ice-ascompletion-to-directly-add-single-file-completion-snippetsa)
- [More Examples<a name="more-examples"></a>](#more-examplesa-namemore-examplesa)
- [How to Use<a name="how-to-use"></a>](#how-to-usea-namehow-to-usea)
- [Ice Modifiers<a name="ice-modifiers"></a>](#ice-modifiersa-nameice-modifiersa)
- [Cloning Options<a name="cloning-options"></a>](#cloning-optionsa-namecloning-optionsa)
- [Selection of Files (To Source, …)<a name="selection-of-files-to-source-%E2%80%A6"></a>](#selection-of-files-to-source-a-nameselection-of-files-to-source-a)
- [Conditional Loading<a name="conditional-loading"></a>](#conditional-loadinga-nameconditional-loadinga)
- [Plugin Output<a name="plugin-output"></a>](#plugin-outputa-nameplugin-outputa)
- [Completions<a name="completions"></a>](#completionsa-namecompletionsa)
- [Command Execution After Cloning, Updating or Loading<a name="command-execution-after-cloning-updating-or-loading"></a>](#command-execution-after-cloning-updating-or-loadinga-namecommand-execution-after-cloning-updating-or-loadinga)
- [Sticky-Emulation Of Other Shells<a name="sticky-emulation-of-other-shells"></a>](#sticky-emulation-of-other-shellsa-namesticky-emulation-of-other-shellsa)
- [Others<a name="others"></a>](#othersa-nameothersa)
- [Order of Execution<a name="order-of-execution"></a>](#order-of-executiona-nameorder-of-executiona)
- [Zinit Commands<a name="zinit-commands"></a>](#zinit-commandsa-namezinit-commandsa)
- [Help<a name="help"></a>](#helpa-namehelpa)
- [Loading and Unloading<a name="loading-and-unloading"></a>](#loading-and-unloadinga-nameloading-and-unloadinga)
- [Completions<a name="completions-1"></a>](#completionsa-namecompletions-1a)
- [Tracking of the Active Session<a name="tracking-of-the-active-session"></a>](#tracking-of-the-active-sessiona-nametracking-of-the-active-sessiona)
- [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)
- [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)
- [Calling `compinit` With Turbo Mode<a name="calling-compinit-with-turbo-mode"></a>](#calling-compinit-with-turbo-modea-namecalling-compinit-with-turbo-modea)
- [Ignoring Compdefs<a name="ignoring-compdefs"></a>](#ignoring-compdefsa-nameignoring-compdefsa)
- [Disabling System-Wide `compinit` Call (Ubuntu)<a name="disabling-system-wide-compinit-call-ubuntu"></a>](#disabling-system-wide-compinit-call-ubuntua-namedisabling-system-wide-compinit-call-ubuntua)
- [Zinit Module<a name="zinit-module"></a>](#zinit-modulea-namezinit-modulea)
- [Hints and Tips<a name="hints-and-tips"></a>](#hints-and-tipsa-namehints-and-tipsa)
- [Customizing Paths<a name="customizing-paths"></a>](#customizing-pathsa-namecustomizing-pathsa)
- [Non-GitHub (Local) Plugins<a name="non-github-local-plugins"></a>](#non-github-local-pluginsa-namenon-github-local-pluginsa)
- [Extending Git<a name="extending-git"></a>](#extending-gita-nameextending-gita)
- [Use named directories for plugin dirs](#use-named-directories-for-plugin-dirs)
- [Changelog<a name="changelog"></a>](#changeloga-namechangeloga)
- [Support<a name="support"></a>](#supporta-namesupporta)
- [Getting Help and Community<a name="getting-help-and-community"></a>](#getting-help-and-communitya-namegetting-help-and-communitya)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

<p align="center">
<a href="https://github.com/zdharma-continuum/zinit">
<img src="https://raw.githubusercontent.com/zdharma-continuum/zinit/images/zinit.png"/>
Expand Down Expand Up @@ -1081,6 +1137,36 @@ zi as'null' lucid sbin wait'1' for \

Target directory for installed files is `$ZPFX` (`~/.local/share/zinit/polaris` by default).

### Use named directories for plugin dirs

Named directories are shorthands in the form of `~NAMED_DIR`
(upper case not required). They are setup via `hash` command
with `-d` option, and point to a directory, for example:

```zsh
# Set up a GHUB named directory
hash -d GHUB=~/github
# Then use as:
cd ~GHUB/my-project
# PWD is now: ~/github/my-project
```

A nice usecase for it can be labelling all plugin directories
with `~plugin-id` (for `user-id/plugin-id` plugin), via
following snippet added to the end of zshrc:

```zsh
for i in $ZINIT[PLUGINS_DIR]/*; do
# Remove all except the final ID component.
q=${${i:t}##*---}
# Remove trailing slash.
q=${q%/}
# Hash the final ID part with directory.
# After this it's possible to `cd ~fzf`
# to get to directory of `junegunn/fzf`.
hash -d $q=$i
done
```
## Changelog<a name="changelog"></a>

Link to the [CHANGELOG](doc/CHANGELOG.md).
Expand Down

0 comments on commit f3a3909

Please sign in to comment.