mirror of
https://github.com/zsh-users/zsh-syntax-highlighting
synced 2024-12-11 22:15:23 +00:00
main: Only expand aliases in command position
This commit is contained in:
parent
99d7235c2b
commit
f46b148c52
@ -498,25 +498,27 @@ _zsh_highlight_main_highlighter_highlight_list()
|
|||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Expand aliases.
|
if [[ $this_word == *:start:* ]] && ! (( in_redirection )); then
|
||||||
# TODO: this should be done iteratively, e.g., 'alias x=y y=z z=w\n x'
|
# Expand aliases.
|
||||||
# And then the entire 'alias' branch of the 'case' statement should
|
# TODO: this should be done iteratively, e.g., 'alias x=y y=z z=w\n x'
|
||||||
# be done here.
|
# And then the entire 'alias' branch of the 'case' statement should
|
||||||
# TODO: path expansion should happen _after_ alias expansion
|
# be done here.
|
||||||
_zsh_highlight_main_highlighter_expand_path $arg
|
# TODO: path expansion should happen _after_ alias expansion
|
||||||
_zsh_highlight_main__type "$REPLY"
|
_zsh_highlight_main_highlighter_expand_path $arg
|
||||||
local res="$REPLY"
|
_zsh_highlight_main__type "$REPLY"
|
||||||
if [[ $res == "alias" ]]; then
|
local res="$REPLY"
|
||||||
_zsh_highlight_main__resolve_alias $arg
|
if [[ $res == "alias" ]]; then
|
||||||
() {
|
_zsh_highlight_main__resolve_alias $arg
|
||||||
# Use a temporary array to ensure the subscript is interpreted as
|
() {
|
||||||
# an array subscript, not as a scalar subscript
|
# Use a temporary array to ensure the subscript is interpreted as
|
||||||
local -a reply
|
# an array subscript, not as a scalar subscript
|
||||||
# TODO: the ${interactive_comments+set} path needs to skip comments; see test-data/alias-comment1.zsh
|
local -a reply
|
||||||
reply=( ${interactive_comments-${(z)REPLY}}
|
# TODO: the ${interactive_comments+set} path needs to skip comments; see test-data/alias-comment1.zsh
|
||||||
${interactive_comments+${(zZ+c+)REPLY}} )
|
reply=( ${interactive_comments-${(z)REPLY}}
|
||||||
arg=$reply[1]
|
${interactive_comments+${(zZ+c+)REPLY}} )
|
||||||
}
|
arg=$reply[1]
|
||||||
|
}
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Analyse the current word.
|
# Analyse the current word.
|
||||||
|
Loading…
Reference in New Issue
Block a user