2021-05-04 01:59:31 +00:00
|
|
|
# Syntax Highlighting
|
2012-06-14 21:24:40 +00:00
|
|
|
|
2012-09-03 20:08:39 +00:00
|
|
|
Integrates [zsh-syntax-highlighting][1] into Prezto.
|
2012-06-14 21:24:40 +00:00
|
|
|
|
2021-05-05 17:59:01 +00:00
|
|
|
This module must be loaded _before_ the _`prompt`_ module.
|
2018-06-18 21:16:36 +00:00
|
|
|
|
|
|
|
Additionally, if this module is used in conjunction with the
|
2021-05-05 17:59:01 +00:00
|
|
|
[_`history-substring-search`_][2] module, this module must be loaded _before_
|
|
|
|
the _`history-substring-search`_ module.
|
2012-06-14 21:24:40 +00:00
|
|
|
|
2021-05-05 17:59:01 +00:00
|
|
|
To elaborate, the relative order of loading the modules would be
|
|
|
|
_`syntax-highlighting`_, _`history-substring-search`_ and _`prompt`_.
|
2018-12-13 05:02:59 +00:00
|
|
|
|
2021-05-04 01:59:31 +00:00
|
|
|
## Contributors
|
2012-06-14 21:24:40 +00:00
|
|
|
|
|
|
|
New features and bug fixes should be submitted to the
|
|
|
|
[zsh-syntax-highlighting][1] project according to its rules and regulations.
|
|
|
|
This module will be synchronized against it.
|
|
|
|
|
2021-05-04 01:59:31 +00:00
|
|
|
## Settings
|
2012-06-14 21:24:40 +00:00
|
|
|
|
|
|
|
### Highlighting
|
|
|
|
|
2012-09-03 20:38:18 +00:00
|
|
|
To enable highlighting for this module only, add the following line to
|
2021-05-05 17:59:01 +00:00
|
|
|
_`${ZDOTDIR:-$HOME}/.zpreztorc`_:
|
2012-06-14 21:24:40 +00:00
|
|
|
|
2017-07-21 01:07:29 +00:00
|
|
|
```sh
|
|
|
|
zstyle ':prezto:module:syntax-highlighting' color 'yes'
|
|
|
|
```
|
2012-06-14 21:24:40 +00:00
|
|
|
|
|
|
|
### Highlighters
|
|
|
|
|
2021-05-05 17:59:01 +00:00
|
|
|
Syntax highlighting is accomplished by pluggable [highlighters][3]. This module
|
|
|
|
only enables the _main_ highlighter by default.
|
2012-06-14 21:24:40 +00:00
|
|
|
|
2021-05-05 17:59:01 +00:00
|
|
|
To enable all highlighters, add the following to
|
|
|
|
_`${ZDOTDIR:-$HOME}/.zpreztorc`_.
|
2012-06-14 21:24:40 +00:00
|
|
|
|
2017-07-21 01:07:29 +00:00
|
|
|
```sh
|
|
|
|
zstyle ':prezto:module:syntax-highlighting' highlighters \
|
|
|
|
'main' \
|
|
|
|
'brackets' \
|
|
|
|
'pattern' \
|
2017-08-29 22:00:41 +00:00
|
|
|
'line' \
|
2017-07-21 01:07:29 +00:00
|
|
|
'cursor' \
|
|
|
|
'root'
|
|
|
|
```
|
2012-06-14 21:24:40 +00:00
|
|
|
|
2012-12-23 20:50:12 +00:00
|
|
|
### Highlighting Styles
|
|
|
|
|
|
|
|
Each syntax highlighter defines styles used to highlight tokens.
|
|
|
|
|
|
|
|
To highlight, for example, builtins, commands, and functions in blue instead of
|
2021-05-05 17:59:01 +00:00
|
|
|
green, add the following to _`${ZDOTDIR:-$HOME}/.zpreztorc`_:
|
2012-12-23 20:50:12 +00:00
|
|
|
|
2017-07-21 01:07:29 +00:00
|
|
|
```sh
|
|
|
|
zstyle ':prezto:module:syntax-highlighting' styles \
|
|
|
|
'builtin' 'bg=blue' \
|
|
|
|
'command' 'bg=blue' \
|
|
|
|
'function' 'bg=blue'
|
|
|
|
```
|
2012-12-23 20:50:12 +00:00
|
|
|
|
2021-05-04 01:59:31 +00:00
|
|
|
## Authors
|
2012-06-14 21:24:40 +00:00
|
|
|
|
2021-05-05 17:59:01 +00:00
|
|
|
_The authors of this module should be contacted via the [issue tracker][4]._
|
2012-06-14 21:24:40 +00:00
|
|
|
|
2021-05-04 01:59:31 +00:00
|
|
|
- [Sorin Ionescu](https://github.com/sorin-ionescu)
|
2012-06-14 21:24:40 +00:00
|
|
|
|
|
|
|
[1]: https://github.com/zsh-users/zsh-syntax-highlighting
|
2021-05-05 17:59:01 +00:00
|
|
|
[2]: ../history-substring-search#readme
|
|
|
|
[3]: https://github.com/zsh-users/zsh-syntax-highlighting/tree/master/highlighters
|
|
|
|
[4]: https://github.com/sorin-ionescu/prezto/issues
|