139347Re: Improve context syntax file
- Sep 26, 2013
On Sep 26, 2013 6:20 PM, "Paul Isambert" <zappathustra@...> wrote:
> Nikolay Pavlov <zyx.vim@...> a écrit:
> > On Sep 26, 2013 2:12 PM, "Marco" <lists@...> wrote:
> > >
> > > On 2013–09–26 Paul Isambert wrote:
> > >
> > > > > But I can't add it permanently. The underscore is only part of a
> > > > > word in between the following blocks.
> > > > >
> > > > > \unprotect … \protect %% or
> > > > > \starttexcode … \stoptexcode
> > > >
> > > > Since there is little chance that an underscore will immediately follow
> > a
> > > > control sequence anyway, I don't think defining it for the entire
> > syntax file
> > > > will cause any problem.
> > >
> > > I tried this. But iskeyword does not change the syntax highlighting.
> > > It only seems to have an effect on the “*” and similar commands. So
> > > changing iskeyword is probably not what I'm after.
> > It also affects \k atom. If changing &iskeyword does not affect syntax
> > highlighting then it means this atom is not used.
> Anyway it’s not a good idea since I had forgotten about math mode indeed.
> > > > However, you can do something along the following lines:
> > > >
> > > > sy match ControlSequence '\\[a-zA-Z]\+'
> > > > sy match SpecialControlSequence '\\[a-zA-Z_]\+' contained
> > > > sy region SpecialCode matchgroup=ControlSequence start='\\unprotect'
> > end='\\protect' contains=SpecialControlSequence
> > >
> > > I tried this, but it removes all syntax highlighting. Frankly, I
> > > have no idea of how the syntax highlighting works. I have to read up
> > > the basics to understand how this exactly works. The issue seems
> > > more complicated than anticipated. But thanks for the snippet, it's
> > > something to start with.
> > You also need to make all other syntax groups be containedin=SpecialCode.
> > Or add contains=... to SpecialCode definition for all groups you need to be
> > highlighted.
> > Note that there is no need in defining two separate syntax groups. You can
> > make two rules for ControlSequence where one will be contained and other
> > will not.
> You also need, above all, to define highlight groups (that was
> implicit in my code, I thought you knew about that), e.g.:
> hi link ControlSequence Statement
That's the reason why I suggest using two syntax rules for one highlighting group: I assume that separate highlighting for the same elements just in different context is not needed.
> But indeed you should learn a little bit more about highlighting (I’ve--
> always found modifying existing syntax files quite painful and easier
> to start from scratch). Otherwise you may perhaps ask someone like
> Aditya Mahajan, who is both an advanced ConTeXt user (he writes in
> TUGboat) and, as far as I know, a Vim user.
> 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+unsubscribe@....
> For more options, visit https://groups.google.com/groups/opt_out.
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+unsubscribe@....
For more options, visit https://groups.google.com/groups/opt_out.
- << Previous post in topic