Cleanup vi support

This commit is contained in:
Gal Szkolnik 2022-06-09 14:22:39 -04:00
parent 1701cc1189
commit dfe6dfe212
2 changed files with 38 additions and 31 deletions

View File

@ -1,3 +1,16 @@
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_vi='eval $EDITOR '
else
alias my_vi="$PREFERED_VI"
fi
else
alias my_vi="$PREFERED_VI -p"
fi
if [[ -r "$HOME/.config/_my.emacs/spacemacs/emacs.d/init.el" \ if [[ -r "$HOME/.config/_my.emacs/spacemacs/emacs.d/init.el" \
&& -n "$(type -fP emacsclient)" \ && -n "$(type -fP emacsclient)" \
&& -n "$(type -fP emacs)" \ && -n "$(type -fP emacs)" \
@ -5,22 +18,11 @@ if [[ -r "$HOME/.config/_my.emacs/spacemacs/emacs.d/init.el" \
]]; then ]]; then
alias my_editor='edit-with-spacemacs' alias my_editor='edit-with-spacemacs'
else else
PREFERED_VI=$(type -fP nvim vim | head -1) alias my_editor='my_vi'
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 fi
else alias nvim="my_vi"
alias my_editor="$PREFERED_VI -p" alias vim="my_vi"
fi alias vi="my_vi"
fi
alias nvim="my_editor"
alias vim="my_editor"
alias vi="my_editor"
alias ed="my_editor" alias ed="my_editor"
alias edit="my_editor" alias edit="my_editor"

View File

@ -1,4 +1,6 @@
set background=dark set background=dark
if !has("compatible")
" Install vim-plug if not found " Install vim-plug if not found
let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim' let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim'
if empty(glob(data_dir . '/autoload/plug.vim')) if empty(glob(data_dir . '/autoload/plug.vim'))
@ -17,3 +19,6 @@ Plug 'tpope/vim-sensible'
Plug 'junegunn/seoul256.vim' Plug 'junegunn/seoul256.vim'
call plug#end() call plug#end()
endif