### Manual Z-shell Setup: Prepare Installation Directories Source: https://github.com/z-shell/wiki/blob/main/docs/getting_started/01_installation.mdx Defines the home and binary directories for Zi and creates the necessary directory structure for manual installation. ```zsh typeset -Ag ZI typeset -gx ZI[HOME_DIR]="${HOME}/.zi" typeset -gx ZI[BIN_DIR]="${HOME}/.zi/bin" command mkdir -p "$ZI[BIN_DIR]" ``` -------------------------------- ### Installing Git Extension Plugins with `for` and Common Ices Source: https://github.com/z-shell/wiki/blob/main/docs/guides/syntax/02_for.mdx This example showcases how to install multiple Git extension plugins using the `zi for` syntax. It applies common `as"null"`, `wait"3"`, and `lucid` ices to all plugins, along with plugin-specific `sbin` and `make` commands for installation. This method streamlines the setup of several related tools. ```shell zi wait"3" lucid for as"null" \ sbin Fakerr/git-recall \ sbin paulirish/git-open \ sbin paulirish/git-recent \ sbin davidosomething/git-my \ make"PREFIX=$ZPFX install" iwata/git-now \ make"PREFIX=$ZPFX" tj/git-extras ``` -------------------------------- ### ZUI Hello World Application Initialization and Execution Source: https://github.com/z-shell/wiki/blob/main/ecosystem/plugins/zui.mdx Demonstrates a basic ZUI 'Hello World' application. It covers initializing the ZUI environment, setting up an application configuration, defining a content generator function, and starting the ZUI event loop. This example showcases the minimal setup required to run a ZUI application from Zle or the command line. ```shell -zui_std_cleanup deserialize:"zui-demo-hello-world" -zui_std_init app:"zui-demo-hello-world" app_name:"ZUI Hello World" emulate -LR zsh -o extended_glob -o type_set_silent -o warn_create_global -zui_std_init2 # after emulate -LR -zui_std_store_default_app_config b:border 1 demo_generator_A() { local mod="$1" ice="$2" # Content, no hyper-links reply=( "Hello World from ${ZUI[YELLOW]}ZUI${ZUI[FMT_END]}! Module $mod, instance $ice." ) # Non-selectable lines Hops to jump with [ and ] Local anchors reply2=( ) reply3=( 1 ) reply4=( ) } ## Start application ## zui-event-loop 1:demo_generator_A -zui_std_cleanup serialize ``` -------------------------------- ### Simplifying fzf Installation with Zi Packages Source: https://github.com/z-shell/wiki/blob/main/ecosystem/packages/01_synopsis.mdx Compares the traditional, complex method of installing `fzf` with Zi's simplified `zi pack` command. The package approach streamlines setup, including completions and additional executables, and allows for updates similar to a package manager. ```shell zi lucid as=program pick="$ZPFX/bin/(fzf|fzf-tmux)" \ atclone="cp shell/completion.zsh _fzf_completion; \ cp bin/(fzf|fzf-tmux) $ZPFX/bin" \ make="PREFIX=$ZPFX install" for \ junegunn/fzf ``` ```shell zi pack for fzf ``` -------------------------------- ### API Documentation for Zi GitHub Release Installation Source: https://github.com/z-shell/wiki/blob/main/i18n/ja/docusaurus-plugin-content-docs/current/guides/syntax/01_standard.mdx This table describes the `zi` parameters specific to installing `direnv` from GitHub releases. It explains `from'gh-r'` and `mv'direnv* -> direnv'`, noting that other parameters are similar to previous examples. ```APIDOC from'gh-r' Install from direnv from GitHub Github releases. mv'direnv* -> direnv' After installation, rename direnv.linux-386 or similar file to direnv. atclone'…', atpull'…' Same above example. pick'direnv' Same above example. as'program' Same above example. ``` -------------------------------- ### Install fzf Binary Release from GitHub Source: https://github.com/z-shell/wiki/blob/main/docs/getting_started/02_overview.mdx This example shows how to install a binary release like 'fzf' directly from GitHub using `zi`. The `from"gh-r"` modifier indicates that the source is a GitHub release, and `as"program"` ensures that the downloaded archive is automatically unpacked and the executable is made available as a program. ```shell zi ice from"gh-r" as"program" zi light junegunn/fzf ``` -------------------------------- ### Install ogham/exa Program from GitHub Releases Source: https://github.com/z-shell/wiki/blob/main/community/gallery/collection/03_programs.mdx Command to install `exa`, a modern replacement for `ls`, using `zi` from GitHub releases, including sbin handling and post-clone setup for completions. ```shell zi ice from'gh-r' as'program' sbin'**/exa -> exa' atclone'cp -vf completions/exa.zsh _exa' zi light ogham/exa ``` -------------------------------- ### Automated Z-shell Installation with ZUnit Source: https://github.com/z-shell/wiki/blob/main/i18n/zh-Hant/docusaurus-plugin-content-docs/current/getting_started/01_installation.mdx This command installs Z-shell, including recommended annexes, and sets up `zdharma/zunit`, a testing framework. It streamlines the setup for developers who require testing capabilities within their Z-shell environment. ```shell sh -c "$(curl -fsSL get.zshell.dev)" -- -a zunit ``` -------------------------------- ### Comprehensive Example: Installing `fbterm` with `dl` and `patch` Source: https://github.com/z-shell/wiki/blob/main/i18n/zh-Hant/docusaurus-plugin-content-docs-ecosystem/current/annexes/4_patch-dl.mdx A practical example showing how to install `fbterm` using both `dl` and `patch` ice-modifiers. This command downloads two specific patches, applies them, and then configures and installs `fbterm` into the Zsh plugin manager's prefix. ```shell zi ice as"command" pick"$ZPFX/bin/fbterm" \ dl"https://bugs.archlinux.org/task/46860?getfile=13513 -> ins.patch" \ dl"https://aur.archlinux.org/cgit/aur.git/plain/0001-Fix-build-with-gcc-6.patch?h=fbterm-git" \ patch"ins.patch; 0001-Fix-build-with-gcc-6.patch" \ atclone"./configure --prefix=$ZPFX" \ atpull"%atclone" make"install" reset zi load izmntuk/fbterm ``` -------------------------------- ### Automated Z-shell Installation with Annexes Source: https://github.com/z-shell/wiki/blob/main/i18n/zh-Hant/docusaurus-plugin-content-docs/current/getting_started/01_installation.mdx This command installs Z-shell along with recommended annexes, which are extensions providing additional functionalities. It automates the setup process to provide a more feature-rich Z-shell environment. ```shell sh -c "$(curl -fsSL get.zshell.dev)" -- -a annex ``` -------------------------------- ### Compile and Install Git-Extras with Zi Source: https://github.com/z-shell/wiki/blob/main/i18n/zh-Hant/docusaurus-plugin-content-docs/current/guides/syntax/01_standard.mdx Shows how to use `zi ice` to compile and install `git-extras` into the `$ZPFX` prefix. It uses `make"PREFIX=$ZPFX"` to specify the installation directory and `pick"$ZPFX/bin/git-*"` to add the installed binaries to `$PATH`. ```shell zi ice as"program" pick"$ZPFX/bin/git-*" make"PREFIX=$ZPFX" zi light tj/git-extras ``` -------------------------------- ### Compile and Install Vim to ZPFX with Zi Source: https://github.com/z-shell/wiki/blob/main/docs/guides/syntax/01_standard.mdx Demonstrates how to compile and install Vim to the `$ZPFX` directory using Zi, including passing `--prefix=$ZPFX` to `./configure` and running `make all install`. ```shell zi ice as'program' atclone'rm -f src/auto/config.cache; \n ./configure --prefix=$ZPFX' atpull'%atclone' make'all install' pick'$ZPFX/bin/vim' zi light vim/vim ``` -------------------------------- ### Load a Zsh plugin using zi load Source: https://github.com/z-shell/wiki/blob/main/docs/guides/syntax/01_standard.mdx Demonstrates how to load a Zsh plugin from a repository using the `zi load` command. This command installs the plugin and applies its setup instructions. ```shell zi load z-shell/0 ``` -------------------------------- ### Example: Installing `youtube-dl` pip package with `zi ice` Source: https://github.com/z-shell/wiki/blob/main/ecosystem/annexes/1_bin_gem_node.mdx Demonstrates how to install the `youtube-dl` pip package using `zi ice`. It assigns the ID 'youtube-dl' to the installation and loads it from the `z-shell/0` empty repository, skipping file compilation. `z-shell/0` is an empty repository used to store the package, `id-as` assigns a name, and `nocompile` skips compilation. ```shell zi ice pip'youtube-dl <- !youtube-dl -> youtube-dl' id-as'youtube-dl' nocompile zi load z-shell/0 ``` -------------------------------- ### Install fzy fuzzy finder with various zi pack profiles Source: https://github.com/z-shell/wiki/blob/main/ecosystem/packages/02_usage.mdx This section details how to install the `fzy` fuzzy finder using `zi pack`, offering different installation methods. It includes default installation, using the `bin-gem-node` annex, installing from a Git repository, and an example of overriding `atclone` ice for custom behavior. ```shell zi pack for fzy ``` ```shell zi pack"bgn" for fzy ``` ```shell zi pack"bgn" git for fzy ``` ```shell zi pack"bgn" atclone'' for fzy ``` -------------------------------- ### Load a Zsh Plugin Source: https://github.com/z-shell/wiki/blob/main/i18n/zh-Hant/docusaurus-plugin-content-docs/current/guides/syntax/01_standard.mdx Demonstrates how to load a Zsh plugin using the `zi load` command. This command installs the plugin and executes its setup instructions. ```shell zi load z-shell/0 ``` -------------------------------- ### Install meta-plugins with specific plugin exclusions Source: https://github.com/z-shell/wiki/blob/main/i18n/ja/docusaurus-plugin-content-docs-ecosystem/current/annexes/2_meta_plugins.mdx This advanced example demonstrates installing meta-plugins while explicitly skipping certain constituent plugins. It installs `@annexes`, `@zsh-users` (skipping `zsh-completions`), and `@console-tools` (skipping `vivid`, `exa`, `tig`). This allows fine-grained control over plugin installation. ```shell zi light-mode for @annexes \ skip'zsh-completions' @zsh-users \ skip'vivid exa tig' @console-tools ``` -------------------------------- ### Manual Z-shell Setup: Enable Zi Completions Source: https://github.com/z-shell/wiki/blob/main/docs/getting_started/01_installation.mdx Adds a snippet to .zshrc to enable Zi's completion system. This snippet must be placed after the main Zi enabling snippet. ```zsh autoload -Uz _zi (( ${+_comps} )) && _comps[zi]=_zi ``` -------------------------------- ### Install fzy fuzzy finder with zi pack and various options Source: https://github.com/z-shell/wiki/blob/main/i18n/zh-Hans/docusaurus-plugin-content-docs-ecosystem/current/packages/02_usage.mdx Outlines different methods for installing the `fzy` fuzzy finder using `zi pack`. This includes default installation, using the `bin-gem-node` annex, installing from a Git repository, and an example of overriding `atclone` ice for custom behavior. ```shell zi pack for fzy ``` ```shell zi pack"bgn" for fzy ``` ```shell zi pack"bgn" git for fzy ``` ```shell zi pack"bgn" atclone'' for fzy ``` -------------------------------- ### Install fzf fuzzy finder with various zi pack profiles Source: https://github.com/z-shell/wiki/blob/main/ecosystem/packages/02_usage.mdx This section provides multiple `zi pack` commands to install the `fzf` fuzzy finder, demonstrating different installation profiles. Options include default, key bindings, `bin-gem-node` annex, Git source, and direct binary downloads, catering to various user preferences and system setups. ```shell zi pack for fzf ``` ```shell zi pack"default+keys" for fzf ``` ```shell zi pack"bgn" for fzf ``` ```shell zi pack"bgn+keys" for fzf ``` ```shell zi pack"bgn" git for fzf ``` ```shell zi pack"binary" for fzf ``` ```shell zi pack"bgn-binary" for fzf ``` -------------------------------- ### Zsh `zi ice` Options for Program Installation Source: https://github.com/z-shell/wiki/blob/main/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/syntax/01_standard.mdx This API documentation details the `zi ice` options specifically for installing programs, highlighting modifications to `atclone` for prefixing and `make` for running the install target, along with `pick` for the installed binary path. ```APIDOC Syntax | Description ------------------ | :------------------------------------------------------------------------------------------- `as'program'` | As above. `atclone'…'` | As above **plus** pass `--prefix=$ZPFX` to `./configure`, to set the installation directory. `atpull'%atclone'` | As above. `make` | As above, but also run the `install` target. `pick'src/vim'` | as above, but for a different path `$ZPFX/bin/vim`. ``` -------------------------------- ### Compile and Install Vim to ZPFX with Zi Source: https://github.com/z-shell/wiki/blob/main/i18n/zh-Hant/docusaurus-plugin-content-docs/current/guides/syntax/01_standard.mdx Illustrates how to compile and install Vim into the `$ZPFX` directory. It uses `atclone` to pass `--prefix=$ZPFX` to `./configure` and `make'all install'` to run the install target. The `pick` modifier ensures the installed binary at `$ZPFX/bin/vim` is added to `$PATH`. ```shell zi ice as'program' atclone'rm -f src/auto/config.cache; \ ./configure --prefix=$ZPFX' atpull'%atclone' make'all install' pick'$ZPFX/bin/vim' zi light vim/vim ``` -------------------------------- ### Z-shell `pip` ice command example for `youtube-dl` Source: https://github.com/z-shell/wiki/blob/main/i18n/zh-Hant/docusaurus-plugin-content-docs-ecosystem/current/annexes/1_bin_gem_node.mdx This example demonstrates installing the `youtube-dl` Python package using `zi ice pip`. It ensures the `youtube-dl` binary is available as `youtube-dl` and loads it into the `z-shell/0` empty repository. ```shell zi ice pip'youtube-dl <- !youtube-dl -> youtube-dl' id-as'youtube-dl' nocompile zi load z-shell/0 ``` -------------------------------- ### Install multiple Git extension plugins with common and specific ices Source: https://github.com/z-shell/wiki/blob/main/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/syntax/02_for.mdx This example showcases installing six Git extension plugins using `zi for`. It applies common `as "null" wait "3" lucid` ices to all plugins and includes specific `make` ices for `git-now` and `git-extras`, demonstrating flexible configuration for a set of plugins. ```shell zi wait"3" lucid for as"null" \ sbin Fakerr/git-recall \ sbin paulirish/git-open \ sbin paulirish/git-recent \ sbin davidosomething/git-my \ make"PREFIX=$ZPFX install" iwata/git-now \ make"PREFIX=$ZPFX" tj/git-extras ``` -------------------------------- ### Manual Z-shell Setup: Enable Zi in .zshrc Source: https://github.com/z-shell/wiki/blob/main/docs/getting_started/01_installation.mdx Adds a snippet to the .zshrc file to define the Zi binary directory and source the main zi.zsh script, enabling Zi in the shell. ```zsh typeset -A ZI ZI[BIN_DIR]="${HOME}/.zi/bin" source "${ZI[BIN_DIR]}/zi.zsh" ``` -------------------------------- ### Install multiple meta-plugins using zi light mode Source: https://github.com/z-shell/wiki/blob/main/i18n/zh-Hant/docusaurus-plugin-content-docs-ecosystem/current/annexes/2_meta_plugins.mdx This snippet illustrates how to install several meta-plugins simultaneously. It shows the 'zi light-mode for' syntax to include '@annexes', '@zsh-users', and '@console-tools' in a single command, streamlining the setup process. ```shell zi light-mode for @annexes @zsh-users @console-tools ``` -------------------------------- ### Z-Shell Installer Service URLs Source: https://github.com/z-shell/wiki/blob/main/docs/getting_started/01_installation.mdx Provides direct URLs for downloading and executing the Z-Shell installer script from various services. These links can be used for automated or manual installation processes. ```APIDOC Service: Git.io URL: https://git.io/get-zi Service: GitHub RAW URL: https://raw.githubusercontent.com/z-shell/zi-src/main/lib/sh/install.sh ``` -------------------------------- ### Manual Z-shell Directory Preparation Source: https://github.com/z-shell/wiki/blob/main/i18n/zh-Hant/docusaurus-plugin-content-docs/current/getting_started/01_installation.mdx This snippet prepares the necessary installation directories for Z-shell by defining `ZI` environment variables for the home and binary directories. It then creates the binary directory, which is a prerequisite for manual installation. ```shell typeset -Ag ZI typeset -gx ZI[HOME_DIR]="${HOME}/.zi" typeset -gx ZI[BIN_DIR]="${HOME}/.zi/bin" command mkdir -p "$ZI[BIN_DIR]" ``` -------------------------------- ### Installing Gems and Node Modules with Zi Packages Source: https://github.com/z-shell/wiki/blob/main/ecosystem/packages/01_synopsis.mdx Demonstrates how to use `zi pack` with `any-gem` and `any-node` to install Ruby Gems and Node.js modules locally. It also shows how to use `id-as` when installing from `.zshrc` to indicate the package is already installed, allowing for Unicode arrows in syntax. ```shell zi pack param='GEM -> rails' for any-gem zi pack param='MOD -> doctoc' for any-node ``` ```shell zi id-as=jekyll pack param='GEM → jekyll' for any-gem ``` -------------------------------- ### Manual Z-shell Setup: Fix Permissions and Clone Repository Source: https://github.com/z-shell/wiki/blob/main/docs/getting_started/01_installation.mdx Checks and fixes file permissions to ensure the completion system uses files owned by the current user and then clones the Zi repository into the designated binary directory. ```zsh compaudit | xargs chown -R "$(whoami)" "$ZI[HOME_DIR]" compaudit | xargs chmod -R go-w "$ZI[HOME_DIR]" command git clone https://github.com/z-shell/zi.git "$ZI[BIN_DIR]" ``` -------------------------------- ### Install a single meta-plugin Source: https://github.com/z-shell/wiki/blob/main/i18n/zh-Hans/docusaurus-plugin-content-docs-ecosystem/current/annexes/2_meta_plugins.mdx Demonstrates the basic command to install a single meta-plugin using `zi light`. ```shell zi light @annexes ``` -------------------------------- ### Z-shell: Example for installing fbterm with dl and patch Source: https://github.com/z-shell/wiki/blob/main/i18n/zh-Hans/docusaurus-plugin-content-docs-ecosystem/current/annexes/4_patch-dl.mdx This example demonstrates the use of `dl` and `patch` ice-modifiers to install `fbterm`. It downloads two patches, applies them, then configures and installs `fbterm` using `atclone`, `atpull`, and `make`. ```shell zi ice as"command" pick"$ZPFX/bin/fbterm" \ dl"https://bugs.archlinux.org/task/46860?getfile=13513 -> ins.patch" \ dl"https://aur.archlinux.org/cgit/aur.git/plain/0001-Fix-build-with-gcc-6.patch?h=fbterm-git" \ patch"ins.patch; 0001-Fix-build-with-gcc-6.patch" \ atclone"./configure --prefix=$ZPFX" \ atpull"%atclone" make"install" reset zi load izmntuk/fbterm ``` -------------------------------- ### Automated Z-shell Installation with Recommended Annexes Source: https://github.com/z-shell/wiki/blob/main/docs/getting_started/01_installation.mdx Installs Z-shell and includes minimal configuration along with recommended annexes for extended functionality. ```shell sh -c "$(curl -fsSL get.zshell.dev)" -- -a annex ``` -------------------------------- ### Compile and Install Program with Zsh `zi ice` Source: https://github.com/z-shell/wiki/blob/main/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/syntax/01_standard.mdx This snippet extends the compilation process to include installation under a specified prefix (`$ZPFX`). It uses `atclone` to configure with `--prefix` and `make'all install'` to run both build and install targets, picking the installed executable. ```shell zi ice as'program' atclone'rm -f src/auto/config.cache; \ ./configure --prefix=$ZPFX' atpull'%atclone' make'all install' pick'$ZPFX/bin/vim' zi light vim/vim ``` -------------------------------- ### Loading Oh-My-Zsh and Prezto Plugins using Shorthands Source: https://github.com/z-shell/wiki/blob/main/i18n/ja/docusaurus-plugin-content-docs/current/getting_started/02_overview.mdx Introduces convenient `OMZ::` and `PZT::` shorthands for loading Oh-My-Zsh and Prezto plugins, simplifying the `zi snippet` command by abstracting the full GitHub URLs. ```shell zi snippet OMZ::plugins/git/git.plugin.zsh zi snippet PZT::modules/helper/init.zsh ``` -------------------------------- ### Load Pure Theme with Zi Source: https://github.com/z-shell/wiki/blob/main/docs/getting_started/02_overview.mdx This example shows how to load the `pure` theme using `zi light`. It specifies to `pick` the `async.zsh` library and `src` (source) `pure.zsh` for proper theme initialization and functionality. ```shell zi ice pick"async.zsh" src"pure.zsh"\ zi light sindresorhus/pure ``` -------------------------------- ### Install fzf binary release from GitHub Source: https://github.com/z-shell/wiki/blob/main/i18n/zh-Hant/docusaurus-plugin-content-docs/current/getting_started/02_overview.mdx Shows how to install a binary release like 'fzf' directly from GitHub archives, with automatic unpacking and program availability. ```shell zi ice from"gh-r" as"program" zi light junegunn/fzf ``` -------------------------------- ### Z-shell `node` ice command example for `remark-cli` Source: https://github.com/z-shell/wiki/blob/main/i18n/zh-Hant/docusaurus-plugin-content-docs-ecosystem/current/annexes/1_bin_gem_node.mdx This example demonstrates installing the `remark-cli` Node.js module using `zi ice node`. It renames the binary `remark-cli` to `remark` and also installs `remark-man`, loading them into the `z-shell/0` empty repository. ```shell zi ice node'remark <- !remark-cli -> remark; remark-man' id-as'remark' nocompile zi load z-shell/0 ``` -------------------------------- ### Z-shell `gem` ice command example for `asciidoctor` Source: https://github.com/z-shell/wiki/blob/main/i18n/zh-Hant/docusaurus-plugin-content-docs-ecosystem/current/annexes/1_bin_gem_node.mdx This example demonstrates installing the `asciidoctor` gem using `zi ice gem`. It specifies `id-as'asciidoctor'` to assign a name to the installation and `nocompile` to skip file compilation, loading it into the `z-shell/0` empty repository. ```shell zi ice gem'!asciidoctor' id-as'asciidoctor' nocompile zi load z-shell/0 ``` -------------------------------- ### Load Starship Prompt Theme with Zi Source: https://github.com/z-shell/wiki/blob/main/i18n/ja/docusaurus-plugin-content-docs/current/getting_started/02_overview.mdx This snippet demonstrates loading the Starship prompt theme, which is distributed as a binary. It uses `zi ice` to pick the `starship` binary from a GitHub release, sets up `atclone` and `atpull` hooks to generate `init.zsh` and completions, and then sources `init.zsh` for theme activation. ```shell zi ice as"command" from"gh-r" \ atclone"./starship init zsh > init.zsh; ./starship completions zsh > _starship" \ atpull"%atclone" src"init.zsh"\ zi light starship/starship ``` -------------------------------- ### Integrate Precmd Hooks with Turbo Mode Source: https://github.com/z-shell/wiki/blob/main/docs/getting_started/02_overview.mdx This example demonstrates how to use `atload` ice with `zi load` to ensure prompt setup functions are called immediately after turbo mode loading. This fixes issues like autosuggestions being inactive at the first prompt by explicitly calling the necessary `precmd` functions. ```shell zi ice wait'!' lucid nocd \ atload'!prompt_zinc_setup; prompt_zinc_precmd'\ zi load robobenklein/zinc ``` -------------------------------- ### Automated Z-shell Installation with ZUnit Source: https://github.com/z-shell/wiki/blob/main/docs/getting_started/01_installation.mdx Installs Z-shell with minimal configuration, recommended annexes, and sets up zdharma/zunit for testing. ```shell sh -c "$(curl -fsSL get.zshell.dev)" -- -a zunit ``` -------------------------------- ### Install Agkozak Zsh Prompt as Zi Meta-Plugin Source: https://github.com/z-shell/wiki/blob/main/community/gallery/collection/07_themes.mdx Installs the Agkozak Zsh prompt as a meta-plugin using `zi`, simplifying its setup and management. ```shell zi for @agkozak/agkozak-zsh-prompt ``` -------------------------------- ### Automated Z-shell Installation with Branch Specification Source: https://github.com/z-shell/wiki/blob/main/i18n/zh-Hant/docusaurus-plugin-content-docs/current/getting_started/01_installation.mdx This command initiates an automated installation of Z-shell, skipping interactive prompts and specifying a particular branch (e.g., 'main') for the installation. It uses `curl` to fetch and execute the installation script from `get.zshell.dev`. ```shell sh -c "$(curl -fsSL get.zshell.dev)" -- -i skip -b main ``` -------------------------------- ### Load Starship Theme with Zi Source: https://github.com/z-shell/wiki/blob/main/docs/getting_started/02_overview.mdx This snippet provides an example of loading the `starship` theme using `zi light`. It configures `zi` to pick the `starship` binary as a command from GitHub releases and sets up `atclone` and `atpull` hooks for initialization and updates, ensuring the theme is correctly set up and maintained. ```shell zi ice as"command" from"gh-r" \ atclone"./starship init zsh > init.zsh; ./starship completions zsh > _starship" \ atpull"%atclone" src"init.zsh"\ zi light starship/starship ``` -------------------------------- ### Install multiple meta-plugins in light-mode Source: https://github.com/z-shell/wiki/blob/main/i18n/ja/docusaurus-plugin-content-docs-ecosystem/current/annexes/2_meta_plugins.mdx This example shows how to install multiple meta-plugins (`@annexes`, `@zsh-users`, `@console-tools`) simultaneously using `zi light-mode for`. ```shell zi light-mode for @annexes @zsh-users @console-tools ``` -------------------------------- ### Examples of Zi Plugin and Snippet Loading Source: https://github.com/z-shell/wiki/blob/main/i18n/zh-Hant/docusaurus-plugin-content-docs/current/getting_started/02_overview.mdx This section provides concrete examples of how to use `zi load`, `zi light`, and `zi snippet` for various scenarios. It shows loading a specific plugin with reporting, loading multiple plugins without reporting, and sourcing a remote file via a direct URL. ```shell zi load z-shell/H-S-MW ``` ```shell zi light zsh-users/zsh-autosuggestions zi light z-shell/F-Sy-H ``` ```shell zi snippet https://gist.githubusercontent.com/hightemp/5071909/raw/ ``` -------------------------------- ### Install rootless statically-linked Zsh to user local directory Source: https://github.com/z-shell/wiki/blob/main/ecosystem/packages/02_usage.mdx This command installs a statically-linked Zsh binary without requiring root access. The installation is performed to the user's `~/.local` directory, providing a self-contained setup. ```shell zi pack\"rootless\" for zsh-bin ``` -------------------------------- ### Loading Oh-My-Zsh and Prezto Plugins with Shorthand Snippet URLs Source: https://github.com/z-shell/wiki/blob/main/docs/getting_started/02_overview.mdx Illustrates the use of `OMZ::` and `PZT::` shorthands with `zi snippet` for more concise loading of Oh-My-Zsh and Prezto plugins, simplifying the URL specification. ```shell zi snippet OMZ::plugins/git/git.plugin.zsh zi snippet PZT::modules/helper/init.zsh ``` -------------------------------- ### Install Rust Globally with Custom Configuration Source: https://github.com/z-shell/wiki/blob/main/i18n/zh-Hant/docusaurus-plugin-content-docs-ecosystem/current/annexes/9_rust.mdx Provides an example of installing Rust globally, making `rustc` available and setting `CARGO_HOME` and `RUSTUP_HOME` environment variables. ```shell zi ice id-as"rust" wait"0" lucid rustup as"command" pick"bin/rustc" atload="export \\n CARGO_HOME=\$PWD RUSTUP_HOME=\$PWD/rustup" zi load z-shell/0 ``` -------------------------------- ### API Reference for Zi 'from' and 'mv' syntax Source: https://github.com/z-shell/wiki/blob/main/i18n/zh-Hant/docusaurus-plugin-content-docs/current/guides/syntax/01_standard.mdx This API documentation explains additional Zi syntaxes for installing plugins from GitHub releases and renaming files. It covers `from'gh-r'` for specifying GitHub releases as the installation source and `mv'…'` for post-installation file renaming. It also references previously explained syntaxes like `atclone'…'`, `atpull'…'`, `pick'…'`, and `as'program'` which apply to this installation method as well. ```APIDOC from'gh-r': Install from direnv from GitHub Github releases. mv'direnv* -> direnv': After installation, rename direnv.linux-386 or similar file to direnv. atclone'…', atpull'…': Same above example. pick'direnv': Same above example. as'program': Same above example. ``` -------------------------------- ### Automated Z-shell Repository Cloning Source: https://github.com/z-shell/wiki/blob/main/docs/getting_started/01_installation.mdx Clones the Z-shell repository using the automated script, skipping the installation of configuration to .zshrc. Useful for manual setup or custom paths. ```shell sh -c "$(curl -fsSL get.zshell.dev)" -- -i skip ``` -------------------------------- ### Enable Zsh Startup Profiling (Method 1 - Start) Source: https://github.com/z-shell/wiki/blob/main/i18n/ja/docusaurus-plugin-content-docs/current/guides/03_benchmark.mdx This snippet, placed at the top of `.zshrc`, initializes `zsh/zprof` and configures `xtrace` for detailed startup profiling. It redirects stderr to a log file for capturing trace output, enabling a deep dive into startup performance. ```shell PROFILE_STARTUP=false if [[ "$PROFILE_STARTUP" == true ]]; then zmodload zsh/zprof PS4=$'%D{%M%S%.} %N:%i> ' exec 3>&2 2>$HOME/startlog.$$ setopt xtrace prompt_subst fi ``` -------------------------------- ### Install meta-plugins with skipped components Source: https://github.com/z-shell/wiki/blob/main/ecosystem/annexes/2_meta_plugins.mdx Demonstrates how to install Z-shell meta-plugins while selectively skipping specific components or plugins from other meta-plugins using the `skip` keyword, allowing for fine-grained control over installations. ```shell zi light-mode for @annexes \ skip'zsh-completions' @zsh-users \ skip'vivid exa tig' @console-tools ``` -------------------------------- ### Install zsh-startify plugin with zi Source: https://github.com/z-shell/wiki/blob/main/ecosystem/plugins/zsh_startify.mdx Instructions for installing the zsh-startify plugin using the `zi` plugin manager. The standard method loads synchronously, while turbo mode loads asynchronously. ```shell zi ice atload'zsh-startify' zi load z-shell/zsh-startify ``` ```shell zi ice wait'0' lucid atload'zsh-startify' zi load z-shell/zsh-startify ``` -------------------------------- ### Install meta-plugins while skipping specific components Source: https://github.com/z-shell/wiki/blob/main/i18n/zh-Hant/docusaurus-plugin-content-docs-ecosystem/current/annexes/2_meta_plugins.mdx This advanced snippet shows how to install meta-plugins while excluding certain constituent plugins. It uses the 'skip' keyword to prevent 'zsh-completions' from '@zsh-users' and 'vivid', 'exa', 'tig' from '@console-tools' from being installed, offering fine-grained control over the setup. ```shell zi light-mode for @annexes \ skip'zsh-completions' @zsh-users \ skip'vivid exa tig' @console-tools ``` -------------------------------- ### Enable Zsh Startup Profiling with zprof (Part 1) Source: https://github.com/z-shell/wiki/blob/main/i18n/zh-Hant/docusaurus-plugin-content-docs/current/guides/03_benchmark.mdx This snippet, placed at the top of `.zshrc`, initializes `zsh/zprof` and configures `xtrace` with a custom `PS4` prompt to log startup events to a file. Set `PROFILE_STARTUP=true` to activate. ```shell PROFILE_STARTUP=false if [[ "$PROFILE_STARTUP" == true ]]; then zmodload zsh/zprof PS4=$'%D{%M%S%.} %N:%i> ' exec 3>&2 2>$HOME/startlog.$$ setopt xtrace prompt_subst fi ``` -------------------------------- ### Prezto Shorthand Syntax for zi snippet Source: https://github.com/z-shell/wiki/blob/main/i18n/zh-Hans/docusaurus-plugin-content-docs/current/getting_started/03_migration.mdx This snippet illustrates different shorthand syntaxes for loading Prezto modules and snippets using `zi snippet`. It demonstrates how to use a raw URL, a general Prezto shorthand (`PZT::`), and a specific Prezto modules shorthand (`PZTM::`) for streamlined configuration. ```shell zi snippet # Raw syntax with URL zi snippet PZT:: # Shorthand PZT:: (https://github.com/sorin-ionescu/prezto/tree/master/) zi snippet PZTM:: # Shorthand PZT::modules/ (https://github.com/sorin-ionescu/prezto/tree/master/modules/) ``` -------------------------------- ### Install Specific Zsh Version from zsh-users Mirror Source: https://github.com/z-shell/wiki/blob/main/i18n/zh-Hans/docusaurus-plugin-content-docs-ecosystem/current/packages/02_usage.mdx Installs a preferred specific version of Zsh from the 'zsh-users' mirror using the 'zi pack' command. Multiple version examples are provided to demonstrate flexibility. ```shell zi pack"5.9" for zsh zi pack"5.8.1" for zsh zi pack"5.8" for zsh zi pack"5.7.1" for zsh zi pack"5.6.2" for zsh zi pack"5.5.1" for zsh zi pack"5.4.2" for zsh zi pack"5.3.1" for zsh zi pack"5.2.4" for zsh zi pack"5.1.1" for zsh ``` -------------------------------- ### Install and Configure Starship Prompt with ZI Source: https://github.com/z-shell/wiki/blob/main/community/gallery/collection/07_themes.mdx Demonstrates how to use `zi` to install the `starship` cross-shell prompt. It fetches the latest release, initializes `starship` for Zsh, generates completion files, and then loads the plugin. The `as"command" from"gh-r"` ensures `starship` is treated as a command fetched from GitHub releases. ```shell zi ice as"command" from"gh-r" \ atclone"./starship init zsh > init.zsh; ./starship completions zsh > _starship" \ atpull"%atclone" src"init.zsh" zi light starship/starship ``` -------------------------------- ### Install fzf fuzzy finder with zi pack and various options Source: https://github.com/z-shell/wiki/blob/main/i18n/zh-Hans/docusaurus-plugin-content-docs-ecosystem/current/packages/02_usage.mdx Illustrates diverse installation methods for the `fzf` fuzzy finder using `zi pack`. Options include default installation, adding key bindings, utilizing the `bin-gem-node` annex, installing from Git, and downloading pre-compiled binaries. ```shell zi pack for fzf ``` ```shell zi pack"default+keys" for fzf ``` ```shell zi pack"bgn" for fzf ``` ```shell zi pack"bgn+keys" for fzf ``` ```shell zi pack"bgn" git for fzf ``` ```shell zi pack"binary" for fzf ``` ```shell zi pack"bgn-binary" for fzf ``` -------------------------------- ### Managing `compinit` and `compdef` with Zi Source: https://github.com/z-shell/wiki/blob/main/i18n/zh-Hant/docusaurus-plugin-content-docs/current/guides/01_commands.mdx This example demonstrates how to correctly call `compinit` and use `zi cdreplay` in a `.zshrc` file. Zi intercepts `compdef` calls before `compinit` is loaded, storing them to be replayed later, which optimizes shell startup time. ```shell source ~/.zi/bin/zi.zsh zi load "some/plugin" (…) compdef _gnu_generic fd # this will be intercepted by ZI, because as the compinit # isn't yet loaded, thus there's no such function `compdef'; yet # ZI provides its own `compdef' function which saves the # completion-definition for later possible re-run with `zi # cdreplay' or `zicdreplay' (the second one can be used in hooks # like atload'…', atinit'…', etc.) (…) zi load "other/plugin" autoload -Uz compinit compinit zi cdreplay -q # -q is for quiet; actually, run all the `compdef's saved before #`compinit` call (`compinit' declares the `compdef' function, so # it cannot be used until `compinit' is run; ZI solves this # via intercepting the `compdef'-calls and storing them for later # use with `zi cdreplay') ``` -------------------------------- ### ZNT n-list Automatic Colorization Example Source: https://github.com/z-shell/wiki/blob/main/ecosystem/plugins/zsh_navigation_tools.mdx Provides an example of how to automatically colorize `n-list` entries using Zsh patterns. It sets local variables for the coloring pattern, start and end ANSI colors, and enables multiple matches, then demonstrates the effect with example strings passed to `n-list`. ```shell local NLIST_COLORING_PATTERN="[0-9]##" local NLIST_COLORING_COLOR=$'\x1b[00;34m' local NLIST_COLORING_END_COLOR=$'\x1b[0m' local NLIST_COLORING_MATCH_MULTIPLE=1 n-list "This is a number 123" "This line too has a number: 456" ``` -------------------------------- ### Simplified fzf Installation with Zi pack Source: https://github.com/z-shell/wiki/blob/main/i18n/zh-Hans/docusaurus-plugin-content-docs-ecosystem/current/packages/01_synopsis.mdx Presents the streamlined approach to installing `fzf` using the new `zi pack` command. This single command automatically handles the completion setup and additional executables like `fzf-tmux`, significantly simplifying the installation process compared to the traditional method. ```shell zi pack for fzf ``` -------------------------------- ### Load Starship Zsh Prompt Source: https://github.com/z-shell/wiki/blob/main/i18n/zh-Hant/docusaurus-plugin-content-docs/current/getting_started/02_overview.mdx This `zi` configuration loads the `starship` prompt. It's set to download `starship` as a command from GitHub releases (`as"command" from"gh-r"`). `atclone` and `atpull` hooks are used to initialize `starship` and generate completions, while `src"init.zsh"` sources the necessary setup file. ```shell zi ice as"command" from"gh-r" \ atclone"./starship init zsh > init.zsh; ./starship completions zsh > _starship" \ atpull"%atclone" src"init.zsh"\ zi light starship/starship ``` -------------------------------- ### Install specific plugins and multiple meta-plugins Source: https://github.com/z-shell/wiki/blob/main/i18n/zh-Hant/docusaurus-plugin-content-docs-ecosystem/current/annexes/2_meta_plugins.mdx This example demonstrates a more granular installation, combining a specific plugin ('z-a-meta-plugins') with multiple meta-plugins ('@annexes', '@ext-git', '@zsh-users'). The backslash indicates line continuation for readability in the shell. ```shell zi light-mode for z-a-meta-plugins \ @annexes @ext-git @zsh-users ``` -------------------------------- ### Basic Zi Plugin and Snippet Loading Source: https://github.com/z-shell/wiki/blob/main/docs/getting_started/02_overview.mdx Demonstrates the fundamental ways to load plugins using `zi load` for tracking and `zi light` for faster, untracked loading, and `zi snippet` for sourcing local or remote files. These commands are typically added to `.zshrc`. ```shell zi load z-shell/H-S-MW zi light zsh-users/zsh-syntax-highlighting ``` ```shell zi snippet ``` -------------------------------- ### Z-shell: Install `fbterm` using `dl` and `patch` ice-modifiers Source: https://github.com/z-shell/wiki/blob/main/ecosystem/annexes/4_patch-dl.mdx A comprehensive example showcasing the installation of `fbterm` using the `dl` and `patch` ice-modifiers. This snippet downloads two necessary patches and then applies them, followed by standard build steps like `./configure` and `make install`, demonstrating a full Z-shell annex workflow. ```shell zi ice as"command" pick"$ZPFX/bin/fbterm" \ dl"https://bugs.archlinux.org/task/46860?getfile=13513 -> ins.patch" \ dl"https://aur.archlinux.org/cgit/aur.git/plain/0001-Fix-build-with-gcc-6.patch?h=fbterm-git" \ patch"ins.patch; 0001-Fix-build-with-gcc-6.patch" \ atclone"./configure --prefix=$ZPFX" \ atpull"%atclone" make"install" reset zi load izmntuk/fbterm ``` -------------------------------- ### Install @annexes meta-plugin Source: https://github.com/z-shell/wiki/blob/main/i18n/ja/docusaurus-plugin-content-docs-ecosystem/current/annexes/2_meta_plugins.mdx This snippet demonstrates the basic installation of a single meta-plugin, `@annexes`, using the `zi light` command. ```shell zi light @annexes ``` -------------------------------- ### Install ajeetdsouza/zoxide Program from GitHub Releases Source: https://github.com/z-shell/wiki/blob/main/community/gallery/collection/03_programs.mdx Command to install `zoxide`, a smarter `cd` command, using `zi` from GitHub releases, including specific binary pick, symlinking completions, copying man pages, and generating an initialization script. ```shell zi ice as'program' from'gh-r' pick'zoxide' \ atclone'ln -s completions/_zoxide -> _zoxide;\n cp man/man1/*.1 $ZI[MAN_DIR]/man1; ./zoxide init zsh --cmd x > init.zsh' \ atpull'%atclone' src'init.zsh' nocompile'!' zi light ajeetdsouza/zoxide ``` -------------------------------- ### Example: Installing `youtube-dl` Pip Package with Zi Source: https://github.com/z-shell/wiki/blob/main/i18n/ja/docusaurus-plugin-content-docs-ecosystem/current/annexes/1_bin_gem_node.mdx Illustrates how to use the `pip` ice modifier to install the `youtube-dl` package. It specifies the binary name `youtube-dl` and uses `id-as` and `nocompile`, then loads the empty `z-shell/0` repository. ```shell zi ice pip'youtube-dl <- !youtube-dl -> youtube-dl' id-as'youtube-dl' nocompile zi load z-shell/0 ``` -------------------------------- ### Example: Installing `remark-cli` Node Module with Zi Source: https://github.com/z-shell/wiki/blob/main/i18n/ja/docusaurus-plugin-content-docs-ecosystem/current/annexes/1_bin_gem_node.mdx Illustrates how to use the `node` ice modifier to install the `remark-cli` module. It specifies the binary name `remark` and uses `id-as` and `nocompile`, then loads the empty `z-shell/0` repository. ```shell zi ice node'remark <- !remark-cli -> remark; remark-man' id-as'remark' nocompile zi load z-shell/0 ``` -------------------------------- ### Profile Zsh Startup Time (Method 1 - Setup) Source: https://github.com/z-shell/wiki/blob/main/docs/guides/03_benchmark.mdx This snippet, placed at the top of `.zshrc`, initializes profiling for the entire Zsh startup process. It conditionally loads `zsh/zprof`, sets `PS4` for detailed prompt expansion, redirects stderr to a log file, and enables `xtrace` for command tracing, all controlled by the `PROFILE_STARTUP` flag. ```shell PROFILE_STARTUP=false if [[ "$PROFILE_STARTUP" == true ]]; then zmodload zsh/zprof PS4=$'%D{%M%S%.} %N:%i> ' exec 3>&2 2>$HOME/startlog.$$ setopt xtrace prompt_subst fi ``` -------------------------------- ### Zi Ice Modifiers API Reference for ZPFX Installation Source: https://github.com/z-shell/wiki/blob/main/docs/guides/syntax/01_standard.mdx Further reference for `zi ice` modifiers, specifically highlighting their behavior when installing programs to the `$ZPFX` directory, including `configure` prefix and `make install`. ```APIDOC | Syntax | Description | | ------------------ | :------------------------------------------------------------------------------------------- | | \`as'program'\` | As above. | | \`atclone'…'\` | As above **plus** pass \`--prefix=$ZPFX\` to \`./configure\`, to set the installation directory. | | \`atpull'%atclone'\` | As above. | | \`make\` | As above, but also run the \`install\` target. | | \`pick'src/vim'\` | as above, but for a different path \`$ZPFX/bin/vim\`. | ``` -------------------------------- ### Install Zprompts Standalone Source: https://github.com/z-shell/wiki/blob/main/ecosystem/plugins/zprompts.mdx Provides instructions for loading the Zprompts plugin manually and then invoking a specific theme like 'scala3'. ```shell source {where-zprompts-is}/zprompts.plugin.zsh ``` ```shell promptinit prompt scala3 ``` -------------------------------- ### Example: Installing `asciidoctor` gem with `zi ice` Source: https://github.com/z-shell/wiki/blob/main/ecosystem/annexes/1_bin_gem_node.mdx Demonstrates how to install the `asciidoctor` gem using `zi ice`. It assigns the ID 'asciidoctor' to the installation and loads it from the `z-shell/0` empty repository, skipping file compilation. `z-shell/0` is an empty repository used to store the gem, `id-as` assigns a name, and `nocompile` skips compilation. ```shell zi ice gem'!asciidoctor' id-as'asciidoctor' nocompile zi load z-shell/0 ``` -------------------------------- ### Install asciinema/agg Program from GitHub Releases Source: https://github.com/z-shell/wiki/blob/main/community/gallery/collection/03_programs.mdx Shows how to install `agg`, a tool for generating GIFs from asciicast files, using `zi` from GitHub releases. Includes both default installation and an alternative using the `bin-gem-node` annex for specific binary handling. ```shell zi ice has'asciinema' as'program' from'gh-r' \ mv'agg* -> agg' pick'agg' zi light asciinema/agg ``` ```shell zi ice has'asciinema' as'program' from'gh-r' sbin'agg* -> agg' zi light asciinema/agg ``` -------------------------------- ### Install Zsh Git Meta-Plugins with Zi Source: https://github.com/z-shell/wiki/blob/main/i18n/ja/docusaurus-plugin-content-docs/current/guides/02_customization.mdx This command shows how to install a collection of Git-related meta-plugins and annexes using Zi's light-mode. It simplifies the setup of multiple Git tools and their dependencies by grouping them under `@annexes` and `@ext-git`. ```shell zi light-mode for z-shell/z-a-meta-plugins @annexes @ext-git ``` -------------------------------- ### Zi Ice Modifiers Reference (Installation with ZPFX) Source: https://github.com/z-shell/wiki/blob/main/i18n/zh-Hant/docusaurus-plugin-content-docs/current/guides/syntax/01_standard.mdx Expands on the `zi ice` modifiers, specifically detailing their behavior when installing programs into the `$ZPFX` prefix. It clarifies how `atclone` is used with `--prefix=$ZPFX` and how `make` runs the `install` target. ```APIDOC as'program': As above. atclone'…': As above plus pass --prefix=$ZPFX to ./configure, to set the installation directory. atpull'%atclone': As above. make: As above, but also run the install target. pick'src/vim': as above, but for a different path $ZPFX/bin/vim. ``` -------------------------------- ### Example: Installing `asciidoctor` Gem with Zi Source: https://github.com/z-shell/wiki/blob/main/i18n/ja/docusaurus-plugin-content-docs-ecosystem/current/annexes/1_bin_gem_node.mdx Illustrates how to use the `gem` ice modifier to install the `asciidoctor` gem. It uses `id-as` to assign a specific name and `nocompile` to skip compilation, then loads the empty `z-shell/0` repository to store the gem. ```shell zi ice gem'!asciidoctor' id-as'asciidoctor' nocompile zi load z-shell/0 ``` -------------------------------- ### Install a single Z-shell meta-plugin Source: https://github.com/z-shell/wiki/blob/main/ecosystem/annexes/2_meta_plugins.mdx Demonstrates the basic installation of a single Z-shell meta-plugin using the `zi light` command. ```shell zi light @annexes ``` -------------------------------- ### Comparing zi load and zi light for Plugin Loading Source: https://github.com/z-shell/wiki/blob/main/docs/getting_started/02_overview.mdx Illustrates the difference between `zi load` which enables reporting and tracking of a plugin's activity, and `zi light` which provides faster loading without tracking or the ability to unload the plugin. ```shell zi load # Load with reporting/investigating. zi light # Load without reporting/investigating. ``` -------------------------------- ### Install multiple meta-plugins in light-mode Source: https://github.com/z-shell/wiki/blob/main/i18n/zh-Hans/docusaurus-plugin-content-docs-ecosystem/current/annexes/2_meta_plugins.mdx Shows how to install several meta-plugins simultaneously using `zi light-mode for`. ```shell zi light-mode for @annexes @zsh-users @console-tools ``` -------------------------------- ### Install Specific Zsh Version from zsh-users Mirror Source: https://github.com/z-shell/wiki/blob/main/i18n/zh-Hant/docusaurus-plugin-content-docs-ecosystem/current/packages/02_usage.mdx These commands allow installing a precise version of Zsh from the `zsh-users` mirror. Specify the desired version number (e.g., "5.9", "5.8.1") after `zi pack` to get a particular release. ```shell zi pack"5.9" for zsh zi pack"5.8.1" for zsh zi pack"5.8" for zsh zi pack"5.7.1" for zsh zi pack"5.6.2" for zsh zi pack"5.5.1" for zsh zi pack"5.4.2" for zsh zi pack"5.3.1" for zsh zi pack"5.2.4" for zsh zi pack"5.1.1" for zsh ``` -------------------------------- ### Loading Oh-My-Zsh and Prezto Plugins via Direct URL Snippets Source: https://github.com/z-shell/wiki/blob/main/i18n/ja/docusaurus-plugin-content-docs/current/getting_started/02_overview.mdx Explains how to load specific Oh-My-Zsh and Prezto plugins by providing their direct raw URLs to the `zi snippet` command. This method leverages `curl` or `wget` for downloading single files. ```shell zi snippet 'https://github.com/robbyrussell/oh-my-zsh/raw/master/plugins/git/git.plugin.zsh' zi snippet 'https://github.com/sorin-ionescu/prezto/blob/master/modules/helper/init.zsh' ``` -------------------------------- ### Define Global Prefix for Zsh Plugin Software Installation Source: https://github.com/z-shell/wiki/blob/main/i18n/zh-Hant/docusaurus-plugin-content-docs-community/current/02_zsh_plugin_standard.mdx This snippet details the `$ZPFX` global parameter, which plugin managers can export to specify a dedicated directory for user-land software installations (e.g., `bin`, `lib`, `share`). It provides examples of how this prefix can be used with `make`, `configure`, `cmake`, and `zi` commands to install software within the defined `$ZPFX` path. ```shell export ZPFX="$HOME/polaris" make PREFIX=$ZPFX install ./configure --prefix=$ZPFX cmake -DCMAKE_INSTALL_PREFIX=$ZPFX . zi ice make"PREFIX=$ZPFX install" zi … hook-build:"make PREFIX=$PFX install" ``` -------------------------------- ### zi ice Command Parameters for Profiling Source: https://github.com/z-shell/wiki/blob/main/i18n/ja/docusaurus-plugin-content-docs/current/guides/03_benchmark.mdx This section provides documentation for the `atinit` and `atload` parameters used with the `zi ice` command, specifically for integrating `zsh/zprof` for plugin profiling. It explains when each hook is executed and its purpose in the profiling workflow. ```APIDOC `atinit'…'`: Description: Loads the `zsh/zprof` module, shipped with Zsh, before loading the plugin – this starts the profiling. `atload'…'`: Description: Works after loading the plugin – shows profiling results `zprof / head`, unloads `zsh/zprof` - this stops the profiling. ``` -------------------------------- ### Example: Installing `asciidoctor` gem with Zi `gem` ice Source: https://github.com/z-shell/wiki/blob/main/i18n/zh-Hans/docusaurus-plugin-content-docs-ecosystem/current/annexes/1_bin_gem_node.mdx Shows how to use `zi ice gem` to install the `asciidoctor` gem. `id-as'asciidoctor'` assigns a name to the plugin, and `nocompile` skips file compilation. `z-shell/0` is an empty repository used to store the gem. ```shell zi ice gem'!asciidoctor' id-as'asciidoctor' nocompile zi load z-shell/0 ``` -------------------------------- ### Example: Installing `youtube-dl` pip package with Zi `pip` ice Source: https://github.com/z-shell/wiki/blob/main/i18n/zh-Hans/docusaurus-plugin-content-docs-ecosystem/current/annexes/1_bin_gem_node.mdx Shows how to use `zi ice pip` to install the `youtube-dl` package. It demonstrates mapping a binary name to a function name and uses `z-shell/0` as an empty repository for storage. `id-as'youtube-dl'` assigns a name, and `nocompile` skips compilation. ```shell zi ice pip'youtube-dl <- !youtube-dl -> youtube-dl' id-as'youtube-dl' nocompile zi load z-shell/0 ```