Thanks. That makes great sense. On Thu, Oct 15, 2015 at 10:37 AM, Ben Fritz <[email protected]> wrote:
> On Wednesday, October 14, 2015 at 11:36:50 PM UTC-5, [email protected] > wrote: > > Hi all, > > > > I have right now an autocommand, au BufWritePost *.foo :run_cmd. > > > > I want it to run upon writing all files matching *.foo, but not any > files matching bar.*, or more equivalently bar.*.foo. > > > > How can I disable the autocommand for files starting with bar? The full > path of an ideally excluded file may be /tmp/dir/bar.qux.foo, while > /tmp/dir/qux.foo should be included > > > > Thanks, everyone! > > In addition to your other answer, consider something like this which *may* > be easier in some cases: > > au BufWritePost bar.* let s:disable_my_stuff = 1 > au BufWritePost *.foo if !exists('s:disable_my_stuff') | call DoMyStuff() > | endif > au BufWritePost * unlet! s:disable_my_stuff > > This takes advantage of the fact that autocmds fire in order of their > definition to disable the action if the file matches one pattern, before > attempting to run it when it matches another pattern. > > -- > -- > 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 [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
