* command.c (enter): Speed up and simplify.
[midnight-commander.git] / lib / mc.ext.in
blobc0b387e65e4d2ccb60f9a1278d2f898d66f4ffee
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 regex/\.(h|hpp)$
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|cpp)$
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 @MAN_FLAGS@ @MANDOC@ %f | %var{PAGER:more}
153         View=%view{ascii,nroff} nroff @MAN_FLAGS@ @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 @MAN_FLAGS@ -me %f | %var{PAGER:more}
163         View=%view{ascii,nroff} nroff @MAN_FLAGS@ -me %f
165 # Troff with ms macros.
166 shell/.ms
167         Open=nroff @MAN_FLAGS@ -ms %f | %var{PAGER:more}
168         View=%view{ascii,nroff} nroff @MAN_FLAGS@ -ms %f
170 # Manual page - compressed
171 regex/([^0-9]|^[^\.]*)\.([1-9][a-z]?|n)\.g?[Zz]$
172         Open=gzip -dc %f | nroff @MAN_FLAGS@ @MANDOC@ | %var{PAGER:more}
173         View=%view{ascii,nroff} case %d in /var/log*) gzip -dc %f ;; *) gzip -dc %f | nroff @MAN_FLAGS@ @MANDOC@ ;; esac
175 regex/([^0-9]|^[^\.]*)\.([1-9][a-z]?|n)\.bz$
176         Open=bzip -dc %f | nroff @MAN_FLAGS@ @MANDOC@ | %var{PAGER:more}
177         View=%view{ascii,nroff} bzip -dc %f | nroff @MAN_FLAGS@ @MANDOC@
179 regex/([^0-9]|^[^\.]*)\.([1-9][a-z]?|n)\.bz2$
180         Open=bzip2 -dc %f | nroff @MAN_FLAGS@ @MANDOC@ | %var{PAGER:more}
181         View=%view{ascii,nroff} bzip2 -dc %f | nroff @MAN_FLAGS@ @MANDOC@
184 ### Images ###
186 type/^GIF
187         Include=image
189 type/^JPEG
190         Include=image
192 type/^PC\ bitmap
193         Include=image
195 type/^PNG
196         Include=image
198 type/^TIFF
199         Include=image
201 type/^PBM
202         Include=image
204 type/^PGM
205         Include=image
207 type/^PPM
208         Include=image
210 type/^Netpbm
211         Include=image
213 shell/.xcf
214         Open=gimp %f
216 shell/.xbm
217         Open=bitmap %f
219 shell/.xpm
220         Include=image
221         View=sxpm %f
223 include/image
224         Open=if [ "$DISPLAY" = "" ]; then zgv %f; else (gqview %f &); fi
225         View=%view{ascii} identify %f
226         #View=%view{ascii} asciiview %f
229 ### Sound files ###
231 regex/\.([wW][aA][vV]|[sS][nN][dD]|[vV][oO][cC]|[aA][uU]|[sS][mM][pP]|[aA][iI][fF][fF]|[sS][nN][dD])$
232        Open=if [ "$DISPLAY" = "" ]; then play %f; else (xmms -e %f 1>/dev/null 2>&1 &); fi
234 regex/\.([mM][oO][dD]|[sS]3[mM]|[xX][mM]|[iI][tT]|[mM][tT][mM]|669|[sS][tT][mM]|[uU][lL][tT]|[fF][aA][rR])$
235        Open=mikmod %f
236        #Open=tracker %f
238 regex/\.([wW][aA][wW]22)$
239        Open=vplay -s 22 %f
241 regex/\.([mM][pP]3)$
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/\.([oO][gG][gG])$
246         Open=if [ "$DISPLAY" = "" ]; then ogg123 %f; else (xmms %f &); fi
247         View=%view{ascii} ogginfo %s
249 regex/\.([mM][iI][dD][iI]?|[rR][mM][iI][dD]?)$
250         Open=timidity %f
252 regex/\.([wW][mM][aA])$
253         Open=mplayer -vo null %f
254         View=%view{ascii} mplayer -quiet -slave -frames 0 -vo null -ao null -identify %f 2>/dev/null | tail +13 || file %f
257 ### Play lists ###
259 regex/\.([mM]3[uU]|[pP][lL][sS])$
260         Open=if [ -z "$DISPLAY" ]; then mplayer -vo null -playlist %f; else (xmms -p %f &); fi
263 ### Video ###
265 regex/\.([aA][vV][iI])$
266         Include=video
268 regex/\.([aA][sS][fFxX])$
269         Include=video
271 regex/\.([dD][iI][vV][xX])$
272         Include=video
274 regex/\.([mM][oO][vV]|[qQ][tT])$
275         Include=video
277 regex/\.([mM][pP]4|[mM][pP][eE]?[gG])$
278         Include=video
280 regex/\.([vV][oO][bB])$
281         Include=video
283 regex/\.([wW][mM][vV])$
284         Include=video
286 regex/\.([oO][gG][mM])$
287         Include=video
289 regex/\.([rR][aA]?[mM])$
290         Open=(realplay %f >/dev/null 2>&1 &)
292 include/video
293         Open=(mplayer %f >/dev/null 2>&1 &)
294         #Open=(gtv %f >/dev/null 2>&1 &)
295         #Open=(xanim %f >/dev/null 2>&1 &)
297 ### Documents ###
299 # Postscript
300 type/^PostScript
301         Open=(gv %f &)
302         View=%view{ascii} ps2ascii %f
304 # PDF
305 type/^PDF
306         Open=(xpdf %f &)
307         #Open=(acroread %f &)
308         #Open=(ghostview %f &)
309         View=%view{ascii} pdftotext %f -
311 # The following code very ugly and should not be taken as example.
312 # It should be cleaned up when the new format of mc.ext is developed.
314 # html
315 regex/\.([hH][tT][mM][lL]?)$
316         Open=if test -n "@X11_WWW@" && test -n "$DISPLAY"; then (@X11_WWW@ file://%d/%p &) >/dev/null 2>&1; else links %f 2>/dev/null || lynx -force_html %f; fi
317         View=%view{ascii} lynx -dump -force_html %f
319 # StarOffice 5.2
320 shell/.sdw
321         Open=(ooffice %f &)
323 # StarOffice 6 and OpenOffice.org formats
324 regex/\.(sxw|stw|sxc|stc|sxi|sti|sxd|std|sxm|sxg)$
325         Open=(ooffice %f &)
327 # AbiWord
328 shell/.abw
329         Open=(abiword %f &)
331 # Microsoft Word Document
332 regex/\.([Dd][oO][cCtT]|[Ww][rR][iI])$
333         Open=(abiword %f >/dev/null 2>&1 &)
334         View=%view{ascii} catdoc -w %f || word2x -f text %f - || strings %f
335 type/^Microsoft\ Word
336         Open=(abiword %f >/dev/null 2>&1 &)
337         View=%view{ascii} catdoc -w %f || word2x -f text %f - || strings %f
339 # RTF document
340 regex/\.([rR][tT][fF])$
341         Open=(abiword %f >/dev/null 2>&1 &)
343 # Microsoft Excel Worksheet
344 regex/\.([xX][lL][sSwW])$
345         Open=(gnumeric %f >/dev/null 2>&1 &)
346         View=%view{ascii} xls2csv %f || strings %f
347 type/^Microsoft\ Excel
348         Open=(gnumeric %f >/dev/null 2>&1 &)
349         View=%view{ascii} xls2csv %f || strings %f
351 # Use OpenOffice.org to open any MS Office documents
352 type/^Microsoft\ Office\ Document
353         Open=(ooffice %f &)
355 # Framemaker
356 type/^FrameMaker
357         Open=fmclient -f %f
359 # DVI
360 regex/\.([dD][vV][iI])$
361         Open=if [ x$DISPLAY = x ]; then dvisvga %f; else (xdvi %f &); fi
362         View=%view{ascii} dvi2tty %f
364 # TeX
365 regex/\.([Tt][Ee][Xx])$
366         Open=%var{EDITOR:vi} %f
369 ### Miscellaneous ###
371 # Makefile
372 regex/[Mm]akefile$
373         Open=make -f %f %{Enter parameters}
375 # Imakefile
376 shell/Imakefile
377         Open=xmkmf -a
379 # Makefile.PL (MakeMaker)
380 regex/^Makefile.(PL|pl)$
381         Open=%var{PERL:perl} %f
383 # dbf
384 regex/\.([dD][bB][fF])$
385        Open=%view{ascii} dbview %f
386        View=%view{ascii} dbview -b %f
388 # REXX script
389 regex/\.(rexx?|cmd)$
390        Open=rexx %f %{Enter parameters};echo "Press ENTER";read y
393 ### Archives ###
395 # .tgz, .tpz, .tar.gz, .tar.z, .tar.Z
396 regex/\.t([gp]?z|ar\.g?[zZ])$
397         Open=%cd %p#utar
398         View=%view{ascii} gzip -dc %f 2>/dev/null | tar tvvf -
400 regex/\.tar\.bz$
401         # Open=%cd %p#utar
402         View=%view{ascii} bzip -dc %f 2>/dev/null | tar tvvf -
404 regex/\.t(ar\.bz2|bz|b2)$
405         Open=%cd %p#utar
406         View=%view{ascii} bzip2 -dc %f 2>/dev/null | tar tvvf -
408 # .tar.F - used in QNX
409 regex/\.tar\.F$
410         # Open=%cd %p#utar
411         View=%view{ascii} freeze -dc %f 2>/dev/null | tar tvvf -
413 # .qpr/.qpk - QNX Neutrino package installer files 
414 regex/\.(qp[rk])$
415         Open=%cd %p#utar
416         View=%view{ascii} gzip -dc %f 2>/dev/null | tar tvvf -
418 # tar
419 regex/\.(tar|TAR)$
420         Open=%cd %p#utar
421         View=%view{ascii} tar tvvf %f
423 # zip
424 type/^([Zz][Ii][Pp])\ archive
425         Open=%cd %p#uzip
426         View=%view{ascii} unzip -v %f
428 # zoo
429 regex/\.([Zz][Oo][Oo])$
430         Open=%cd %p#uzoo
431         View=%view{ascii} zoo l %f
432         
433 # lha
434 type/^LHa\ .*archive
435         Open=%cd %p#ulha
436         View=%view{ascii} lha l %f
438 # arj
439 regex/\.a(rj|[0-9][0-9])$
440         Open=%cd %p#uarj
441         View=%view{ascii} unarj l %f
443 # ha
444 regex/\.([Hh][Aa])$
445         Open=%cd %p#uha
446         View=%view{ascii} ha lf %f
448 # rar
449 regex/\.[rR]([aA][rR]|[0-9][0-9])$
450         Open=%cd %p#urar
451         View=%view{ascii} rar v -c- %f
453 # cpio
454 shell/.cpio.Z
455         Open=%cd %p#ucpio
456         View=%view{ascii} gzip -dc '%f' | cpio -itv 2>/dev/null
458 shell/.cpio.gz
459         Open=%cd %p#ucpio
460         View=%view{ascii} gzip -dc '%f' | cpio -itv 2>/dev/null
462 shell/.cpio
463         Open=%cd %p#ucpio
464         View=%view{ascii} cpio -itv <'%f' 2>/dev/null
466 # ls-lR
467 regex/(^|\.)ls-?lR(\.g?z|Z|bz2)?$
468         Open=%cd %p#lslR
470 # patch
471 regex/\.(diff|patch)(\.(bz2|gz|Z))?$
472         Open=%cd %p#patchfs
474 # gzip
475 type/^gzip
476         Open=gzip -dc %f | %var{PAGER:more}
477         View=%view{ascii} gzip -dc %f 2>/dev/null
479 # bzip2
480 type/^bzip2
481         Open=bzip2 -dc %f | %var{PAGER:more}
482         View=%view{ascii} bzip2 -dc %f 2>/dev/null
484 # bzip
485 type/^bzip
486         Open=bzip -dc %f | %var{PAGER:more}
487         View=%view{ascii} bzip -dc %f 2>/dev/null
489 # compress
490 type/^compress
491         Open=gzip -dc %f | %var{PAGER:more}
492         View=%view{ascii} gzip -dc %f 2>/dev/null
494 # ar library
495 regex/\.s?a$
496         Open=%cd %p#uar
497         #Open=%view{ascii} ar tv %f
498         View=%view{ascii} file %f && nm %f
500 # trpm
501 regex/\.trpm$
502         Open=%cd %p#trpm
503         View=%view{ascii} rpm -qivl --scripts `basename %p .trpm`
505 # RPM packages (SuSE uses *.spm for source packages)
506 regex/\.(rpm|spm)$
507         Open=%cd %p#rpm
508         View=%view{ascii} if rpm --nosignature --version >/dev/null 2>&1; then RPM="rpm --nosignature" ; else RPM="rpm" ; fi ; $RPM -qivlp --scripts %f
510 # deb
511 regex/\.deb$
512         Open=%cd %p#deb
513         View=%view{ascii} dpkg-deb -c %f
515 # ISO9660
516 regex/\.iso$
517         Open=%cd %p#iso9660
518         View=%view{ascii} isoinfo -l -i %f
521 ### Default ###
523 # Default target for anything not described above
524 default/*
525         Open=
526         View=
529 ### EOF ###