zsh高亮插件zsh-syntax-highlighting

brew安装

brew install zsh-syntax-highlighting

logs:

Last login: Tue Mar  5 15:41:48 on ttys000
➜  ~ brew install zsh-syntax-highlighting
==> Downloading https://formulae.brew.sh/api/formula.jws.json
############################################################################################################################################################################## 100.0%
==> Downloading https://formulae.brew.sh/api/cask.jws.json
############################################################################################################################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/zsh-syntax-highlighting/manifests/0.8.0
############################################################################################################################################################################## 100.0%
==> Fetching zsh-syntax-highlighting
==> Downloading https://ghcr.io/v2/homebrew/core/zsh-syntax-highlighting/blobs/sha256:603dabae4003cd3d95ab7f872a7fd9944e67cf0d963ffe42a07c8f3c191211ea
############################################################################################################################################################################## 100.0%
==> Pouring zsh-syntax-highlighting--0.8.0.arm64_sonoma.bottle.tar.gz
==> Caveats
To activate the syntax highlighting, add the following at the end of your .zshrc:
  source /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

If you receive "highlighters directory not found" error message,
you may need to add the following to your .zshenv:
  export ZSH_HIGHLIGHT_HIGHLIGHTERS_DIR=/opt/homebrew/share/zsh-syntax-highlighting/highlighters
==> Summary
🍺  /opt/homebrew/Cellar/zsh-syntax-highlighting/0.8.0: 27 files, 203.4KB
==> Running `brew cleanup zsh-syntax-highlighting`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
➜  ~ 

根据上述提示,编辑~/.zshrc:在末尾追加

source /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

最后,使之生效

source ~/.zshrc

效果:

使用之前
使用之前

使用之后
使用之后

发表回复