Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/z-shell/zsh-zoxide

⚙️ The ajeetdsouza/zoxide init for Zsh
https://github.com/z-shell/zsh-zoxide

zoxide zsh zsh-plugins zshell

Last synced: about 1 month ago
JSON representation

⚙️ The ajeetdsouza/zoxide init for Zsh

Awesome Lists containing this project

README

        



Logo

❮ Plugin - Zsh zoxide ❯



ajeetdsouza/zoxide

The plugin calls zoxide init for Zsh.


zoxide is a smarter cd command, inspired by z and autojump.

## The [`ajeetdsouza/zoxide`](https://github.com/ajeetdsouza/zoxide)

### Environment variables

| Variable | Description | Default |
| -------------------------- | ----------------------------------------- | --------------------------------------- |
| \_ZO_CMD_PREFIX | Set variable to preferred prefix | Zi: x, other: z |
| \_ZO_DATA_DIR | Directory in which the database is stored | Zi: $ZPFX/share, other: none |

All environment variables: [ajeetdsouza/zoxide#environment-variables](https://github.com/ajeetdsouza/zoxide#environment-variables)

#### Eval-cache options

Before setting the environment variables, you must declare the associative array:

```shell
typeset -A ZEC
```

Set the following environment variables to change the default behavior:

| Variable | Description | Default |
| ------------------------ | ------------------------------------------------------- | --------------- |
| ZEC[DISABLED] | Disable eval-caching | 0 |
| ZEC[DEBUG] | Enable debug mode for eval-caching | 0 |
| ZEC[MAX] | Maximum number to load from cache (until force refresh) | 1000 |

> Eval-cache files are stored in ${Plugins[ZSH_ZOXIDE]}/.\_zoxide/\* directory.

### Install zoxide

- [Official install](https://github.com/ajeetdsouza/zoxide#step-1-install-zoxide) (recommended)
- With Zi:

```vim
zi ice as'null' from"gh-r" sbin
zi light ajeetdsouza/zoxide
```

> Wiki: install [fzf](https://wiki.zshell.dev/ecosystem/packages/usage#the-fzf-command-line-fuzzy-finder) command-line fuzzy finder as Zi package.

### Install **zsh-zoxide**

> **Note**:
>
> - the alternative for zsh-zoxide is [🌀 eval annex](https://wiki.zshell.dev/ecosystem/annexes/eval).
> - To forcefully set z function include atinit'z(){ \_\_zoxide_z "$@"; }' when installing with Zi ([#37](https://github.com/z-shell/zsh-zoxide/issues/37)).

#### [Standard syntax](https://wiki.zshell.dev/docs/guides/syntax/common#standard-syntax)

```vim
zi ice has'zoxide'
zi light z-shell/zsh-zoxide
```

#### [The "For" syntax](https://wiki.zshell.dev/docs/guides/syntax/for)

```vim
zi has'zoxide' light-mode for \
z-shell/zsh-zoxide
```

#### [Turbo mode](https://wiki.zshell.dev/docs/getting_started/overview#turbo-mode-zsh--53) + "For" syntax

```vim
zi has'zoxide' wait lucid for \
z-shell/zsh-zoxide
```

> Wiki: [automatic, condition based (loading/unloading)](https://wiki.zshell.dev/docs/getting_started/overview#automatic-condition-based---load--unload)

#### [Profile startup time](https://wiki.zshell.dev/docs/guides/benchmark)

After loading the plugin – shows profiling results and then unloads `zsh/zprof`

```vim
zi ice has'zoxide' atinit'zmodload zsh/zprof' \
atload'zprof | head -n 20; zmodload -u zsh/zprof'
zi light z-shell/zsh-zoxide
```

### Environment variables and usage with Zi

The plugin will call zoxide init with prefixed commands x, xi:

- [x] Completions auto-loaded: [commands](https://wiki.zshell.dev/docs/guides/commands#completions-management), [ice-modifiers](https://wiki.zshell.dev/docs/guides/syntax/ice-modifiers#completions)
- [x] Manpage auto installed: [\$ZI[MAN_DIR]](https://wiki.zshell.dev/docs/guides/customization#customizing-paths)
- [x] [Database](https://github.com/ajeetdsouza/zoxide#environment-variables) directory set: [\$ZPFX/share](https://wiki.zshell.dev/community/zsh_plugin_standard#global-parameter-with-prefix), [customizing-paths](https://wiki.zshell.dev/docs/guides/customization#customizing-paths)

```sh
x foo # cd into highest ranked directory matching foo
x foo bar # cd into highest ranked directory matching foo and bar
x foo / # cd into a subdirectory starting with foo
```

```sh
x ~/foo # x also works like a regular cd command
x foo/ # cd into relative path
x .. # cd one level up
x - # cd into the previous directory
```

```sh
xi foo # cd with interactive selection (using fzf)
```

```sh
x foo # show interactive completions
```

### Environment variables and usage with other plugin managers

The plugin will call `zoxide init` with prefixed commands `z`, and `zi`.