I found better solution. Don't generate a mc.ext file, just use run-mailcap for default action for every file. And also we can keep a few special treating files, like ie. archives.
I've attached my proposition of mc.ext and I'm going to add this to a wishlist. Regards. Marcin -- .---, --: mcINEK :-- / ,. \ ' T h e O w l s a r e n o t | | ; ; W h a t T h e y S e e m . . . ' \ `._ / wrote on Debian GNU/Linux SID
# Midnight Commander 3.0 extension file # Warning: Structure of this file has changed completely with version 3.0 # # All lines starting with # or empty lines are thrown away. # Lines starting in the first column should have following format: # # keyword/descNL, i.e. everything after keyword/ until new line is desc # # keyword can be: # # shell (desc is, when starting with a dot, any extension (no wildcars), # i.e. matches all the files *desc . Example: .tar matches *.tar; # if it doesn't start with a dot, it matches only a file of that name) # # regex (desc is an extended regular expression) # Please note that we are using the GNU regex library and thus # \| matches the literal | and | has special meaning (or) and # () have special meaning and \( \) stand for literal ( ). # # type (file matches this if `file %f` matches regular expression desc # (the filename: part from `file %f` is removed)) # # directory (matches any directory matching regular expression desc) # # include (matches an include directive) # # default (matches any file no matter what desc is) # # Other lines should start with a space or tab and should be in the format: # # keyword=commandNL (with no spaces around =), where keyword should be: # # Open (if the user presses Enter or doubleclicks it), # # View (F3), Edit (F4) # # Include is the keyword used to add any further entries from an include/ # section # # command is any one-line shell command, with the following substitutions: # # %% -> % character # %p -> name of the current file (without path, but pwd is its path) # %f -> name of the current file. Unlike %p, if file is located on a # non-local virtual filesystem, i.e. either tarfs, mcfs or ftpfs, # then the file will be temporarily copied into a local directory # and %f will be the full path to this local temporal file. # If you don't want to get a local copy and want to get the # virtual fs path (like /#ftp:ftp.cvut.cz/pub/hungry/xword), then # use %d/%p instead of %f. # %d -> name of the current directory (pwd, without trailing slash) # %s -> "selected files", i.e. space separated list of tagged files if any # or name of the current file # %t -> list of tagged files # %u -> list of tagged files (they'll be untaged after the command) # # (If these 6 letters are in uppercase, they refer to the other panel. # But you shouldn't have to use it in this file.) # # # %cd -> the rest is a path mc should change into (cd won't work, since it's # a child process). %cd handles even vfs names. # # %view -> the command you type will be piped into mc's internal file viewer # if you type only the %view and no command, viewer will load %f file # instead (i.e. no piping, so it is different to %view cat %f) # %view may be directly followed by {} with a list of any of # ascii (Ascii mode), hex (Hex mode), nroff (color highlighting for # text using backspace for bold and underscore) and unform # (no highlighting for nroff sequences) separated by commas. # # %var -> You use it like this: %var{VAR:default}. This macro will expand # to the value of the VAR variable in the environment if it's set # otherwise the value in default will be used. This is similar to # the Bourne shell ${VAR-default} construct. # # Rules are applied from top to bottom, thus the order is important. # If some actions are missing, search continues as if this target didn't # match (i.e. if a file matches the first and second entry and View action # is missing in the first one, then on pressing F3 the View action from # the second entry will be used. default should catch all the actions. # # Any new entries you develop for you are always welcome if they are # useful on more than one system. You can send your modifications # by e-mail to mc-devel@gnome.org ### Changes ### # # 2003-05-13 Using run-mailcap # # Reorganization: 2000-05-01 Michal Svec <[EMAIL PROTECTED]> ### Archives (to enable 'passing thru' like dirs) ### # .tgz, .tpz, .tar.gz, .tar.z, .tar.Z regex/\.t([gp]?z|ar\.g?[zZ])$ Open=%cd %p#utar View=%view{ascii} gzip -dc %f 2>/dev/null | tar tvvf - regex/\.tar\.bz$ # Open=%cd %p#utar View=%view{ascii} bzip -dc %f 2>/dev/null | tar tvvf - regex/\.tar\.bz2$ Open=%cd %p#utar View=%view{ascii} bzip2 -dc %f 2>/dev/null | tar tvvf - # .tar.F - used in QNX regex/\.tar\.F$ # Open=%cd %p#utar View=%view{ascii} freeze -dc %f 2>/dev/null | tar tvvf - # tar regex/\.(tar|TAR)$ Open=%cd %p#utar View=%view{ascii} tar tvvf %f # zip type/^Zip\ archive Open=%cd %p#uzip View=%view{ascii} unzip -v %f # zoo regex/\.(zoo|ZOO)$ Open=%cd %p#uzoo View=%view{ascii} zoo l %f # lha type/^LHa\ .*archive Open=%cd %p#ulha View=%view{ascii} lha l %f # arj regex/\.a(rj|[0-9][0-9])$ Open=%cd %p#uarj View=%view{ascii} unarj l %f # ha regex/\.(ha|HA|Ha)$ Open=%cd %p#uha View=%view{ascii} ha lf %f # rar regex/\.[rR]([aA][rR]|[0-9][0-9])$ Open=%cd %p#urar View=%view{ascii} rar v -c- %f # cpio shell/.cpio.Z Open=%cd %p#ucpio View=%view{ascii} gzip -dc '%f' | cpio -itv 2>/dev/null shell/.cpio.gz Open=%cd %p#ucpio View=%view{ascii} gzip -dc '%f' | cpio -itv 2>/dev/null shell/.cpio Open=%cd %p#ucpio View=%view{ascii} cpio -itv <'%f' 2>/dev/null # RPM packages (SuSE uses *.spm for source packages) regex/\.(rpm|spm)$ Open=%cd %p#rpm View=%view{ascii} if rpm --nosignature --version >/dev/null 2>&1; then RPM="rpm --nosignature" ; else RPM="rpm" ; fi ; $RPM -qivlp --scripts %f # deb regex/\.deb$ Open=%cd %p#deb View=%view{ascii} dpkg-deb -c %f # All files regex/\.*$ Open=run-mailcap %f # View=see %s # Edit=edit %f ### EOF ###
signature.asc
Description: PGP signature