vehomzzz
vehomzzz

Reputation: 44578

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

I’d like to save the files opened in all vertical/horizontal windows? Is it possible without going to each window and executing the :w! command?

Upvotes: 10

Views: 3244

Answers (3)

ib.
ib.

Reputation: 28954

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.

Upvotes: 11

ajwood
ajwood

Reputation: 19027

Yes, you can do this with :wa.

Upvotes: 9

Xavier T.
Xavier T.

Reputation: 42228

Use :wall

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

Upvotes: 4

Related Questions