Here is another solution: edit the extension-file and add an Edit-entry.
(Sorry, not enough reputation to add this as comment to Gustav Bertram's answer.)
Be sure to use MidnightCommander's built-in functionality, as the location of config-files seems to change between some versions of MC.
So press F9
or ESC,9
(to open the menu), then go to Command -> Edit Extension File
.
In the editor, find the last block looking like that:
# Default target for anything not described above
default /*
Open=
View=
Change it to something like that (note the added Edit
-line!!!):
# Default target for anything not described above
default/*
Open= %var{EDITOR:emacs} %f &
View=
Edit= %var{EDITOR:emacs} %f &
After saving the file, be sure to turn the internal editor off!!
(F9
or ESC,9
, Options -> Configuration
, "Use internal edit
" must be unchecked)
That way (working at least with later versions of MC) you can have three different editors (or command-line options) to open a file: "View" (F3
), "Edit" (F4
) and "Open" (Enter
) - each individually configurable.
Note #1: If you added a custom view
-command, do not forget to uncheck "Use internal view
" under Options -> Configuration
.
Note #2: MC still uses its preferred editor (e.g. nano) for editing config-files when opening them from within MC.