Yegappan wrote:

> On Mon, May 23, 2022 at 1:40 PM Nick Jensen <[email protected]>
> wrote:
> 
> > It's probably better to add a "replace" argument: If an autocommand for
> > this group and event already exists, replace it with this one.
> >
> > I think either unique or replace are both fine (although unique is more
> > descriptive in my mind), as long as the default value is true so we
> > normally don't need to use it, or even know about it! It is very rare that
> > an autocmd should *not* replace an existing one with the same group and
> > event.
> >
> >
> > If the 'replace' item is specified, then autocmd_add() will remove all the
> commands
> associated with an autocmd event in the group and add the new command.  If a
> group is not specified, then the default group will be used. This is same
> as running
> the following command:
> 
> autocmd! {group} {event} {pat} {cmd}
> 
> If we make 'replace' the default, then a call to autocmd_add() in a .vimrc
> file will
> remove commands added by a plugin (in the default group) for that event.
> A user may not expect this. So we should not make 'replace' as the default.

Right, having "replace" be the default goes against what would normally
be expected.  For example:

        autocmd_add( ... some group and event ..., command one)
        autocmd_add( ... some group and event ..., command two)

Here the user adds two commands for the same group and event.  Both
should be added.  Having the second one remove the first one is very
unexpected.  Note that the two commands could be far apart.

-- 
Facepalm statement #4: "3000 year old graves?  That's not possible, it's only
2014!"

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            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/20220524104938.49E171C1DF6%40moolenaar.net.

Raspunde prin e-mail lui