Open matan-h opened 9 months ago
alias buckets='${BMA_HOME:-$HOME/.bash-my-aws}/bin/bma buckets'
.
⋮echo "echo run" > $HOME/run.sh chmod +x ~/run.sh alias run="\$HOME/run.sh" run
z-sy-h has not implemented the full man zshexpn | less -p "brain damage"
set of expansions. What it does do is highlight use of an alias according to how the expansion of the alias would be highlighted.
So, you should find that if you literally type $HOME/run.sh
at the prompt, it's highlighted the same way "run" is.
Solving this in the general case is going to require some sort of "indeterminate whether this should be green or red" highlighting, due to side effects (e.g., $(foo), or $((++bar)), or ${baz} where baz is special
and its getfn() has side effects). Highlighting the specific case of $foo/bar
at command position should easy enough, though. In fact, I thought we'd already merged a PR for this... Perhaps it's still open? (It might not mention aliases.)
[Incidentally, "easy enough" does still mean it'd be good to check that that $foo is scalar
, is not special
, and either $foo has a value or $zsyh_user_options[unset] doesn't have the value that means attempting to expand an unset variable is an error.]
In the case of $HOME/run.sh
it's because _zsh_highlight_main_highlighter__try_expand_parameter
expects the whole word to be a parameter expansion. Handling that wouldn't fix the original issue with ${BMA_HOME:-$HOME/.bash-my-aws}
though.
I get to this issue from bash-my-aws, which have this alias in it:
alias buckets='${BMA_HOME:-$HOME/.bash-my-aws}/bin/bma buckets'
.The
buckets
alias works, and the autocomplete work fine, but for some reason it highlights it as not found.There is superuser question about it.
Step to reproduce: