Tip #652: save all open buffers at once
tip karma |
Rating 6/12, Viewed by 862
|
created: |
|
February 6, 2004 3:50 |
|
complexity: |
|
intermediate |
author: |
|
Andreas Berg |
|
as of Vim: |
|
6.0 |
Since i like to work with more than one buffer, i always have had the problem
that i left one of them unsaved by mistake. For this purpose i wrote this
small function which saves all open buffers (only if changes were made).
If you map the function to a key (e.g. F12), this is quite a convenient way.
add this to your .vimrc:
function! SaveBuffers()
if !buflisted(bufnr('%'))
return
end
let myBufferNumber = bufnr('%')
exec("bufdo update")
exec("b".myBufferNumber)
endfunction
nmap <F12> :call SaveBuffers()<CR>
<<Edit gnupg-encrypted files. |
doxygen '///' :comments setting >>
Additional Notes
|