summary refs log tree commit diff stats
path: root/zsh/zshrc
diff options
context:
space:
mode:
Diffstat (limited to 'zsh/zshrc')
-rwxr-xr-xzsh/zshrc37
1 files changed, 27 insertions, 10 deletions
diff --git a/zsh/zshrc b/zsh/zshrc
index d6ae52ea..bbfa9301 100755
--- a/zsh/zshrc
+++ b/zsh/zshrc
@@ -83,13 +83,9 @@ fi
 case $OSTYPE in
 	*gnu*)
 		os=gnu
-		ls_options="-v --group-directories-first --color=auto"
-		ls_isodate="--time-style=long-iso"
 		;;
 	freebsd*)
 		os=freebsd
-		ls_options="-p"
-		ls_isodate="-D '%F %k:%M'"
 		;;
 	darwin*)
 		os=osx
@@ -264,12 +260,33 @@ alias md='mkdir -p'
 alias rd='rmdir'
 alias .='source'
 
-if [[ $os == osx ]]
-then
-	ls='\gls'
-else
-	ls='\ls'
-fi
+ls='\ls'
+gnu_ls_options="-v --group-directories-first --color=auto"
+gnu_ls_isodate="--time-style=long-iso"
+bsd_ls_options="-p"
+bsd_ls_isodate="-D '%F %k:%M'"
+
+case $os in
+	osx)
+		if [[ -n $commands[gls] ]]
+		then
+			ls='\gls'
+			ls_options=$gnu_ls_options
+			ls_isodate=$gnu_ls_isodate
+		else
+			ls_options=$bsd_ls_options
+			ls_isodate=$bsd_ls_isodate
+		fi
+		;;
+	freebsd)
+		ls_options=$bsd_ls_options
+		ls_isodate=$bsd_ls_isodate
+		;;
+	gnu)
+		ls_options=$gnu_ls_options
+		ls_isodate=$gnu_ls_isodate
+		;;
+esac
 alias l="${ls} ${ls_options} -Bp"
 alias l1="${ls} ${ls_options} -1"
 alias ls="${ls} ${ls_options} -hF"