docs: highlighters should use _zsh_highlight_add_highlight
This commit is contained in:
		
							parent
							
								
									f34714b8ee
								
							
						
					
					
						commit
						c346f6eb6f
					
				|  | @ -64,12 +64,17 @@ To create your own `myhighlighter` highlighter: | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
| * Implement the `_zsh_highlight_myhighlighter_highlighter` function. | * Implement the `_zsh_highlight_myhighlighter_highlighter` function. | ||||||
|   This function does the actual syntax highlighting, by modifying |   This function does the actual syntax highlighting, by calling | ||||||
|   `region_highlight`, for example: |   `_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() { |         _zsh_highlight_myhighlighter_highlighter() { | ||||||
|           # Colorize the whole buffer with blue background |           # Colorize the whole buffer with the 'aurora' style | ||||||
|           region_highlight+=(0 $#BUFFER bg=blue) |           _zsh_highlight_add_highlight 0 $#BUFFER aurora | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
| * Activate your highlighter in `~/.zshrc`: | * Activate your highlighter in `~/.zshrc`: | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue