My everyday workstation runs Debian stable, which lets me assign my preferred text editor to the edit action of the run-mailcap utility. At the moment, my choices are the following:
$ select-editor
Select an editor. To change later, run 'select-editor'.
1. /bin/nano <---- easiest
2. /usr/bin/mcedit
3. /usr/bin/vim.tiny
4. /usr/bin/emacs
5. /usr/bin/codium
Choose 1-5 [1]:
There was a time, not long ago, when my first choice would have been #2 on the above list, namely, Midnight Commander's built-in editor, mcedit. As an absolute beginner, I appreciated the curses menus and dialog boxes. I especially liked having a numbered function-key menu at the bottom of the screen. You may recognize this interface if you've ever used htop:
These days I use vim. In fact, it's the current target of my edit symlink. But I'm still grateful to mcedit for providing a soft introduction to the world of terminal-based editors.
Here are some custom mappings from my .vimrc file, inspired by mcedit's function-key menu.
To save the current buffer:
nnoremap <F2> :w %<CR>
This next mapping is my invention, because I'm not sure what it's supposed to emulate. According to mc's maintainers, the default action of F3
is moving the cursor to the start or (when SHIFT
ed up) the end of a line. In my distro's default version (currently 4.8.26), however, F3
simply toggles the open file's byte order mark. Let's put it to better use!
To list all open buffers:
nnoremap <F3> :ls<CR>
To copy the line under the cursor:
nnoremap <F5> vVy
. . . and paste it after the cursor:
nnoremap <F6> p
To delete the line under the cursor:
nnoremap <F8> dd
. . . or, to delete the selected text:
vnoremap <F8> x
To save all buffers and exit:
nnoremap <silent> <F10> :set awa<CR>:qa<CR>
Happy editing!
Note
In case you were wondering, option #5 in the output of select-editor is VS Codium, a FOSS port of VS Code that runs on all the same operating systems.