From: Alexander Barton Date: Fri, 15 Dec 2023 19:53:37 +0000 (+0100) Subject: editor_select: Check the user preferences first! X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;ds=sidebyside;h=ca91f17585f375d6e1b9bfb180b813ab2f8b3108;p=ax-zsh.git editor_select: Check the user preferences first! --- diff --git a/plugins/editor_select/editor_select.zprofile b/plugins/editor_select/editor_select.zprofile index e55cf33..a04d0d0 100644 --- a/plugins/editor_select/editor_select.zprofile +++ b/plugins/editor_select/editor_select.zprofile @@ -6,6 +6,17 @@ if [[ -n "$EDITOR" && ! -x "$EDITOR" && -z "$commands[$EDITOR]" ]]; then unset EDITOR fi +if [[ -z "$EDITOR" ]]; then + # Check user preferences first! + if [[ -r ~/.selected_editor ]]; then + . ~/.selected_editor + if [[ -x "$SELECTED_EDITOR" || -n "$commands[$SELECTED_EDITOR]" ]]; then + EDITOR="$SELECTED_EDITOR" + fi + unset SELECTED_EDITOR + fi +fi + if [[ -z "$EDITOR" ]]; then # Auto-detect a "good" editor ... if [[ -n "$DISPLAY" ]]; then @@ -14,6 +25,7 @@ if [[ -z "$EDITOR" ]]; then fi for editor ( + sensible-editor code atom mate subl mvim $x11_editors vim nano joe vi