zsh-syntax-highlighting icon indicating copy to clipboard operation
zsh-syntax-highlighting copied to clipboard

Selectively activate ZSH_HIGHLIGHT_STYLES?

Open mejo13 opened this issue 4 years ago • 7 comments
trafficstars

Hey, is there a way to deactivate all styles for one highlighter without setting everysingle one of them to 'none'? I'd like to activate only some and not all!?

Greetings

mejo13 avatar Aug 06 '21 10:08 mejo13

No.

Going forward, however, we could namespace styles, so the foo highlighter's styles would all be named foo:… (and existing names would be continue to be accepted for compatibility). That would enable the above request by iterating ${(k)ZSH_HIGHLIGHT_STYLES[(I)…]}. WDYT, all?

danielshahaf avatar Aug 06 '21 23:08 danielshahaf

How'd this interact with themes?

danielshahaf avatar Aug 06 '21 23:08 danielshahaf

Would be awesome to be able to do that! For the mean time, if anyone is interested in the list:

ZSH_HIGHLIGHT_STYLES[unknown-token]='none'
ZSH_HIGHLIGHT_STYLES[reserved-word]='none'
ZSH_HIGHLIGHT_STYLES[alias]='none'
ZSH_HIGHLIGHT_STYLES[suffix-alias]='none'
ZSH_HIGHLIGHT_STYLES[global-alias]='none'
ZSH_HIGHLIGHT_STYLES[builtin]='none'
ZSH_HIGHLIGHT_STYLES[function]='none'
ZSH_HIGHLIGHT_STYLES[command]='none'
ZSH_HIGHLIGHT_STYLES[precommand]='none'
ZSH_HIGHLIGHT_STYLES[commandseparator]='none'
ZSH_HIGHLIGHT_STYLES[hashed-command]='none'
ZSH_HIGHLIGHT_STYLES[autodirectory]='none'
ZSH_HIGHLIGHT_STYLES[path]='none'
ZSH_HIGHLIGHT_STYLES[path_pathseparator]='none'
ZSH_HIGHLIGHT_STYLES[path_prefix]='none'
ZSH_HIGHLIGHT_STYLES[path_prefix_pathseparator]='none'
ZSH_HIGHLIGHT_STYLES[globbing]='none'
ZSH_HIGHLIGHT_STYLES[history-expansion]='none'
ZSH_HIGHLIGHT_STYLES[command-substitution]='none'
ZSH_HIGHLIGHT_STYLES[command-substitution-unquoted]='none'
ZSH_HIGHLIGHT_STYLES[command-substitution-quoted]='none'
ZSH_HIGHLIGHT_STYLES[command-substitution-delimiter]='none'
ZSH_HIGHLIGHT_STYLES[command-substitution-delimiter-unquoted]='none'
ZSH_HIGHLIGHT_STYLES[command-substitution-delimiter-quoted]='none'
ZSH_HIGHLIGHT_STYLES[process-substitution]='none'
ZSH_HIGHLIGHT_STYLES[process-substitution-delimiter]='none'
ZSH_HIGHLIGHT_STYLES[arithmetic-expansion]='none'
ZSH_HIGHLIGHT_STYLES[single-hyphen-option]='none'
ZSH_HIGHLIGHT_STYLES[double-hyphen-option]='none'
ZSH_HIGHLIGHT_STYLES[back-quoted-argument]='none'
ZSH_HIGHLIGHT_STYLES[back-quoted-argument-unclosed]='none'
ZSH_HIGHLIGHT_STYLES[back-quoted-argument-delimiter]='none'
ZSH_HIGHLIGHT_STYLES[single-quoted-argument]='none'
ZSH_HIGHLIGHT_STYLES[single-quoted-argument-unclosed]='none'
ZSH_HIGHLIGHT_STYLES[double-quoted-argument]='none'
ZSH_HIGHLIGHT_STYLES[double-quoted-argument-unclosed]='none'
ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]='none'
ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument-unclosed]='none'
ZSH_HIGHLIGHT_STYLES[rc-quote]='none'
ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]='none'
ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]='none'
ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument]='none'
ZSH_HIGHLIGHT_STYLES[assign]='none'
ZSH_HIGHLIGHT_STYLES[redirection]='none'
ZSH_HIGHLIGHT_STYLES[comment]='none'
ZSH_HIGHLIGHT_STYLES[comment]='none'
ZSH_HIGHLIGHT_STYLES[named-fd]='none'
ZSH_HIGHLIGHT_STYLES[numeric-fd]='none'
ZSH_HIGHLIGHT_STYLES[arg0]='none'
ZSH_HIGHLIGHT_STYLES[default]='none'

mejo13 avatar Aug 07 '21 11:08 mejo13

Just curious, in your configuration, what styles didn't you set tonone? Matthew has proposed a similar setup and I wonder how closely his proposal matches your use.

danielshahaf avatar Aug 08 '21 06:08 danielshahaf

only a few, i'll build up on that. currently active are {single,double}-hyphen-option, {single,double}-quoted-argument{-unclosed}, redirection.

mejo13 avatar Aug 08 '21 17:08 mejo13

bad math expression: operand expected at `/usr/local...'

ctykwz avatar Nov 02 '21 09:11 ctykwz

Probably missing a typeset -A ZSH_HIGHLIGHT_STYLES.

Open a new ticket to discuss further, unless your issue relates to the snippets above.

danielshahaf avatar Nov 02 '21 20:11 danielshahaf