.config/mc/mc.ext
author Oleksandr Gavenko <gavenkoa@gmail.com>
Fri, 06 Apr 2012 20:33:03 +0300
changeset 327 a8face3f062f
parent 326 4cd8dc6dcb84
child 330 6197aede6474
permissions -rw-r--r--
Remove "Plain compressed files" section to use system wide configs... Sync content with /etc/mc/mc.ext from Debian for version 4.8.1.

# -*- mode: conf -*-
# Midnight Commander 3.0 extension file
# Warning: Structure of this file has changed completely with version 3.0
#
# All lines starting with # or empty lines are thrown away.
# Lines starting in the first column should have following format:
#
# keyword/descNL, i.e. everything after keyword/ until new line is desc
#
# keyword can be: 
#
#    shell (desc is, when starting with a dot, any extension (no wildcars), 
#          i.e. matches all the files *desc . Example: .tar matches *.tar;
#          if it doesn't start with a dot, it matches only a file of that name)
#
#    regex (desc is an extended regular expression)
#          Please note that we are using the GNU regex library and thus
#          \| matches the literal | and | has special meaning (or) and
#          () have special meaning and \( \) stand for literal ( ).
#
#    type  (file matches this if `file %f` matches regular expression desc
#          (the filename: part from `file %f` is removed))
#
#    directory (matches any directory matching regular expression desc)
#
#    include (matches an include directive)
#
#    default (matches any file no matter what desc is)
#
# Other lines should start with a space or tab and should be in the format:
#
# keyword=commandNL (with no spaces around =), where keyword should be: 
#
#    Open (if the user presses Enter or doubleclicks it), 
#
#    View (F3), Edit (F4)
#
#    Include is the keyword used to add any further entries from an include/
#    section
#
# command is any one-line shell command, with the following substitutions:
#
# %% -> % character
# %p -> name of the current file (without path, but pwd is its path)
# %f -> name of the current file. Unlike %p, if file is located on a
#	non-local virtual filesystem, i.e. either tarfs or ftpfs,
#	then the file will be temporarily copied into a local directory
#	and %f will be the full path to this local temporal file.
#	If you don't want to get a local copy and want to get the
#	virtual fs path (like /#ftp:ftp.cvut.cz/pub/hungry/xword), then
#	use %d/%p instead of %f.
# %d -> name of the current directory (pwd, without trailing slash)
# %s -> "selected files", i.e. space separated list of tagged files if any
#       or name of the current file
# %t -> list of tagged files
# %u -> list of tagged files (they'll be untaged after the command)
#
# (If these 6 letters are in uppercase, they refer to the other panel.
# But you shouldn't have to use it in this file.)
#
#
# %cd -> the rest is a path mc should change into (cd won't work, since it's
#	a child process).  %cd handles even vfs names.
#
# %view -> the command you type will be piped into mc's internal file viewer
#	if you type only the %view and no command, viewer will load %f file
#	instead (i.e. no piping, so it is different to %view cat %f)
#	%view may be directly followed by {} with a list of any of
#	ascii (Ascii mode), hex (Hex mode), nroff (color highlighting for
#	text using backspace for bold and underscore) and unform
#	(no highlighting for nroff sequences) separated by commas.
#
# %var -> You use it like this: %var{VAR:default}.  This macro will expand
#       to the value of the VAR variable in the environment if it's set
#       otherwise the value in default will be used.  This is similar to
#       the Bourne shell ${VAR-default} construct.
#
# Rules are applied from top to bottom, thus the order is important.
# If some actions are missing, search continues as if this target didn't
# match (i.e. if a file matches the first and second entry and View action
# is missing in the first one, then on pressing F3 the View action from
# the second entry will be used. default should catch all the actions.
#
# Any new entries you develop for you are always welcome if they are
# useful on more than one system.  You can post your modifications
# as tickets at www.midnight-commander.org


# .so libraries
# Exception - .so libraries are not manual pages
regex/\.(so|so\.[0-9\.]*)$
	View=%view{ascii} file %f && nm -C -D %f

# Exception: .3gp are video files not manual pages
regex/\.(3[gG][pP])$
	Include=video

# Object
type/^ELF
	#Open=%var{PAGER:more} %f
	View=%view{ascii} file %f && nm -C %f

### Documentation ###

# Texinfo
regex/\.(te?xi|texinfo)$

# GNU Info page
type/^Info\ text
	Open=info -f %f

shell/.info
	Open=info -f %f

### Images ###

type/^GIF
	Include=image

type/^JPEG
	View=%view{ascii} identify %f; test -x /usr/bin/exif && echo && exif %f
	Include=image

type/^PC\ bitmap
	Include=image

