"Excuse me please. My ear is full of milk..."

– Oliver Hardy, Going Bye Bye (1934)

Skip on down to the menu.

How to use mc as default text editor in Linux

Typically the default text editor is vi, but I prefer to use the text editor from Midnight Commander instead.

From the command line just type the following, and you're done.

EDITOR="mc -e"; export EDITOR

To make it permanent, do the following.

# cd /usr/local/bin
# touch mc-editor
# chmod a+x mc-editor
# mc -e mc-editor 

Now, while your inside the mc editor type this bash script. Save, and exit.

mc -e $1

Next check to see what the /usr/bin/edit symlink is pointing to.

# l /usr/bin/edit

Mine came back with this.

lrwxrwxrwx 1 root root 3 Jan 14  2010 /usr/bin/edit -> vim*

Delete this link and make your own.

# rm /usr/bin/edit
# ln -s /usr/local/bin/mc-editor /usr/bin/edit

Verify that the link is there and points to where you expect.

# l /usr/bin/edit
lrwxrwxrwx 1 root root 24 May  4 00:34 /usr/bin/edit -> /usr/local/bin/mc-editor*

Now type "edit some-text-file" to edit some-text-file using the mc text editor. If it pops up in the mc text editor and then goes right back to your command prompt when you F-10 out of the text editor you have succeeded. If not, trace your steps through the procedure again to find what went wrong.

If you don't like the mc text editor you can substitute your favorite editor for "mc -e" in this procedure to make that editor be your default.

2012-05-03, T. Sneddon