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.  If you don't like it
you can use:

        " Don't set 'modified' when reading from stdin
        au StdinReadPost * set nomodified

I'll update the help.

-- 
The only backup you need is the one that you didn't have time for.
(Murphy)

 /// Bram Moolenaar -- [email protected] -- 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_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/202002042208.014M8kom017924%40masaka.moolenaar.net.

Raspunde prin e-mail lui