Thursday, September 26, 2013

Re: Improve context syntax file


On Sep 26, 2013 11:53 AM, "Marco" <lists@homerow.info> wrote:
>
> On 2013–09–26 Nikolay Pavlov wrote:
>
> > > Does someone have a solution for the remaining two problems?
> >
> > I guess you need to alter iskeyword for the problem with underscore.
>
> 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

If you want to respect this I see no way other then duplicating syntax definitions for inner region. :execute is your friend here.

> > But different comments could be only a result of patching
> > commetary and other plugins. You can try hacking with
> > CursorMoved/CursorMovedI events but likely you will introduce more
> > problems then solve.
>
> I don't think patching commetary is the right solution. It's a very
> small plugin only relying on commentstring. Furthermore, vim knows
> already that it's inside a Lua snippet (it switched to Lua syntax
> highlighting) and it knows that it's inside a Lua comment (it's
> highlighted as a comment). So all required information is available
> at this point. If I only could make vim change the commentstring in
> this case, that would be perfect.

Vim knows nothing. Lua syntax highlighting groups are not a tiny bit different from any other syntax highlighting group included in any other cluster (implementation of :syn include). There is no source of information about &commentstring in lua hl group that defines highlighting for comments. Also what vim is supposed to use if you included multiple languages in the selection and want to comment it? And note that there is no line-local options.

You must patch commentary to make it obtain information from the syntax group name or use some plugin that is already capable of doing this: information that really is there requires human for teaching computer to interpret it. Vim cannot do this itself.

Note that it is likely that no plugins capable of doing this use &commentstring for nested region due to problems which will appear if one sources ftplugin for different filetype.

> Marco

--
--
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@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment