3

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!

5
  • 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
    Commented Nov 2, 2017 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
    Commented Nov 2, 2017 at 6:06
  • @guillem How can I tell if vi runs vi or vim... or gvim?
    – CJ Dennis
    Commented Nov 2, 2017 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
    Commented Nov 2, 2017 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
    Commented Nov 2, 2017 at 22:45

2 Answers 2

5

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
0
1

Maybe you are in Ex mode? You can get there by typing Q in command mode. Type :visual and press Enter to exit from it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.