20b5ab
#!/usr/bin/sh
20b5ab
20b5ab
# run vim if:
20b5ab
# - 'vi' command is used and 'vim' binary is available
20b5ab
# - 'vim' command is used
20b5ab
# NOTE: Set up a local alias if you want vim -> vi functionality. We will not
20b5ab
# do it globally, because it messes up with available startup options (see 
20b5ab
# ':help starting', 'vi' is not capable of '-d'). The introducing an environment
20b5ab
# variable, which an user must set to get the feature, will do the same trick
20b5ab
# as setting an alias (needs user input, does not work with sudo), so it is left
20b5ab
# on user whether he decides to use an alias:
20b5ab
#
20b5ab
# alias vim=vi
20b5ab
#
20b5ab
# in bashrc file.
20b5ab
20b5ab
if test -f /usr/bin/vim
20b5ab
then
20b5ab
  exec /usr/bin/vim "$@"
20b5ab
fi
20b5ab
20b5ab
# run vi otherwise
20b5ab
exec /usr/libexec/vi "$@"