Update zsh: use zinit

This commit is contained in:
rydesun 2021-03-08 20:41:07 +08:00
parent 2284aa0926
commit 5c27db0306
4 changed files with 34 additions and 18 deletions

12
.config/zsh/tools/install.sh Executable file
View file

@ -0,0 +1,12 @@
#!/bin/zsh -e
zinit_bin_dir=${XDG_DATA_HOME:-~/.data}/zinit/bin
if [[ -e $zinit_bin_dir ]]; then
echo Clean up old zinit bin dir.
rm -rf $zinit_bin_dir
fi
echo Installing zinit...
git clone --depth 1 --single-branch \
https://github.com/zdharma/zinit.git $zinit_bin_dir

11
.config/zsh/tools/update.sh Executable file
View file

@ -0,0 +1,11 @@
#!/bin/zsh -ie
if command -v zinit &>/dev/null; then
echo Updating plugins...
zinit update --all --parallel
else
echo zinit is missing >&2
fi
echo
echo Done.

View file

@ -1,11 +0,0 @@
#!/bin/zsh -e
if command -v antibody &>/dev/null; then
echo Updating plugins...
antibody update
else
echo antibody is missing >&2
fi
echo
echo Done.

View file

@ -6,13 +6,17 @@ setopt interactive_comments # 交互模式支持注释
fpath=(${ZDOTDIR}/functions ${ZDOTDIR}/Completion $fpath)
# 插件 <<<------------------------------
command -v antibody &>/dev/null && source <(antibody init) && \
antibody bundle <<EOF
skywind3000/z.lua
zsh-users/zsh-completions
zsh-users/zsh-autosuggestions
zsh-users/zsh-syntax-highlighting
EOF
declare -A ZINIT
ZINIT[HOME_DIR]=${XDG_DATA_HOME}/zinit
ZINIT[BIN_DIR]=${ZINIT[HOME_DIR]}/bin
source ${ZINIT[BIN_DIR]}/zinit.zsh
zinit light zdharma/fast-syntax-highlighting # 语法高亮
zinit ice lucid wait atload='_zsh_autosuggest_start'
zinit light zsh-users/zsh-autosuggestions # 提示建议
zinit light zsh-users/zsh-completions # 更多命令补全
zinit light skywind3000/z.lua # 快速跳转目录
# z.lua <<<-----------------------------
# 数据文件路径
export _ZL_DATA=${XDG_DATA_HOME}/zsh/zlua