sorin-ionescu / prezto

The configuration framework for Zsh
MIT License
14k stars 4.49k forks source link

Feature request to make gls work on macos with coreutils #1758

Open GiHutb opened 5 years ago

GiHutb commented 5 years ago

After installing coreutils via below command

$> brew install coreutils

'gls' and 'gdircolors' are available. So if I do below colors and directory dirs-first is working.

$> git diff
diff --git a/modules/utility/init.zsh b/modules/utility/init.zsh
index a2e5c2b..4400cf0 100644
--- a/modules/utility/init.zsh
+++ b/modules/utility/init.zsh
@@ -73,6 +73,12 @@ if zstyle -T ':prezto:module:utility' safe-ops; then
 fi

 # ls
+
+if is-callable 'gdircolors'; then
+  alias dircolors='gdircolors'
+  alias ls="${aliases[ls]:-gls}"
+fi
+
 if is-callable 'dircolors'; then
   # GNU Core Utilities

Can you check if coreutils has been installed ?

belak commented 4 years ago

The problem is that normally coreutils is installed without the g prefix. I may port over the same fix that I implemented for my zsh-utils: https://github.com/belak/zsh-utils/blob/8e2a0280/utility/utility.plugin.zsh#L9-L28

GaRUi commented 4 years ago

Thank you so much belak :)