mirror of
				https://github.com/zsh-users/zsh-autosuggestions.git
				synced 2025-10-23 15:16:27 +08:00 
			
		
		
		
	Add highlight color config variables
This commit is contained in:
		
							parent
							
								
									196cfa0eb0
								
							
						
					
					
						commit
						ea19b7bcf8
					
				| @ -37,3 +37,10 @@ Emacs-mode users can simply use alt+f which is bound to forward-word | |||||||
| 
 | 
 | ||||||
| The [zsh-history-substring-search](https://github.com/zsh-users/zsh-history-substring-search) | The [zsh-history-substring-search](https://github.com/zsh-users/zsh-history-substring-search) | ||||||
| plugin is also recommended. | plugin is also recommended. | ||||||
|  | 
 | ||||||
|  | ## Configuration | ||||||
|  | 
 | ||||||
|  | You may override default global config variables after plugin load. | ||||||
|  | 
 | ||||||
|  | - `AUTOSUGGESTION_HIGHLIGHT_COLOR`: suggestion highlight color, default is `'fg=8'`. | ||||||
|  | - `AUTOSUGGESTION_HIGHLIGHT_CURSOR`: highlight word after cursor or not. Must be integer value `1` or `0`, default is `1`. | ||||||
|  | |||||||
| @ -11,6 +11,10 @@ zmodload zsh/net/socket | |||||||
| 
 | 
 | ||||||
| source "${0:a:h}/completion-client.zsh" | source "${0:a:h}/completion-client.zsh" | ||||||
| 
 | 
 | ||||||
|  | # configuration variables | ||||||
|  | AUTOSUGGESTION_HIGHLIGHT_COLOR='fg=8' | ||||||
|  | AUTOSUGGESTION_HIGHLIGHT_CURSOR=1 | ||||||
|  | 
 | ||||||
| function { | function { | ||||||
| 	if [[ -n $ZLE_DISABLE_AUTOSUGGEST ]]; then | 	if [[ -n $ZLE_DISABLE_AUTOSUGGEST ]]; then | ||||||
| 		ZSH_HIGHLIGHT_HIGHLIGHTERS=() | 		ZSH_HIGHLIGHT_HIGHLIGHTERS=() | ||||||
| @ -123,10 +127,7 @@ _zsh_highlight_autosuggest_highlighter_predicate() { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| _zsh_highlight_autosuggest_highlighter() { | _zsh_highlight_autosuggest_highlighter() { | ||||||
| 	local color='fg=8' | 	region_highlight+=("$(( $CURSOR + $AUTOSUGGESTION_HIGHLIGHT_CURSOR )) $(( $CURSOR + $#RBUFFER )) $AUTOSUGGESTION_HIGHLIGHT_COLOR") | ||||||
| 	[[ -n $AUTOSUGGESTION_HIGHLIGHT_COLOR ]] &&\ |  | ||||||
| 		color=$AUTOSUGGESTION_HIGHLIGHT_COLOR |  | ||||||
| 	region_highlight+=("$(( $CURSOR + 1 )) $(( $CURSOR + $#RBUFFER )) $color") |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| autosuggest-insert-or-space() { | autosuggest-insert-or-space() { | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Vladimir Rudnyh
						Vladimir Rudnyh