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#86943b30a6c1912a1d4a5c8ae867ee7b15d456c1
33 lines
950 B
Bash
33 lines
950 B
Bash
__vi_internal_vim_alias()
|
|
(
|
|
# run vim if installed
|
|
test -f /usr/bin/vim && exec /usr/bin/vim "$@"
|
|
|
|
# run vi otherwise
|
|
test -f /usr/bin/vi && exec /usr/bin/vi "$@"
|
|
)
|
|
|
|
__view_internal_vim_alias()
|
|
(
|
|
# run vim -R instead of view if vim installed
|
|
test -f /usr/bin/vim && exec /usr/bin/vim -R "$@"
|
|
|
|
# run view otherwise
|
|
test -f /usr/bin/view && exec /usr/bin/view "$@"
|
|
)
|
|
|
|
|
|
if [ -n "${BASH_VERSION-}" -o -n "${KSH_VERSION-}" -o -n "${ZSH_VERSION-}" ]; then
|
|
# This will avoid user defined aliases
|
|
case "$(command -v vim)-$(command -v vi)" in
|
|
"/usr/bin/vim-/usr/bin/vi" | "-/usr/bin/vi")
|
|
# apply only when founded vim and vi are in expected dirs from distro
|
|
# we need to call a shell function to avoid shell restarts when vi/vim
|
|
# is being installed/uninstalled
|
|
alias vi=__vi_internal_vim_alias
|
|
alias view=__view_internal_vim_alias
|
|
alias vim=__vi_internal_vim_alias
|
|
;;
|
|
esac
|
|
fi
|