How do I close all open tabs at once?

Viewed 105903

If I have 10 tabs opened, I have to close each one using ":q" separately.

How can I close them all at once?

8 Answers

Shortest/simplest/fastest way would be:

:qa

To save work in all tabs and quit:

:wqa

I often use :tabo (:tabonly) to close all other tabs.

That can be done with the following command (in normal or escape mode):

:tabdo :q

"tabdo" apparently executes the command for all the open tabs.

Adding to what fuentesjr said:

:qa!

Will force quit all tabs, if you don't care about saving.

:qall

This closes all tabs and open buffers.

here is an Dark Side way of closing ALL VIM INSTANCES on Linux/Mac

:!killall vim -9

Do not use it. It does what you ask but probably not the best way but fun way

I'm using the VIM plugin in VSCode and I was looking for a way to close all the tabs open on the current window.

The commands :qa and :wqa didn't work because they closed all the tabs from all the windows.

The command :tabonly closed all the tabs from the current window except the current tab.

Because I'm usually only using 2 windows at the same time, the closer I managed to get to my need was to focus on the other window and run the command :

:on

(:only) it closes all the windows except the current one.

Related