8

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

1 Answer 1

3

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.

2
  • Patch and recompile it is, then. Thanks for the answer.
    – Mihai
    Commented Sep 8, 2016 at 21:52
  • Still not fixed in 2022. Atrocious. Commented Feb 21, 2022 at 19:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .