vissha Posted May 28, 2017 Share Posted May 28, 2017 How To Exit Vim? Multiple Ways To Quit Vim Editor How to exit Vim? How to quit Vim? How do you exit Vi editor? How to save and quit Vim? These are some of the most googled questions about Vim editor. Vim, one of the best terminal based editors, is known for its powerful features. Its ardent users swear by it but it leaves the new users baffled because of the ‘unusual shortcuts’. This even leaves them wondering how to exit from Vim editor. In this article, I’ll show you several ways to exit Vim. We’ll also see some interesting fun facts about exiting Vim. How to exit Vim As we have already seen in advanced Vim tips, there are multiple ways to quit Vim. Let me list them one by one along with the procedure. Press Esc key: This is very important because you must exit the edit mode first before typing the exit command(s). Next, you can type one of the following commands: :q (yes, the colon is included in the command) – This will quite the editor :q! – Quit Vim without saving the data file :wq – Save the file and exit Vim And then Enter key Do note that when you press :, the editor will have the next keystrokes displayed at the bottom left of the terminal. Other ways to exit Vim Normally, you should remember the above three commands and you should be good with exiting Vim. But as I said earlier, there are more shortcuts to quit Vim. These are following: Esc + + Enter (Save and exit) Esc + :qa + Enter (Quit all open files) Esc + Shift ZZ (Save and exit) Esc + Shift ZQ (Exit without saving) Now it is really up to you to choose how you want to quit Vim editor. If you ask me, the first method is what you should opt for. Because you save (without exiting) with :w command and then you can use :wq to save and quit (w for save and q for quit). It is easier to remember q for quit. Facts and fun about exiting Vim If you are feeling a little low because you didn’t know how to quit Vim, don’t do that. Because you are not the only one. According to Stack Overflow, over a million developers worldwide searched about how to exit Vim. In fact, exiting Vim has become a talking point in the popular culture. Take this tweet for example. This is one of the most popular fun pokes at the ‘complexity’ of exiting Vim: I've been using Vim for about 2 years now, mostly because I can't figure out how to exit it. — I Am Devloper (@iamdevloper) February 17, 2014 Which is somewhat surprising because if you run Vim, you’ll see the information about how to exit Vim at the splash screen: Exit command is displayed at the splash screen of Vim But then, obvious things are not that obvious at times. It’s funny that we are so accustomed to Ctrl+S, Ctrl+X shortcuts that it baffles us when we don’t find the same ‘standard’ shortcuts elsewhere. Vim is an excellent editor. If you can master its features, there will be nothing like it. SysAdmins particularly spend a lot of time on the command line. Mastering Vim could really be beneficial. If you are serious about learning Vim, I suggest this video course from Linux Training Academy. I hope this tutorial helped you to exit Vim. Do share your views and thoughts on it. Source Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.