From: Michael Prokop Date: Fri, 25 May 2018 09:12:40 +0000 (+0200) Subject: Merge remote-tracking branch 'origin/github/pr/55' X-Git-Tag: v0.15.0~4 X-Git-Url: http://git.grml.org/?p=grml-etc-core.git;a=commitdiff_plain;h=a5eb2feca052396d5b923979118f68f626ac9d69;hp=dcba02cdc441315685ddeb2217aaefe35753a906 Merge remote-tracking branch 'origin/github/pr/55' --- diff --git a/etc/zsh/zshrc b/etc/zsh/zshrc index 53af394..96869cc 100644 --- a/etc/zsh/zshrc +++ b/etc/zsh/zshrc @@ -431,11 +431,22 @@ ZSH_NO_DEFAULT_LOCALE=${ZSH_NO_DEFAULT_LOCALE:-0} typeset -ga ls_options typeset -ga grep_options + +# Colors on GNU ls(1) if ls --color=auto / >/dev/null 2>&1; then ls_options+=( --color=auto ) +# Colors on FreeBSD and OSX ls(1) elif ls -G / >/dev/null 2>&1; then ls_options+=( -G ) fi + +# Natural sorting order on GNU ls(1) +# OSX and IllumOS have a -v option that is not natural sorting +if ls --version |& grep -q 'GNU' >/dev/null 2>&1 && ls -v / >/dev/null 2>&1; then + ls_options+=( -v ) +fi + +# Color on GNU and FreeBSD grep(1) if grep --color=auto -q "a" <<< "a" >/dev/null 2>&1; then grep_options+=( --color=auto ) fi