mirror of
				https://github.com/zsh-users/zsh-syntax-highlighting.git
				synced 2025-10-23 15:46:27 +08:00 
			
		
		
		
	docs: s/myhighlighter/acme/g
Makes the text easier to read ("_zsh_highlight_myhighlighter_highlighter" is
a mouthful).
			
			
This commit is contained in:
		
							parent
							
								
									3e59ab41b6
								
							
						
					
					
						commit
						ba16cf2fb2
					
				| @ -49,21 +49,21 @@ highlighter's documentation for details and examples. | ||||
| How to implement a new highlighter | ||||
| ---------------------------------- | ||||
| 
 | ||||
| To create your own `myhighlighter` highlighter: | ||||
| To create your own `acme` highlighter: | ||||
| 
 | ||||
| * Create your script at | ||||
|     `highlighters/${myhighlighter}/${myhighlighter}-highlighter.zsh`. | ||||
|     `highlighters/${acme}/${acme}-highlighter.zsh`. | ||||
| 
 | ||||
| * Implement the `_zsh_highlight_myhighlighter_highlighter_predicate` function. | ||||
| * Implement the `_zsh_highlight_acme_highlighter_predicate` function. | ||||
|   This function must return 0 when the highlighter needs to be called and | ||||
|   non-zero otherwise, for example: | ||||
| 
 | ||||
|         _zsh_highlight_myhighlighter_highlighter_predicate() { | ||||
|         _zsh_highlight_acme_highlighter_predicate() { | ||||
|           # Call this highlighter in SVN working copies | ||||
|           [[ -d .svn ]] | ||||
|         } | ||||
| 
 | ||||
| * Implement the `_zsh_highlight_myhighlighter_highlighter` function. | ||||
| * Implement the `_zsh_highlight_acme_highlighter` function. | ||||
|   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 | ||||
| @ -71,15 +71,15 @@ To create your own `myhighlighter` highlighter: | ||||
|   `: ${ZSH_HIGHLIGHT_STYLES[key]:=value}`, being sure to prefix | ||||
|   the key with your highlighter name and a colon. For example: | ||||
| 
 | ||||
|         : ${ZSH_HIGHLIGHT_STYLES[myhighlighter:aurora]:=fg=green} | ||||
|         : ${ZSH_HIGHLIGHT_STYLES[acme:aurora]:=fg=green} | ||||
| 
 | ||||
|         _zsh_highlight_myhighlighter_highlighter() { | ||||
|         _zsh_highlight_acme_highlighter() { | ||||
|           # Colorize the whole buffer with the 'aurora' style | ||||
|           _zsh_highlight_add_highlight 0 $#BUFFER myhighlighter:aurora | ||||
|           _zsh_highlight_add_highlight 0 $#BUFFER acme:aurora | ||||
|         } | ||||
| 
 | ||||
| * Activate your highlighter in `~/.zshrc`: | ||||
| 
 | ||||
|         ZSH_HIGHLIGHT_HIGHLIGHTERS+=(myhighlighter) | ||||
|         ZSH_HIGHLIGHT_HIGHLIGHTERS+=(acme) | ||||
| 
 | ||||
| * [Write tests](../tests/README.md). | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Daniel Shahaf
						Daniel Shahaf