Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to save all files in tabs on Vim?

Tags:

vim

editor

tabs

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

like image 519
rp101 Avatar asked Nov 22 '10 14:11

rp101


People also ask

How do I save a folder in Vim?

This is where your file will be saved if simply enter :w filename . You can change the working directory with :cd path/to/new/directory . Or you can enter the full path to the location where you want to save the file with the write command, e.g., :w /var/www/filename . Save this answer.


3 Answers

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.

like image 188
Cascabel Avatar answered Oct 22 '22 03:10

Cascabel


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")

like image 27
Paul Avatar answered Oct 22 '22 03:10

Paul


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)

like image 7
snowbound Avatar answered Oct 22 '22 02:10

snowbound