Quantcast

VimDiff => ":diffupdate" does not work

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

VimDiff => ":diffupdate" does not work

GeertVc
When changing one or both files which are currently open/compared in
VimDiff, in an *external* editor (so, not in Vim or VimDiff itself),
VimDiff doesn't update the diffs when forcing an update using the
command ":diffupdate".  In fact, nothing happens at all while
executing this ":diffupdate" command.

Only when forcing VimDiff to lose focus and re-gain focus again, I see
the message that files have been changed.  After (re)loading the
changed files, the diff is updated.

I enforce losing focus by executing the command ":shell" from within
VimDiff and then exit-ing the shell mode again to come back to
VimDiff.

Is ":diffupdate" not supposed to "forcefully" rescan both files and
update the view?

I'm using VimDiff version 7.1.138 on Ubuntu 8.04, but the same
complaint is valid for VimDiff 7.3.449 on a very recent Ubuntu 12.04
distro.

--
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: VimDiff => ":diffupdate" does not work

Christian Brabandt
Hi GeertVc!

On Do, 10 Mai 2012, GeertVc wrote:

> When changing one or both files which are currently open/compared in
> VimDiff, in an *external* editor (so, not in Vim or VimDiff itself),
> VimDiff doesn't update the diffs when forcing an update using the
> command ":diffupdate".  In fact, nothing happens at all while
> executing this ":diffupdate" command.
>
> Only when forcing VimDiff to lose focus and re-gain focus again, I see
> the message that files have been changed.  After (re)loading the
> changed files, the diff is updated.
>
> I enforce losing focus by executing the command ":shell" from within
> VimDiff and then exit-ing the shell mode again to come back to
> VimDiff.
>
> Is ":diffupdate" not supposed to "forcefully" rescan both files and
> update the view?
>
> I'm using VimDiff version 7.1.138 on Ubuntu 8.04, but the same
> complaint is valid for VimDiff 7.3.449 on a very recent Ubuntu 12.04
> distro.

Yeah, diffupdate only updates the diff for the buffer that is loaded. It
doesn't check, whether the original file, has been changed. If you want
this, I suggest you set the 'autoread' option together with an
CursorHold autocommand, e.g. like this

au CursorHold * checktime

regards,
Christian
--
Der Stand erhebt die Großen über die Urteile, die die Kleinen über
ihre Tugenden fällen - aber nicht über ihre Vorzüge. Sie rächen nicht
die beleidigte Achtung, sondern die beleidigte Eitelkeit.
                -- Jean Paul

--
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: VimDiff => ":diffupdate" does not work

Christian Brabandt

On Fr, 11 Mai 2012, Christian Brabandt wrote:

> On Do, 10 Mai 2012, GeertVc wrote:
>
> > When changing one or both files which are currently open/compared in
> > VimDiff, in an *external* editor (so, not in Vim or VimDiff itself),
> > VimDiff doesn't update the diffs when forcing an update using the
> > command ":diffupdate".  In fact, nothing happens at all while
> > executing this ":diffupdate" command.
> >
> > Only when forcing VimDiff to lose focus and re-gain focus again, I see
> > the message that files have been changed.  After (re)loading the
> > changed files, the diff is updated.
> >
> > I enforce losing focus by executing the command ":shell" from within
> > VimDiff and then exit-ing the shell mode again to come back to
> > VimDiff.
> >
> > Is ":diffupdate" not supposed to "forcefully" rescan both files and
> > update the view?
> >
> > I'm using VimDiff version 7.1.138 on Ubuntu 8.04, but the same
> > complaint is valid for VimDiff 7.3.449 on a very recent Ubuntu 12.04
> > distro.
>
> Yeah, diffupdate only updates the diff for the buffer that is loaded. It
> doesn't check, whether the original file, has been changed. If you want
> this, I suggest you set the 'autoread' option together with an
> CursorHold autocommand, e.g. like this
>
> au CursorHold * checktime
BTW: Here is a patch, that let's you use :diffupdate! to force reloading
the buffers before updating the diff. Be careful, as you will lose all
your changes that you have made to a buffer without saving.

regards,
Christian

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

