# r(un) config file
# (C) Jan Psota 2009-06-28

# use \t+ as column separators; empty lines are allowed;
# lines starting with # are treated as comments
# columns:
# 1. file extension (regular expression) | LABEL
#    r adds $ at the end so awk's match() compares it with the end of each
#    name, converted to lowercase before; remember to use \. if you mean '.'
#    and not any character; if line starts with \t+, we assume it is next
#    action for previous ext. / LABEL;
#    regexps containing | are surrounded with ()
# 2. action (single lower case letter) | LABEL
#    any letter can be used (remember to make it a symlink to r);
#    for example: v(iew), e(dit) and so on
# 3. program name to run with file as a parameter if second column stores action
#    | must not exist if there is a LABEL in second column
#    %f is replaced with file name; if it does not appear, file name is appended
#    at the end;
# 'program' can be any shell interpretable, ';' separated commands list
# LABEL starts with uppercase; LABEL cannot point to another LABEL
#
# r will run first matching program

# extension			action	program and options
# | LABEL			| LABEL

\.ps|\.pdf			v	evince
\.jp.*g|\.png|\.gif		IMAGE
IMAGE				v	qiv -ft
				e	gimp
\.gnumeric|\.xls		e	gnumeric
\.xls				v	antixls
\.txt(\.gz|\.bz2|\.lzma)?	v	$PAGER
\.txt\.lzo			v	lzop -cdf %f | less
\.txt				e	$EDITOR
\.tex				r	a=`basename %f .tex` ; pdflatex "$a" && v "$a.pdf"
				v	$PAGER
				e	$EDITOR
\.dvi				v	dvipdf %f && v "`basename %f .dvi`.pdf"
\.md5(sum)?			r	md5sum -c
\.sha256(sum)?			r	sha256sum -c
\.zip|\.tar(\.gz|\.bz2|\.lzma)?|\.tbz2|\.tgz	v	bsdtar tvf
\.tar\.lzo					v	tar tvf
\.avi				v	a=`basename %f .avi`.ogg ; if [ -e "$a" ] ; then mplayer -zoom -audiofile "$a" %f ; else mplayer -zoom %f ; fi
\.mkv|\.mp.*g|\.asf|\.wmv|\.flv|\.mov	v	mplayer -zoom
\.html				v	epiphany
\.conf				v	grep -v ^# %f | sort -u | $PAGER
				e	$EDITOR
\.ebuild			e	$EDITOR %f && ebuild %f manifest
