]> arthur.barton.de Git - ax-zsh.git/blobdiff - plugins/editor_select/editor_select.zprofile
editor_select: Check the user preferences first!
[ax-zsh.git] / plugins / editor_select / editor_select.zprofile
index e55cf33c881d2ee7e9fc2764f7101937d3a3e8ed..a04d0d01dc394b349330da1ffbbcbea73ad66f86 100644 (file)
@@ -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