Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Define syntax region in multiple buffers via bufdo
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Edward Beach  
View profile  
 More options Nov 16 2012, 2:03 pm
From: Edward Beach <beach9...@hotmail.com>
Date: Fri, 16 Nov 2012 11:03:25 -0800 (PST)
Local: Fri, Nov 16 2012 2:03 pm
Subject: Define syntax region in multiple buffers via bufdo

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?

Thanks!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andy Wokula  
View profile  
 More options Nov 16 2012, 3:08 pm
From: Andy Wokula <anw...@yahoo.de>
Date: Fri, 16 Nov 2012 21:07:44 +0100
Local: Fri, Nov 16 2012 3:07 pm
Subject: 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
> 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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »