Re: Define syntax region in multiple buffers via bufdo
- Am 16.11.2012 20:03, schrieb Edward Beach:
> If I execute the command 'syn region Region1 matchgroup=Highlight1:bufdo executes its arguments with ignored Syntax event. E.g. try
> start=+(+ end=+)+' individually on three different buffers, the syntax
> region Region1 is properly defined in all three buffers.
> However if I execute it via bufdo, like 'bufdo syn region Region1
> matchgroup=Highlight1 start=+(+ end=+)+' the syntax region is missing
> on the last buffer.
> I would like to define this region in all active buffers but I don't
> understand why bufdo is failing. Could somebody help?
:bufdo set ei?
to convince yourself.
When :bufdo finishes, it fires the Syntax event to activate syntax
highlighting for the last (= current) buffer. This clears the syntax
highlighting that you just defined for that buffer.
auSyntax * syn region Region1 matchgroup=Highlight1 start=+(+ end=+)+
When defining these commands in the vimrc, I'd also make sure this is
installed after other Syntax autocmds:
au VimEnter * call s:AfterPlugin()
au! Syntax * syn region Region1 matchgroup=Highlight1 start=+(+ end=+)+
A surrounding :augroup command is not required, but a good habit ...
makes it generally easier to filter and remove autocmds.
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