The idea for discussion: adding to MC an autoexec file, which is sourced when pressing Ctrl-O and contains macro variables

Nikolai Bezroukov speditor at optonline.net
Wed Apr 29 23:17:31 UTC 2020


Hi All,

In the current versions of MC  macro variables such as  %f, %F, %d %D, 
etc are not available in the command line window.  But they are quite 
useful and were available in some old MC versions.  I implemented a 
"kludge" solution using programmable keyboard (writing a file with bash 
statements setting shell variables to the values of those macros via the 
user menu, Ctrl-O, sourcing the file)  and it proved to be quite useful 
extension which increased my productivity with MC.

It might make sense to implement such "autoexec" file directly. It 
should be generated when you switch to command line window using Crtl-O 
and put in it values of MC Variables such as %f, %F, %d %D, etc (simply 
as $f $F, $d, $D).

In addition it can write the content of  Favorite directories list 
(Ctrl-/) as aliases. It also makes sense to provide a user defined 
section (for example, for sourcing ~/.bash_profile  and/or ~/bashrc )

I think the availability of such "autoexec" file will increase 
flexibility of MC while requiring minor changes in the code as MC 
already writes and sources a file on exit in order to exist to the 
current direction on active panel.  Essentially this code can be reused.

This "autoexec" file can be activated by an additional option  in 
Options/Configuration menu.

IMHO this allows for a better and more flexible shell environment than 
currently exists with minimal development efforts.

What do you think?

-- 
Best Regards,

Nikolai Bezroukov




More information about the mc-devel mailing list