跳到主要内容

⚙️ Zi Console

z-shell/zi-console

A console for Zi – based on the zsh/zcurses Zshell module allows the user to:

  • View the currently loaded plugins in a colorful list, in one of 3 different display modes.
  • Unload and load plugins.
  • Delete the plugins and snippets from the disk.

Zi Console keybindings

Start the console by Ctrl-O Ctrl-J keyboard shortcut, or by running ziconsole function in the shell.

Key(s)Description
Ctrl-U ,Ctrl-DHalf page up; half page down
Ctrl-P ,Ctrl-NPrevious line, centered; next line, centered
Ctrl-LRedraw of whole display
[ , ]Jump to next and previous section (e.g.: next plugin or snippet)
g , GJump to beginning and end of whole interface
< ,> or { ,}Horizontal scroll (i.e.: left or right)
/Show incremental search
F1Jump to result (in incremental search) and back
EscExit incremental search, clearing query
Ctrl-WDelete whole word (in incremental search)
Ctrl-KDelete whole line (in incremental search)

Zi Console preview

Install Zi Console

Prerequisites: ZUI library.

Standard syntax:

zi load z-shell/zi-console

The plugin needs the zsh/curses Zsh module. You can check if it's available to your Zsh by executing:

zmodload zsh/curses

If the call will return an error, then the zsh/curses module isn't available.

Build the zsh/curses module

You can build the zsh/curses-equipped Z shell with Zi by the following command:

zi ice id-as"zsh" atclone"./.preconfig    CFLAGS='-I/usr/include -I/usr/local/include -g -O2 -Wall' \    LDFLAGS='-L/usr/lib -L/usr/local/lib' ./configure --prefix='$ZPFX'" \  atpull"%atclone" run-atpull make"install" pick"/dev/null"zi load zsh-users/zsh

The command will build a custom zsh and install it under $ZPFX (~/.zi/polaris by default). The path $ZPFX/bin is already added to $PATH by Zi at the first position, so starting zsh will run the new Z shell.

When on Gentoo, and possibly other systems, the zsh can still not have the ncurses library linked. To address this, utilize the z-a-patch-dl annex and automatically patch the source first:

zi light z-shell/z-a-patch-dlzi ice id-as"zsh" atclone"./.preconfig    CFLAGS='-I/usr/include -I/usr/local/include -g -O2 -Wall' \    LDFLAGS='-L/usr/lib -L/usr/local/lib' ./configure --prefix='$ZPFX'" \  dl"https://gist.githubusercontent.com/z-shell/2373494c71cb6d1529344a2ed1a64b03/raw -> curses.patch" \  patch'curses.patch' atpull"%atclone" reset \  run-atpull make"install" pick"/dev/null"zi load zsh-users/zsh

Then, to update, rebuild and reinstall the zsh, you can do zi update zsh. The binary can be safely copied over /bin/zsh as it has paths to all needed directories built-in.