Make vim detection simpler

This commit is contained in:
Anthony Rose 2022-07-17 22:53:12 +01:00
parent 4c5d943942
commit c7f7524133

View file

@ -32,6 +32,7 @@ for dir in "$HOME/.local/bin" \
"$HOME/.cargo/bin" \ "$HOME/.cargo/bin" \
"$HOME/opt/centos-git-common" \ "$HOME/opt/centos-git-common" \
"${XDG_DATA_HOME:-$HOME/.local/share}/gem/ruby/bin" \ "${XDG_DATA_HOME:-$HOME/.local/share}/gem/ruby/bin" \
"${XDG_DATA_HOME:-$HOME/.local/share}/flatpak/exports/bin" \
/usr/local/bin \ /usr/local/bin \
/usr/local/sbin \ /usr/local/sbin \
/usr/bin \ /usr/bin \
@ -74,28 +75,18 @@ then
export GPG_TTY=$(tty) export GPG_TTY=$(tty)
fi fi
# Set up Vim. # Set up Vi/Vim.
vimflatpak=${XDG_DATA_HOME:-$HOME/.local/share}/flatpak/app/org.vim.Vim/current/active/export/bin/org.vim.Vim if command -v org.vim.Vim > /dev/null
if test -x $vimflatpak
then then
export EDITOR="$vimflatpak -f" export EDITOR="org.vim.Vim -f"
elif test -x /usr/bin/vim alias vi=org.vim.Vim
elif command -v vim > /dev/null
then then
export EDITOR="/usr/bin/vim -f" export EDITOR="vim -f"
alias vi=vim
else else
export EDITOR=vi export EDITOR=vi
fi fi
if test -x $vimflatpak
then
alias vim=$vimflatpak
alias vi=$vimflatpak
elif test -x /usr/bin/vim
then
alias vi=/usr/bin/vim
else
alias vim=vi
fi
unset vimflatpak
if [ ${XDG_CURRENT_DESKTOP:-unknown} == GNOME ] if [ ${XDG_CURRENT_DESKTOP:-unknown} == GNOME ]
then then