CodeNewbie Community

Cover image for How To Exit Vim
Jeremy Schuurmans
Jeremy Schuurmans

Posted on

How To Exit Vim

A common quandary for those just getting started with the Vim text editor is how to exit out of it once started.

To exit Vim:

  1. If you are in edit mode (meaning Vim is allowing you to type words), first press the esc key.
  2. Then enter :wq + return to save and exit.

To exit without saving, you can run :q! + return

Discussion (4)

Collapse
mccurcio profile image
Matt C

The first time I used Vim,
I used the top-right close button with my mouse. lol

Collapse
kitarp29 profile image
Pratik Singh

I always wanted to ask.
Why do people use Vim over Nano?
I mean both are CLI text editors and Nano is much easier

Collapse
juanfrank77 profile image
Juan F Gonzalez

Nano is not as ubiquitous as Vim.
If you know Vim, you can be thrown into whatever (linux) server and know your way around.
If you ssh into a remote server to make a necessary change, you'll always find Vim but not always Nano.
Vim is like a language on itself. Once you learn the language, a whole world opens and you can become exponentially more productive writing (not just) code.
With Nano you're limited to how the program works.
With Vim you can go a long way customizing it to suit your needs.

I could go on but I think those are enough reasons as to why people prefer one over the other.

Collapse
kitarp29 profile image
Pratik Singh

Thanks, Man it was really helpful🙌🏽