You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

169 line
6.4 KiB

  1. How to install
  2. --------------
  3. ### Using packages
  4. First, install the package:
  5. * Arch Linux: [community/zsh-syntax-highlighting][arch-package] / [AUR/zsh-syntax-highlighting-git][AUR-package]
  6. * Debian: `zsh-syntax-highlighting` package [in `stretch`][debian-package] (or in [OBS repository][obs-repository])
  7. * Fedora: [zsh-syntax-highlighting package][fedora-package-alt] in Fedora 24+ (or in [OBS repository][obs-repository])
  8. * FreeBSD: `pkg install zsh-syntax-highlighting` (port name: [`shells/zsh-syntax-highlighting`][freebsd-port])
  9. * Gentoo: [app-shells/zsh-syntax-highlighting][gentoo-repository]
  10. * Mac OS X / Homebrew: `brew install zsh-syntax-highlighting` ([formula][brew-package])
  11. * NetBSD: `pkg_add zsh-syntax-highlighting` (port name: [`shells/zsh-syntax-highlighting`][netbsd-port])
  12. * OpenBSD: `pkg_add zsh-syntax-highlighting` (port name: [`shells/zsh-syntax-highlighting`][openbsd-port])
  13. * openSUSE / SLE: `zsh-syntax-highlighting` package in [OBS repository][obs-repository]
  14. * RHEL / CentOS / Scientific Linux: `zsh-syntax-highlighting` package in [OBS repository][obs-repository]
  15. * Ubuntu: `zsh-syntax-highlighting` package [in Xenial][ubuntu-package] (or in [OBS repository][obs-repository])
  16. * Void Linux: `zsh-syntax-highlighting package` [in XBPS][void-package]
  17. [arch-package]: https://www.archlinux.org/packages/zsh-syntax-highlighting
  18. [AUR-package]: https://aur.archlinux.org/packages/zsh-syntax-highlighting-git
  19. [brew-package]: https://github.com/Homebrew/homebrew-core/blob/master/Formula/z/zsh-syntax-highlighting.rb
  20. [debian-package]: https://packages.debian.org/zsh-syntax-highlighting
  21. [fedora-package]: https://apps.fedoraproject.org/packages/zsh-syntax-highlighting
  22. [fedora-package-alt]: https://bodhi.fedoraproject.org/updates/?packages=zsh-syntax-highlighting
  23. [freebsd-port]: https://www.freshports.org/textproc/zsh-syntax-highlighting/
  24. [gentoo-repository]: https://packages.gentoo.org/packages/app-shells/zsh-syntax-highlighting
  25. [netbsd-port]: http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/shells/zsh-syntax-highlighting/
  26. [obs-repository]: https://software.opensuse.org/download.html?project=shells%3Azsh-users%3Azsh-syntax-highlighting&package=zsh-syntax-highlighting
  27. [openbsd-port]: https://cvsweb.openbsd.org/ports/shells/zsh-syntax-highlighting/
  28. [ubuntu-package]: https://launchpad.net/ubuntu/+source/zsh-syntax-highlighting
  29. [void-package]: https://github.com/void-linux/void-packages/tree/master/srcpkgs/zsh-syntax-highlighting
  30. See also [repology's cross-distro index](https://repology.org/metapackage/zsh-syntax-highlighting/versions)
  31. Second, enable zsh-syntax-highlighting by sourcing the script. Running this command on the terminal will add the source line to the end of your .zshrc:
  32. * On most Linux distributions (except perhaps NixOS):
  33. ```zsh
  34. echo "source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc
  35. ```
  36. * NetBSD and OpenBSD:
  37. ```zsh
  38. echo "source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc
  39. ```
  40. * Mac OS X / Homebrew:
  41. ```zsh
  42. echo "source $(brew --prefix)/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc
  43. ```
  44. Then restart zsh (such as by opening a new instance of your terminal emulator).
  45. Alternatively, add the `source` command manually **at the end** of your `.zshrc`:
  46. * On most Linux distributions (except perhaps NixOS):
  47. `source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh`
  48. * NetBSD and OpenBSD:
  49. `source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh`
  50. Then restart zsh.
  51. ### In your ~/.zshrc
  52. Simply clone this repository and source the script:
  53. ```zsh
  54. git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
  55. echo "source ${(q-)PWD}/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc
  56. ```
  57. Then, enable syntax highlighting in the current interactive shell:
  58. ```zsh
  59. source ./zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
  60. ```
  61. If `git` is not installed, download and extract a snapshot of the latest
  62. development tree from:
  63. ```
  64. https://github.com/zsh-users/zsh-syntax-highlighting/archive/master.tar.gz
  65. ```
  66. Note the `source` command must be **at the end** of `~/.zshrc`.
  67. ### With a plugin manager
  68. Note that `zsh-syntax-highlighting` must be the last plugin sourced.
  69. The zsh-syntax-highlighting authors recommend manual installation over the use
  70. of a framework or plugin manager.
  71. This list is incomplete as there are too many
  72. [frameworks / plugin managers][framework-list] to list them all here.
  73. [framework-list]: https://github.com/unixorn/awesome-zsh-plugins#frameworks
  74. #### [Antigen](https://github.com/zsh-users/antigen)
  75. Add `antigen bundle zsh-users/zsh-syntax-highlighting` as the last bundle in
  76. your `.zshrc`.
  77. #### [Fig](https://fig.io)
  78. Click the `Install Plugin` button on the [Fig plugin page][fig-plugin].
  79. [fig-plugin]: https://fig.io/plugins/other/zsh-syntax-highlighting
  80. #### [Oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh)
  81. 1. Clone this repository in oh-my-zsh's plugins directory:
  82. ```zsh
  83. git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
  84. ```
  85. 2. Activate the plugin in `~/.zshrc`:
  86. ```zsh
  87. plugins=( [plugins...] zsh-syntax-highlighting)
  88. ```
  89. 3. Restart zsh (such as by opening a new instance of your terminal emulator).
  90. #### [Prezto](https://github.com/sorin-ionescu/prezto)
  91. Zsh-syntax-highlighting is included with Prezto. See the
  92. [Prezto documentation][prezto-docs] to enable and configure highlighters.
  93. [prezto-docs]: https://github.com/sorin-ionescu/prezto/tree/master/modules/syntax-highlighting
  94. #### [zgen](https://github.com/tarjoilija/zgen)
  95. Add `zgen load zsh-users/zsh-syntax-highlighting` to the end of your `.zshrc`.
  96. #### [zinit](https://github.com/zdharma-continuum/zinit)
  97. Add `zinit light zsh-users/zsh-syntax-highlighting` to the end of your
  98. `.zshrc`.
  99. #### [zplug](https://github.com/zplug/zplug)
  100. Add `zplug "zsh-users/zsh-syntax-highlighting", defer:2` to your `.zshrc`.
  101. ### System-wide installation
  102. Any of the above methods is suitable for a single-user installation,
  103. which requires no special privileges. If, however, you desire to install
  104. zsh-syntax-highlighting system-wide, you may do so by running
  105. ```zsh
  106. make install
  107. ```
  108. and directing your users to add
  109. ```zsh
  110. source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
  111. ```
  112. to their `.zshrc`s.