zsh-syntax-highlighting
zsh-syntax-highlighting copied to clipboard
Precommand assignments after `env` should be allowed to be quoted
See https://github.com/zsh-users/zsh-syntax-highlighting/issues/627#issuecomment-639383008 and the following comments.
For greppability purposes, quoting @phy1729 analysis from there:
sudo env "PATH=$PATH"First word issudowhich is a known precommand, so next word will be parsed as a command. Next word isenvwhich is a known precommand, so next word will be parsed as a command. Next word is"PATH=$PATH". There's a bug in z-sy-h that when parsing a command ($this_word == *:start:*) an assignment is recognized even if it's no long the true start of a command (i.e. after a precommand), socommand foo=bar echo bazparsesfoo=baras an assignment andechoas the command even though command will error asfoo=barisn't a command. However in the case ofenvthis mostly is desired.envbeing a command allows for quoted arguments just like any other, but assignments at the beginning of a command must not be quoted.