Save all vim buffers to new directory

I'd like to do a :wa, but save all buffers under a new path. I could to each buffer write them individually to a new path, but I'm looking to do this for all open buffers. I actually wouldn't care if all sub-paths or absolute paths were stripped, and everything was just flatly in one directory.

I'm trying to save all open vim files after deleting the directory from the shell while vim was open.

Answers


All buffers calls for :bufdo. With %:t, you get the current buffer's filename (without path). Read :help filename-modifiers for all of them; you can include subpaths, too. Ergo (to make copies in /tmp/backup):

:bufdo write /tmp/backups/%:t

Need Your Help

How to override 'this' parameter of a bound function in javascript

javascript

I have a function that is already bound by using Function.prototype.bind method. Somehow, I want to override the this parameter of the bound function. But it does not work. Check the description in...