autocmd! followed by <bar>

17 views
Skip to first unread message

Lifepillar

unread,
Aug 19, 2017, 2:18:17 AM8/19/17
to vim...@googlegroups.com
It seems impossible to have autocmd! followed by another command, i.e.:

autocmd! some_group | <whatever I put here is ignored>

According to `:help autocmd`, autocmd may be followed by another command
when the '|' appears before {cmd}. This does not seem to be the case for
autocmd!. Is that intentional?

Thanks,
Life.

Andy Wokula

unread,
Aug 20, 2017, 2:54:24 PM8/20/17
to vim...@googlegroups.com
Help says "this works":
:augroup mine | au! BufRead | augroup END

but it doesn't (augroup "mine" still active afterwards), thus it can't be
intentional and you found a bug.

Also not working:
:augroup mine | au! BufRead *| augroup END
" `*|' is taken as autocmd-{pat}, `augroup END' becomes {cmd}

:augroup mine | au! BufRead * | augroup END
" uses `| augroup END' for {cmd}

Weird that it went unnoticed for so long, probably because most people
instead use
:au! mine BufRead

I think Vim should make anything after `:au' part of the command.
`:au' is already listed under `:h :bar' without further notice.

--
Andy

Nikolay Aleksandrovich Pavlov

unread,
Aug 20, 2017, 6:18:43 PM8/20/17
to vim...@googlegroups.com
I second this, there already are at least five variants of handling
command separator (bar), comment start (double quote) and escaping
characters. Let’s not make rules surrounding bar/dquote/backslash even
more weird by adding an exception.

>
> --
> Andy
>
>
> --
> --
> 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+u...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages