Am 16.11.2012 20:03, schrieb Edward Beach:
If I execute the command 'syn region Region1 matchgroup=Highlight1
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  executes its arguments with ignored Syntax event.  E.g. try
    :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.


Suggestion:

    augroup MySyntax
    au!
    auSyntax * syn region Region1 matchgroup=Highlight1 start=+(+ end=+)+
    augroup End


When defining these commands in the vimrc, I'd also make sure this is
installed after other Syntax autocmds:

augroup Vimrc
    au!
    au VimEnter * call s:AfterPlugin()
augroup End

func! s:AfterPlugin()
    augroup MySyntax
    au! Syntax * syn region Region1 matchgroup=Highlight1 start=+(+ end=+)+
    augroup End
endfunc


A surrounding :augroup command is not required, but a good habit ...
makes it generally easier to filter and remove autocmds.

--
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

Reply via email to