4.2.5 Editor in MC
The internal editor has an interesting cut-and-paste scheme. Pressing F3 marks
the start of a selection, a second F3 marks the end of selection and highlights
the selection. Then you can move your cursor. If you press F6, the selected
area will be moved to the cursor location. If you press F5, the selected area
will be copied and inserted at the cursor location. F2 will save the file.
F10 will get you out. Most cursor keys work intuitively.
This editor can be directly started on a file:
$ mc -e filename_to_edit
$ mcedit filename_to_edit
This is not a multi-window editor, but one can use multiple Linux consoles to
achieve the same effect. To copy between windows, use Alt-Fn keys
to switch virtual consoles and use "File->Insert file" or
"File->Copy to file" to move a portion of a file to another file.
This internal editor can be replaced with any external editor of choice.
Also, many programs use environment variables EDITOR or
VISUAL to decide which editor to use. If you are uncomfortable
with vim
, set these to mcedit by adding these lines
to ~/.bashrc
:
...
export EDITOR=mcedit
export VISUAL=mcedit
...
I do recommend setting these to vim if possible. Getting used to
vim
commands is the right thing to do, since Vi-editor is always
there in the Linux/Unix world. [
15]