OK, so I'm using this little fancy cutting edge technology called zsh-syntax-highlighting and although I'm overall happy with the result I don't know how to set styles to anything but 8 basic colors (black, red, green, yellow, blue, magenta, cyan, white), e.g.
#works
ZSH_HIGHLIGHT_STYLES[path]='fg=red'
ZSH_HIGHLIGHT_STYLES[path]='fg=1'
#doesn't work
ZSH_HIGHLIGHT_STYLES[path]='fg=31m'
ZSH_HIGHLIGHT_STYLES[path]='fg=\e[31m'
ZSH_HIGHLIGHT_STYLES[path]='fg=%{\e[31m%}'
ZSH_HIGHLIGHT_STYLES[path]='31m'
ZSH_HIGHLIGHT_STYLES[path]='\e[31m'
ZSH_HIGHLIGHT_STYLES[path]='%{\e[31m%}'
ZSH_HIGHLIGHT_STYLES[path]='%{\e[1;38;5;118m%}'
So, how do I set more fancy colors for this zshzle plugin?
Best Answer
As you pointed out in the comment to chepner answer
terminator
is a fork ofgnome-terminal
and it still uses a lot of functions from gnome. In fact it seems that the wholeterminator
VTE widget comes from gnome and gnome-terminal by defaults "supports" only 8 basic colors. You can check that withechotc Co
command. It will return 8 for both of them and forxterm
too (although inxterm
case this is true and only 8 colors), so basically all 3 terminal emulators you tried so far.Now, you noted that teminator (and gnome-terminal) can in fact display more colors, but this is only because it more or less processes all those special color codes without paying attention to TERM settings what does not obey standards but well, this is gnome. Anyway to make long story short you need to set
TERM
environment variable to something likexterm-256color
and check again withechotc Co
- you should now see256
, and yourZSH_HIGHLIGHT_STYLES[path]='fg=217'
should work as well.To always start with 256 colors you can put into you .zshrc
and if you have any gnome shortcuts with
terminator
then change them as follows