How to switch the editor in mc (midnight commander) from mcedit to nano?

if I disable it “use internal edit”
i don’t know what is basic, but I can’t use it

Try adding these two lines to .bashrc, then log out and back in:

export EDITOR

This suggestion is likely correct, but just FYI it’s 2019, even /bin/sh will let you one-line that now. :laughing:

export EDITOR=nano

ohh Thx
really work!

1 Like

F31 not work:(
What corect mod?

F31 shouldn’t have changed anything… are you sure nano is installed on the upgraded system? (sudo dnf install nano)

Beyond that… well, how are you installing/running Midnight Commander? I don’t think it exists as an official Fedora package…

The only other thing I can think of, if setting EDITOR doesn’t work, it might be worth it to also set VISUAL:

export VISUAL=nano

Yes, installed mc and nano
dnf install mc nano

not work export VISUAL=nano

My mistake, sorry! I tried sudo dnf search runs with ‘midnight’, ‘commander’, ‘command’… but since the package name is “mc” and the summary line reads just

User-friendly text console file manager and visual shell

It’s actually quite hard to find!

OK, so here’s what you do: In mc

  1. Type F9 to open the PullDn (pulldown) menu
  2. Navigate to Command > Edit extension file

(Or you can just load $HOME/.config/mc/mc.ext in vim or any other editor.)

Ctrl+End to the bottom of the file, and find the default section. It starts out as:

# Default target for anything not described above

Add a line below those two, indented with a single Tab the same way they are, for an Edit mapping:

--- a/.config/mc/mc.ext	2019-09-20 10:04:53.000000000 -0400
+++ b/.config/mc/mc.ext	2019-11-09 13:52:19.719371634 -0500
@@ -838,6 +838,7 @@
+	Edit=vim
 ### EOF ###

…And that will set vim as the default Edit tool for all files that don’t have a different mapping listed earlier in the same file.

1 Like

For the record, despite the syntax highlighting this:

isn’t actually a commented-out section of the file.

Midnight Commander’s extension syntax is documented as keyword/desc, where the keyword default matches everything regardless of desc. So really it could be default/xyzzy or default/ and it would work. default/* is just a wildcard placeholder that unfortunately triggers comment styling when the file is displayed syntax-highlighted.

It’s far too late to fix it now, but I should’ve explicitly set the content type to text, e.g.:

# Default target for anything not described above