I have installed zsh-syntax-highlighting. This works well, except of one oddity: When I type a parameter expansion as a command argument, i.e.
foo $PWD
as soon as I type the $P
, the parameter expansion is coloured black (which makes it invisible since I use a terminal with black backroung). It stays black when I type $PW
, and turns visible (foreground colour, but underlined) once the $PWD
is typed. It seems that the highlight attributes are "fg=black" for an "unfinished/unknown" parameter, but just unline for a known parameter.
I like the fact that they are coloured differently, since I can catch in this way typos in a variable name early. However, black is unreadable, since I also have a black background.
More interestingly, this happens only if the first word in the line is either an external command (like foo
in my example), or a syntax keyword (if
). It does not happen if the first word in the line is an internal command (such as echo
), or an alias invocation, or a function call.
I searched the documentation, but did not find where this colouring of "unfinished parameter expansion" could be defined.
I'm using the following highlighters:
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern line)
I set various highlight categories, but there is none where I would simply set the foreground to black.
I do some highlighting of very specific parameters, which are important to me, like this:
ZSH_HIGHLIGHT_PATTERNS+=('$(oncoll|onyt|oncp|ong)' 'fg=black,bold,bg=white')
But this also can't have any impact to the problem described here.
Does someone happen to know, which style setting affects me here?
ZSH_HIGHLIGHT_STYLES[comment]
, which isn't what you describe, but try changing it, as I don't think you want it in black anyways. It could be also any withnone
, did you try changing theZSH_HIGHLIGHT_STYLES[default]
one to see if it affects it?comment
. After I changed it to something better visible, it worked like a charm. If you post your finding as an answer, I will accept it.