diff --git a/hsmw-highlight b/hsmw-highlight index 2b8dcd7..e04a489 100644 --- a/hsmw-highlight +++ b/hsmw-highlight @@ -386,9 +386,7 @@ typeset -gA HSMW_HIGHLIGHT_STYLES next_word+=':start:' else -hsmw-highlight-expand-path $arg - local expanded_arg="$REPLY" - -hsmw-highlight-main-type ${expanded_arg} - local res="$REPLY" + -hsmw-highlight-main-type $REPLY () { # Special-case: command word is '$foo', like that, without braces or anything. # @@ -397,15 +395,14 @@ typeset -gA HSMW_HIGHLIGHT_STYLES # incorrectness is outweighed by the usability improvement of permitting the use of # parameters that refer to commands, functions, and builtins. local MATCH; integer MBEGIN MEND - if [[ $res == none ]] && (( ${+parameters} )) && + if [[ $REPLY == none ]] && (( ${+parameters} )) && [[ ${arg[1]} == \$ ]] && [[ ${arg:1} = (#m)([[:alpha:]_][[:alnum:]_]#|[[:digit:]]##) ]] && (( ${+parameters[${MATCH}]} )) then -hsmw-highlight-main-type ${(P)MATCH} - res=$REPLY fi } - case $res in + case $REPLY in reserved) # reserved word style=reserved-word if [[ $arg == $'\x7b' ]]; then @@ -502,7 +499,7 @@ typeset -gA HSMW_HIGHLIGHT_STYLES fi fi ;; - *) -hsmw-add-highlight $start_pos $end_pos commandtypefromthefuture-$res + *) -hsmw-add-highlight $start_pos $end_pos commandtypefromthefuture-$REPLY already_added=1 ;; esac