On Thu, 19 Oct 2006 at 11:25pm, Yakov Lerner wrote: > I'd like to cache some information about file, into > b:variables, and be able to check in my function, > whether buffer changed in any way between 2 calls > to the function. Is there any "change counter" that I can > store and compare later to detect the buffer change (any > change like any insertion, deletion, undo, redo, file was re-read from disk) ? > > I though about using &modified but it does not work. If file > was modified and saved, then &modified is off and I don't detect > anything. > > Yakov
You can probably monitor InsertEnter and InsertLeave in addition to :undolist to figure this out, but you can only see what Vim thinks of the buffer, if you are trying to see if contents really changed, then you can do that only by comparing the text by saving it at different points. - If 'nomodified' at the time of InsertEnter, but 'modified' at the time of 'InsertLeave', then Vim thinks user changed something. - If 'modified' at the time of InsertEnter, save :undolist and compare it with that at the time of InsertLeave to see if any new undo points have been entered. -- HTH, Hari __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com