rules in mc.ext

Jörg Thümmler listen at vordruckleitverlag.de
Fri Sep 16 05:35:05 UTC 2022


Am 16.09.22 um 06:31 schrieb Fourhundred Thecat via mc:
> Hello,
> 
> can I change the default internal viewer to something else (less)? I
> think I could change each line individually:
> 
>    View=%view{ascii} mediainfo %f
> 
> to
> 
>    View=mediainfo %f | less
> 
> but I would rather change this once, globally.
> 
> Also, I am confused how the include directive works in mc.ext. As it
> says in mc.ext, the rules are applied from top to bottom. Therefore, I
> want to have exact, specific rules at the top
> 
>    shell/i/.tar.xz
> 
> and vague, "dirty-hack" rules as low as possible, ie
> 
>    type/^PC\ bitmap
> 
> I also think calling external command "file" is expensive, so I don't
> want to call it too early, when simple regex rule is sufficient.
> 
> Anyways, so I have relatively early:
> 
>    shell/i/.gif
>          Include=image
> 
>    include/image
>          Open=([ "$DISPLAY" ] && gpicview %f >/dev/null 2>&1 &)
>          View=%view{ascii} file %f
> 
> and at the bottom, I have:
> 
>    type/^PC\ bitmap
>          Include=image
> 
> but this does not work because this last rule is after "include/image".
> I thought, "include/image" just defines what "Include=image" means. But
> apparently it must be right after I used "Include=image" ?
> 
> Lastly, is there some optimization in processing this decision tree?
> Lets say I have 100 rules in mc.ext. And I press F3 on file.foo. MC goes
> from top to bottom, testing each rule. If there are 50 rules "type/",
> does it mean MC calls the file command 50 times (if it does not find
> match earlier) ?
> 
> PS: I am using my original mc.ext file, which I kept over upgrades. I
> noticed the format has changed, and it now uses scripts stored in
> /usr/lib/mc/ext.d/:
> 
>    View=%view{ascii} /usr/lib/mc/ext.d/archive.sh view tar.xz
> 
> I would like to stick with my original format.
> 
> thank you,
> _______________________________________________
> mc mailing list
> https://mail.gnome.org/mailman/listinfo/mc

Hi,

you can change viewer and editor globally:

press F9 - goto Options - Configuration and unselect "use internal 
viewer" (and if you want, "internal editor" as well). MC will use now, 
whats globally set for your system/user. Less (and vi(m) as editor i assume.

If you set and export VIEWER and EDITOR env variables before calling mc, 
you can change this to whatever you want...

-- 
cu

jth



More information about the mc mailing list