How to exit Vim editor

When you are using the VIM editor on Linux and you would like to exit, you just need to follow the tips below. First press the Esc key in order to access the Normal mode. Now to access the Command-line mode, you can just type in : .

You will then notice a colon (:) that pops up at the bottom of your current screen session. This will allow you to execute one of the following most used commands using the Enter key :

  • :q (short for :quit) : used to quit
  • :q! (short for :quit!) : used to quit without saving the content (vim quit without saving)
  • :wq: used to write and quit (Vim save and quit)
  • :wq! : used to write and then quit even if the file has only the read permission
  • : x : used to write and then quit (looks similar to :wq, but writes in case of changes)
  • :exit : (similar to :x) used to write and then exit
  • :qa : (short for :quitall) used to quit all

Read: How to display the contents of a text file on the terminal in Linux/Ubuntu

You can also check the help documentation of Vim using the :help command to find out more about Vim editor commands.

 

Answer due to : dirvine

 


If you like the content, we would appreciate your support by buying us a coffee. Thank you so much for your visit and support.

 

Nikolaus Oosterhof

Nikolaus has a degree in software development. He is passionate about gadgets with a screen, nostalgic for phones, a retired gamer and open source programmer. He likes also to write about macOS and Windows. design web pages and debug long programs!

Leave a Reply