ls --color=auto くわっ!! LS_COLORS

結論から。
man ls --> man dircolors --> man dir_colors と巡って,
.zshrc に,

## setting for colors of ls command
eval "`dircolors -b ~/.dir_colors`"

で解決。うーん,全部マニュアルに書いてある。すばらしい。
ぐぐらずに解決できるのが一番やね。
Linux から man をコピーしといてよかったなぁと。
Cygwin の man にもあるかどうかは確かめてないですが。。。
にしても,man はすげぇ。書いた人たちに感謝。


`-b' オプションは,B shell 用に出力するらしいけど,見てみたら,
いけそうだったので。一応,出力を載っけときます。
ちなみに,`-c' オプションで,csh 用に出力されるそうです。

% dircolors -b ~/.dir_colors   
LS_COLORS='no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:
cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:tw=37;42:ow=34;42:st=37;44:ex=01;32:
*.cmd=01;32:*.exe=01;32:*.com=01;32:*.btm=01;32:*.bat=01;32:*.tar=01;31:
*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:
*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:
*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:
*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:
*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:
*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.flac=01;35:*.mp3=01;35:
*.mpc=01;35:*.ogg=01;35:*.wav=01;35:';
export LS_COLORS
## 適当に改行しています。実際は改行ははいりません。
## tw=37;42 っていうのが,今回変更した箇所。sTicky bit set and other Writable か。


いやね,`ls --color=auto /' ってやったときに,
tmp ディレクトリの背景が緑で,文字色が黒となり,
ほとんど認識できなくて,苦痛で,今まで --color=auto を
使ってこなかったわけで,でも,一念発起して,
過去のトラウマに立ち向かったという壮大なドラマなんです。


どうやら, --color=auto では,/etc/DIR_COLORS を使って
色を決めているご様子。ほんとか?


んでもって,tmp ディレクトリの背景色ですが,sticky bit が立っていることと,
背景が緑であることから,/etc/DIR_COLORS を眺めると,

STICKY_OTHER_WRITABLE 30;42 # dir that is sticky and other-writable (+t,o+w)

これが該当っぽい。
迷ったけど,文字色を白にすることにしました。
で,まず,ホームディレクトリに,.dir_colors としてコピー。
んで,/etc/DIR_COLORS によると・・・

# Below are the color init strings for the basic file types. A color init
# string consists of one or more of the following numeric codes:
# Attribute codes:
# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
# Text color codes:
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
# Background color codes:
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white

文字色の白は 37 らしいので,

STICKY_OTHER_WRITABLE 37;42 # dir that is sticky and other-writable (+t,o+w)

と該当行を変更して,.zshrc にこのエントリの一番上に書いた行を追加と。


attribute の,concealed とか,underscore とかおもしろそうだね。
concealed はためしたけど,見えなくなるわけでもなく?だったです。


いやー,毎度のことながら,なげーなぁ。
「短くまとめることができない == 文章力がない」なのか?
そうなのか?
そうだったんか?

今回活躍してくれた英雄のみなさん

  • man ls
  • man dircolors
  • man dir_colors
  • dircolors
  • /etc/DIR_COLORS
  • 俺。

なげーなげーといいながら,さらにかいてもうた。。。