How to save the files opened in all windows and tabs in Vim?

Yes, you can do this with :wa.


To save only those buffers that opened in the current tab page and not those that are hidden, run the :write command for every open window:

:windo w!

In order to save all open buffers regardless of the corresponding windows’ locations, run the :wall command:

:wa!

There is also a similar command

:bufdo w!

but it does not behave in quite the same fashion. Both commands affect hidden buffers, but :wall does not attempt to write the buffers that do not have a file name set.


Use :wall

It writes all changed buffers (but it will also save the hidden one).

Tags:

Vim