From 4ae63ce2cb49507c0a5d2b1c05471b3c0a139fb0 Mon Sep 17 00:00:00 2001 From: Kevin Cotugno Date: Fri, 3 Mar 2023 16:58:25 -0700 Subject: [PATCH] Replace rbenv and nvm with asdf --- .zshrc | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/.zshrc b/.zshrc index d332126..edf383b 100644 --- a/.zshrc +++ b/.zshrc @@ -12,6 +12,7 @@ if [[ -f "$oh_my_zsh/oh-my-zsh.sh" ]]; then themes git urltools + asdf ) if [[ $(command -v tmux) ]]; then @@ -49,18 +50,6 @@ if [[ -d "$HOME/.cargo" ]]; then export PATH=$HOME/.cargo/bin:$PATH fi -if [[ -d "$HOME/.rbenv" ]]; then - export PATH="$HOME/.rbenv/bin:$PATH" - eval "$(rbenv init -)" -fi - -if [[ -d "$HOME/.nvm" ]]; then - export NVM_DIR="$HOME/.nvm" - - [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" - [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion -fi - if [[ $(command -v nvim) ]]; then export EDITOR="nvim" elif [ $(command -v vim) ]; then @@ -79,6 +68,20 @@ fi mkdir -p "$HOME/.local/bin" && export PATH="$HOME/.local/bin:$PATH" +function install_asdf_plugins() { + if [[ ! $(command -v asdf) ]]; then return; fi + + local asdf_plugins=(ruby nodejs) + + foreach plugin in $asdf_plugins; do + if [[ ! -d "$HOME/.asdf/plugins/$plugin" ]]; then + echo "Installing asdf $plugin plugin" + asdf plugin add $plugin https://github.com/asdf-vm/asdf-$plugin.git + asdf install $plugin latest + fi + done +} + function weather() { local loc=$1 if [[ -z "$loc" ]]; then @@ -114,3 +117,5 @@ alias l="ls -lah" alias ll="ls -lh" alias la="ls -lah" alias hexenc="hexdump -e '1/1 \"%02x\"'" + +install_asdf_plugins