Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

174 řádky
6.6 KiB

před 11 měsíci
  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. * Arch Linux:
  37. ```zsh
  38. echo "source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc
  39. ```
  40. * NetBSD and OpenBSD:
  41. ```zsh
  42. echo "source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc
  43. ```
  44. * Mac OS X / Homebrew:
  45. ```zsh
  46. echo "source $(brew --prefix)/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc
  47. ```
  48. Then restart zsh (such as by opening a new instance of your terminal emulator).
  49. Alternatively, add the `source` command manually **at the end** of your `.zshrc`:
  50. * On most Linux distributions (except perhaps NixOS):
  51. `source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh`
  52. * NetBSD and OpenBSD:
  53. `source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh`
  54. Then restart zsh.
  55. ### In your ~/.zshrc
  56. Simply clone this repository and source the script:
  57. ```zsh
  58. git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
  59. echo "source ${(q-)PWD}/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc
  60. ```
  61. Then, enable syntax highlighting in the current interactive shell:
  62. ```zsh
  63. source ./zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
  64. ```
  65. If `git` is not installed, download and extract a snapshot of the latest
  66. development tree from:
  67. ```
  68. https://github.com/zsh-users/zsh-syntax-highlighting/archive/master.tar.gz
  69. ```
  70. Note the `source` command must be **at the end** of `~/.zshrc`.
  71. ### With a plugin manager
  72. Note that `zsh-syntax-highlighting` must be the last plugin sourced.
  73. The zsh-syntax-highlighting authors recommend manual installation over the use
  74. of a framework or plugin manager.
  75. This list is incomplete as there are too many
  76. [frameworks / plugin managers][framework-list] to list them all here.
  77. [framework-list]: https://github.com/unixorn/awesome-zsh-plugins#frameworks
  78. #### [Antigen](https://github.com/zsh-users/antigen)
  79. Add `antigen bundle zsh-users/zsh-syntax-highlighting` as the last bundle in
  80. your `.zshrc`.
  81. #### [Fig](https://fig.io)
  82. Click the `Install Plugin` button on the [Fig plugin page][fig-plugin].
  83. [fig-plugin]: https://fig.io/plugins/other/zsh-syntax-highlighting
  84. #### [Oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh)
  85. 1. Clone this repository in oh-my-zsh's plugins directory:
  86. ```zsh
  87. git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
  88. ```
  89. 2. Activate the plugin in `~/.zshrc`:
  90. ```zsh
  91. plugins=( [plugins...] zsh-syntax-highlighting)
  92. ```
  93. 3. Restart zsh (such as by opening a new instance of your terminal emulator).
  94. #### [Prezto](https://github.com/sorin-ionescu/prezto)
  95. Zsh-syntax-highlighting is included with Prezto. See the
  96. [Prezto documentation][prezto-docs] to enable and configure highlighters.
  97. [prezto-docs]: https://github.com/sorin-ionescu/prezto/tree/master/modules/syntax-highlighting
  98. #### [zgen](https://github.com/tarjoilija/zgen)
  99. Add `zgen load zsh-users/zsh-syntax-highlighting` to the end of your `.zshrc`.
  100. #### [zinit](https://github.com/zdharma-continuum/zinit)
  101. Add `zinit light zsh-users/zsh-syntax-highlighting` to the end of your
  102. `.zshrc`.
  103. #### [zplug](https://github.com/zplug/zplug)
  104. Add `zplug "zsh-users/zsh-syntax-highlighting", defer:2` to your `.zshrc`.
  105. ### System-wide installation
  106. Any of the above methods is suitable for a single-user installation,
  107. which requires no special privileges. If, however, you desire to install
  108. zsh-syntax-highlighting system-wide, you may do so by running
  109. ```zsh
  110. make install
  111. ```
  112. and directing your users to add
  113. ```zsh
  114. source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
  115. ```
  116. to their `.zshrc`s.