1

I use zsh-syntax-highlighting package and it colorize all files with the same color as directories (path). I think one should have possibility to customize these colors or at least use $LS_COLORS as default. However it seems that I can change only one variable:

ZSH_HIGHLIGHT_STYLES[path]='fg=blue,bold'

Am I missing something?

1
  • Not a solution, but have you tried to use this: github.com/trapd00r/LS_COLORS ? It's pretty straightforward and you can customize a lot of file extensions in there.
    – ramonovski
    Sep 5, 2014 at 21:55

1 Answer 1

3

This question pushed me to fork zsh-syntax-hightighting and add this feature. I've started from the filetypes project as ramonovski suggested in the comment, but it is very outdated with respect to original zsh-syntax-highlighting, lacks a lot of feature, supports only "256 color codes" in $LS_COLORS, etc.

At the end I've decided to write my own functions, and the result looks like that:

enter image description here

Notice a few things:

  1. Files (basename) and directories (dirname) are colored differently. This is not like standard ls works but I like that better, and to my taste this is just a bug in ls.
  2. All possible file attributes are taken into account, not only file extension *.xxx. So for example null from /dev/ as a character device is yellow here, as in ls command.
  3. Files without 'special' attributes and without extension are in default color (.zshrc on the picture)
  4. Directory names are resolved correctly with tilde

If you like it you can download from github: http://github.com/jimmijj/zsh-syntax-highlighting

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .