Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When calling Vim from Midnight Commander, Ctrl-O makes me stuck in the Midnight Commander panel view

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?

like image 806
Unknown artist Avatar asked Dec 17 '12 12:12

Unknown artist


1 Answers

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.

like image 137
Quinn Strahl Avatar answered Nov 02 '22 20:11

Quinn Strahl