From a23362f69de77c1b1c1faeb59749f73ddffe413f Mon Sep 17 00:00:00 2001 From: Daniel Lynn Date: Thu, 22 Jul 2021 15:18:16 -0400 Subject: [PATCH] Add support for ruby gem paths and rvm Update convention to use -s over !-f --- zshenv | 14 ++++++++++++-- zshrc | 11 +++++------ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/zshenv b/zshenv index ee5bcb3..5b946a3 100644 --- a/zshenv +++ b/zshenv @@ -1,10 +1,20 @@ export EDITOR="nvim" export GPG_TTY=$(tty) +export NVM_DIR="$HOME/.nvm" fpath+=(~/.zsh/completions) # Setup cargo -[[ ! -f ~/.cargo/env ]] || source ~/.cargo/env +[[ -s ~/.cargo/env ]] && source ~/.cargo/env # Source machine-specific environment -[[ ! -f ~/.zshenv.local ]] || source ~/.zshenv.local +[[ -s ~/.zshenv.local ]] && source ~/.zshenv.local + +# Local gems +if (( $+commands[ruby] )); then + local gem_bin_path="$(ruby -r rubygems -e 'puts Gem.user_dir')/bin" + [[ -d "$gem_bin_path" ]] && path+=("$gem_bin_path") +fi + +# Add RVM to PATH for scripting. Make sure this is the last PATH variable change. +[[ -d "$HOME/.rvm/bin" ]] && path+=("$HOME/.rvm/bin") diff --git a/zshrc b/zshrc index 8ce7324..3637394 100644 --- a/zshrc +++ b/zshrc @@ -20,15 +20,14 @@ if [[ -e /usr/share/zsh/manjaro-zsh-prompt ]]; then fi # To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. -[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh +[[ -s ~/.p10k.zsh ]] && source ~/.p10k.zsh # Custom aliases -[[ ! -f ~/.aliases ]] || source ~/.aliases +[[ -s ~/.aliases ]] && source ~/.aliases # NVM -export NVM_DIR="$HOME/.nvm" -[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm -[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion +[[ -s "$NVM_DIR/nvm.sh" ]] && source "$NVM_DIR/nvm.sh" # This loads nvm +[[ -s "$NVM_DIR/bash_completion" ]] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion # Source machine-specific setup -[[ ! -f ~/.zshrc.local ]] || source ~/.zshrc.local +[[ -s ~/.zshrc.local ]] && source ~/.zshrc.local