type/^PNG
	Include=image

type/^TIFF
	Include=image

type/^PBM
	Include=image

type/^PGM
	Include=image

type/^PPM
	Include=image

type/^Netpbm
	Include=image

shell/.xcf
	Open=(gimp %f &)

shell/.xbm
	Include=image 
	#Open=bitmap %f

shell/.xpm
	Include=image
	View=sxpm %f

shell/.ico
	Include=image

include/image
	Open=(see %f &)
	View=%view{ascii} identify %f
	#View=%view{ascii} asciiview %f


### Sound files ###

regex/\.([wW][aA][vV]|[sS][nN][dD]|[vV][oO][cC]|[aA][uU]|[sS][mM][pP]|[aA][iI][fF][fF]|[sS][nN][dD])$
	Open=run-mailcap audio/x-wav:%f &

regex/\.([mM][oO][dD]|[sS]3[mM]|[xX][mM]|[iI][tT]|[mM][tT][mM]|669|[sS][tT][mM]|[uU][lL][tT]|[fF][aA][rR])$
	Open=run-mailcap application/x-mod:%f &

regex/\.([mM][pP]3)$
	Open=run-mailcap audio/mpeg:%f &
	View=%view{ascii} mpg123 -vtn1 %f 2>&1 | sed -n '/^Title/,/^Comment/p;/^MPEG/,/^Audio/p'

regex/\.([oO][gG][gG|aA|vV|xX])$
	Open=run-mailcap application/x-ogg:%f &
	View=%view{ascii} ogginfo %s

regex/\.([sS][pP][xX]|[fF][lL][aA][cC])$
	Open=if [ "$DISPLAY" = "" ]; then play %f; else (xmms %f >/dev/null 2>&1 &); fi

regex/\.([mM][iI][dD][iI]?|[rR][mM][iI][dD]?)$
	Open=run-mailcap audio/midi:%f

regex/\.([wW][mM][aA])$
	Open=mplayer -vo null %f
	View=%view{ascii} mplayer -quiet -slave -frames 0 -vo null -ao null -identify %f 2>/dev/null | tail +13 || file %f


### Play lists ###

regex/\.([mM]3[uU]|[pP][lL][sS])$
	Open=if [ -z "$DISPLAY" ]; then mplayer -vo null -playlist %f; else (xmms -p %f >/dev/null 2>&1 &); fi


### Video ###

regex/\.([aA][vV][iI])$
	Include=video

regex/\.([aA][sS][fFxX])$
	Include=video

regex/\.([dD][iI][vV][xX])$
	Include=video

regex/\.([mM][kK][vV])$
	Include=video

regex/\.([mM][oO][vV]|[qQ][tT])$
	Include=video

regex/\.([mM][pP]4|[mM][pP][eE]?[gG])$
	Include=video

# MPEG-2 TS container + H.264 codec
regex/\.([mM][tT][sS])$
	Include=video

regex/\.([vV][oO][bB])$
	Include=video

# Old VLC under Debian have no association for wmv mimetype.
regex/\.([wW][mM][vV])$
	Open=vlc %f &

regex/\.([fF][lL][iIcCvV])$
	Include=video

regex/\.([oO][gG][mM])$
	Include=video

regex/\.([rR][aA]?[mM])$
	Open=run-mailcap audio/x-pn-realaudio:%f &
	#Open=(realplay %f >/dev/null 2>&1 &)

include/video
	Open=see %f
	#Open=(mplayer %f >/dev/null 2>&1 &)
	#Open=(gtv %f >/dev/null 2>&1 &)
	#Open=(xanim %f >/dev/null 2>&1 &)


### Documents ###

# Postscript
type/^PostScript
	Open=run-mailcap application/postscript:%f &
	#Open=(gv %f &)
	View=%view{ascii} ps2ascii %f

# PDF
type/^PDF
	Open=run-mailcap application/pdf:%f 2>/dev/null &
	#Open=(xpdf %f &)
	#Open=(acroread %f &)
	#Open=(ghostview %f &)
	View=%view{ascii} pdftotext %f -

shell/.pdf.gz
    Open=(zxpdf %f &)

# CHM
shell/.chm
	Open=xchm %f &
	#Open=(xpdf %f &)
	#Open=(acroread %f &)
	#Open=(ghostview %f &)

# The following code very ugly and should not be taken as example.
# It should be cleaned up when the new format of mc.ext is developed.

# DJVU
shell/.djvu
    Open=djview %f &

# html
regex/\.([hH][tT][mM][lL]?)$
	Open=run-mailcap text/html:%f &
	View=%view{ascii} links -dump %f 2>/dev/null || w3m -dump %f 2>/dev/null || lynx -dump -force_html %f

