#!/bin/sh -

vi=${VIPROG-vi}
vim=${VIMPROG-vim}

# just in case we somehow picked up a view on these, see .vimrc
rm -f "$HOME"/.vim/view/*mbox= "$HOME"/.vim/view/*msgs= 2> /dev/null

case "$ARCHIT" in	# seems the best can do to get some coloring on AIX
rs6000)	TERM=xterm; export TERM; unset TERMINFO;;
esac

# via - invocation front-end for vim else vi
# Steve Kinzler, steve@kinzler.com, Mar 98/Nov 98/May 00
# https://kinzler.com/me/home.html#vi

case "$NOVIM" in
?*)	exec $vi ${1+"$@"};;
esac

host=${HOST-${HOSTNAME-`(hostname) 2> /dev/null`}}
case "$host" in
'')     host=`uname -n`;;
esac

# backwards-compatibility kludge for machines with vim version < 5.4
# needed to set $VIMRUNTIME
#case "$host" in
#*.itd.umich.edu) VIM=/afs/umich.edu/user/k/i/kinzler/lib/vim; export VIM;;
#esac

# kludge for machines with vim version >= 5.7 -X11 (arg error) or +X11
# (speeds startup and avoids potential X11 server cxion error messages)
# this may also be required to get syntax coloring working
vimopts=
case "$host" in
*.itd.umich.edu)			vimopts='-display -';;
*.cs.indiana.edu)	case "`opsys`" in
			sunos5)		vimopts='-display -';;
			esac;;
esac

$vim $vimopts ${1+"$@"} || $vi ${1+"$@"}
