I have made wrong changes in a text, and now I want to leave Vim without saving. I know I have to type :!q while in normal mode, but when I do this, it says:

[No write since last change]
/bin/bash: q: command not found

shell returned 127

Press ENTER or type command to continue

And if I click ENTER or anything else, it returns back to Vim. What's going on?

closed as off-topic by Gilles, jimmij, mdpc, Scott, Jeff Schaller Jan 6 '16 at 1:09

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – Gilles, jimmij, mdpc, Scott, Jeff Schaller
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Also see vi.stackexchange.com for future vim questions. – agold Jan 5 '16 at 13:23
  • 3
    It is :q! (quit, I mean it!), not :!q (shell escape, pipe current line through q) – vonbrand Jan 6 '16 at 0:27
  • 1
    "they are unlikely to help future readers" but for some strange reason, it keeps receiving up-votes... – Rodrigo Aug 4 '17 at 15:25
  • 5
    I don't agree with the "off-topic" flag of this post. It was the top hit on google on the exact same issue I had, being a vim noob. Thanks, @Rodrigo, for asking. – andersoyvind May 14 '18 at 11:45
  • 1
    I don't understand how this is off topic, I just encountered the same problem. I literally couldn't return to the shell prompt and was asked the same thing as OP. I knew that I could :!q and issued the command several times before just deciding to close the terminal window. – ConstantFun Dec 7 '18 at 5:42

Use :q!. :!q tells vim to execute a command called q in your example.

See also :help ! and :help quit for details

  • Of course. The ! is after, not before, the command. I was in a hurry... – Rodrigo Jan 5 '16 at 15:22

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