Make .zshrc more flexible for arm64 M1 Macs.

This commit is contained in:
Jeff Geerling
2021-05-25 21:18:08 -05:00
parent 40e4290910
commit 47908121a5
+12 -2
View File
@@ -19,7 +19,7 @@ export PS1=$'\n'"%F{green} %*%F %3~ %F{white}"$'\n'"$ "
plugins=(git brew history kubectl history-substring-search)
# Custom $PATH with extra locations.
export PATH=/usr/local/bin:/usr/local/sbin:$HOME/bin:$HOME/go/bin:/usr/local/git/bin:$HOME/.composer/vendor/bin:$PATH
export PATH=$HOME/Library/Python/3.8/bin:/opt/homebrew/bin:/usr/local/bin:/usr/local/sbin:$HOME/bin:$HOME/go/bin:/usr/local/git/bin:$HOME/.composer/vendor/bin:$PATH
# Bash-style time output.
export TIMEFMT=$'\nreal\t%*E\nuser\t%*U\nsys\t%*S'
@@ -30,8 +30,18 @@ then
source ~/.aliases
fi
# Set architecture-specific brew share path.
arch_name="$(uname -m)"
if [ "${arch_name}" = "x86_64" ]; then
share_path="/usr/local/share"
elif [ "${arch_name}" = "arm64" ]; then
share_path="/opt/homebrew/share"
else
echo "Unknown architecture: ${arch_name}"
fi
# Allow history search via up/down keys.
source /usr/local/share/zsh-history-substring-search/zsh-history-substring-search.zsh
source ${share_path}/zsh-history-substring-search/zsh-history-substring-search.zsh
bindkey "^[[A" history-substring-search-up
bindkey "^[[B" history-substring-search-down