summary refs log tree commit diff stats
path: root/tag-zsh/config
diff options
context:
space:
mode:
authorAlan Pearce2017-01-17 11:38:48 +0100
committerAlan Pearce2017-01-17 11:38:48 +0100
commit4f655369e8e87b73e2a932091b5db84c81e7736a (patch)
treedbc0a223a5a68b9dd343174c9507da8580bc857d /tag-zsh/config
parent60966619f991659c804c8f8c82224e82dd7a8dd7 (diff)
downloadnixfiles-4f655369e8e87b73e2a932091b5db84c81e7736a.tar.lz
nixfiles-4f655369e8e87b73e2a932091b5db84c81e7736a.tar.zst
nixfiles-4f655369e8e87b73e2a932091b5db84c81e7736a.zip
zsh: Set os/arch in zshenv
Diffstat (limited to 'tag-zsh/config')
-rw-r--r--tag-zsh/config/zsh/zshenv24
-rw-r--r--tag-zsh/config/zsh/zshrc8
2 files changed, 28 insertions, 4 deletions
diff --git a/tag-zsh/config/zsh/zshenv b/tag-zsh/config/zsh/zshenv
index 86efc02d..e62dca5c 100644
--- a/tag-zsh/config/zsh/zshenv
+++ b/tag-zsh/config/zsh/zshenv
@@ -16,4 +16,28 @@ then
   then
     export SSH_AUTH_SOCK=$XDG_RUNTIME_DIR/ssh-agent.socket
   fi
+
+  case $OSTYPE in
+    darwin*)
+      os=darwin
+      ;;
+    linux-gnu)
+      os=linux
+      ;;
+    freebsd*)
+      os=freebsd
+      ;;
+    *)
+      os=unknown
+      ;;
+  esac
+
+  case $MACHTYPE in
+    *64)
+      arch=amd64
+      ;;
+    *)
+      arch=386
+      ;;
+  esac
 fi
diff --git a/tag-zsh/config/zsh/zshrc b/tag-zsh/config/zsh/zshrc
index 269d5e53..1d37e8ea 100644
--- a/tag-zsh/config/zsh/zshrc
+++ b/tag-zsh/config/zsh/zshrc
@@ -55,8 +55,8 @@ gnu_ls_isodate="--time-style=long-iso"
 bsd_ls_options="-p"
 bsd_ls_isodate="-D '%F %k:%M'"
 
-case $OSTYPE in
-  darwin*)
+case $os in
+  darwin)
     if [[ -n $commands[gls] ]]
     then
       ls='\gls'
@@ -67,11 +67,11 @@ case $OSTYPE in
       ls_isodate=$bsd_ls_isodate
     fi
     ;;
-  freebsd*)
+  freebsd)
     ls_options=$bsd_ls_options
     ls_isodate=$bsd_ls_isodate
     ;;
-  linux-gnu)
+  linux)
     ls_options=$gnu_ls_options
     ls_isodate=$gnu_ls_isodate
     ;;