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?
:wa - save all tabs / unsaved buffers. :xa / :wqa - save all tabs / unsaved buffers and exit Vim.
The command to save a file in Vim is :w . To save the file without exiting the editor, switch back to normal mode by pressing Esc , type :w and hit Enter . There is also an update command :up , which writes the buffer to the file only if there are unsaved changes.
So if you only want to have only one session saved in your current directory, you can use :mksession or :mks from vim to save your current session, and just vim -S to open it back up.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With