From 8dc4c32c913f370ebcfa246ffc9f01a3cb85e892 Mon Sep 17 00:00:00 2001 From: Steve McKinney Date: Mon, 2 Apr 2012 07:13:59 -0400 Subject: [PATCH] Adds dircolors support for OS X All GNU coreutils commands are installed with the prefix 'g' on Mac OS X via homebrew. This fix adds support for GNU ls without losing the git alias 'gls'. --- alias.zsh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/alias.zsh b/alias.zsh index ccef5275..24eea664 100644 --- a/alias.zsh +++ b/alias.zsh @@ -20,6 +20,18 @@ if (( $+commands[dircolors] )); then else alias ls="$aliases[ls] -F" fi +elif (( $+commands[gdircolors] )); then + # GNU core utilities on OS X. + alias ls='/usr/local/bin/gls --group-directories-first' + + if zstyle -t ':omz:alias:ls' color; then + if [[ -f "$HOME/.dir_colors" ]]; then + eval $(gdircolors "$HOME/.dir_colors") + fi + alias ls="$aliases[ls] --color=auto" + else + alias ls="$aliases[ls] -F" + fi else # BSD core utilities. if zstyle -t ':omz:alias:ls' color; then