vim/vim.sh
DistroBaker cd566d2a34 Merged update from upstream sources
This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/vim.git#e59c5ebce8c7d43a3b2dfa556273d8f58a77a3d5
2020-12-11 12:03:48 +01:00

19 lines
777 B
Bash

if [ -n "${BASH_VERSION-}" -o -n "${KSH_VERSION-}" -o -n "${ZSH_VERSION-}" ]; then
# This will avoid user defined aliases and possibly stuff defined earlier in the PATH.
case "$(command -v vim)-$(command -v vi)" in
/usr/bin/vim-/usr/bin/vi)
# apply only when founded vim and vi are in expected dirs from distro
alias vi=vim
alias view="vim -R"
;;
-/usr/bin/vi)
# apply only if founded vi is in expected dir from distro
if [ -n "${ZSH_VERSION-}" ]; then
alias vim="read -t 10 -s -k 1 '?No vim found, using vi, press ENTER to continue...' && echo '' && vi"
else
alias vim="read -rep $'No vim found, using vi, press ENTER to continue...\n' -n1 -t 10 -s && vi"
fi
;;
esac
fi