GVIM=/usr/local/bin/gvim
WMCTRL=/usr/bin/wmctrl DEBUG=no
for ARG in "$@"; do
if echo "$ARG" | grep -q '^note:'; then
continue
elif [ ! -f "$ARG" ]; then
[ $DEBUG = yes ] && echo "Process $$: Executing $GVIM $@" >&2
exec $GVIM "$@"
exit fi
done
if ! pidof $GVIM > /dev/null; then
[ $DEBUG = yes ] && "Process $$: Executing $GVIM -p $@" >&2
exec "$GVIM" -p "$@"
else
[ $DEBUG = yes ] && echo "Process $$: Requesting server list" >&2
$GVIM --serverlist | grep '^GVIM[0-9]*$' | while read VIM_SERVER_NAME; do
[ $DEBUG = yes ] && echo "Process $$: Raising selected Vim server" >&2
$WMCTRL -xa $VIM_SERVER_NAME
if [ $ [ $DEBUG = yes ] && echo "Process $$: Executing $GVIM --servername '$VIM_SERVER_NAME' --remote-tab-silent $@" >&2
exec $GVIM --servername "$VIM_SERVER_NAME" --remote-tab-silent "$@"
fi
done
fi