Loading ...
Sorry, an error occurred while loading the content.

Is there an autocmd for when buffer modified flag changed?

Expand Messages
  • Aarto Matti
    Hi, 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
    Message 1 of 3 , Sep 2, 2010
    • 0 Attachment
      Hi,

      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:

      autocmd! * * UMiniBufExplore

      I think it's far for an optimal solution as it reacts on every possible event, and in some case other than UMiniBufExplore call it may slowdown vim a lot. Any better way?

      --
      aarto

      --
      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
    • Aarto Matti
      ... Never mind, I used a combination of CursorMoved, CursorMovedI, BufWritePost and FileWritePost. -- aarto -- You received this message from the vim_use
      Message 2 of 3 , Sep 2, 2010
      • 0 Attachment
        On Thu, Sep 2, 2010 at 10:23 AM, Aarto Matti <aarto.matti@...> wrote:
        Hi,

        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:

        autocmd! * * UMiniBufExplore

        I think it's far for an optimal solution as it reacts on every possible event, and in some case other than UMiniBufExplore call it may slowdown vim a lot. Any better way?


        Never mind, I used a combination of CursorMoved, CursorMovedI, BufWritePost and FileWritePost.

        --
        aarto

        --
        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
      • Ben Fritz
        ... 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
        Message 3 of 3 , Sep 3, 2010
        • 0 Attachment
          On Sep 2, 3:17 am, Aarto Matti <aarto.ma...@...> wrote:
          > On Thu, Sep 2, 2010 at 10:23 AM, Aarto Matti <aarto.ma...@...> 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
        Your message has been successfully submitted and would be delivered to recipients shortly.