Переглянути джерело

[utility] Some GNU aliases are not colours-related

and they were mistakenly inside the Colours scope. Move them out of
there.

Still using the same `(( ${+commands[dircolors]} ))` test because it
works well with MacOS with coreutils installed without the `g` prefix,
for example.
Eric Nielsen 6 роки тому
батько
коміт
0dfce9e8b7
1 змінених файлів з 16 додано та 11 видалено
  1. 16 11
      modules/utility/init.zsh

+ 16 - 11
modules/utility/init.zsh

@@ -17,14 +17,6 @@ if (( terminfo[colors] >= 8 )); then
     else
       export LS_COLORS='di=1;34:ln=35:so=32:pi=33:ex=31:bd=1;36:cd=1;33:su=30;41:sg=30;46:tw=30;42:ow=30;43'
     fi
-
-    alias ls='ls --group-directories-first --color=auto'
-    alias lx='ll -X' # long format, sort by extension (GNU only)
-
-    # Always wear a condom (GNU only)
-    alias chmod='chmod --preserve-root -v'
-    alias chown='chown --preserve-root -v'
-
   else
     # BSD
 
@@ -44,9 +36,7 @@ if (( terminfo[colors] >= 8 )); then
   (( ! ${+GREP_COLOR} )) && export GREP_COLOR='37;45'               #BSD
   (( ! ${+GREP_COLORS} )) && export GREP_COLORS="mt=${GREP_COLOR}"  #GNU
   if [[ ${OSTYPE} == openbsd* ]]; then
-    if (( ${+commands[ggrep]} )); then
-      alias grep='ggrep --color=auto'
-    fi
+    (( ${+commands[ggrep]} )) && alias grep='ggrep --color=auto'
   else
    alias grep='grep --color=auto'
   fi
@@ -65,6 +55,21 @@ fi
 
 
 #
+# GNU only
+#
+
+if (( ${+commands[dircolors]} )); then
+
+  alias ls='ls --group-directories-first --color=auto'
+  alias lx='ll -X' # long format, sort by extension
+
+  # Always wear a condom
+  alias chmod='chmod --preserve-root -v'
+  alias chown='chown --preserve-root -v'
+fi
+
+
+#
 # ls Aliases
 #