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

RE: Diffmode - 'Diffupdate on Save'

Expand Messages
  • Halim, Salman
    Sometimes, when I make a major change, an explicit diffupdate is called for (when, as you mention, the diff gets out of sync). Usually, I like to save major
    Message 1 of 3 , Sep 1, 2005
    • 0 Attachment
      Sometimes, when I make a major change, an explicit diffupdate is called
      for (when, as you mention, the diff gets out of sync). Usually, I like
      to save major changes (call me paranoid), so I do use this:

      au BufWritePre * if (&diff) | diffupdate | endif

      Basically, if you have multiple windows open and not all are
      participating in a diff, why update the diff if the window you're saving
      isn't actually the one being diffed, I figure :)

      Regards,

      Salman.

      > -----Original Message-----
      > From: Bram@... [mailto:Bram@...]
      > Sent: Thursday, September 01, 2005 8:35 AM
      > To: Dominic Evans
      > Cc: vim@...
      > Subject: Re: Diffmode - 'Diffupdate on Save'
      >
      >
      > Dominic Evans wrote:
      >
      > > Is there an easy addition to my .vimrc to make Vim do a 'diffupdate'
      > > automatically every time I save one of the buffers being diffed?
      >
      > I didn't try it, but this should work:
      >
      > :au BufWritePost * diffupdate
      >
      > > Should this not be the default thing to do anyway?
      >
      > Why? Mostly the diff is updated when making changes. When
      > it gets out of sync you need to invoke ":diffupdate", but
      > that is not directly related to writing the file. One might
      > as well want this for ":!ls" or ":help". At least I wouldn't
      > want a user to write the file to get the diffs updated.
      >
      > --
      > You are not really successful until someone claims he sat
      > beside you in school.
      >
      > /// Bram Moolenaar -- Bram@... --
      > http://www.Moolenaar.net \\\
      > /// Sponsor Vim, vote for features --
      > http://www.Vim.org/sponsor/ \\\
      > \\\ Project leader for A-A-P --
      > http://www.A-A-P.org ///
      > \\\ Buy LOTR 3 and help AIDS victims --
      > http://ICCF.nl/lotr.html ///
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.