#!/bin/sh
# $Id: vile-pager,v 1.7 2008/12/05 00:03:03 tom Exp $
# This is a simple script that uses the vi-clone 'vile' as a pager to show
# highlighted text.  It's a lot easier to work with large listings than 'more'
# or 'less'
# - T.Dickey
PROG=xvile
OPTS=
TMP=${TMPDIR-/tmp}/rc$$
trap "rm -f $TMP" 0 1 2 5 15
cat >$TMP <<'EOF'
set glob=on
~force source &pcat ~ &default '$startup-file'
set nopopup-msgs
store-procedure OnRead
	setl noview
	1 goto-line
	filter-til end-of-file "vile-manfilt"
	attribute-cntl_a-sequences-til end-of-file
	unmark
	setl view
	1 goto-line
	setv $buffer-hook ""
~endm
setv $buffer-hook "OnRead"
EOF
case $PROG in
x*)
	OPTS="+fork"
	;;
esac
cat $* | $PROG $OPTS @$TMP
