From 5f5bd03911480432bf33bb23f82d8ba95fbcbfd5 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Fri, 24 Sep 2021 18:14:57 +0200 Subject: [PATCH] functions/ls: Work around Terminal.app not setting $COLORTERM Fixes #8309 --- share/functions/ls.fish | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/share/functions/ls.fish b/share/functions/ls.fish index 3cd144073..dd58e7176 100644 --- a/share/functions/ls.fish +++ b/share/functions/ls.fish @@ -52,5 +52,14 @@ function ls --description "List contents of directory" isatty stdout and set -a opt -F + # Terminal.app doesn't set $COLORTERM or $CLICOLOR, + # but the new FreeBSD ls requires either to be set, + # before it will enable color. + # See #8309. + # We don't set $COLORTERM because that should be set to + # "truecolor" or similar and we don't want to specify that here. + test "$TERM_PROGRAM" = Apple_Terminal + and set -fx CLICOLOR 1 + command $__fish_ls_command $__fish_ls_color_opt $argv end