I pressed :wq to write and quit.

Except now I see a Command Line at the bottom and nothing I do makes vi respond (Enter, Esc, Ctrl+c, :, q, etc.). How do I get back to civilisation from here? If you can save my file at the same time, bonus! Otherwise, I'll try editing it again... if I can ever exit!

  • That's annoying! It unfroze itself (and deleted the contents, but didn't save it) while I was asking this question. Apparently you need to ask a question on this site to get it to work again... Answers still welcome for next time!
    – CJ Dennis
    Nov 2 '17 at 5:56
  • 2
    Assuming you are using vim in a terminal, not gvim: could you have press Ctrl+s by accident, thus freezing the terminal? This would have rendered vi irresponsive. If that was the case, you could have used Ctrl+q to unfreeze.
    – guillem
    Nov 2 '17 at 6:06
  • @guillem How can I tell if vi runs vi or vim... or gvim?
    – CJ Dennis
    Nov 2 '17 at 6:09
  • The command :echo has('gui_running') shows 1 for gvim, and 0 for vim. Furthermore, gvim does not freeze by pressing Ctrl+s.
    – guillem
    Nov 2 '17 at 14:06
  • Thanks for the edit @Carpetsmoker. However, you deleted the bit that I pressed a whole bunch of other keys first. I think that was important.
    – CJ Dennis
    Nov 2 '17 at 22:45

You probably pressed q: instead of :q. The q: command opens the commandline window.

You can close it like any other window by using :q, :close, or <C-w>w.

Some people like to disable this mapping:

:nnoremap q: <Nop>

Or have it auto-correct to :q:

:nnoremap q: :q
  • 1
    Am I mistaken, or can you also use visual<CR> to break out?
    – D. Ben Knoble
    Nov 2 '17 at 15:54

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.