From: Alexander Barton Date: Fri, 15 Dec 2023 19:49:14 +0000 (+0100) Subject: editor_select: Validate an already set $EDITOR X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=ax-zsh.git;a=commitdiff_plain;h=cbf55702ebc46f77868407c956022fbe0ec67773 editor_select: Validate an already set $EDITOR --- diff --git a/plugins/editor_select/editor_select.zprofile b/plugins/editor_select/editor_select.zprofile index 1fdc1c9..e55cf33 100644 --- a/plugins/editor_select/editor_select.zprofile +++ b/plugins/editor_select/editor_select.zprofile @@ -1,7 +1,13 @@ # AX-ZSH: Alex' Modular ZSH Configuration # editor_select.zprofile: Setup $EDITOR for the "best" available editor +if [[ -n "$EDITOR" && ! -x "$EDITOR" && -z "$commands[$EDITOR]" ]]; then + # Oops, current $EDITOR seems to be invalid! Start over! + unset EDITOR +fi + if [[ -z "$EDITOR" ]]; then + # Auto-detect a "good" editor ... if [[ -n "$DISPLAY" ]]; then # X11 available, consider X11-based editors, too! x11_editors="gvim"