From c346f6eb6fb601a03ee333685d195c16a3c411e3 Mon Sep 17 00:00:00 2001 From: Matthew Martin Date: Fri, 29 Apr 2016 21:23:09 -0500 Subject: [PATCH] docs: highlighters should use _zsh_highlight_add_highlight --- docs/highlighters.md | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/docs/highlighters.md b/docs/highlighters.md index 266abe1..3309fb9 100644 --- a/docs/highlighters.md +++ b/docs/highlighters.md @@ -64,12 +64,17 @@ To create your own `myhighlighter` highlighter: } * Implement the `_zsh_highlight_myhighlighter_highlighter` function. - This function does the actual syntax highlighting, by modifying - `region_highlight`, for example: + This function does the actual syntax highlighting, by calling + `_zsh_highlight_add_highlight` with the start and end of the region to + be highlighted and the `ZSH_HIGHLIGHT_STYLES` key to use. Define the default + style for that key in the highlighter script outside of any function with `: + ${ZSH_HIGHLIGHT_STYLES[key]:=value}`. For example: + + : ${ZSH_HIGHLIGHT_STYLES[aurora]:=fg=green} _zsh_highlight_myhighlighter_highlighter() { - # Colorize the whole buffer with blue background - region_highlight+=(0 $#BUFFER bg=blue) + # Colorize the whole buffer with the 'aurora' style + _zsh_highlight_add_highlight 0 $#BUFFER aurora } * Activate your highlighter in `~/.zshrc`: