From 906f8cfd1c9adb8615bc79067346a7505b5de13b Mon Sep 17 00:00:00 2001 From: "Gal@Shefet" Date: Wed, 5 Oct 2022 22:50:59 -0400 Subject: [PATCH] Modified editor detection --- _home/dot_sz.shrc.d/22_editor.aliases | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/_home/dot_sz.shrc.d/22_editor.aliases b/_home/dot_sz.shrc.d/22_editor.aliases index ddf0f14..6d18ebb 100644 --- a/_home/dot_sz.shrc.d/22_editor.aliases +++ b/_home/dot_sz.shrc.d/22_editor.aliases @@ -1,4 +1,12 @@ -MY_VI="$(type -fP my_vi)" +MY_VI="$(type -fP my_vi || printf "%s -p" $(type -fP nvim) || type -fP vi) " +[[ ! -z "${MY_VI}" ]] \ + && alias my_editor="${MY_VI} " \ + && alias nvim="${MY_VI} " \ + && alias vim="${MY_VI} " \ + && alias vi="${MY_VI} " + +[[ -n $(which-command "${EDITOR}") ]] \ + && alias my_editor="${EDITOR} " export DOOMROOT="$HOME/.config/_my.emacs/doom" [[ -x $DOOMROOT/emacs.d/bin/doom ]] && function doom() { @@ -17,10 +25,13 @@ if [[ -r "$HOME/.config/_my.emacs/spacemacs/emacs.d/init.el" \ && -n "$(which-command edit-with-spacemacs)" \ ]]; then alias my_editor='edit-with-spacemacs' -else - alias my_editor="${MY_VI} " fi +[[ -n $(which-command my_editor) ]] \ + && alias ed="my_editor" \ + && alias edit="my_editor" \ + && alias editor="my_editor" + alias nvim="${MY_VI} " alias vim="${MY_VI} " alias vi="${MY_VI} "