8

By default, Ctrl-O in Midnight Commander is used to show the console output. In /etc/mc/mc.keymap I have set ShowCommandLine to another keyboard shortcut, and now MC doesn't react to Ctrl-O.

Again, by default, Ctrl-O in Vim is used to cycle through previously accessed files. In my ~/.vimrc, I added map <C-o> <nop> and, just in case, imap <C-o> <nop>. Now, if called directly from terminal or xterm, Vim doesn't react to Ctrl-O either.

Despite this, if I call Vim from the Midnight Commander prompt, and then press Ctrl-O, I end up in the standard two-panel mode of Midnight Commander, and I can't Ctrl-O (nor Ctrl-I) out of it.

Naturally, if I try to start a new Vim task from MC, it now tells me that "the shell is already running a command," and if I simply want to F10 out of MC, it says "the shell is still active. quit anyway?", and if I do so, it, of course, kills Vim in the process.

How do I solve this issue?

Unknown artist
  • 947
  • 9
  • 14
  • Nitpicking: `` is used to go back your jumplist, not cycling through your previously accessed files. The two may be identical in some cases but should be considered two different things. Did you try `:unmap` instead of `:map `? – romainl Dec 17 '12 at 12:51
  • @romainl I'm fairly new to Vim, I will keep note about the jumplist. `:unmap` gives me `E31: No such mapping`. Which is strange, seeing as without `:map ` it lets me go into the jumplist, while with remapping to jumplist isn't accessible. Also, I realize that by disabling a jumplist shortcut I'm probably shooting myself in the leg somewhere. – Unknown artist Dec 17 '12 at 13:02
  • Oh yeah, `` and `` usefulness can't be overstated. About the error, `` is probably not considered by Vim as a "mapping". It looks to me that either MC or your terminal emulator is at fault here. Or whatever else. The behaviour you describe is roughly similar to what `` does in Vim. – romainl Dec 17 '12 at 13:15

1 Answers1

1

What's happening here is that Vim captures Ctrl+O by default for navigating back in the jumplist. When you do :map <C-o> <nop>, Vim still captures the Ctrl+O key sequence; it just doesn't do anything about it. As far as Midnight Commander is concerned, you never pressed those keys; Vim captured the input first. I'm not aware of a way to make Vim stop capturing default key sequences.

Quinn Strahl
  • 1,718
  • 1
  • 16
  • 22
  • 1
    Thanks! It makes sense now. Anyway, the way I troubleshot this was to ditch MC in favor of Ranger, because Ranger natively uses Vim keys for navigation, haha. – Unknown artist Apr 05 '13 at 11:10
  • @Unknownartist thanks for the ranger reference, I like it so far! – bora89 Feb 02 '22 at 12:08