mirror of
https://github.com/zdharma-continuum/history-search-multi-word
synced 2024-11-21 19:03:11 +00:00
*highlight: Use $REPLY, don't create additional variables
This commit is contained in:
parent
05cb4c6073
commit
8acdd8bd5b
1 changed files with 4 additions and 7 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue