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.

131 lines
5.2 KiB

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