if [[ -r "$HOME/.config/_my.emacs/spacemacs/emacs.d/init.el" \ && -n "$(type -fP emacsclient)" \ && -n "$(type -fP emacs)" \ && -n "$(type -fP edit-with-spacemacs)" \ ]]; then alias my_editor='edit-with-spacemacs' else PREFERED_VI=$(type -fP nvim vim | head -1) if [[ -z "$PREFERED_VI" ]]; then PREFERED_VI=$(type -fP vi | head -1) if [[ -z "$PREFERED_VI" ]]; then alias my_editor='eval $EDITOR ' else alias my_editor="$PREFERED_VI" fi else alias my_editor="$PREFERED_VI -p" fi fi alias nvim="my_editor" alias vim="my_editor" alias vi="my_editor" alias ed="my_editor" alias edit="my_editor" alias editor="my_editor"