2022-06-18 18:13:08 +00:00
|
|
|
PREFERED_VI=$(which-command nvim vim | head -1)
|
2022-06-09 18:22:39 +00:00
|
|
|
if [[ -z "$PREFERED_VI" ]]; then
|
2022-06-18 18:13:08 +00:00
|
|
|
PREFERED_VI=$(which-command vi | head -1)
|
2022-06-09 18:22:39 +00:00
|
|
|
|
|
|
|
if [[ -z "$PREFERED_VI" ]]; then
|
|
|
|
alias my_vi='eval $EDITOR '
|
|
|
|
else
|
|
|
|
alias my_vi="$PREFERED_VI"
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
alias my_vi="$PREFERED_VI -p"
|
|
|
|
fi
|
|
|
|
|
2022-06-07 04:41:52 +00:00
|
|
|
if [[ -r "$HOME/.config/_my.emacs/spacemacs/emacs.d/init.el" \
|
2022-06-18 18:13:08 +00:00
|
|
|
&& -n "$(which-command emacsclient)" \
|
|
|
|
&& -n "$(which-command emacs)" \
|
|
|
|
&& -n "$(which-command edit-with-spacemacs)" \
|
2022-06-07 04:41:52 +00:00
|
|
|
]]; then
|
2022-07-11 21:59:11 +00:00
|
|
|
EDITOR=$(which-command edit-with-spacemacs | head -1)
|
|
|
|
alias my_editor="$EDITOR "
|
2022-06-04 18:56:36 +00:00
|
|
|
else
|
2022-07-11 21:59:11 +00:00
|
|
|
EDITOR="$PREFERRED_VI"
|
2022-06-09 18:22:39 +00:00
|
|
|
alias my_editor='my_vi'
|
2022-06-04 18:56:36 +00:00
|
|
|
fi
|
2022-06-09 18:22:39 +00:00
|
|
|
alias nvim="my_vi"
|
|
|
|
alias vim="my_vi"
|
|
|
|
alias vi="my_vi"
|
2022-06-04 18:56:36 +00:00
|
|
|
|
2022-06-07 16:34:50 +00:00
|
|
|
alias ed="my_editor"
|
|
|
|
alias edit="my_editor"
|
2022-06-09 18:22:39 +00:00
|
|
|
alias editor="my_editor"
|