My開発メモ

zsh-syntax-highlighting のインストール(macOS/Monterey)

zsh-syntax-highlighting

INSTALL.md

How to install があって、Using package にインストールの仕方がのっている。

homebrew を使えばいいみたい。

で、やってみた。

% brew install zsh-syntax-highlighting
Running `brew update --auto-update`...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> New Formulae
aztfy                      lexicon                    qbe
evernote-backup            libpython-tabulate         tuc
hwatch                     llvm@13                    vectorscan

You have 1 outdated formula installed.
You can upgrade it with brew upgrade
or list it with brew outdated.

==> Downloading https://ghcr.io/v2/homebrew/core/zsh-syntax-highlighting/manifes
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/zsh-syntax-highlighting/blobs/s
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Pouring zsh-syntax-highlighting--0.7.1.arm64_monterey.bottle.1.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.7.1: 27 files, 164.8KB
==> 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`).

途中、以下の説明がある。

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

source 以下の1文を .zshrc に加える。

~./zshrc

...(略)...

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

それから、.zshrc を再読み込みする。

% source ~/.zshrc

おお! コマンドに色がついた!

% pwd  <== 色がついた。

カテゴリー: MacOS, memo

タグ: syntax-hilighting, zsh

カウント: 203