Actually check that ls options exist before adding them to the alias.
[grml-etc-core.git] / etc / zsh / zshrc
index 6533d72..9ce49ca 100644 (file)
@@ -345,9 +345,9 @@ ZSH_NO_DEFAULT_LOCALE=${ZSH_NO_DEFAULT_LOCALE:-0}
 
 typeset -ga ls_options
 typeset -ga grep_options
-if ls --help 2> /dev/null | grep -q GNU; then
+if ls --color=auto / >/dev/null 2>&1; then
     ls_options=( --color=auto )
-elif [[ $OSTYPE == freebsd* ]]; then
+elif ls -G / >/dev/null 2>&1; then
     ls_options=( -G )
 fi
 if grep --help 2> /dev/null | grep -q GNU || \
@@ -2326,8 +2326,8 @@ fi
 
 # do we have GNU ls with color-support?
 if [[ "$TERM" != dumb ]]; then
-    #a1# List files with colors (\kbd{ls -CF \ldots})
-    alias ls='ls -CF '${ls_options:+"${ls_options[*]}"}
+    #a1# List files with colors (\kbd{ls -F \ldots})
+    alias ls='ls -F '${ls_options:+"${ls_options[*]}"}
     #a1# List all files, with colors (\kbd{ls -la \ldots})
     alias la='ls -la '${ls_options:+"${ls_options[*]}"}
     #a1# List files with long colored list, without dotfiles (\kbd{ls -l \ldots})
@@ -2337,7 +2337,7 @@ if [[ "$TERM" != dumb ]]; then
     #a1# List files with long colored list, append qualifier to filenames (\kbd{ls -lF \ldots})\\&\quad(\kbd{/} for directories, \kbd{@} for symlinks ...)
     alias l='ls -lF '${ls_options:+"${ls_options[*]}"}
 else
-    alias ls='ls -CF'
+    alias ls='ls -F'
     alias la='ls -la'
     alias ll='ls -l'
     alias lh='ls -hAl'