⚡️ 安装
快速开始
将以下内容添加到 .zshrc 文件中:
- Instant
- Verified
source <(curl -sL init.zshell.dev); zzinit
这种设置方法需要在版本库中每次改变内容时,手动验证文件 lib/zsh/init.zsh 的sha256 checksum。
local cs_ok='7fab1ecb8d2ffbdb4aa98dd1e51cebaeaa4d8137e1de11938f3e0df24af262bb'
local cs_get=$(sha256sum <(curl -sL init.zshell.dev) | awk '{print $1}')
[[ $cs_ok == $cs_get ]] && { source <(curl -sL init.zshell.dev); zzinit; } || {
print -P "%F{160}▓▒░ Houston, we have a problem, the %F{226}$cs_get%F{160} do not match\!%f%b"; return 1
}
unset cs_ok cs_get
Reload the shell with exec zsh -il and run zi -h for usage information.
自动设置
- 验证文件: lib/sh/install.sh 的 sha256 校验和
- If required append
-b <tag>or-b <branch>e.g:
sh -c "$(curl -fsSL get.zshell.dev)" -- -i skip -b main
- Minimal
- Loader
- Repository
- Annex
- ZUnit
Install and include minimal configuration to the .zshrc:
sh -c "$(curl -fsSL get.zshell.dev)" --
Install and include minimal configuration with loader:
sh -c "$(curl -fsSL get.zshell.dev)" -- -a loader
The installer will download the loader and add the snippet below to the .zshrc file.
if [[ -r "${XDG_CONFIG_HOME:-${HOME}/.config}/zi/init.zsh" ]]; then
source "${XDG_CONFIG_HOME:-${HOME}/.config}/zi/init.zsh" && zzinit
fi
The loader can be manually fetched from available links to any location on the system, and sourced from .zshrc or as shown in the quick-setup.
然后用 exec zsh 重新加载 shell 。 全部完成了!
使用默认的或 自定义的 值克隆版本库。
sh -c "$(curl -fsSL get.zshell.dev)" -- -i skip
使用最小化配置和推荐的 annexes 安装:
sh -c "$(curl -fsSL get.zshell.dev)" -- -a annex
使用最小化配置,安装推荐的 annexes ,并配置 zdharma/zunit:
sh -c "$(curl -fsSL get.zshell.dev)" -- -a zunit
手动设置
设置安装位置并创建目录:
typeset -Ag ZI
typeset -gx ZI[HOME_DIR]="${HOME}/.zi" ZI[BIN_DIR]="${ZI[HOME_DIR]}/bin"
command mkdir -p "$ZI[BIN_DIR]"
For security reasons run function compaudit to check if the completion system would use files owned by root or by the current user, or files in directories that are world or group-writable.
如果失败,则将当前用户设置为目录的所有者,然后删除 group/others 的写入权限,并克隆存储库:
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]"
To enable Zi, source the zi.zsh from the previously set up directory placing the following snippet in the .zshrc file:
typeset -A ZI
ZI[BIN_DIR]="${HOME}/.zi/bin"
source "${ZI[BIN_DIR]}/zi.zsh"
下面的两行必须放在上面的行之后,即在启用 Zi 之后。
启用 Zi 补全:
autoload -Uz _zi
(( ${+_comps} )) && _comps[zi]=_zi
安装后操作
After a fresh install, it is recommended to reload the shell and recompile Zi with:
- exec zsh -il
- zi self-update
Run zi -h for available commands or explore wiki to extend, customize and create 👍 🎉.
If you have any issue or need help 🤦♂️, lets discuss it or open an issue on GitHub.
It helps us to improve and make Zi better. Don't forget to help the project: share, contribute, or translate 🌐 🥰 🤓.
Let's glue a toolchain that works for us 🚀.
有想法?
在 playground 建议或请求
sh -c "$(curl -fsSL get.zshell.dev)" -- -a ???
需要热身?
Alpine Docker
docker run --rm -it ghcr.io/z-shell/zd:latest
Docker 中的 Turbo Zi
If you create a Docker image that uses Zi, install Turbo-loaded plugins before the shell starts interactively, with the @zi-scheduler function in such a way, that it:
- Install plugins without waiting for the prompt (i.e. it's script friendly).
- Install all plugins instantly, without respecting the wait argument.
To accomplish this, use burst argument and call the @zi-scheduler function:
RUN zsh -i -c -- '@zi-scheduler burst || true'
- An example: Dockerfile
- In action: Playground
Zi Module: zpmod
The module transparently and automatically compiles sourced scripts and lists of all sourced files with the time the sourcing took in milliseconds on the left.