1 # Midnight Commander 3.0 extension file
2 # Warning: Structure of this file has changed completely with version 3.0
4 # All lines starting with # or empty lines are thrown away.
5 # Lines starting in the first column should have following format:
7 # keyword/descNL, i.e. everything after keyword/ until new line is desc
11 # shell (desc is, when starting with a dot, any extension (no wildcars),
12 # i.e. matches all the files *desc . Example: .tar matches *.tar;
13 # if it doesn't start with a dot, it matches only a file of that name)
15 # regex (desc is an extended regular expression)
16 # Please note that we are using the GNU regex library and thus
17 # \| matches the literal | and | has special meaning (or) and
18 # () have special meaning and \( \) stand for literal ( ).
20 # type (file matches this if `file %f` matches regular expression desc
21 # (the filename: part from `file %f` is removed))
23 # directory (matches any directory matching regular expression desc)
25 # include (matches an include directive)
27 # default (matches any file no matter what desc is)
29 # Other lines should start with a space or tab and should be in the format:
31 # keyword=commandNL (with no spaces around =), where keyword should be:
33 # Open (if the user presses Enter or doubleclicks it),
35 # View (F3), Edit (F4)
37 # Include is the keyword used to add any further entries from an include/
40 # command is any one-line shell command, with the following substitutions:
43 # %p -> name of the current file (without path, but pwd is its path)
44 # %f -> name of the current file. Unlike %p, if file is located on a
45 # non-local virtual filesystem, i.e. either tarfs, mcfs or ftpfs,
46 # then the file will be temporarily copied into a local directory
47 # and %f will be the full path to this local temporal file.
48 # If you don't want to get a local copy and want to get the
49 # virtual fs path (like /#ftp:ftp.cvut.cz/pub/hungry/xword), then
50 # use %d/%p instead of %f.
51 # %d -> name of the current directory (pwd, without trailing slash)
52 # %s -> "selected files", i.e. space separated list of tagged files if any
53 # or name of the current file
54 # %t -> list of tagged files
55 # %u -> list of tagged files (they'll be untaged after the command)
57 # (If these 6 letters are in uppercase, they refer to the other panel.
58 # But you shouldn't have to use it in this file.)
61 # %cd -> the rest is a path mc should change into (cd won't work, since it's
62 # a child process). %cd handles even vfs names.
64 # %view -> the command you type will be piped into mc's internal file viewer
65 # if you type only the %view and no command, viewer will load %f file
66 # instead (i.e. no piping, so it is different to %view cat %f)
67 # %view may be directly followed by {} with a list of any of
68 # ascii (Ascii mode), hex (Hex mode), nroff (color highlighting for
69 # text using backspace for bold and underscore) and unform
70 # (no highlighting for nroff sequences) separated by commas.
72 # %var -> You use it like this: %var{VAR:default}. This macro will expand
73 # to the value of the VAR variable in the environment if it's set
74 # otherwise the value in default will be used. This is similar to
75 # the Bourne shell ${VAR-default} construct.
77 # Rules are applied from top to bottom, thus the order is important.
78 # If some actions are missing, search continues as if this target didn't
79 # match (i.e. if a file matches the first and second entry and View action
80 # is missing in the first one, then on pressing F3 the View action from
81 # the second entry will be used. default should catch all the actions.
83 # Any new entries you develop for you are always welcome if they are
84 # useful on more than one system. You can send your modifications
85 # by e-mail to mc-devel@gnome.org
90 # Reorganization: 2000-05-01 Michal Svec <rebel@penguin.cz>
95 # Postscript Open: ps2svga [gs -DEVICE=jpeg|zgv or something]
98 # All X Apps [Nothing/Warning] if no DISPLAY
99 # Not found [Default/Warning]
100 # Empty Output [Default/Warning]
101 # Edit: CopyOut+EDIT+CopyIn
102 # Security Check gzip/bzip EDIT (mktemp)
104 # Maybe: Open/XOpen/GOpen/KOpen/... for Console/X/GNOME/KDE/etc.
109 # .tgz, .tpz, .tar.gz, .tar.z, .tar.Z, .ipk
110 regex/\.t([gp]?z|ar\.g?[zZ])$|\.ipk$
112 View=%view{ascii} gzip -dc %f 2>/dev/null | tar tvvf -
116 View=%view{ascii} bzip -dc %f 2>/dev/null | tar tvvf -
118 regex/\.t(ar\.bz2|bz|b2)$
120 View=%view{ascii} bzip2 -dc %f 2>/dev/null | tar tvvf -
122 # .tar.F - used in QNX
125 View=%view{ascii} freeze -dc %f 2>/dev/null | tar tvvf -
127 # .qpr/.qpk - QNX Neutrino package installer files
130 View=%view{ascii} gzip -dc %f 2>/dev/null | tar tvvf -
135 View=%view{ascii} tar tvvf %f
140 View=%view{ascii} lha l %f
143 regex/\.a(rj|[0-9][0-9])$
145 View=%view{ascii} unarj l %f
150 View=%view{ascii} ha lf %f
153 regex/\.[rR]([aA][rR]|[0-9][0-9])$
155 View=%view{ascii} rar v -c- %f
160 View=%view{ascii} unalz -l %f
165 View=%view{ascii} gzip -dc '%f' | cpio -itv 2>/dev/null
169 View=%view{ascii} gzip -dc '%f' | cpio -itv 2>/dev/null
173 View=%view{ascii} cpio -itv <'%f' 2>/dev/null
176 regex/(^|\.)ls-?lR(\.g?z|Z|bz2)?$
180 regex/\.(diff|patch)(\.(bz2|gz|Z))?$
186 #Open=%view{ascii} ar tv %f
187 View=%view{ascii} file %f && nm %f
192 View=%view{ascii} rpm -qivl --scripts `basename %p .trpm`
194 # RPM packages (SuSE uses *.spm for source packages)
197 View=%view{ascii} if rpm --nosignature --version >/dev/null 2>&1; then RPM="rpm --nosignature" ; else RPM="rpm" ; fi ; $RPM -qivlp --scripts %f
202 View=%view{ascii} dpkg-deb -I %f && echo && dpkg-deb -c %f
207 View=%view{ascii} isoinfo -l -i %f
209 # 7zip archives (they are not man pages)
212 View=%view{ascii} 7za l %f 2>/dev/null
215 type/^ASCII\ mail\ text
223 Open=%var{EDITOR:vi} %f
227 Open=%var{EDITOR:vi} %f
231 Open=%var{EDITOR:vi} %f
235 #Open=%var{PAGER:more} %f
236 View=%view{ascii} file %f && nm %f
240 Open=%var{EDITOR:vi} %f
244 Open=%var{EDITOR:vi} %f
247 ### Documentation ###
250 regex/\.(te?xi|texinfo)$
260 # Exception - .so libraries are not manual pages
261 regex/\.(so|so\.[0-9\.]*)$
262 View=%view{ascii} file %f && nm %f
264 regex/(([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])|\.man)$
265 Open=case %d/%f in */log/*|*/logs/*) cat %f ;; *) nroff @MAN_FLAGS@ @MANDOC@ %f ;; esac | %var{PAGER:more}
266 View=%view{ascii,nroff} case %d/%f in */log/*|*/logs/*) cat %f ;; *) nroff @MAN_FLAGS@ @MANDOC@ %f ;; esac
270 Open=pod2man %f | nroff @MAN_FLAGS@ @MANDOC@ | %var{PAGER:more}
271 View=%view{ascii,nroff} pod2man %f | nroff @MAN_FLAGS@ @MANDOC@
273 # Troff with me macros.
274 # Exception - "read.me" is not a nroff file.
280 Open=nroff @MAN_FLAGS@ -me %f | %var{PAGER:more}
281 View=%view{ascii,nroff} nroff @MAN_FLAGS@ -me %f
283 # Troff with ms macros.
285 Open=nroff @MAN_FLAGS@ -ms %f | %var{PAGER:more}
286 View=%view{ascii,nroff} nroff @MAN_FLAGS@ -ms %f
288 # Manual page - compressed
289 regex/([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.g?[Zz]$
290 Open=case %d/%f in */log/*|*/logs/*) gzip -dc %f ;; *) gzip -dc %f | nroff @MAN_FLAGS@ @MANDOC@ ;; esac | %var{PAGER:more}
291 View=%view{ascii,nroff} case %d/%f in */log/*|*/logs/*) gzip -dc %f ;; *) gzip -dc %f | nroff @MAN_FLAGS@ @MANDOC@ ;; esac
293 regex/([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.bz$
294 Open=case %d/%f in */log/*|*/logs/*) bzip -dc %f ;; *) bzip -dc %f | nroff @MAN_FLAGS@ @MANDOC@ ;; esac | %var{PAGER:more}
295 View=%view{ascii,nroff} case %d/%f in */log/*|*/logs/*) bzip -dc %f ;; *) bzip -dc %f | nroff @MAN_FLAGS@ @MANDOC@ ;; esac
297 regex/([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.bz2$
298 Open=case %d/%f in */log/*|*/logs/*) bzip2 -dc %f ;; *) bzip2 -dc %f | nroff @MAN_FLAGS@ @MANDOC@ ;; esac | %var{PAGER:more}
299 View=%view{ascii,nroff} case %d/%f in */log/*|*/logs/*) bzip2 -dc %f ;; *) bzip2 -dc %f | nroff @MAN_FLAGS@ @MANDOC@ ;; esac
342 Open=if [ "$DISPLAY" = "" ]; then zgv %f; else (gqview %f &); fi
343 View=%view{ascii} identify %f
344 #View=%view{ascii} asciiview %f
349 regex/\.([wW][aA][vV]|[sS][nN][dD]|[vV][oO][cC]|[aA][uU]|[sS][mM][pP]|[aA][iI][fF][fF]|[sS][nN][dD])$
350 Open=if [ "$DISPLAY" = "" ]; then play %f; else (xmms %f >/dev/null 2>&1 &); fi
352 regex/\.([mM][oO][dD]|[sS]3[mM]|[xX][mM]|[iI][tT]|[mM][tT][mM]|669|[sS][tT][mM]|[uU][lL][tT]|[fF][aA][rR])$
356 regex/\.([wW][aA][wW]22)$
360 Open=if [ "$DISPLAY" = "" ]; then mpg123 %f; else (xmms %f >/dev/null 2>&1 &); fi
361 View=%view{ascii} mpg123 -vtn1 %f 2>&1 | sed -n '/^Title/,/^Comment/p;/^MPEG/,/^Audio/p'
363 regex/\.([oO][gG][gG])$
364 Open=if [ "$DISPLAY" = "" ]; then ogg123 %f; else (xmms %f >/dev/null 2>&1 &); fi
365 View=%view{ascii} ogginfo %s
367 regex/\.([mM][iI][dD][iI]?|[rR][mM][iI][dD]?)$
370 regex/\.([wW][mM][aA])$
371 Open=mplayer -vo null %f
372 View=%view{ascii} mplayer -quiet -slave -frames 0 -vo null -ao null -identify %f 2>/dev/null | tail +13 || file %f
377 regex/\.([mM]3[uU]|[pP][lL][sS])$
378 Open=if [ -z "$DISPLAY" ]; then mplayer -vo null -playlist %f; else (xmms -p %f >/dev/null 2>&1 &); fi
383 regex/\.([aA][vV][iI])$
386 regex/\.([aA][sS][fFxX])$
389 regex/\.([dD][iI][vV][xX])$
392 regex/\.([mM][oO][vV]|[qQ][tT])$
395 regex/\.([mM][pP]4|[mM][pP][eE]?[gG])$
398 regex/\.([vV][oO][bB])$
401 regex/\.([wW][mM][vV])$
404 regex/\.([fF][lL][iIcCvV])$
407 regex/\.([oO][gG][mM])$
410 regex/\.([rR][aA]?[mM])$
411 Open=(realplay %f >/dev/null 2>&1 &)
414 Open=(mplayer %f >/dev/null 2>&1 &)
415 #Open=(gtv %f >/dev/null 2>&1 &)
416 #Open=(xanim %f >/dev/null 2>&1 &)
424 View=%view{ascii} ps2ascii %f
429 #Open=(acroread %f &)
430 #Open=(ghostview %f &)
431 View=%view{ascii} pdftotext %f -
433 # The following code very ugly and should not be taken as example.
434 # It should be cleaned up when the new format of mc.ext is developed.
437 regex/\.([hH][tT][mM][lL]?)$
438 Open=(if test -n "@X11_WWW@" && test -n "$DISPLAY"; then (@X11_WWW@ file://%d/%p &) 1>&2; else links %f || lynx -force_html %f || ${PAGER:-more} %f; fi) 2>/dev/null
439 View=%view{ascii} lynx -dump -force_html %f
445 # StarOffice 6 and OpenOffice.org formats
446 regex/\.(odt|ott|sxw|stw|ods|ots|sxc|stc|odp|otp|sxi|sti|odg|otg|sxd|std|odb|odf|sxm|odm|sxg)$
448 View=%view{ascii} odt2txt %f
454 # Microsoft Word Document
455 regex/\.([Dd][oO][cCtT]|[Ww][rR][iI])$
456 Open=(abiword %f >/dev/null 2>&1 &)
457 View=%view{ascii} catdoc -w %f || word2x -f text %f - || strings %f
458 type/^Microsoft\ Word
459 Open=(abiword %f >/dev/null 2>&1 &)
460 View=%view{ascii} catdoc -w %f || word2x -f text %f - || strings %f
463 regex/\.([rR][tT][fF])$
464 Open=(abiword %f >/dev/null 2>&1 &)
466 # Microsoft Excel Worksheet
467 regex/\.([xX][lL][sSwW])$
468 Open=(gnumeric %f >/dev/null 2>&1 &)
469 View=%view{ascii} xls2csv %f || strings %f
470 type/^Microsoft\ Excel
471 Open=(gnumeric %f >/dev/null 2>&1 &)
472 View=%view{ascii} xls2csv %f || strings %f
474 # Use OpenOffice.org to open any MS Office documents
475 type/^Microsoft\ Office\ Document
483 regex/\.([dD][vV][iI])$
484 Open=if [ x$DISPLAY = x ]; then dvisvga %f; else (xdvi %f &); fi
485 View=%view{ascii} dvi2tty %f
488 regex/\.([Tt][Ee][Xx])$
489 Open=%var{EDITOR:vi} %f
492 ### Miscellaneous ###
496 Open=make -f %f %{Enter parameters}
502 # Makefile.PL (MakeMaker)
503 regex/^Makefile.(PL|pl)$
504 Open=%var{PERL:perl} %f
507 regex/\.([dD][bB][fF])$
508 Open=%view{ascii} dbview %f
509 View=%view{ascii} dbview -b %f
513 Open=rexx %f %{Enter parameters};echo "Press ENTER";read y
515 # Disk images for Commodore computers (VIC20, C64, C128)
518 View=%view{ascii} c1541 %f -list
519 Extract=c1541 %f -extract
522 ### Plain compressed files ###
527 View=%view{ascii} unace l %f
533 View=%view{ascii} arc l %f
535 Extract (with flags)=I=%{Enter any Arc flags:}; if test -n "$I"; then arc x $I %f; fi
538 type/^([Zz][Ii][Pp])\ archive
540 View=%view{ascii} unzip -v %f
543 regex/\.([Zz][Oo][Oo])$
545 View=%view{ascii} zoo l %f
549 Open=gzip -dc %f | %var{PAGER:more}
550 View=%view{ascii} gzip -dc %f 2>/dev/null
554 Open=bzip2 -dc %f | %var{PAGER:more}
555 View=%view{ascii} bzip2 -dc %f 2>/dev/null
559 Open=bzip -dc %f | %var{PAGER:more}
560 View=%view{ascii} bzip -dc %f 2>/dev/null
564 Open=gzip -dc %f | %var{PAGER:more}
565 View=%view{ascii} gzip -dc %f 2>/dev/null
570 # Default target for anything not described above