Glyph
Glyph

Reputation: 31860

error when attempting to go back to normal mode in vim command-line window

When I open the command-line window for editing a complex command-line in vim, I expect to be able to go back and forth in and out of insert / normal mode to edit as I would in any other buffer. (That's the point of the command-line window, right? So that I can do that?) But instead, when I hit ESC to go back to normal mode, I get this:

Error detected while processing function <SNR>15_CloseStackPop:
line    3:
E11: Invalid in command-line window; <CR> executes, CTRL-C quits:         pclose

I'm game to try to figure this out, but I don't have a lot to go on. vim --noplugin doesn't seem to have this problem, so it's clearly one of the plugins I have loaded, but which one? I have quite a few. "line 3" of what file? What does "E11" mean?

Upvotes: 4

Views: 3609

Answers (2)

Glyph
Glyph

Reputation: 31860

It turns out that this was a bug in the 'autoclose' plugin. I removed the reference to pclose from the <SID>CloseStackPop function, and now Escape in command-line mode works fine.

In case anyone else has this problem: functions in plugins can be defined with <SID>, which (in the source code) just looks like <SID>Foo, but to Vim look like <SNR>4321_Foo. I was looking for 15_CloseStackPop, assuming that the <SNR> was something special, but when I just did a grep CloseStackPop -r ~/.vim/plugins the offending plugin came up right away.

Upvotes: 4

ktm5124
ktm5124

Reputation: 12123

Try Ctrl+C as a synonym for Escape. Also check .vimrc for the plugins. This isn't standard behavior for vi. If I were you I wouldn't use any plugins unless I was absolutely sure what they did. Perhaps start from scratch and reinstall the ones you feel completely sure of.

Upvotes: 1

Related Questions