Saturday, March 21, 2015

Re: File matches multiple parts of an autocommand pattern

Benji Fisher wrote:

>
> Is this the expected behavior? If an autocommand pattern contains several
> parts, and a file matches more than one of them, then the autocommand is
> executed more than once. For example, if I add this to my vimrc file
>
> let foo_count = 0
> augroup Foo
> au Bufread,BufEnter *foo*,*bar* let foo_count += 1
> augroup END
>
> and edit foobar.txt, then foo_count is set to 2.

Yes, that works as intended. when using more than one pattern it's
essentially the same as two commands with each pattern:

au Bufread,BufEnter *foo* let foo_count += 1
au Bufread,BufEnter *bar* let foo_count += 1

I notice this isn't documented, I'll add some text for it.

--
No letters of the alphabet were harmed in the creation of this message.

/// Bram Moolenaar -- Bram@Moolenaar.net -- 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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: