diff --git a/share/functions/ls.fish b/share/functions/ls.fish index 772d6b29c..3cd144073 100644 --- a/share/functions/ls.fish +++ b/share/functions/ls.fish @@ -28,10 +28,20 @@ function ls --description "List contents of directory" # Also test -F because we'll want to define this function even with an ls that can't do colors (like NetBSD). if not set -q __fish_ls_color_opt set -g __fish_ls_color_opt - for opt in --color=auto -G --color -F - if command ls $opt / >/dev/null 2>/dev/null - set -g __fish_ls_color_opt $opt - break + set -g __fish_ls_command ls + # OpenBSD ships a command called "colorls" that takes "-G" and "-F", + # but there's also a ruby implementation that doesn't understand "-F". + # Since that one's quite different, don't use it. + if command -sq colorls + and command colorls -GF >/dev/null 2>/dev/null + set -g __fish_ls_color_opt -GF + set -g __fish_ls_command colorls + else + for opt in --color=auto -G --color -F + if command ls $opt / >/dev/null 2>/dev/null + set -g __fish_ls_color_opt $opt + break + end end end end @@ -42,10 +52,5 @@ function ls --description "List contents of directory" isatty stdout and set -a opt -F - if command -sq colorls - command colorls -GF $argv - else - command ls $__fish_ls_color_opt $argv - end - + command $__fish_ls_command $__fish_ls_color_opt $argv end