zsh-users / zsh-syntax-highlighting

Fish shell like syntax highlighting for Zsh.
github.com/zsh-users/zsh-syntax-highlighting
BSD 3-Clause "New" or "Revised" License
19.93k stars 1.32k forks source link

Inner command words highlighting disregards allowed types #608

Open danielshahaf opened 5 years ago

danielshahaf commented 5 years ago

In the commands builtin foo, command foo, and sudo foo, the inner command word foo should be looked up only as a builtin or external command, respectively.

After builtin aliases, function names, hashed command names, and absolute paths should be red even if they're otherwise valid; similar restrictions apply after command and external commands that are precommands (e.g., sudo/doas, env, ssh, xargs, chroot/jexec, strace, setsid, stdbuf, etc). We needn't enumerate them; any known precommand [see $precommand_options] that's itself an external command — that is, isn't shadowed by a function or alias — can only be followed by external commands.

This should be fairly easy to fix by making the setting and testing of the :start: state more fine-grained.

danielshahaf commented 5 years ago

(GitHub's UI doesn't show that I pushed the tests to this repository as well: https://github.com/zsh-users/zsh-syntax-highlighting/commit/bc3f77f719ae80b5258292a10a5461aee5597eb2)

danielshahaf commented 4 years ago

Cross-referencing #249 #541 #545, which are all variants of this.

danielshahaf commented 4 years ago

Also #461.