1

Is it possible to create an entry in Midnight Commander's "user menu", which operates on two files, possibly one from each pane?

I'm trying to set up a user command that will open Meld for diffing two files (instead of the built-in differ). But I can't figure out how to operate on two files at once.

lonix
  • 526
  • 3
  • 15

1 Answers1

2
+ ! t t
-   meld diff, current files (or dirs) from two panels
    meld %f %F

+ t t
-   meld diff, tagged files (or dirs) from one panel
    meld %t

For better understanding see man mc (section Edit Menu File and Macro Substitution) or try this mc menu with view Midnight Commander macro substitution (debug) entry (at the end of the mc menu file).

Jan
  • 36
  • 3
  • Thanks, I almost have it working. If I select two files in one pane, it shows the "from one pane" option. But if I select one file in each pane, the "from two panels" option doesn't show. Does it work for you? – lonix Sep 13 '22 at 11:35
  • Yes, `+ t t` and `+ ! t t` are addition conditions (`+ t t` = show menu entry only if tagged file). Try simple remove (or comment with `#`) this conditions. – Jan Sep 13 '22 at 13:41
  • `%f` = current file, `%t` = tagged files. If letter is in uppercase %F or %T refers to the other (unselected, opposite) panel. You can try `meld %t %T`. Please see `man mc` or github example in the post above. – Jan Sep 13 '22 at 13:57
  • Ah my mistake was I was selecting (INS) the files in each panel. When I just highlight each one, the "two panel" option works. Thanks! – lonix Sep 14 '22 at 01:59
  • Thanks. For ubuntu 22 it works for me like this in the file ~/.config/mc/menu meld %d/%f %D/%F %d and %D are the directory names. Without it meld opened the same file twice. – PeterB Jun 14 '23 at 10:52