mc – How to Completely Disable Ctrl-O Shortcut in Midnight Commander

keyboard shortcutsmcvim

I like using both Midnight Commander and Vim. In Vim, Ctrl-O is the "go to previous position" command, and in MC, by default, it toggles between the shell and the panel. I would like to be able to call Vim from MC, and use the Ctrl-O from Vim without MC intercepting it and yanking me back to the panel view.

I created a ~/.config/mc/mc.keymap with the following contents:

[main]
Shell =
[viewer]
Shell =
[diffviewer]
Shell =
[editor]
Shell =

This gets me halfway, in that it disables the shortcut when I call Vim using the F4 key. However, if I run Vim as a shell program, from the input line, and then press Ctrl-O, MC still intercepts it.

Is there a configuration option that I'm missing here?

Note: I'm reluctant to do any of the following:

  • change my default Vim key mappings
  • change my preferred editor or file manager
  • dig through the MC source code, patch, and recompile

Best Answer

No, you did not overlook a configuration setting. It is hardcoded in the source file src/subshell/common.c, as a variable that "could" be made configurable, but is not:

/* The key for switching back to MC from the subshell */
/* *INDENT-OFF* */
static const char subshell_switch_key = XCTRL ('o') & 255;

It is only referenced in one place in the file: the case which you noticed.

Related Question