zsh-syntax-highlighting/INSTALL.md
2022-07-08 22:52:18 +08:00

4.6 KiB

Installation

Manual (Git Clone)

  1. Clone this repository and source the script:

    git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
    echo "source ${(q-)PWD}/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc
    

    If git is not installed, download and extract a snapshot of the latest development tree from:

    https://github.com/zsh-users/zsh-syntax-highlighting/archive/master.tar.gz
    
  2. Enable syntax highlighting in the current interactive shell (add the following to the end of your .zshrc):

    source ./zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
    
  3. Start a new terminal session.

Packages

System Package
Arch Linux / Antergos / Manjaro / Hyperbola zsh-syntax-highlighting, zsh-syntax-highlighting-git
Debian zsh-syntax-highlighting OBS repository, zsh-syntax-highlighting in Stretch
CentOS / Fedora / RHEL / Scientific Linux zsh-syntax-highlighting OBS repository, zsh-syntax-highlighting in Fedora 24+
FreeBSD / NetBSD shells/zsh-syntax-highlighting
Gentoo app-shells/zsh-syntax-highlighting
macOS brew install zsh-syntax-highlighting
OpenBSD shells/zsh-syntax-highlighting
OpenSUSE / SLE zsh-syntax-highlighting OBS repository
Ubuntu zsh-syntax-highlighting OBS repository, zsh-syntax-highlighting in Xenial
Void Linux zsh-syntax-highlighting in XBPS

See also repology's cross-distro index

Oh My Zsh

  1. Clone this repository in oh-my-zsh's plugins directory:

    git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
    
  2. Activate the plugin in ~/.zshrc:

    plugins=( [plugins...] zsh-syntax-highlighting)
    
  3. Start a new terminal session.

Plugin Managers

Note that zsh-syntax-highlighting must be the last plugin sourced.

The zsh-syntax-highlighting authors recommend manual installation over the use of a framework or plugin manager.

This list is incomplete as there are too many frameworks / plugin managers to list them all here.

Antigen

Add antigen bundle zsh-users/zsh-syntax-highlighting to your .zshrc.

Prezto

Zsh-syntax-highlighting is included with Prezto. See the Prezto documentation to enable and configure highlighters.

zgen

Add zgen load zsh-users/zsh-syntax-highlighting to the end of your .zshrc.

zplug

Add zplug "zsh-users/zsh-syntax-highlighting", defer:2 to your .zshrc.

zplugin

Add zplugin load zsh-users/zsh-syntax-highlighting to the end of your .zshrc.