From 4cd989312641fb7d595af1cc868ca80a6be19e54 Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Mon, 18 Sep 2023 10:05:54 +0100 Subject: [PATCH] chore(rtx): install via official script instead of zinit A bit more code, but should make installation more reliable, as zinit often has issues detecting the correct binary/tarball to download from GitHub releases. --- zshenv | 2 +- zshrc | 24 ++++++++++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/zshenv b/zshenv index a715af3..142197c 100644 --- a/zshenv +++ b/zshenv @@ -200,13 +200,13 @@ if command-exists sccache; then fi # rtx setup +path_prepend "$HOME/.local/share/rtx/bin" path_prepend "$HOME/.local/share/rtx/shims" # ============================================================================== # Path setup for select binaries installed with zinit # ============================================================================== -path_prepend "$HOME/.local/zsh/zinit/plugins/jdxcode---rtx" path_prepend "$HOME/.local/zsh/zinit/plugins/junegunn---fzf" path_prepend "$HOME/.local/zsh/zinit/plugins/rbenv---rbenv/bin" diff --git a/zshrc b/zshrc index 0632213..1a024df 100644 --- a/zshrc +++ b/zshrc @@ -93,10 +93,26 @@ if command-exists direnv; then eval "$(direnv hook zsh)" fi -zinit light-mode wait lucid from'gh-r' as'program' pick'rtx' mv'rtx* -> rtx' \ - atclone'./rtx completion zsh > _rtx && chmod +x _rtx && ./rtx activate zsh > .rtx.zsh && zinit creinstall jdxcode/rtx' \ - atpull'%atclone' src='.rtx.zsh' \ - for @jdxcode/rtx +RTX_HOME="$HOME/.local/share/rtx" +RTX_INIT="$RTX_HOME/shell/init.zsh" +export RTX_INSTALL_PATH="$RTX_HOME/bin/rtx" + +if ! command-exists rtx; then + read -q 'REPLY?rtx is not installed, install with curl `https://rtx.pub/install.sh | sh`? [y/N]:' && + echo && curl https://rtx.pub/install.sh | sh +fi + +if [ -f "$HOME/.local/share/rtx/bin/rtx" ]; then + path_prepend "$RTX_HOME/bin" +fi + +if command-exists rtx; then + if [ ! -f "$RTX_INIT" ] || [ "$RTX_INIT" -ot "$RTX_INSTALL_PATH" ]; then + mkdir -p "$(dirname "$RTX_INIT")" + rtx activate zsh > "$RTX_INIT" + fi + source "$RTX_INIT" +fi # ============================================================================== # Prompt