From cbf55702ebc46f77868407c956022fbe0ec67773 Mon Sep 17 00:00:00 2001 From: Alexander Barton Date: Fri, 15 Dec 2023 20:49:14 +0100 Subject: [PATCH] editor_select: Validate an already set $EDITOR --- plugins/editor_select/editor_select.zprofile | 6 ++++++ 1 file changed, 6 insertions(+) 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" -- 2.39.2