diffupdate!.diff (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: VimDiff => ":diffupdate" does not work

GeertVc
On Friday, 11 May 2012 10:35:04 UTC+2, Christian Brabandt  wrote:

> On Fr, 11 Mai 2012, Christian Brabandt wrote:
>
> > On Do, 10 Mai 2012, GeertVc wrote:
> >
> > > When changing one or both files which are currently open/compared in
> > > VimDiff, in an *external* editor (so, not in Vim or VimDiff itself),
> > > VimDiff doesn't update the diffs when forcing an update using the
> > > command ":diffupdate".  In fact, nothing happens at all while
> > > executing this ":diffupdate" command.
> > >
> > > Only when forcing VimDiff to lose focus and re-gain focus again, I see
> > > the message that files have been changed.  After (re)loading the
> > > changed files, the diff is updated.
> > >
> > > I enforce losing focus by executing the command ":shell" from within
> > > VimDiff and then exit-ing the shell mode again to come back to
> > > VimDiff.
> > >
> > > Is ":diffupdate" not supposed to "forcefully" rescan both files and
> > > update the view?
> > >
> > > I'm using VimDiff version 7.1.138 on Ubuntu 8.04, but the same
> > > complaint is valid for VimDiff 7.3.449 on a very recent Ubuntu 12.04
> > > distro.
> >
> > Yeah, diffupdate only updates the diff for the buffer that is loaded. It
> > doesn't check, whether the original file, has been changed. If you want
> > this, I suggest you set the 'autoread' option together with an
> > CursorHold autocommand, e.g. like this
> >
> > au CursorHold * checktime
>
> BTW: Here is a patch, that let's you use :diffupdate! to force reloading
> the buffers before updating the diff. Be careful, as you will lose all
> your changes that you have made to a buffer without saving.
>
> regards,
> Christian

Hi Christian,

Your patch works like a charm!!!  That is, on a quite recent Vim version (see original post), I didn't test it on my "old" 7.1 version...

Would it be possible for you to send this patch to Bram Moolenaar to have it in the upstream?

Much appreciated!

Best rgds,
--Geert

--
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: VimDiff => ":diffupdate" does not work

Christian Brabandt
Hi GeertVc!

On Fr, 11 Mai 2012, GeertVc wrote:
> Your patch works like a charm!!!  That is, on a quite recent Vim
> version (see original post), I didn't test it on my "old" 7.1
> version...
>
> Would it be possible for you to send this patch to Bram Moolenaar to have it in the upstream?
>
> Much appreciated!

It went to the mailinglist vim-dev. Bram probably saw it and will
include it, if he thinks it is useful.

regards,
Christian

--
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: VimDiff => ":diffupdate" does not work

Bram Moolenaar

Christian Brabandt wrote:

> On Fr, 11 Mai 2012, GeertVc wrote:
> > Your patch works like a charm!!!  That is, on a quite recent Vim
> > version (see original post), I didn't test it on my "old" 7.1
> > version...
> >
> > Would it be possible for you to send this patch to Bram Moolenaar to have it in the upstream?
> >
> > Much appreciated!
>
> It went to the mailinglist vim-dev. Bram probably saw it and will
> include it, if he thinks it is useful.

I think it's better than, instead of adding a ! to :diffupdate, that
command would always check the timestamp on the files involved.  Like
using ":checktime N" on the buffers involved.  That is probably what
most users expect to happen and prompts the user what to do about files
changed externally.

--
A fool must search for a greater fool to find admiration.

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

--
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: VimDiff => ":diffupdate" does not work

Christian Brabandt
Hi Bram!

On Sa, 12 Mai 2012, Bram Moolenaar wrote:

> I think it's better than, instead of adding a ! to :diffupdate, that
> command would always check the timestamp on the files involved.  Like
> using ":checktime N" on the buffers involved.  That is probably what
> most users expect to happen and prompts the user what to do about files
> changed externally.

Hmm, I started using buf_check_timestamp(), and it prompts to reload the
buffer. But once you didn't reload the buffer, the next time you
checked, it wouldn't prompt again.

regards,
Christian
--

--
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: VimDiff => ":diffupdate" does not work

Christian Brabandt
Bram,

On Sa, 12 Mai 2012, Christian Brabandt wrote:

> > I think it's better than, instead of adding a ! to :diffupdate, that
> > command would always check the timestamp on the files involved.  Like
> > using ":checktime N" on the buffers involved.  That is probably what
> > most users expect to happen and prompts the user what to do about files
> > changed externally.
>
> Hmm, I started using buf_check_timestamp(), and it prompts to reload the
> buffer. But once you didn't reload the buffer, the next time you
> checked, it wouldn't prompt again.

here is an updated patch, using buf_check_timestamp() this time. Which
should prompt everytime, :diffupdat! has been called (even when the
prompt was only acknowledged the last time, but the buffer not
reloaded).

regards,
Christian
--

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

diffupdate!.diff (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: VimDiff => ":diffupdate" does not work

Bram Moolenaar
In reply to this post by Christian Brabandt

Christian Brabandt wrote:

> On Sa, 12 Mai 2012, Bram Moolenaar wrote:
>
> > I think it's better than, instead of adding a ! to :diffupdate, that
> > command would always check the timestamp on the files involved.  Like
> > using ":checktime N" on the buffers involved.  That is probably what
> > most users expect to happen and prompts the user what to do about files
> > changed externally.
>
> Hmm, I started using buf_check_timestamp(), and it prompts to reload the
> buffer. But once you didn't reload the buffer, the next time you
> checked, it wouldn't prompt again.

Well, isn't that what the user expects?  If you first skip the loading
of the buffer, you can later use ":e" or ":e!" to force the reload.  I
think that's better than asking every time :diffupdate is used.

--
People who want to share their religious views with you
almost never want you to share yours with them.

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

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