cd647b6dc6779a1aafa2bcc3a81ec10b65c783ac

Author
Marc Cornellà <hello@mcornella.com>
Committer
GitHub <noreply@github.com>
Date

Message

fix(gnu-utils): reset ls alias to use GNU-based --color argument (#11527)

Fixes #11503

Diff

 1diff --git a/plugins/gnu-utils/gnu-utils.plugin.zsh b/plugins/gnu-utils/gnu-utils.plugin.zsh
 2index 9419127d891550e9065f8b920003e1ea679f7efa..6bd3e846321e277a73dcd732d40954a43abbcd5d 100644
 3--- a/plugins/gnu-utils/gnu-utils.plugin.zsh
 4+++ b/plugins/gnu-utils/gnu-utils.plugin.zsh
 5@@ -61,3 +61,14 @@ __gnu_utils_preexec() {
 6 
 7 autoload -Uz add-zsh-hook
 8 add-zsh-hook preexec __gnu_utils_preexec
 9+
10+# lib/theme-and-appearance.zsh sets the alias for ls not knowing that
11+# we'll be using GNU ls. We'll reset this to use GNU ls --color.
12+# See https://github.com/ohmyzsh/ohmyzsh/issues/11503
13+#
14+# The ls alias might look like:
15+# - ls='ls -G'
16+# - ls='gls --color=tty'
17+if [[ -x "${commands[gls]}" && "${aliases[ls]}" = (*-G*|gls*) ]]; then
18+  alias ls='ls --color=tty'
19+fi