From ea0f718e32d1a25da7ecc6e42b70e501f152c99f Mon Sep 17 00:00:00 2001 From: Matt Singleton Date: Sat, 2 Apr 2011 01:00:17 -0400 Subject: better ls colors and always use gnu ls if it's installed --- zsh/appearance.zsh | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'zsh/appearance.zsh') diff --git a/zsh/appearance.zsh b/zsh/appearance.zsh index 04d270f..84d8471 100644 --- a/zsh/appearance.zsh +++ b/zsh/appearance.zsh @@ -2,12 +2,19 @@ # colorize shell programs # ls (platform dependent) -if $(ls --color -d . &>/dev/null 2>&1); then - alias ls='ls --color=tty' - export LS_COLORS="di=34;40:ln=36;40:so=31;40:pi=33;40:ex=32;40:bd=34;46:cd=34;43:su=0;41:sg=0;46:tw=0;42:ow=0;43:" +if [ -e /usr/local/bin/gls ]; then + # if GNU ls is installed (e.g. on BSD), use it + alias ls='/usr/local/bin/gls --color=tty' + export LS_COLORS="rs=0:di=34:ln=36:mh=00:pi=40;33:so=35:do=35:bd=40;33:cd=40;33:or=40;31:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=32" else - alias ls='ls -G' - export LSCOLORS="exgxbxdxcxegedxbxgxcxd" + # otherwise, detect which version of ls is on the path + if $(ls --color -d . &>/dev/null 2>&1); then + alias ls='ls --color=tty' + export LS_COLORS="rs=0:di=34:ln=36:mh=00:pi=40;33:so=35:do=35:bd=40;33:cd=40;33:or=40;31:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=32" + else + alias ls='ls -G' + export LSCOLORS="exgxbxdxcxegedxbxgxcxd" + fi fi # grep -- cgit v1.2.3