From 271d7eedcad0def42ba43ac4ce1b494151e61007 Mon Sep 17 00:00:00 2001 From: Loic Nageleisen Date: Tue, 14 Apr 2020 15:48:20 +0200 Subject: [PATCH] Autodetect chruby better --- shell/chruby | 8 ++++++++ zsh/rc | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/shell/chruby b/shell/chruby index 823abfc..0783936 100755 --- a/shell/chruby +++ b/shell/chruby @@ -1,7 +1,15 @@ if [[ -f $HOME/.nix-profile/share/chruby/chruby.sh ]]; then source $HOME/.nix-profile/share/chruby/chruby.sh +elif [[ -f /opt/arch/share/chruby/chruby.sh ]]; then + source /opt/arch/share/chruby/chruby.sh +elif [[ -f /usr/local/share/chruby/chruby.sh ]]; then + source /usr/local/share/chruby/chruby.sh fi +_has-chruby() { + type -f chruby >/dev/null 2>&1 +} + _ruby-version() { local check_dir=$PWD local next_check_dir=${check_dir%/*} diff --git a/zsh/rc b/zsh/rc index ecd6c45..0ec1473 100644 --- a/zsh/rc +++ b/zsh/rc @@ -36,7 +36,7 @@ preexec() { chpwd() { __git_ps1_gitdir _gopath - _auto-chruby + if _has-chruby; then _auto-chruby; fi } chpwd