47

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?

Rodrigo
  • 1,832
  • Also see http://vi.stackexchange.com for future vim questions. – agold Jan 05 '16 at 13:23
  • 6
    It is :q! (quit, I mean it!), not :!q (shell escape, pipe current line through q) – vonbrand Jan 06 '16 at 00:27
  • 3
    "they are unlikely to help future readers" but for some strange reason, it keeps receiving up-votes... – Rodrigo Aug 04 '17 at 15:25
  • 1
    Two more upvotes only today! Maybe you moderators could re-think your parameters? – Rodrigo Aug 14 '17 at 01:01
  • 1
    10 upvotes as of today. This problem is obviously affecting lots of troubled Linux newbies! – Rodrigo Sep 01 '17 at 15:35
  • 1
    14 upvotes in 25 January 2018... – Rodrigo Jan 25 '18 at 02:07
  • 8
    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
  • 3
    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 07 '18 at 05:42

1 Answers1

58

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

See also :help ! and :help quit for details

Lambert
  • 12,680