mc.ext.in 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572
  1. # Midnight Commander 3.0 extension file
  2. # Warning: Structure of this file has changed completely with version 3.0
  3. #
  4. # All lines starting with # or empty lines are thrown away.
  5. # Lines starting in the first column should have following format:
  6. #
  7. # keyword/descNL, i.e. everything after keyword/ until new line is desc
  8. #
  9. # keyword can be:
  10. #
  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)
  14. #
  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 ( ).
  19. #
  20. # type (file matches this if `file %f` matches regular expression desc
  21. # (the filename: part from `file %f` is removed))
  22. #
  23. # directory (matches any directory matching regular expression desc)
  24. #
  25. # include (matches an include directive)
  26. #
  27. # default (matches any file no matter what desc is)
  28. #
  29. # Other lines should start with a space or tab and should be in the format:
  30. #
  31. # keyword=commandNL (with no spaces around =), where keyword should be:
  32. #
  33. # Open (if the user presses Enter or doubleclicks it),
  34. #
  35. # View (F3), Edit (F4)
  36. #
  37. # Include is the keyword used to add any further entries from an include/
  38. # section
  39. #
  40. # command is any one-line shell command, with the following substitutions:
  41. #
  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)
  56. #
  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.)
  59. #
  60. #
  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.
  63. #
  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.
  71. #
  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.
  76. #
  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.
  82. #
  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
  86. ### Changes ###
  87. #
  88. # Reorganization: 2000-05-01 Michal Svec <rebel@penguin.cz>
  89. ### TODO ###
  90. #
  91. # Postscript Open: ps2svga [gs -DEVICE=jpeg|zgv or something]
  92. # Images asciiview
  93. #
  94. # All X Apps [Nothing/Warning] if no DISPLAY
  95. # Not found [Default/Warning]
  96. # Empty Output [Default/Warning]
  97. # Edit: CopyOut+EDIT+CopyIn
  98. # Security Check gzip/bzip EDIT (mktemp)
  99. #
  100. # Maybe: Open/XOpen/GOpen/KOpen/... for Console/X/GNOME/KDE/etc.
  101. ### Archives ###
  102. # .tgz, .tpz, .tar.gz, .tar.z, .tar.Z, .ipk
  103. regex/\.t([gp]?z|ar\.g?[zZ])$|\.ipk$
  104. Open=%cd %p#utar
  105. View=%view{ascii} gzip -dc %f 2>/dev/null | tar tvvf -
  106. regex/\.tar\.bz$
  107. # Open=%cd %p#utar
  108. View=%view{ascii} bzip -dc %f 2>/dev/null | tar tvvf -
  109. regex/\.t(ar\.bz2|bz|b2)$
  110. Open=%cd %p#utar
  111. View=%view{ascii} bzip2 -dc %f 2>/dev/null | tar tvvf -
  112. # .tar.F - used in QNX
  113. regex/\.tar\.F$
  114. # Open=%cd %p#utar
  115. View=%view{ascii} freeze -dc %f 2>/dev/null | tar tvvf -
  116. # .qpr/.qpk - QNX Neutrino package installer files
  117. regex/\.(qp[rk])$
  118. Open=%cd %p#utar
  119. View=%view{ascii} gzip -dc %f 2>/dev/null | tar tvvf -
  120. # tar
  121. regex/\.(tar|TAR)$
  122. Open=%cd %p#utar
  123. View=%view{ascii} tar tvvf %f
  124. # lha
  125. type/^LHa\ .*archive
  126. Open=%cd %p#ulha
  127. View=%view{ascii} lha l %f
  128. # arj
  129. regex/\.a(rj|[0-9][0-9])$
  130. Open=%cd %p#uarj
  131. View=%view{ascii} unarj l %f
  132. # ha
  133. regex/\.([Hh][Aa])$
  134. Open=%cd %p#uha
  135. View=%view{ascii} ha lf %f
  136. # rar
  137. regex/\.[rR]([aA][rR]|[0-9][0-9])$
  138. Open=%cd %p#urar
  139. View=%view{ascii} rar v -c- %f
  140. # ALZip
  141. regex/\.(alz|ALZ)$
  142. Open=%cd %p#ualz
  143. View=%view{ascii} unalz -l %f
  144. # cpio
  145. shell/.cpio.Z
  146. Open=%cd %p#ucpio
  147. View=%view{ascii} gzip -dc %f | cpio -itv 2>/dev/null
  148. shell/.cpio.gz
  149. Open=%cd %p#ucpio
  150. View=%view{ascii} gzip -dc %f | cpio -itv 2>/dev/null
  151. shell/.cpio
  152. Open=%cd %p#ucpio
  153. View=%view{ascii} cpio -itv < %f 2>/dev/null
  154. # ls-lR
  155. regex/(^|\.)ls-?lR(\.gz|Z|bz2)$
  156. Open=%cd %p#lslR
  157. # patch
  158. regex/\.(diff|patch)(\.bz2)$
  159. Open=%cd %p#patchfs
  160. View=%view{ascii} bzip2 -dc %f 2>/dev/null
  161. regex/\.(diff|patch)(\.(gz|Z))$
  162. Open=%cd %p#patchfs
  163. View=%view{ascii} gzip -dc %f 2>/dev/null
  164. regex/\.(diff|patch)$
  165. Open=%cd %p#patchfs
  166. View=%view{ascii} /bin/cat %f 2>/dev/null
  167. # ar library
  168. regex/\.s?a$
  169. Open=%cd %p#uar
  170. #Open=%view{ascii} ar tv %f
  171. View=%view{ascii} file %f && nm %f
  172. # trpm
  173. regex/\.trpm$
  174. Open=%cd %p#trpm
  175. View=%view{ascii} rpm -qivl --scripts `basename %p .trpm`
  176. # RPM packages (SuSE uses *.spm for source packages)
  177. regex/\.(rpm|spm)$
  178. Open=%cd %p#rpm
  179. View=%view{ascii} if rpm --nosignature --version >/dev/null 2>&1; then RPM="rpm --nosignature" ; else RPM="rpm" ; fi ; $RPM -qivlp --scripts %f
  180. # deb
  181. regex/\.u?deb$
  182. Open=%cd %p#deb
  183. View=%view{ascii} dpkg-deb -I %f && echo && dpkg-deb -c %f
  184. # ISO9660
  185. regex/\.iso$
  186. Open=%cd %p#iso9660
  187. View=%view{ascii} isoinfo -l -i %f
  188. # 7zip archives (they are not man pages)
  189. regex/\.(7z|7Z)$
  190. Open=%cd %p#u7z
  191. View=%view{ascii} 7za l %f 2>/dev/null
  192. # Mailboxes
  193. type/^ASCII\ mail\ text
  194. Open=%cd %p#mailfs
  195. ### Sources ###
  196. # C
  197. shell/.c
  198. Open=%var{EDITOR:vi} %f
  199. # Fortran
  200. shell/.f
  201. Open=%var{EDITOR:vi} %f
  202. # Header
  203. regex/\.(h|hpp)$
  204. Open=%var{EDITOR:vi} %f
  205. # Object
  206. type/^ELF
  207. #Open=%var{PAGER:more} %f
  208. View=%view{ascii} file %f && nm %f
  209. # Asm
  210. shell/.s
  211. Open=%var{EDITOR:vi} %f
  212. # C++
  213. regex/\.(C|cc|cpp)$
  214. Open=%var{EDITOR:vi} %f
  215. ### Documentation ###
  216. # Texinfo
  217. regex/\.(te?xi|texinfo)$
  218. # GNU Info page
  219. type/^Info\ text
  220. Open=info -f %f
  221. shell/.info
  222. Open=info -f %f
  223. # Manual page
  224. # Exception - .so libraries are not manual pages
  225. regex/\.(so|so\.[0-9\.]*)$
  226. View=%view{ascii} file %f && nm %f
  227. regex/(([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])|\.man)$
  228. Open=case %d/%f in */log/*|*/logs/*) cat %f ;; *) nroff @MAN_FLAGS@ @MANDOC@ %f ;; esac | %var{PAGER:more}
  229. View=%view{ascii,nroff} case %d/%f in */log/*|*/logs/*) cat %f ;; *) nroff @MAN_FLAGS@ @MANDOC@ %f ;; esac
  230. # Perl pod page
  231. shell/.pod
  232. Open=pod2man %f | nroff @MAN_FLAGS@ @MANDOC@ | %var{PAGER:more}
  233. View=%view{ascii,nroff} pod2man %f | nroff @MAN_FLAGS@ @MANDOC@
  234. # Troff with me macros.
  235. # Exception - "read.me" is not a nroff file.
  236. shell/read.me
  237. Open=
  238. View=
  239. shell/.me
  240. Open=nroff @MAN_FLAGS@ -me %f | %var{PAGER:more}
  241. View=%view{ascii,nroff} nroff @MAN_FLAGS@ -me %f
  242. # Troff with ms macros.
  243. shell/.ms
  244. Open=nroff @MAN_FLAGS@ -ms %f | %var{PAGER:more}
  245. View=%view{ascii,nroff} nroff @MAN_FLAGS@ -ms %f
  246. # Manual page - compressed
  247. regex/([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.g?[Zz]$
  248. Open=case %d/%f in */log/*|*/logs/*) gzip -dc %f ;; *) gzip -dc %f | nroff @MAN_FLAGS@ @MANDOC@ ;; esac | %var{PAGER:more}
  249. View=%view{ascii,nroff} case %d/%f in */log/*|*/logs/*) gzip -dc %f ;; *) gzip -dc %f | nroff @MAN_FLAGS@ @MANDOC@ ;; esac
  250. regex/([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.bz$
  251. Open=case %d/%f in */log/*|*/logs/*) bzip -dc %f ;; *) bzip -dc %f | nroff @MAN_FLAGS@ @MANDOC@ ;; esac | %var{PAGER:more}
  252. View=%view{ascii,nroff} case %d/%f in */log/*|*/logs/*) bzip -dc %f ;; *) bzip -dc %f | nroff @MAN_FLAGS@ @MANDOC@ ;; esac
  253. regex/([^0-9]|^[^\.]*)\.([1-9][A-Za-z]*|[ln])\.bz2$
  254. Open=case %d/%f in */log/*|*/logs/*) bzip2 -dc %f ;; *) bzip2 -dc %f | nroff @MAN_FLAGS@ @MANDOC@ ;; esac | %var{PAGER:more}
  255. View=%view{ascii,nroff} case %d/%f in */log/*|*/logs/*) bzip2 -dc %f ;; *) bzip2 -dc %f | nroff @MAN_FLAGS@ @MANDOC@ ;; esac
  256. ### Images ###
  257. type/^GIF
  258. Include=image
  259. type/^JPEG
  260. Include=image
  261. type/^PC\ bitmap
  262. Include=image
  263. type/^PNG
  264. Include=image
  265. type/^TIFF
  266. Include=image
  267. type/^PBM
  268. Include=image
  269. type/^PGM
  270. Include=image
  271. type/^PPM
  272. Include=image
  273. type/^Netpbm
  274. Include=image
  275. shell/.xcf
  276. Open=(gimp %f &)
  277. shell/.xbm
  278. Open=bitmap %f
  279. shell/.xpm
  280. Include=image
  281. View=sxpm %f
  282. include/image
  283. Open=if [ "$DISPLAY" = "" ]; then zgv %f; else (gqview %f &); fi
  284. View=%view{ascii} identify %f
  285. #View=%view{ascii} asciiview %f
  286. ### Sound files ###
  287. regex/\.([wW][aA][vV]|[sS][nN][dD]|[vV][oO][cC]|[aA][uU]|[sS][mM][pP]|[aA][iI][fF][fF]|[sS][nN][dD])$
  288. Open=if [ "$DISPLAY" = "" ]; then play %f; else (xmms %f >/dev/null 2>&1 &); fi
  289. regex/\.([mM][oO][dD]|[sS]3[mM]|[xX][mM]|[iI][tT]|[mM][tT][mM]|669|[sS][tT][mM]|[uU][lL][tT]|[fF][aA][rR])$
  290. Open=mikmod %f
  291. #Open=tracker %f
  292. regex/\.([wW][aA][wW]22)$
  293. Open=vplay -s 22 %f
  294. regex/\.([mM][pP]3)$
  295. Open=if [ "$DISPLAY" = "" ]; then mpg123 %f; else (xmms %f >/dev/null 2>&1 &); fi
  296. View=%view{ascii} mpg123 -vtn1 %f 2>&1 | sed -n '/^Title/,/^Comment/p;/^MPEG/,/^Audio/p'
  297. regex/\.([oO][gG][gG])$
  298. Open=if [ "$DISPLAY" = "" ]; then ogg123 %f; else (xmms %f >/dev/null 2>&1 &); fi
  299. View=%view{ascii} ogginfo %s
  300. regex/\.([mM][iI][dD][iI]?|[rR][mM][iI][dD]?)$
  301. Open=timidity %f
  302. regex/\.([wW][mM][aA])$
  303. Open=mplayer -vo null %f
  304. View=%view{ascii} mplayer -quiet -slave -frames 0 -vo null -ao null -identify %f 2>/dev/null | tail +13 || file %f
  305. ### Play lists ###
  306. regex/\.([mM]3[uU]|[pP][lL][sS])$
  307. Open=if [ -z "$DISPLAY" ]; then mplayer -vo null -playlist %f; else (xmms -p %f >/dev/null 2>&1 &); fi
  308. ### Video ###
  309. regex/\.([aA][vV][iI])$
  310. Include=video
  311. regex/\.([aA][sS][fFxX])$
  312. Include=video
  313. regex/\.([dD][iI][vV][xX])$
  314. Include=video
  315. regex/\.([mM][oO][vV]|[qQ][tT])$
  316. Include=video
  317. regex/\.([mM][pP]4|[mM][pP][eE]?[gG])$
  318. Include=video
  319. regex/\.([vV][oO][bB])$
  320. Include=video
  321. regex/\.([wW][mM][vV])$
  322. Include=video
  323. regex/\.([fF][lL][iIcCvV])$
  324. Include=video
  325. regex/\.([oO][gG][mM])$
  326. Include=video
  327. regex/\.([rR][aA]?[mM])$
  328. Open=(realplay %f >/dev/null 2>&1 &)
  329. include/video
  330. Open=(mplayer %f >/dev/null 2>&1 &)
  331. #Open=(gtv %f >/dev/null 2>&1 &)
  332. #Open=(xanim %f >/dev/null 2>&1 &)
  333. ### Documents ###
  334. # Postscript
  335. type/^PostScript
  336. Open=(gv %f &)
  337. View=%view{ascii} ps2ascii %f
  338. # PDF
  339. type/^PDF
  340. Open=(xpdf %f &)
  341. #Open=(acroread %f &)
  342. #Open=(ghostview %f &)
  343. View=%view{ascii} pdftotext %f -
  344. # The following code very ugly and should not be taken as example.
  345. # It should be cleaned up when the new format of mc.ext is developed.
  346. # html
  347. regex/\.([hH][tT][mM][lL]?)$
  348. 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
  349. View=%view{ascii} lynx -dump -force_html %f
  350. # StarOffice 5.2
  351. shell/.sdw
  352. Open=(ooffice %f &)
  353. # StarOffice 6 and OpenOffice.org formats
  354. regex/\.(odt|ott|sxw|stw|ods|ots|sxc|stc|odp|otp|sxi|sti|odg|otg|sxd|std|odb|odf|sxm|odm|sxg)$
  355. Open=(ooffice %f &)
  356. View=%view{ascii} odt2txt %f
  357. # AbiWord
  358. shell/.abw
  359. Open=(abiword %f &)
  360. # Microsoft Word Document
  361. regex/\.([Dd][oO][cCtT]|[Ww][rR][iI])$
  362. Open=(abiword %f >/dev/null 2>&1 &)
  363. View=%view{ascii} catdoc -w %f || word2x -f text %f - || strings %f
  364. type/^Microsoft\ Word
  365. Open=(abiword %f >/dev/null 2>&1 &)
  366. View=%view{ascii} catdoc -w %f || word2x -f text %f - || strings %f
  367. # RTF document
  368. regex/\.([rR][tT][fF])$
  369. Open=(abiword %f >/dev/null 2>&1 &)
  370. # Microsoft Excel Worksheet
  371. regex/\.([xX][lL][sSwW])$
  372. Open=(gnumeric %f >/dev/null 2>&1 &)
  373. View=%view{ascii} xls2csv %f || strings %f
  374. type/^Microsoft\ Excel
  375. Open=(gnumeric %f >/dev/null 2>&1 &)
  376. View=%view{ascii} xls2csv %f || strings %f
  377. # Use OpenOffice.org to open any MS Office documents
  378. type/^Microsoft\ Office\ Document
  379. Open=(ooffice %f &)
  380. # Framemaker
  381. type/^FrameMaker
  382. Open=fmclient -f %f
  383. # DVI
  384. regex/\.([dD][vV][iI])$
  385. Open=if [ x$DISPLAY = x ]; then dvisvga %f; else (xdvi %f &); fi
  386. View=%view{ascii} dvi2tty %f
  387. # TeX
  388. regex/\.([Tt][Ee][Xx])$
  389. Open=%var{EDITOR:vi} %f
  390. ### Miscellaneous ###
  391. # Makefile
  392. regex/[Mm]akefile$
  393. Open=make -f %f %{Enter parameters}
  394. # Imakefile
  395. shell/Imakefile
  396. Open=xmkmf -a
  397. # Makefile.PL (MakeMaker)
  398. regex/^Makefile.(PL|pl)$
  399. Open=%var{PERL:perl} %f
  400. # dbf
  401. regex/\.([dD][bB][fF])$
  402. Open=%view{ascii} dbview %f
  403. View=%view{ascii} dbview -b %f
  404. # REXX script
  405. regex/\.(rexx?|cmd)$
  406. Open=rexx %f %{Enter parameters};echo "Press ENTER";read y
  407. ### Plain compressed files ###
  408. # zip
  409. type/^([Zz][Ii][Pp])\ archive
  410. Open=%cd %p#uzip
  411. View=%view{ascii} unzip -v %f
  412. # zoo
  413. regex/\.([Zz][Oo][Oo])$
  414. Open=%cd %p#uzoo
  415. View=%view{ascii} zoo l %f
  416. # gzip
  417. type/^gzip
  418. Open=gzip -dc %f | %var{PAGER:more}
  419. View=%view{ascii} gzip -dc %f 2>/dev/null
  420. regex/\.(gz|Z)?$
  421. View=%view{ascii} gzip -dc %f 2>/dev/null
  422. # bzip2
  423. type/^bzip2
  424. Open=bzip2 -dc %f | %var{PAGER:more}
  425. View=%view{ascii} bzip2 -dc %f 2>/dev/null
  426. regex/\.bz2?$
  427. View=%view{ascii} bzip2 -dc %f 2>/dev/null
  428. # bzip
  429. type/^bzip
  430. Open=bzip -dc %f | %var{PAGER:more}
  431. View=%view{ascii} bzip -dc %f 2>/dev/null
  432. # compress
  433. type/^compress
  434. Open=gzip -dc %f | %var{PAGER:more}
  435. View=%view{ascii} gzip -dc %f 2>/dev/null
  436. ### Default ###
  437. # Default target for anything not described above
  438. default/*
  439. Open=
  440. View=
  441. ### EOF ###