*** empty log message ***
[midnight-commander.git] / lib / mc.ext.in
blobfa8149cb6819342c728a6f17e31e97407a39f006
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
9 # keyword can be: 
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/
38 #    section
40 # command is any one-line shell command, with the following substitutions:
42 # %% -> % character
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
88 ### Changes ###
90 # Reorganization: 2000-05-01 Michal Svec <rebel@penguin.cz>
93 ### TODO ###
95 # Postscript    Open: ps2svga [gs -DEVICE=jpeg|zgv or something]
96 # Images                asciiview
97
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.
107 ### Sources ###
109 # C
110 shell/.c
111         Open=%var{EDITOR:vi} %f
113 # Fortran
114 shell/.f
115         Open=%var{EDITOR:vi} %f
116         
117 # Header
118 shell/.h
119         Open=%var{EDITOR:vi} %f
121 # Object
122 shell/.o
123         #Open=%var{PAGER:more} %f
124         View=%view{ascii} file %f && nm %f
126 # Asm
127 shell/.s
128         Open=%var{EDITOR:vi} %f
130 # C++
131 regex/\.(C|cc)$
132         Open=%var{EDITOR:vi} %f
134 ### Documentation ###
136 # Texinfo
137 regex/\.(te?xi|texinfo)$
139 # GNU Info page
140 type/^Info\ text
141         Open=info -f %f
143 shell/.info
144         Open=info -f %f
146 # Manual page
147 # Exception - .so libraries are not manual pages
148 regex/\.(so|so\.[0-9\.]*)$
149         View=%view{ascii} file %f && nm %f
151 regex/(([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|n)|\.man)$
152         Open=nroff @TROFFASCII@ @MANDOC@ %f | %var{PAGER:more}
153         View=%view{ascii,nroff} nroff @TROFFASCII@ @MANDOC@ %f
155 # Troff with me macros.
156 # Exception - "read.me" is not a nroff file.
157 shell/read.me
158         Open=
159         View=
161 shell/.me
162         Open=nroff @TROFFASCII@ -me %f | %var{PAGER:more}
163         View=%view{ascii,nroff} nroff @TROFFASCII@ -me %f
165 # Troff with ms macros.
166 shell/.ms
167         Open=nroff @TROFFASCII@ -ms %f | %var{PAGER:more}
168         View=%view{ascii,nroff} nroff @TROFFASCII@ -ms %f
170 # Manual page - compressed
171 regex/([^0-9]|^[^\.]*)\.([1-9][a-z]?|n)\.g?[Zz]$
172         Open=gzip -dc %f | nroff @TROFFASCII@ @MANDOC@ | %var{PAGER:more}
173         View=%view{ascii,nroff} gzip -dc %f | nroff @TROFFASCII@ @MANDOC@
175 regex/([^0-9]|^[^\.]*)\.([1-9][a-z]?|n)\.bz$
176         Open=bzip -dc %f | nroff @TROFFASCII@ @MANDOC@ | %var{PAGER:more}
177         View=%view{ascii,nroff} bzip -dc %f | nroff @TROFFASCII@ @MANDOC@
179 regex/([^0-9]|^[^\.]*)\.([1-9][a-z]?|n)\.bz2$
180         Open=bzip2 -dc %f | nroff @TROFFASCII@ @MANDOC@ | %var{PAGER:more}
181         View=%view{ascii,nroff} bzip2 -dc %f | nroff @TROFFASCII@ @MANDOC@
184 ### Images ###
186 type/^GIF
187         Include=image-options
189 type/^JPEG
190         Include=image-options
192 type/^PC\ bitmap
193         Include=image-options
195 type/^PNG
196         Include=image-options
198 type/^TIFF
199         Include=image-options
201 type/^PBM
202         Include=image-options
204 type/^PGM
205         Include=image-options
207 type/^PPM
208         Include=image-options
210 type/^Netpbm
211         Include=image-options
213 shell/.xcf
214         Open=gimp %f
216 shell/.xbm
217         Open=bitmap %f
219 shell/.xpm
220         Include=image-options
221         View=sxpm %f
223 include/image-options
224         Open=if [ "$DISPLAY" = "" ]; then zgv %f; else (ee %f &); fi
225         View=%view{ascii} identify %f
226         #View=%view{ascii} asciiview %f
229 ### Sound files ###
231 regex/\.(wav|WAV|Wav|snd|SND|Snd|voc|VOC|Voc|au|AU|Au)$
232        Open=play %f
234 regex/\.(mod|MOD|Mod|s3m|S3M|S3m|xm|XM|Xm)$
235        Open=mikmod %f
236        #Open=tracker %f
238 regex/\.(wav22|WAV22)$
239        Open=vplay -s 22 %f
241 regex/\.(mp3|MP3|Mp3)$
242         Open=if [ "$DISPLAY" = "" ]; then mpg123 %f; else (xmms %f &); fi
243         View=%view{ascii} mpg123 -vtn1 %f 2>&1 | sed -n '/^Title/,/^Comment/p;/^MPEG/,/^Audio/p'
245 regex/\.(ogg|OGG|Ogg)$
246         Open=if [ "$DISPLAY" = "" ]; then ogg123 %f; else (xmms %f &); fi
247         View=%view{ascii} ogginfo %s
249 regex/\.(midi?|MIDI?|Midi?|rmid?|RMID?|Rmid?)$
250         Open=timidity %f
252 ### Multimedia ###
254 regex/\.(mpe?g|MPE?G|Mpe?g)$
255         Open=(mplayer %f >/dev/null 2>&1 &)
256         #Open=(gtv %f >/dev/null 2>&1 &)
258 regex/\.(avi|AVI|Avi|mov|MOV|Mov)$
259         Open=(mplayer %f >/dev/null 2>&1 &)
260         #Open=(xanim %f >/dev/null 2>&1 &)
262 regex/\.(asf|ASF|Asf|wmv|WMV|Wmv)$
263         Open=(mplayer %f >/dev/null 2>&1 &)
265 regex/\.(rm|RM|Rm|ram|RAM|Ram)$
266         Open=(realplay %f >/dev/null 2>&1 &)
269 ### Documents ###
271 # Postscript
272 type/^PostScript
273         Open=(gv %f &)
274         View=%view{ascii} ps2ascii %f
276 # PDF
277 type/^PDF
278         Open=(xpdf %f &)
279         #Open=(acroread %f &)
280         #Open=(ghostview %f &)
281         View=%view{ascii} pdftotext %f -
283 # The following code very ugly and should not be taken as example.
284 # It should be cleaned up when the new format of mc.ext is developed.
286 # html
287 regex/\.([Hh]tml?|HTML?)$
288         Open=if test -n "@X11_WWW@" && test -n "$DISPLAY"; then (@X11_WWW@ file://%d/%p &) >/dev/null 2>&1; else links %f || lynx -force_html %f; fi
289         View=%view{ascii} links -dump %f || lynx -dump -force_html %f
291 # StarOffice and OpenOffice
292 shell/.sdw
293         Open=(soffice %f &)
295 # AbiWord
296 shell/.abw
297         Open=(abiword %f &)
299 # Microsoft Word Document
300 regex/\.([Dd]o[ct]|DO[CT]|[Ww]ri|WRI)$
301         Open=(abiword %f >/dev/null 2>&1 &)
302         View=%view{ascii} catdoc -w %f || word2x -f text %f - || strings %f
303 type/^Microsoft\ Word
304         Open=(abiword %f >/dev/null 2>&1 &)
305         View=%view{ascii} catdoc -w %f || word2x -f text %f - || strings %f
307 # RTF document
308 regex/\.(rtf|RTF|Rtf)$
309         Open=(abiword %f >/dev/null 2>&1 &)
311 # Microsoft Excel Worksheet
312 regex/\.([Xx]l[sw]|XL[SW])$
313         Open=(gnumeric %f >/dev/null 2>&1 &)
314         View=%view{ascii} xls2csv %f || strings %f
315 type/^Microsoft\ Excel
316         Open=(gnumeric %f >/dev/null 2>&1 &)
317         View=%view{ascii} xls2csv %f || strings %f
319 # Use StarOffice to open any MS Office documents
320 type/^Microsoft\ Office\ Document
321         Open=(soffice %f &)
323 # Framemaker
324 type/^FrameMaker
325         Open=fmclient -f %f
327 # DVI
328 regex/\.([Dd]vi|DVI)$
329         Open=if [ x$DISPLAY = x ]; then dvisvga %f; else (xdvi %f &); fi
330         View=%view{ascii} dvi2tty %f
332 # TeX
333 regex/\.([Tt]ex|TEX|TeX)$
334         Open=%var{EDITOR:vi} %f
337 ### Miscellaneous ###
339 # Makefile
340 regex/[Mm]akefile$
341         Open=make -f %f %{Enter parameters}
343 # Imakefile
344 shell/Imakefile
345         Open=xmkmf -a
347 # Makefile.PL (MakeMaker)
348 regex/^Makefile.(PL|pl)$
349         Open=%var{PERL:perl} %f
351 # dbf
352 regex/\.(dbf|DBF)$
353        Open=%view{ascii} dbview %f
354        View=%view{ascii} dbview -b %f
356 # REXX script
357 regex/\.(rexx|rex|cmd)$
358        Open=rexx %f %{Enter parameters};echo "Press ENTER";read y
361 ### Archives ###
363 # .tgz, .tpz, .tar.gz, .tar.z, .tar.Z
364 regex/\.t([gp]?z|ar\.g?[zZ])$
365         Open=%cd %p#utar
366         View=%view{ascii} gzip -dc %f 2>/dev/null | tar tvvf -
368 regex/\.tar\.bz$
369         # Open=%cd %p#utar
370         View=%view{ascii} bzip -dc %f 2>/dev/null | tar tvvf -
372 regex/\.tar\.bz2$
373         Open=%cd %p#utar
374         View=%view{ascii} bzip2 -dc %f 2>/dev/null | tar tvvf -
376 # .tar.F - used in QNX
377 regex/\.tar\.F$
378         # Open=%cd %p#utar
379         View=%view{ascii} freeze -dc %f 2>/dev/null | tar tvvf -
381 # tar
382 regex/\.(tar|TAR)$
383         Open=%cd %p#utar
384         View=%view{ascii} tar tvvf %f
386 # zip
387 type/^Zip\ archive
388         Open=%cd %p#uzip
389         View=%view{ascii} unzip -v %f
391 # zoo
392 regex/\.(zoo|ZOO)$
393         Open=%cd %p#uzoo
394         View=%view{ascii} zoo l %f
395         
396 # lha
397 type/^LHa\ .*archive
398         Open=%cd %p#ulha
399         View=%view{ascii} lharc l %f
401 # arj
402 regex/\.a(rj|[0-9][0-9])$
403         Open=%cd %p#uarj
404         View=%view{ascii} unarj l %f
406 # ha
407 regex/\.(ha|HA|Ha)$
408         Open=%cd %p#uha
409         View=%view{ascii} ha lf %f
411 # rar
412 regex/\.[rR]([aA][rR]|[0-9][0-9])$
413         Open=%cd %p#urar
414         View=%view{ascii} rar v -c- %f
416 # cpio
417 shell/.cpio.Z
418         Open=%cd %p#ucpio
419         View=%view{ascii} compress -dc '%f' | cpio -ictv
421 shell/.cpio.gz
422         Open=%cd %p#ucpio
423         View=%view{ascii} gzip -dc '%f' | cpio -ictv
425 shell/.cpio
426         Open=%cd %p#ucpio
427         View=%view{ascii} cat '%f' | cpio -ictv
429 # ls-lR
430 regex/(^|\.)ls-?lR$
431         Open=%cd %p#lslR
432 regex/(^|\.)ls-?lR\.(g?z|Z)$
433         Open=%cd %p#lslR
434         View=%view{ascii} gunzip -c %f
436 # ftplist
437 regex/\.ftplist$
438         Open=%cd %p#ftplist
440 # gzip
441 type/^gzip
442         Open=gzip -dc %f | %var{PAGER:more}
443         View=%view{ascii} gzip -dc %f 2>/dev/null
444         Edit=I=`date +%%s`; export I; gzip -cd %f >/tmp/gzed.$I && %var{EDITOR:vi} /tmp/gzed.$I && gzip -c /tmp/gzed.$I > %f; rm -f /tmp/gzed.$I
446 # bzip2
447 type/^bzip2
448         Open=bzip2 -dc %f | %var{PAGER:more}
449         View=%view{ascii} bzip2 -dc %f 2>/dev/null
450         Edit=I=`date +%%s`; export I; bzip2 -cd %f >/tmp/bzed.$I && %var{EDITOR:vi} /tmp/bzed.$I && bzip2 -c /tmp/bzed.$I > %f; rm -f /tmp/bzed.$I
452 # bzip
453 type/^bzip
454         Open=bzip -dc %f | %var{PAGER:more}
455         View=%view{ascii} bzip -dc %f 2>/dev/null
456         Edit=I=`date +%%s`; export I; bzip -cd %f >/tmp/bzed.$I && %var{EDITOR:vi} /tmp/bzed.$I && bzip -c /tmp/bzed.$I > %f; rm -f /tmp/bzed.$I
458 # compress
459 type/^compress
460         Open=gzip -dc %f | %var{PAGER:more}
461         View=%view{ascii} gzip -dc %f 2>/dev/null
462         Edit=I=`date +%%s`; export I; gzip -cd %f >/tmp/gzed.$I && %var{EDITOR:vi} /tmp/gzed.$I && gzip -c /tmp/gzed.$I > %f; rm -f /tmp/gzed.$I
464 # ar library
465 regex/\.s?a$
466         Open=%cd %p#uar
467         #Open=%view{ascii} ar tv %f
468         View=%view{ascii} file %f && nm %f
470 # trpm
471 regex/\.trpm$
472         Open=%cd %p#trpm
473         View=%view{ascii} rpm -qivl --scripts `basename %p .trpm`
475 # Source RPMs (SuSE uses *.spm, others use *.src.rpm)
476 regex/\.(spm|src\.rpm)$
477         Open=%cd %p#rpm
478         View=%view{ascii} rpm -qivlp --scripts %f
480 # Compiled RPMs
481 regex/\.rpm$
482         Open=%cd %p#rpm
483         View=%view{ascii} rpm -qivlp --scripts %f
485 # deb
486 regex/\.deb$
487         Open=%cd %p#deb
488         View=%view{ascii} dpkg-deb -c %f
491 ### Default ###
493 # Default target for anything not described above
494 default/*
495         Open=
496         View=
499 ### EOF ###