# StarOffice 5.2
shell/.sdw
	Open=(libreoffice %f &)

# StarOffice 6 and OpenOffice.org formats
regex/\.(odt|ott|sxw|stw|ods|ots|sxc|stc|odp|otp|sxi|sti|odg|otg|sxd|std|odb|odf|sxm|odm|sxg)$
	Open=(libreoffice %f &)
	View=%view{ascii} odt2txt %f

# AbiWord
shell/.abw
	Open=(abiword %f &)

# Microsoft Word Document
regex/\.([Dd][oO][cCtT]|[Ww][rR][iI])$
	Open=run-mailcap application/msword:%f &
	View=%view{ascii} antiword -t %f || catdoc -w %f || word2x -f text %f - || strings %f
type/^Microsoft\ Word
	Open=(abiword %f >/dev/null 2>&1 &)
	View=%view{ascii} antiword -t %f || catdoc -w %f || word2x -f text %f - || strings %f

# RTF document
regex/\.([rR][tT][fF])$
	Open=run-mailcap text/rtf:%f &
	#Open=(abiword %f >/dev/null 2>&1 &)

# Microsoft Excel Worksheet
regex/\.([xX][lL][sSwW])$
	Open=(gnumeric %f >/dev/null 2>&1 &)
	View=%view{ascii} xls2csv %f || strings %f
type/^Microsoft\ Excel
	Open=(gnumeric %f >/dev/null 2>&1 &)
	View=%view{ascii} xls2csv %f || strings %f

# Use OpenOffice.org to open any MS Office documents
type/^Microsoft\ Office\ Document
	Open=(libreoffice %f &)

# Framemaker
type/^FrameMaker
	Open=fmclient -f %f

# DVI
regex/\.([dD][vV][iI])$
	Open=run-mailcap %f 2>&1 &
	View=%view{ascii} catdvi %f

shell/.fb2
    Open=fbreader %f &

shell/.epub
    Open=fbreader %f &

# DjVu
regex/\.(djvu|DJVU)$
	Open=djview %f &

### Miscellaneous ###

# Makefile
regex/[Mm]akefile$
	Open=make -f %f %{Enter parameters}

# Imakefile
shell/Imakefile
	Open=xmkmf -a

# Makefile.PL (MakeMaker)
regex/^Makefile.(PL|pl)$
	Open=%var{PERL:perl} %f

# dbf
regex/\.([dD][bB][fF])$
       Open=%view{ascii} dbview %f
       View=%view{ascii} dbview -b %f

# REXX script
regex/\.(rexx?|cmd)$
       Open=rexx %f %{Enter parameters};echo "Press ENTER";read y

# Disk images for Commodore computers (VIC20, C64, C128)
regex/\.(d64|D64)$
	Open=%cd %p/uc1541://
	View=%view{ascii} c1541 %f -list
	Extract=c1541 %f -extract

# Glade, a user interface designer for GTK+ and GNOME
regex/\.([Gg][Ll][Aa][Dd][Ee])$
	Open=if glade-3 --version >/dev/null 2>&1; then (glade-3 %f >/dev/null 2>&1 &); else (glade-2 %f >/dev/null 2>&1 &); fi

# Gettext Catalogs
shell/.mo
	View=%view{ascii} msgunfmt %f || cat %f

# lyx
regex/\.(lyx|LYX)$
	Open=lyx %f
	View=%view{ascii} lyxcat %f

# torrent
regex/\.([tT][oO][rR][rR][eE][nN][tT])$
	View=%view{ascii} ctorrent -x %f 2>/dev/null

### Debian additions ###

# Gettext Catalogs
shell/.mo
	View=%view{ascii} msgunfmt %f || cat %f

################################################################
# My preference.

shell/.my
    Open=tmp=%f; echo ${tmp%.my} %f %{Enter opt:} %{Enter file:}

# Open in Emacs.
regex/\.(c|cpp|cxx)
    Open=e %f
	# Open=sensible-editor %f
regex/\.(h|hpp)
    Open=e %f
shell/.(s|S)
    Open=e %f
shell/.java
    Open=e %f
shell/.f
    Open=e %f
regex/\.([Tt][Ee][Xx])$
	Open=e %f
	#Open=%var{EDITOR:vi} %f
regex/\.(sh|bash|tcsh)
    Edit=e %f

# Object files.
regex/\.(o|obj)
	#Open=sensible-pager %f
	View=%view{ascii} file %f && nm %f
shell/.class
	View=%view{ascii} tmp=%p; javap -c ${tmp%%.class}

### Default ###

# Default target for anything not described above
default/*
	Open=
	View=

### EOF ###