mirror of
				https://github.com/zsh-users/zsh-syntax-highlighting.git
				synced 2025-10-30 15:56:28 +08:00 
			
		
		
		
	protect alias expansion from interpreting aliases as options
If one defines aliases like `++` the alias builtin tries to interprete these
as options so they have to be protected like this
    alias -- ++=true
The same goes for a call to `alias` in order to expand the alias again.
			
			
This commit is contained in:
		
							parent
							
								
									dbd27cb30a
								
							
						
					
					
						commit
						784a5dc35b
					
				| @ -97,7 +97,7 @@ _zsh_highlight_main_highlighter() | |||||||
|       case $res in |       case $res in | ||||||
|         *': reserved')  style=$ZSH_HIGHLIGHT_STYLES[reserved-word];; |         *': reserved')  style=$ZSH_HIGHLIGHT_STYLES[reserved-word];; | ||||||
|         *': alias')     style=$ZSH_HIGHLIGHT_STYLES[alias] |         *': alias')     style=$ZSH_HIGHLIGHT_STYLES[alias] | ||||||
|                         local aliased_command="${"$(alias $arg)"#*=}" |                         local aliased_command="${"$(alias -- $arg)"#*=}" | ||||||
|                         [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_FOLLOWED_BY_COMMANDS:#"$aliased_command"} && -z ${(M)ZSH_HIGHLIGHT_TOKENS_FOLLOWED_BY_COMMANDS:#"$arg"} ]] && ZSH_HIGHLIGHT_TOKENS_FOLLOWED_BY_COMMANDS+=($arg) |                         [[ -n ${(M)ZSH_HIGHLIGHT_TOKENS_FOLLOWED_BY_COMMANDS:#"$aliased_command"} && -z ${(M)ZSH_HIGHLIGHT_TOKENS_FOLLOWED_BY_COMMANDS:#"$arg"} ]] && ZSH_HIGHLIGHT_TOKENS_FOLLOWED_BY_COMMANDS+=($arg) | ||||||
|                         ;; |                         ;; | ||||||
|         *': builtin')   style=$ZSH_HIGHLIGHT_STYLES[builtin];; |         *': builtin')   style=$ZSH_HIGHLIGHT_STYLES[builtin];; | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Lucas Hoffmann
						Lucas Hoffmann