Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vim: how to quit vim when I split window?

Tags:

vim

I have to type :q many times if I split window (or open file in a new tab) in vim to close every splited window( or tabs). Is there any way to exit vim just type one time :q and save all changes?

like image 335
remy Avatar asked May 16 '12 08:05

remy


People also ask

How do I end a Vim session?

Exit Vim Using a Shortcut Key In addition to command mode, Vim also has the option for shortcut keys: To save a file in Vim and exit, press Esc > Shift + ZZ. To exit Vim without saving, press Esc > Shift + ZX.


2 Answers

To save and quit all. This is what you need.

:wqa

Note that the following will do the same thing because :xa is a synonym for :wqa. This is my favourite since it is shorter to type.

:xa

To quit all:

:qa

To not save (lose changes) and quit all:

:qa!
like image 134
Susam Pal Avatar answered Oct 04 '22 03:10

Susam Pal


:qa
:wqa

Mnemonic: write quit all. You can access the docs like this from within Vim:

:help :quit
like image 28
Lumi Avatar answered Oct 04 '22 03:10

Lumi