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