fish-shell/share/functions/ls.fish
axel b8f2f46945 Use dircolors to set default colors for ls
darcs-hash:20061130154026-ac50b-d6d5e182a71516aa56ab16851e47510f2561b585.gz
2006-12-01 01:40:26 +10:00

29 lines
616 B
Fish

#
# Make ls use colors if we are on a system that supports this
#
if command ls --version 1>/dev/null 2>/dev/null
# This is GNU ls
function ls -d (N_ "List contents of directory")
set -l param --color=auto
if isatty 1
set param $param --indicator-style=classify
end
command ls $param $argv
end
if not set -q LS_COLORS
if type -f dircolors >/dev/null
eval (dircolors -c)
end
end
else
# BSD, OS X and a few more support colors through the -G switch instead
if command ls / -G 1>/dev/null 2>/dev/null
function ls -d (N_ "List contents of directory")
command ls -G $argv
end
end
end