about summary refs log tree commit diff
diff options
context:
space:
mode:
authorStarfall <us@starfall.systems>2021-09-16 13:20:27 -0500
committerStarfall <us@starfall.systems>2021-09-16 13:20:27 -0500
commit973b43d377ce07fa4e583823c955b4de9ccf21ca (patch)
tree120db7864ae61944f8ba201d26d95862d2f529ab
parent62a06767a5c3c7a9ae29a913b34e6a7f2fd09710 (diff)
zsh: add aliases for ls on bsd/mac
-rw-r--r--.config/zsh/.zshrc14
1 files changed, 12 insertions, 2 deletions
diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc
index dc29d5a..bc63b3b 100644
--- a/.config/zsh/.zshrc
+++ b/.config/zsh/.zshrc
@@ -62,14 +62,25 @@ zle -N zle-line-finish
 
 # colors in various core utils
 alias diff='diff --color'
-alias ls='ls --color=auto'
 export LESS='-R'
+
 grep_opts="--color=auto --exclude-dir=.git"
 alias grep="grep $grep_opts"
 alias egrep="egrep $grep_opts"
 alias fgrep="fgrep $grep_opts"
 unset grep_opts
 
+# perhaps time to switch to exa
+if ls --color 1>/dev/null 2>&1; then
+    # gnu ls
+    alias ls='ls --color=auto'
+    alias ll='ls -l --almost-all --no-group --human-readable'
+else
+    # bsd/mac ls
+    export CLICOLOR='1'
+    alias ll='ls -hoA'
+fi
+
 # dots go up
 alias -g ...='../..'
 alias -g ....='../../..'
@@ -78,7 +89,6 @@ alias -g .....='../../../..'
 # aliases
 alias cls=clear
 alias config='git --git-dir=$HOME/.dotfiles --work-tree=$HOME'
-alias ll='ls -l --almost-all --no-group --human-readable'
 alias mkdir='mkdir -p'
 
 if command -v gpg2 &> /dev/null; then