From 951764555bd500d4b8189ab34e0aa5282e03a08f Mon Sep 17 00:00:00 2001 From: Taylor Bockman Date: Mon, 1 Aug 2022 09:23:13 -0700 Subject: [PATCH] patch up zshrc to work on other computers --- dotfiles/zsh/exports.zsh | 9 +++++++-- dotfiles/zsh/zshrc | 27 ++++++++++++++------------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/dotfiles/zsh/exports.zsh b/dotfiles/zsh/exports.zsh index f588ee4..b2fab00 100644 --- a/dotfiles/zsh/exports.zsh +++ b/dotfiles/zsh/exports.zsh @@ -29,5 +29,10 @@ export HISTCONTROL=ignoredups # If go is installed, set the $GOPATH to the projects directory created above. if which go > /dev/null; then export GOPATH=$HOME/.go; fi -export PATH="$PATH:$HOME/.rvm/bin" -. "$HOME/.cargo/env" +if [ -d "$HOME/.rvm" ]; then + export PATH="$PATH:$HOME/.rvm/bin" +fi + +if [ -f "$HOME/.cargo/env" ]; then + . "$HOME/.cargo/env" +fi diff --git a/dotfiles/zsh/zshrc b/dotfiles/zsh/zshrc index b56f9f9..b76b664 100644 --- a/dotfiles/zsh/zshrc +++ b/dotfiles/zsh/zshrc @@ -59,20 +59,21 @@ if [[ ! -d $HOME/.zsh ]]; then popd fi -# Install zsh-syntax-highlighting if it doesn't exist -if [[ ! -d $HOME/.zsh/zsh-syntax-highlighting ]]; then - if ! is-at-least 4.3.11; then - echo "ZSH syntax highlighting requires ZSH >= 4.3.11 (current: $ZSH_VERSION)." - else - echo "Installing zsh syntax highlighting" - pushd - - cd $HOME/.zsh - git clone https://github.com/zsh-users/zsh-syntax-highlighting.git - - popd - fi +autoload -U is-at-least +# Install zsh-syntax-highlighting if it doesn't exist +if is-at-least 4.3.11; then + if [[ ! -d $HOME/.zsh/zsh-syntax-highlighting ]]; then + echo "Installing zsh syntax highlighting" + pushd + + cd $HOME/.zsh + git clone https://github.com/zsh-users/zsh-syntax-highlighting.git + + popd + fi +else + echo "ZSH syntax highlighting requires ZSH >= 4.3.11 (current: $ZSH_VERSION)." fi zstyle ':completion:*:*:git:*' script $HOME/.zsh/git-completion.bash