Customizing Midnight Commander

Midnight commander is one of those nifty ncurses tools I use once in a while but never really enough to ever have considered spending time mucking about with its settings. Which is a shame because it is quite customizable. Here’s a few settings worth tending to.

Quit

The default quit key in MC, like htop, is F10. Anybodys who has ever tried using that from a terminal emulator will know that that is an unfortunate choice because GNOME and XFCE terminals both hijack the F10 key to display a window menu. Solution: cp /etc/mc/mc.default.keymap ~/.config/mc/mc.keymap and edit the keymap to set Quit = f12. AFAICT user keymap files are read on top of systemwide keymaps so both the replace-the-systemwide-keymap and override-a-single-setting strategy works.

Panel sizes

If you use tmux you will probably at some point have modified a vertical split by moving the split either to the right or left so as to give the left/right side more space. Midnight commander has a similar feature which is especially useful if you ever use the right hand side for “Quick view”, i.e. reading text files. My work laptop only has room for 71 columns on the left and 71 on the right, so if I want to read a standard width text file at 80 columns or a python file at 79 columns, I need more space. Go to “Options” | “Layout”, remove the “X” from “Equal split” and use the arrows to redistribute the available columns.

Skin

Yes, I like fancy colours and the light blue/faded yellow color scheme doesn’t quite cut it. MC comes with a bunch of alternative color schemes which can all be previewed and set from the Options menu, look for Appearance. Picking one of the true color skins (24 bit color, or 16 million colors, as opposed to 8 bit color which gives 256 colors) will usually result in an error, though, as the autodetection of true color support doesn’t seem to work very well.

As long as you are on a reasonably recent OS, like Ubuntu 18.04 or newer, you should be able to switch to one of the “16M” skins by feeding Midnight Commander the environment variable COLORTERM=truecolor, e.g. by using the command COLORTERM=truecolor mc. If that works, i.e. you’re allowed to switch and it looks right, you can export the variable in .profile or .bash_profile so that it’s always present.

Leave a Reply