From 1ccd47cb1f40c76ac65ab009fb6169d2ba854909 Mon Sep 17 00:00:00 2001
From: Joel Grunbaum <joelgrun@gmail.com>
Date: Thu, 23 Dec 2021 04:02:28 +0000
Subject: [PATCH] Added extra paths for mac/homebrew

---
 all-shells/.commonshell |   33 ++++++++++++++++++++++++++-------
 1 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/all-shells/.commonshell b/all-shells/.commonshell
index 6b70090..c8a8f3a 100644
--- a/all-shells/.commonshell
+++ b/all-shells/.commonshell
@@ -1,7 +1,11 @@
 #aliases
-if [[ "$OSTYPE" == "darwin"* ]]; then
+if [ -z "${OSTYPE##*darwin*}" ]; then
 	#Mac OSX specific versions
 	alias ls="ls -G"
+	[ -d /usr/local/opt/llvm/bin ] && PATH="$PATH:/usr/local/opt/llvm/bin"
+	[ -d "$(brew --prefix coreutils)/libexec/gnubin" ] && export PATH="$(brew --prefix coreutils)/libexec/gnubin:$PATH"
+	[ -d "$(brew --prefix grep)/libexec/gnubin" ] && export PATH="$(brew --prefix grep)/libexec/gnubin:$PATH"
+	[ -d "$(brew --prefix findutils)/libexec/gnubin" ] && export PATH="$(brew --prefix findutils)/libexec/gnubin:$PATH"
 else
 	#Linux + others as default
 	alias ls="ls --color=auto"
@@ -10,20 +14,35 @@
 alias l="ls -laF"
 alias grep="grep --color=always"
 alias less='less -r'
-alias stats="find . -type f -print | sed -E -n 's/.+(\..*)$/\1/p' | sort | uniq -c | sort -g"
+function stats() {
+	find ${1:-'.'} -type f -print | sed -E -n 's/.+(\..*)$/\1/pi' | sort | uniq -c | sort -g
+}
 
 alias pip-upgrade="python -m pip list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1  | xargs -n1 python -m pip install -U"
 
 #export EDITOR="/usr/bin/emacsclient -nw -a /usr/bin/vim"
 #alias ec=$EDITOR
-export EDITOR="/usr/bin/vim"
+alias ec="/usr/bin/emacsclient -nw -a $(which vim)"
+[ -n "$(which vim)" ] && export EDITOR="$(which vim)"
 
 #default wine prefix
-export WINEPREFIX=$HOME/.wine/Games/
-export STEAM_COMPAT_DATA_PATH=$HOME/proton
-
-export LIBVA_DRIVER_NAME=iHD
+[ -n "$(whereis wine)" ] && export WINEPREFIX=$HOME/.wine/Games/
+[ -n "$(whereis steam)" ] && export STEAM_COMPAT_DATA_PATH=$HOME/proton
 
 # add to path
 export PATH=$PATH:~/.local/bin
 [ -r /usr/bin/ruby ] && PATH="$PATH:$(ruby -e 'puts Gem.user_dir')/bin"
+[ -d ~/.cargo ] && PATH="$PATH:$HOME/.cargo/bin"
+
+# wsl display settings
+if [ -n "$(uname -a | grep -i 'microsoft')" ]; then
+	export DISPLAY=$(ip route | awk '{print $3; exit}'):0
+	export LIBGL_ALWAYS_INDIRECT=1
+fi
+
+# acme.sh
+[ -f "${HOME}/.acme.sh/acme.sh.env" ] && source ~/.acme.sh/acme.sh.env
+
+# Update dotfiles
+(git -C ~/.dotfiles pull &) &>/dev/null
+[ -d ~/.emacs.d ] && (git -C ~/.emacs.d pull &) &>/dev/null

--
Gitblit v1.9.3