Modified editor detection

This commit is contained in:
Gal@Shefet 2022-10-05 22:50:59 -04:00
parent 589b6fa2f4
commit 906f8cfd1c
1 changed files with 14 additions and 3 deletions

View File

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