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