On 2020-02-04, Bram Moolenaar wrote:
> Gary Johnson wrote:
> 
> > On 2020-02-04, Tony Mechelynck wrote:
> > > To avoid marking the file as modified when r'eading from stdin, use view 
> > > rather
> > > than vim as the pager command.
> > 
> > That's true, but is not what the documentation says.
> > 
> > I did some investigating with git blame.  The earliest version of
> > the code that I could find was the apparent creation of buffer.c on
> > 13 June 2004 for version 7.0001, commit
> > 071d4279d6ab81b7187b48f3a0fc61e587b6db6c.  It contains the comment
> > 
> >     /* When reading stdin, the buffer contents always needs writing, so set
> >      * the changed flag.  Unless in readonly mode: "ls | gview -".
> > 
> > which is the same today and matches the actual behavior.
> > 
> > Until 18 November 2018, the documentation agreed.  Until that time,
> > it read:
> > 
> >     The buffer will be marked modified, because it contains text
> >     that needs to be saved.  Except when in readonly mode, then
> >     the buffer is not marked modified.  Example: >
> >             ls | view -
> > 
> > On that date, with commit a2a80162deb1e96e16b097dfe48b61b6eb0824bf,
> > it was changed to the current, incorrect, text:
> > 
> >     The buffer will not be marked as modified, so that it's easy
> >     to exit.  Be careful to mark it as modified if you don't want
> >     to accidentally lose it.  Example: >
> >             ls | view -
> > 
> > I don't know why it was changed.  Perhaps someone intended to change
> > the behavior but changed only the documentation, or they
> > misunderstood the behavior and tried to correct the documentation.
> > In any case, that change to the documentation should be reverted.
> 
> I recall we went back and forth on this.  Marking the buffer as modified
> is the safest, thus that's what we ended up with.

It makes sense that it does what it does.  I was more concerned that
the help didn't match the behavior.  (I was also intrigued by the
difference between the two and the possibility of learning to use
Fugitive's :Gblame to explore the history.)

> If you don't like it you can use:
> 
>       " Don't set 'modified' when reading from stdin
>       au StdinReadPost * set nomodified

I do.  This is just more convenient for me for the way I typically
use Vim.

> I'll update the help.

Thanks.

Regards,
Gary

-- 
-- 
You received this message from the "vim_dev" 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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20200204223622.GC3735%40phoenix.

Raspunde prin e-mail lui