I am trying to get the solarized color theme to work in my terminal. I read the instructions here but I get the following dircolors error:
dircolors: `/home/avazquez/.dircolors_zsh':90: unrecognized keyword RESET
dircolors: `/home/avazquez/.dircolors_zsh':94: unrecognized keyword MULTIHARDLINK
dircolors: `/home/avazquez/.dircolors_zsh':103: unrecognized keyword CAPABILITY
when running:
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
fi
from my .zshrc
in zsh (latest version) (which I remotely access ssh -X
from gnome-terminal
in Ubuntu).
The path to the .dircolors
file in question is here and the troubling lines seem to be some of the special files definitions:
## Special files
NORMAL 00;38;5;244 # no color code at all
#FILE 00 # regular file: use no color at all
RESET 0 # reset to "normal" color
DIR 00;38;5;33 # directory 01;34
LINK 01;38;5;37 # symbolic link. (If you set this to 'target' instead of a
# numerical value, the color is as for the file pointed to.)
MULTIHARDLINK 00 # regular file with more than one link
FIFO 48;5;230;38;5;136;01 # pipe
SOCK 48;5;230;38;5;136;01 # socket
DOOR 48;5;230;38;5;136;01 # door
BLK 48;5;230;38;5;244;01 # block device driver
CHR 48;5;230;38;5;244;01 # character device driver
ORPHAN 48;5;235;38;5;160 # symlink to nonexistent file, or non-stat'able file
SETUID 48;5;160;38;5;230 # file that is setuid (u+s)
SETGID 48;5;136;38;5;230 # file that is setgid (g+s)
CAPABILITY 30;41 # file with capability
STICKY_OTHER_WRITABLE 48;5;64;38;5;230 # dir that is sticky and other-writable (+t,o+w)
OTHER_WRITABLE 48;5;235;38;5;33 # dir that is other-writable (o+w) and not sticky
STICKY 48;5;33;38;5;230 # dir with the sticky bit set (+t) and not other-writable
# This is for files with execute permission:
EXEC 01;38;5;64
Best Answer
That has little to do with
zsh
.zsh
supports coloured completion like GNUls
does (with things like blue for directories, green for executables...), and it supports the same configuration directives as GNUls
does.GNU
ls
colour configuration is done via theLS_COLORS
environment variable. When that variable containsln=01;36
, that means that symbolik links are to be rendered in bold cyan (36
being the ANSI colour code for foreground cyan and01
being bold).In
zsh
, you can do the same with:And actually you generally configure
zsh
coloured completion with:So
zsh
colours completions the same way GNU ls does.To make it easier writing the content of the
LS_COLORS
variable, GNUls
comes with thedircolors
command. That command takes as input a configuration file with a more verbose content (as configuration files don't have space constraints like environment variables have) and generates the corresponding content of theLS_COLORS
variable suitable for your terminal.Above we have:
01
is still bold, but38;5;37
is the specification for extended colour modes for terminals likexterm
that support 88 or 256 colours.That's foreground colour 37 which is some shade of cyan (
rgb:00/af/af
) slightly darker than the default colour for the ANSI colour 6 (cyan3
at least with myxterm
, which here isrgb:00/cd/cd
).When passed through
dircolors
, that becomesln=38;5;37
.There's also
MULTIHARDLINK 00
which says that files with more than one hard link are to be rendered with the default colour. That would translate tomh=00
in$LS_COLORS
.However, that's been introduced in a relatively recent version of
ls
/dircolors
. It used to beHARDLINK
/hl
, but was renamed toMULTIHARDLINK
/mh
in coreutils 7.5 in 2009 as that was a more correct choice of wording.It seems that you have an older version of
dircolors
. Note thatzsh
supports neitherhl
normh
(though it wouldn't complain, just ignore it), and because it's just set to the default colours, you might as well remove that line.RESET
/rs
was added in coreutils 6.11, and is not supported byzsh
either.CAPABILITY
/ca
was added in coreutils 7.0 and is not supported byzsh
either.There are probably more of those not supported by
zsh
(Seeinfo zsh 'The zsh/complist Module'
for details), but again,zsh
just ignores what it doesn't support.The errors you get there are from
dircolors
. It just means that whoever wrote thatdircolors
file had a newer version of coreutils (the GNU suite of utilities includingls
anddircolors
) than you have. Just remove the lines that are not supported in that file.