Friday, September 3, 2010

Re: Is there an autocmd for when buffer modified flag changed?

On Sep 2, 3:17 am, Aarto Matti <aarto.ma...@gmail.com> wrote:
> On Thu, Sep 2, 2010 at 10:23 AM, Aarto Matti <aarto.ma...@gmail.com> wrote:
>
> > I'm using MiniBufExplorer, and I want it's buffer to be updated
> > whenever buffer's modified flag ([+] in statusline) gets changed, but I
> > couldn't find an appropriate autocmd for it. There is FileChangedRO event,
> > but why it's only for read-only files? So, I added this au to my .vimrc:
>
>
> I used a combination of CursorMoved, CursorMovedI, BufWritePost
> and FileWritePost.
>

Personally, I'd use CursorHold and CursorHoldI. I'd store off the old
value of &modified and compare it to the current value in these
events. You could add the CursorMoved events too if you really wanted
but I think that's not really necessary.

--
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

No comments:

Post a Comment