How do I exit the Vim editor?

jones268

jones268

Posted on May 10, 2021

How do I exit the Vim editor?

Are you stuck in vim and cannot exit?

Vim is a powerful text editor, but if you are new to vim it may seem very confusing.

Personally I use the command ZZ to exit. This saves the file and exists. I use this all the time because what is simpler than pressing Z twice?

Exit vim

Vim works using commands. Before you enter a command, hit the Esc key.

You can exit without saving your changes with :q!. This is useful if you accidentally modified a file you didn't want to.

If you don't want to quit without saving, instead use :wq.

  • :q to quit (short for :quit)
  • :q! to quit without saving (short for :quit!)
  • :wq to write and quit
  • :x to write and quit (similar to :wq)
  • :exit to write and exit (same as :x)

Vim is a program that gives me the ability to edit text files, and it has a ton of features. If you are new to vim, I recommend this course

Why Vim?

Vim is a text editor. It’s been around for a long time and has an avid community of users.

  • Vim does not require a mouse. This makes it incredibly efficient for editing text files that just contain text or code, increasing your productivity.

productivity

  • Vim can be used remotely over SSH, in the shell or inside an IDE. Personally I use vim inside visual studio code.

vim visual studio

  • Vim has been around for more than 30 years and it hasn’t changed its philosophy. Learn vim once and you can use it for years.

  • I've used several IDEs through my career and having to learn shortcuts only once saved me tons of time.

  • It hasn’t become bloated and neither added flashy GUI (but you can use it inside IDEs like Visual Studio Code, Jetbrains). That is what makes vim so unique among editors.

Vim is an editor for everyone and not just programmers. It simply does its job with minimal set of commands.

💖 💪 🙅 🚩
jones268
jones268

Posted on May 10, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related