![]() * upstream/master: 'main': Enable fallback to the 'arg0' style. 'main': Set fallback style for the 'arg0' style. dev tools: Automagically handle newlines (\n) in $BUFFER. tests: Also test arguments to an anonymous function. 'main': Directly count spaces to skip, don't leverage proc_buf length 'main': Highlight several more special (non-alphabetic) parameters. 'main': Highlight shell's PID ($$) inside double quotes. 'main': Highlight command substitutions inside double quotes. 'main': Permit subshells to end at command position. 'main': Highlight mismatched foreach/end. dev tools: Add a TODO to introduce code reuse. 'main': Highlight mismatched do/done. 'main': Yet another test for mismatched braces. 'main' / *_check_path: Precompute $#BUFFER and use it for speed gain dev tools: Remove a superfluous empty line. 'main': Highlight 'always' blocks. 'main': Don't find command positions within multiline array literals. dev tools: Stage the copyright block to make diffs smaller. dev tools: Tolerate invalid input. 'main': Restore compatibility with zsh-4.3.14 and older (after e3182c18de8f). dev tools: Automate a recurring step: Set year correctly for new tests. 'main': Highlight first command word in named functions defined in the sh syntax when MULTI_FUNC_DEF is set. 'main': More tests for mismstached parentheses and braces. 'main': Highlight mismatched parentheses and braces. driver: Warn just once when a highlighter is missing. 'main': Support the IGNORE_BRACES option. 'main': Add tests for the IGNORE_BRACES option. 'main': Followup to |
||
---|---|---|
docs | ||
highlighters | ||
images | ||
tests | ||
.gitattributes | ||
.gitignore | ||
.revision-hash | ||
.version | ||
changelog.md | ||
COPYING.md | ||
HACKING.md | ||
INSTALL.md | ||
Makefile | ||
README.md | ||
release.md | ||
zsh-syntax-highlighting.plugin.zsh | ||
zsh-syntax-highlighting.zsh |
zsh-syntax-highlighting
Fish shell-like like syntax highlighting for Zsh.
Requirements: zsh 4.3.17+.
This package provides syntax highlighing for the shell zsh. It enables highlighing of commands whilst they are typed at a zsh prompt into an interactive terminal. This helps in reviewing commands before running them, particularly in catching syntax errors.
How to install
See INSTALL.md.
FAQ
Why must zsh-syntax-highlighting.zsh
be sourced at the end of the .zshrc
file?
zsh-syntax-highlighting works by hooking into the Zsh Line Editor (ZLE) and computing syntax highlighting for the command-line buffer as it stands at the time z-sy-h's hook is invoked.
In zsh 5.2 and older,
zsh-syntax-highlighting.zsh
hooks into ZLE by wrapping ZLE widgets. It must
be sourced after all custom widgets have been created (i.e., after all zle -N
calls and after running compinit
) in order to be able to wrap all of them.
Widgets created after z-sy-h is sourced will work, but will not update the
syntax highlighting.
In zsh 5.3 and newer,
zsh-syntax-highlighting uses the add-zle-hook-widget
facility to install
a zle-line-pre-redraw
hook. Hooks are run in order of registration,
therefore, z-sy-h must be sourced (and register its hook) after anything else
that adds hooks that modify the command-line buffer.
Does syntax highlighting work during incremental history search?
Highlighting the command line during an incremental history search
(with the history-incremental-search-backward
widget, which is
bound by default to Ctrl+R in zsh's emacs keymap) requires zsh 5.3
or newer.
Under zsh 5.2 and older, the zsh-default underlining of the matched portion of the buffer remains available, but zsh-syntax-highlighting's additional highlighting is unavailable. (Those versions of zsh do not provide enough information to allow computing the highlighting correctly.)
See issue #288 for details.
How are new releases announced?
There is currently no "push" announcements channel. However, the following alternatives exist:
- GitHub's RSS feed of releases: https://github.com/zsh-users/zsh-syntax-highlighting/releases.atom
- An anitya entry: https://release-monitoring.org/project/7552/
How to tweak
Syntax highlighting is done by pluggable highlighter scripts. See the documentation on highlighters for details and configuration settings.