2006-02-08 09:20:05 +00:00
|
|
|
#
|
|
|
|
# Make ls use colors if we are on a system that supports this
|
|
|
|
#
|
|
|
|
|
2006-02-20 13:02:03 +00:00
|
|
|
if command ls --version 1>/dev/null 2>/dev/null
|
2006-02-08 09:20:05 +00:00
|
|
|
# This is GNU ls
|
2007-01-16 01:29:18 +00:00
|
|
|
function ls --description "List contents of directory"
|
2006-09-19 16:53:17 +00:00
|
|
|
set -l param --color=auto
|
|
|
|
if isatty 1
|
|
|
|
set param $param --indicator-style=classify
|
|
|
|
end
|
2006-10-04 23:55:30 +00:00
|
|
|
command ls $param $argv
|
2006-02-08 09:20:05 +00:00
|
|
|
end
|
2006-02-20 13:02:03 +00:00
|
|
|
|
2006-11-30 15:40:26 +00:00
|
|
|
if not set -q LS_COLORS
|
|
|
|
if type -f dircolors >/dev/null
|
2013-08-12 06:38:17 +00:00
|
|
|
eval (dircolors -c | sed 's/>&\/dev\/null$//')
|
2006-11-30 15:40:26 +00:00
|
|
|
end
|
2006-02-20 13:02:03 +00:00
|
|
|
end
|
|
|
|
|
2006-02-08 09:20:05 +00:00
|
|
|
else
|
|
|
|
# BSD, OS X and a few more support colors through the -G switch instead
|
2009-02-01 22:24:10 +00:00
|
|
|
if command ls -G / 1>/dev/null 2>/dev/null
|
2007-01-16 01:29:18 +00:00
|
|
|
function ls --description "List contents of directory"
|
2006-02-08 09:20:05 +00:00
|
|
|
command ls -G $argv
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|