rp101
rp101

Reputation: 1339

How to save all files in tabs on Vim?

If I have multiple files in tabs on VIM and I edit few of them. How to save them with one command?

Upvotes: 65

Views: 27721

Answers (6)

snowbound
snowbound

Reputation: 1732

It's possible to suffix a[ll] for a number of Vim command-line commands (i.e. type : when in normal mode), include:

  • :wa - save all tabs / unsaved buffers

  • :xa/:wqa - save all tabs / unsaved buffers and exit Vim

  • :qa - exit vim (will warn if unsaved buffers exist)

Upvotes: 14

Paul
Paul

Reputation: 8182

Just do

:wa

(followed by return) which is a shorthand for

:wall

Also to "save everything and exit" you can do

:wqa or :xa

(="write-quit-all")

Upvotes: 32

Zsolt Botykai
Zsolt Botykai

Reputation: 51603

And you can use :tabdo! w too, I'm just adding this, because it's useful for other things too (e.g. :tabdo! g/somepattern/ s/something/anything/... I use it all the time for refactoring purposes...)

Upvotes: 4

Cascabel
Cascabel

Reputation: 496902

The command wa (short for wall) will write all changed buffers. You can also use :tabdo w, which is definitely exactly what you want, and generalizes nicely.

Upvotes: 75

Arnis Lapsa
Arnis Lapsa

Reputation: 47587

Check out :wall command

Upvotes: 4

Colin Newell
Colin Newell

Reputation: 3163

To save all the files just use an a after the write command to write all the files.

:wa

Upvotes: 9

Related Questions