From e30f86800d6ae85d4b39194ab680879b643760b3 Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Sat, 17 Jun 2023 15:15:00 +0100 Subject: [PATCH] Don't check for vim when using $EDITOR --- autoenv/autoenv.zsh | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/autoenv/autoenv.zsh b/autoenv/autoenv.zsh index 5e2084b..b03756e 100644 --- a/autoenv/autoenv.zsh +++ b/autoenv/autoenv.zsh @@ -46,21 +46,16 @@ commands: if ! [ -f $PWD/.enter ] || ! [ -f $PWD/.exit ]; then echo '.enter or .exit not found'; return 1 fi - # If vim exists, edit enter and exit scripts. - if which vim &> /dev/null; then - # Exit the autoenv before editing. - _autoenv_exit $PWD - if $EDITOR -p $PWD/.enter $PWD/.exit; then - # If enter script exists, authorize it. - [ -f $PWD/.enter ] && _autoenv_authorized $PWD/.enter yes - # If exit script exists, authorize it. - [ -f $PWD/.exit ] && _autoenv_authorized $PWD/.exit yes - fi - # Enter the autoenv. - _autoenv_enter $PWD - else - echo 'vim not found'; return 1 + # Exit the autoenv before editing. + _autoenv_exit $PWD + if $EDITOR -p $PWD/.enter $PWD/.exit; then + # If enter script exists, authorize it. + [ -f $PWD/.enter ] && _autoenv_authorized $PWD/.enter yes + # If exit script exists, authorize it. + [ -f $PWD/.exit ] && _autoenv_authorized $PWD/.exit yes fi + # Enter the autoenv. + _autoenv_enter $PWD ;; deinit) # Remove .enter and .exit scripts in current directory.