From 268a570ae338318416c0df3356b4aca47c3093c0 Mon Sep 17 00:00:00 2001 From: Eric Nielsen Date: Mon, 19 Nov 2018 17:13:45 -0500 Subject: [PATCH] [utility] Use CLICOLOR for coloured output in BSD instead of aliasing `ls` to `ls -G`. CLICOLOR is detected not only by `ls`, but by `tree` too (starting with version 1.8.0). See http://mama.indstate.edu/users/ice/tree/changes.html It's probably more widely used by other tools too. --- modules/utility/init.zsh | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/modules/utility/init.zsh b/modules/utility/init.zsh index 96e7692..b998cc0 100644 --- a/modules/utility/init.zsh +++ b/modules/utility/init.zsh @@ -22,15 +22,12 @@ if (( terminfo[colors] >= 8 )); then else # BSD + (( ! ${+CLICOLOR} )) && export CLICOLOR=1 (( ! ${+LSCOLORS} )) && export LSCOLORS='ExfxcxdxbxGxDxabagacad' # stock OpenBSD ls does not support colors at all, but colorls does. - if [[ ${OSTYPE} == openbsd* ]]; then - if (( ${+commands[colorls]} )); then - alias ls='colorls -G' - fi - else - alias ls='ls -G' + if [[ ${OSTYPE} == openbsd* && ${+commands[colorls]} -ne 0 ]]; then + alias ls='colorls' fi fi