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:

Shell =
Shell =
Shell =
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

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.

  • Patch and recompile it is, then. Thanks for the answer.
    – Mihai
    Sep 8 '16 at 21:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.