PREFERED_VI=$(which-command nvim vim | head -1) if [[ -z "$PREFERED_VI" ]]; then PREFERED_VI=$(which-command vi | head -1) 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 export DOOMROOT="$HOME/.config/_my.emacs/doom" [[ -x $DOOMROOT/emacs.d/bin/doom ]] && function doom() { export EMACSDIR="$DOOMROOT/emacs.d" export DOOMDIR="$DOOMROOT/config" "$EMACSDIR/bin/doom" "${@}" unset EMACSDIR DOOMDIR } && function doomemacs() { emacs --with-profile=doom ${@} } || unset DOOMROOT if [[ -r "$HOME/.config/_my.emacs/spacemacs/emacs.d/init.el" \ && -n "$(which-command emacsclient)" \ && -n "$(which-command emacs)" \ && -n "$(which-command edit-with-spacemacs)" \ ]]; then alias my_editor='edit-with-spacemacs' else alias my_editor='my_vi' fi alias nvim="my_vi" alias vim="my_vi" alias vi="my_vi" alias ed="my_editor" alias edit="my_editor" alias editor="my_editor"