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 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 post your modifications
85 # as tickets at www.midnight-commander.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.
110 Open=%cd %p/changesetfs://
111 View=%cd %p/patchsetfs://
115 # .tgz, .tpz, .tar.gz, .tar.z, .tar.Z, .ipk
116 regex/\.t([gp]?z|ar\.g?[zZ])$|\.ipk|\.gem$
118 View=%view{ascii} gzip -dc %f 2>/dev/null | tar tvvf -
121 # Open=%cd %p/utar://
122 View=%view{ascii} bzip -dc %f 2>/dev/null | tar tvvf -
124 regex/\.t(ar\.bz2|bz2?|b2)$
126 View=%view{ascii} bzip2 -dc %f 2>/dev/null | tar tvvf -
129 regex/\.t(ar\.lzma|lz)$
131 View=%view{ascii} lzma -dc %f 2>/dev/null | tar tvvf -
134 regex/\.t(ar\.xz|xz)$
136 View=%view{ascii} xz -dc %f 2>/dev/null | tar tvvf -
138 # .tar.F - used in QNX
140 # Open=%cd %p/utar://
141 View=%view{ascii} freeze -dc %f 2>/dev/null | tar tvvf -
143 # .qpr/.qpk - QNX Neutrino package installer files
146 View=%view{ascii} gzip -dc %f 2>/dev/null | tar tvvf -
151 View=%view{ascii} tar tvvf - < %f
156 View=%view{ascii} lha l %f
159 regex/\.a(rj|[0-9][0-9])$
161 View=%view{ascii} unarj l %f
164 regex/\.([cC][aA][bB])$
166 View=%view{ascii} cabextract -l %f
171 View=%view{ascii} ha lf %f
174 regex/\.[rR]([aA][rR]|[0-9][0-9])$
176 View=%view{ascii} rar v -c- %f
181 View=%view{ascii} unalz -l %f
186 View=%view{ascii} gzip -dc %f | cpio -itv 2>/dev/null
190 View=%view{ascii} gzip -dc %f | cpio -itv 2>/dev/null
194 View=%view{ascii} cpio -itv < %f 2>/dev/null
197 regex/(^|\.)ls-?lR(\.gz|Z|bz2)$
201 regex/\.(diff|patch)(\.bz2)$
202 Open=%cd %p/patchfs://
203 View=%view{ascii} bzip2 -dc %f 2>/dev/null
205 regex/\.(diff|patch)(\.(gz|Z))$
206 Open=%cd %p/patchfs://
207 View=%view{ascii} gzip -dc %f 2>/dev/null
209 regex/\.(diff|patch)$
210 Open=%cd %p/patchfs://
211 View=%view{ascii} /bin/cat %f 2>/dev/null
216 #Open=%view{ascii} ar tv %f
217 View=%view{ascii} file %f && nm -C %f
222 View=%view{ascii} rpm -qivl --scripts `basename %p .trpm`
224 # RPM packages (SuSE uses *.spm for source packages)
225 regex/\.(src\.rpm|spm)$
227 View=%view{ascii} if rpm --nosignature --version >/dev/null 2>&1; then RPM="rpm --nosignature" ; else RPM="rpm" ; fi ; $RPM -qivlp --scripts %f
231 View=%view{ascii} if rpm --nosignature --version >/dev/null 2>&1; then RPM="rpm --nosignature" ; else RPM="rpm" ; fi ; $RPM -qivlp --scripts %f
236 View=%view{ascii} dpkg-deb -I %f && echo && dpkg-deb -c %f
241 View=%view{ascii} dpkg -s `echo %p | sed 's/\([0-9a-z.-]*\).*/\1/'`
245 View=%view{ascii} apt-cache show `echo %p | sed 's/\([0-9a-z.-]*\).*/\1/'`
248 regex/\.([iI][sS][oO])$
249 Open=%cd %p/iso9660://
250 View=%view{ascii} isoinfo -l -i %f
252 # 7zip archives (they are not man pages)
255 View=%view{ascii} 7za l %f 2>/dev/null
258 type/^ASCII\ mail\ text
259 Open=%cd %p/mailfs://
285 Open=%var{EDITOR:vi} %f
288 regex/\.(so|so\.[0-9\.]*)$
289 View=%view{ascii} file %f && nm -C -D %f
293 #Open=%var{PAGER:more} %f
294 View=%view{ascii} file %f && nm -C %f
296 ### Documentation ###
299 #regex/\.(te?xi|texinfo)$
308 # Exception: .3gp are video files not manual pages
313 regex/(([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])|\.man)$
314 Open=case %d/%f in */log/*|*/logs/*) cat %f ;; *) { zsoelim %f 2>/dev/null || cat %f; } | nroff @MAN_FLAGS@ @MANDOC@ ;; esac | %var{PAGER:more}
315 View=%view{ascii,nroff} case %d/%f in */log/*|*/logs/*) cat %f ;; *) { zsoelim %f 2>/dev/null || cat %f; } | nroff @MAN_FLAGS@ @MANDOC@ ;; esac
319 Open=pod2man %f | nroff @MAN_FLAGS@ @MANDOC@ | %var{PAGER:more}
320 View=%view{ascii,nroff} pod2man %f | nroff @MAN_FLAGS@ @MANDOC@
322 # Troff with me macros.
323 # Exception - "read.me" is not a nroff file.
329 Open=nroff @MAN_FLAGS@ -me %f | %var{PAGER:more}
330 View=%view{ascii,nroff} nroff @MAN_FLAGS@ -me %f
332 # Troff with ms macros.
334 Open=nroff @MAN_FLAGS@ -ms %f | %var{PAGER:more}
335 View=%view{ascii,nroff} nroff @MAN_FLAGS@ -ms %f
337 # Manual page - compressed
338 regex/([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.g?[Zz]$
339 Open=case %d/%f in */log/*|*/logs/*) gzip -dc %f ;; *) gzip -dc %f | nroff @MAN_FLAGS@ @MANDOC@ ;; esac | %var{PAGER:more}
340 View=%view{ascii,nroff} case %d/%f in */log/*|*/logs/*) gzip -dc %f ;; *) gzip -dc %f | nroff @MAN_FLAGS@ @MANDOC@ ;; esac
342 regex/([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.bz$
343 Open=case %d/%f in */log/*|*/logs/*) bzip -dc %f ;; *) bzip -dc %f | nroff @MAN_FLAGS@ @MANDOC@ ;; esac | %var{PAGER:more}
344 View=%view{ascii,nroff} case %d/%f in */log/*|*/logs/*) bzip -dc %f ;; *) bzip -dc %f | nroff @MAN_FLAGS@ @MANDOC@ ;; esac
346 regex/([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.bz2$
347 Open=case %d/%f in */log/*|*/logs/*) bzip2 -dc %f ;; *) bzip2 -dc %f | nroff @MAN_FLAGS@ @MANDOC@ ;; esac | %var{PAGER:more}
348 View=%view{ascii,nroff} case %d/%f in */log/*|*/logs/*) bzip2 -dc %f ;; *) bzip2 -dc %f | nroff @MAN_FLAGS@ @MANDOC@ ;; esac
350 regex/([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.lzma$
351 Open=case %d/%f in */log/*|*/logs/*) lzma -dc %f ;; *) lzma -dc %f | nroff @MAN_FLAGS@ @MANDOC@ ;; esac | %var{PAGER:more}
352 View=%view{ascii,nroff} case %d/%f in */log/*|*/logs/*) lzma -dc %f ;; *) lzma -dc %f | nroff @MAN_FLAGS@ @MANDOC@ ;; esac
354 regex/([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.xz$
355 Open=case %d/%f in */log/*|*/logs/*) xz -dc %f ;; *) xz -dc %f | nroff @MAN_FLAGS@ @MANDOC@ ;; esac | %var{PAGER:more}
356 View=%view{ascii,nroff} case %d/%f in */log/*|*/logs/*) xz -dc %f ;; *) xz -dc %f | nroff @MAN_FLAGS@ @MANDOC@ ;; esac
360 Open=which kchmviewer > /dev/null 2>&1 && (kchmviewer %f &) || (xchm %f &)
368 View=%view{ascii} identify %f; test -x /usr/bin/exif && echo && exif %f 2>/dev/null
406 Open=if [ "$DISPLAY" = "" ]; then zgv %f; else (gqview %f &); fi
407 View=%view{ascii} identify %f
408 #View=%view{ascii} asciiview %f
413 regex/\.([wW][aA][vV]|[sS][nN][dD]|[vV][oO][cC]|[aA][uU]|[sS][mM][pP]|[aA][iI][fF][fF]|[sS][nN][dD])$
414 Open=if [ "$DISPLAY" = "" ]; then play %f; else (xmms %f >/dev/null 2>&1 &); fi
416 regex/\.([mM][oO][dD]|[sS]3[mM]|[xX][mM]|[iI][tT]|[mM][tT][mM]|669|[sS][tT][mM]|[uU][lL][tT]|[fF][aA][rR])$
420 regex/\.([wW][aA][wW]22)$
424 Open=if [ "$DISPLAY" = "" ]; then mpg123 %f; else (xmms %f >/dev/null 2>&1 &); fi
425 View=%view{ascii} mpg123 -vtn1 %f 2>&1 | sed -n '/^Title/,/^Comment/p;/^MPEG/,/^Audio/p'
427 regex/\.([oO][gG][gG|aA|vV|xX])$
428 Open=if [ "$DISPLAY" = "" ]; then ogg123 %f; else (xmms %f >/dev/null 2>&1 &); fi
429 View=%view{ascii} ogginfo %s
431 regex/\.([sS][pP][xX]|[fF][lL][aA][cC])$
432 Open=if [ "$DISPLAY" = "" ]; then play %f; else (xmms %f >/dev/null 2>&1 &); fi
434 regex/\.([mM][iI][dD][iI]?|[rR][mM][iI][dD]?)$
437 regex/\.([wW][mM][aA])$
438 Open=mplayer -vo null %f
439 View=%view{ascii} mplayer -quiet -slave -frames 0 -vo null -ao null -identify %f 2>/dev/null | tail +13 || file %f
444 regex/\.([mM]3[uU]|[pP][lL][sS])$
445 Open=if [ -z "$DISPLAY" ]; then mplayer -vo null -playlist %f; else (xmms -p %f >/dev/null 2>&1 &); fi
450 regex/\.([aA][vV][iI])$
453 regex/\.([aA][sS][fFxX])$
456 regex/\.([dD][iI][vV][xX])$
459 regex/\.([mM][kK][vV])$
462 regex/\.([mM][oO][vV]|[qQ][tT])$
465 regex/\.([mM][pP]4|[mM]4[vV]|[mM][pP][eE]?[gG])$
468 # MPEG-2 TS container + H.264 codec
469 regex/\.([mM][tT][sS])$
475 regex/\.([vV][oO][bB])$
478 regex/\.([wW][mM][vV])$
481 regex/\.([fF][lL][iIcCvV])$
484 regex/\.([oO][gG][mM])$
487 regex/\.([rR][aA]?[mM])$
488 Open=(realplay %f >/dev/null 2>&1 &)
491 Open=(mplayer %f >/dev/null 2>&1 &)
492 #Open=(gtv %f >/dev/null 2>&1 &)
493 #Open=(xanim %f >/dev/null 2>&1 &)
501 View=%view{ascii} ps2ascii %f
506 #Open=(acroread %f &)
507 #Open=(ghostview %f &)
508 View=%view{ascii} pdftotext %f -
510 # The following code very ugly and should not be taken as example.
511 # It should be cleaned up when the new format of mc.ext is developed.
514 regex/\.([hH][tT][mM][lL]?)$
515 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
516 View=%view{ascii} links -dump %f 2>/dev/null || w3m -dump %f 2>/dev/null || lynx -dump -force_html %f
522 # StarOffice 6 and OpenOffice.org formats
523 regex/\.(odt|ott|sxw|stw|ods|ots|sxc|stc|odp|otp|sxi|sti|odg|otg|sxd|std|odb|odf|sxm|odm|sxg)$
525 View=%view{ascii} odt2txt %f
531 # Microsoft Word Document
532 regex/\.([Dd][oO][cCtT]|[Ww][rR][iI])$
533 Open=(abiword %f >/dev/null 2>&1 &)
534 View=%view{ascii} antiword -t %f || catdoc -w %f || word2x -f text %f - || strings %f
535 type/^Microsoft\ Word
536 Open=(abiword %f >/dev/null 2>&1 &)
537 View=%view{ascii} antiword -t %f || catdoc -w %f || word2x -f text %f - || strings %f
540 regex/\.([rR][tT][fF])$
541 Open=(abiword %f >/dev/null 2>&1 &)
543 # Microsoft Excel Worksheet
544 regex/\.([xX][lL][sSwW])$
545 Open=(gnumeric %f >/dev/null 2>&1 &)
546 View=%view{ascii} xls2csv %f || strings %f
547 type/^Microsoft\ Excel
548 Open=(gnumeric %f >/dev/null 2>&1 &)
549 View=%view{ascii} xls2csv %f || strings %f
551 # Use OpenOffice.org to open any MS Office documents
552 type/^Microsoft\ Office\ Document
560 regex/\.([dD][vV][iI])$
561 Open=if [ x$DISPLAY = x ]; then dvisvga %f; else (xdvi %f &); fi
562 View=%view{ascii} dvi2tty %f
565 regex/\.([Tt][Ee][Xx])$
569 regex/\.(djvu?|DJVU?)$
571 View=%view{ascii} djvused -e print-pure-txt %f
573 ### Miscellaneous ###
577 Open=make -f %f %{Enter parameters}
583 # Makefile.PL (MakeMaker)
584 regex/^Makefile.(PL|pl)$
585 Open=%var{PERL:perl} %f
588 regex/\.([dD][bB][fF])$
589 Open=%view{ascii} dbview %f
590 View=%view{ascii} dbview -b %f
594 Open=rexx %f %{Enter parameters};echo "Press ENTER";read y
596 # Disk images for Commodore computers (VIC20, C64, C128)
598 Open=%cd %p/uc1541://
599 View=%view{ascii} c1541 %f -list
600 Extract=c1541 %f -extract
602 # Glade, a user interface designer for GTK+ and GNOME
603 regex/\.([Gg][Ll][Aa][Dd][Ee])$
604 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
608 View=%view{ascii} msgunfmt %f || cat %f
613 View=%view{ascii} lyxcat %f
616 regex/\.([tT][oO][rR][rR][eE][nN][tT])$
617 View=%view{ascii} ctorrent -x %f 2>/dev/null
619 ### Plain compressed files ###
624 View=%view{ascii} unace l %f
630 View=%view{ascii} arc l %f
632 Extract (with flags)=I=%{Enter any Arc flags:}; if test -n "$I"; then arc x $I %f; fi
635 type/^([Zz][Ii][Pp])\ archive
637 View=%view{ascii} unzip -v %f
640 regex/\.([Zz][Oo][Oo])$
642 View=%view{ascii} zoo l %f
646 Open=gzip -dc %f | %var{PAGER:more}
647 View=%view{ascii} gzip -dc %f 2>/dev/null
650 View=%view{ascii} gzip -dc %f 2>/dev/null
654 Open=bzip2 -dc %f | %var{PAGER:more}
655 View=%view{ascii} bzip2 -dc %f 2>/dev/null
658 View=%view{ascii} bzip2 -dc %f 2>/dev/null
662 Open=bzip -dc %f | %var{PAGER:more}
663 View=%view{ascii} bzip -dc %f 2>/dev/null
667 Open=gzip -dc %f | %var{PAGER:more}
668 View=%view{ascii} gzip -dc %f 2>/dev/null
672 Open=lzma -dc %f | %var{PAGER:more}
673 View=%view{ascii} lzma -dc %f 2>/dev/null
677 Open=xz -dc %f | %var{PAGER:more}
678 View=%view{ascii} xz -dc %f 2>/dev/null
682 # Default target for anything not described above