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} "