On Feb 6, 10:13 pm, suan <[email protected]> wrote: > Is there a way to call :update <some other file name> such that you can > tell whether there actually were changes and that the file was written? > > I'd like to perform an action each time the current buffer changes (without > explicitly saving to the current file), but presently calling :update > <other file name> seems like a black hole as there's no way to know whether > anything was written or not. > > I've tried treating update as a function by doing things like `echo > update`, but it seems that it behaves differently from a function and it > errors... >
I'm really not sure what you're asking for (on one hand you talk about writing changes with :update, and then you go into performing actions on EVERY change, which is entirely different). But, for detecting when a buffer is saved, a simple test shows that BufWritePre autocmds only fire when an actual write will be performed. You can define a BufWritePre autocmd, and if you run :update, the autocmd will only fire if there are changes which will be written. -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
