How to save all files in tabs on Vim?

谁说胖子不能爱 提交于 2019-12-20 09:28:19

问题


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


回答1:


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.




回答2:


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




回答3:


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

:wa



回答4:


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)




回答5:


Check out :wall command




回答6:


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



来源:https://stackoverflow.com/questions/4246268/how-to-save-all-files-in-tabs-on-vim

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!