#!/bin/sh
#
# This wrapper script is part of the "cream" Debian GNU/Linux package
# written by Christoph Haas <email@christoph-haas.de>.

# Exit on error
set -e

CREAM=/usr/share/vim/cream/
export CREAM

# If this script is called as 'gcream' then try to run gvim
if [ $(basename $0) == "gcream" -a -x /usr/bin/gvim -a "$DISPLAY" != "" ] ; then
	exec /usr/bin/gvim -U NONE -u "\$VIM/cream/creamrc" "$@"
# If this script is called as 'kcream' then try to run kvim
elif [ $(basename $0) == "kcream" -a -x /usr/bin/kvim -a "$DISPLAY" != "" ] ; then
	exec /usr/bin/kvim -U NONE -u "\$VIM/cream/creamrc" "$@"
# ...otherwise try 'vim' (e.g. on a console)
else
	exec /usr/bin/vim -U NONE -u "\$VIM/cream/creamrc" "$@"
fi

