Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

129 rader
4.9 KiB

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