adityam / filter

ConTeXt module to process contents of a start-stop environment through an external program
45 stars 10 forks source link

Utility of line 172 in 2context.vim #46

Closed Semptum closed 3 years ago

Semptum commented 3 years ago

Hi, Apologies, I'm rather new to ConTeXt and vim so i might be completely wrong. This comment is from the perspective of trying to make Julia be correctly highlighted. I have a suspicion that the question I'm asking is linked to the preferred groups and that I didn't quite understand the code right. If not, here's the question:

Does the line 172

let s:id      = synIDtrans (s:id)

still have a use? It seems to mangle the IDs and (at least for Julia) results in id_name=juliaNone for a lot of different IDs.

Best regards.

adityam commented 3 years ago

Many syntax highlight schemes provide an intermediate groups for syntax regions. For example, the syntax highlighting scheme included in julia-vim package provides juliaParDelim, juliaSemicolon, etc. These are typically linked to a group name (either preferred or minor group, see :he group-name).

The line in question is used to determine what this final group is. The reason that you are seeing juliaNone is that the syntax color scheme of julia-vim decides to map some elements to juliaNone.

What is the behavior that you expect here? What element should, say, juliaParDelim map to? It might be possible to change these mappings using the extra key.

Semptum commented 3 years ago

Thank you, this was a very clear explanation.

I added an extra option to rewrite some of those elements (for instance juliaParDelim->Delimiter). Together with a custom colorscheme your plugin provides complete control over the highlighting of code without changes to the source code. I will read the docs until the end next time...

Thank you very much, sorry for the non-issue issue.

Best regards!

adityam commented 3 years ago

No worries. The module depends quite a lot on the internals of how syntax highlighting works in vim. Since you have figured it out, it may be a good idea to post a complete working example here so that it may help someone who is trying to do so in the future

Semptum commented 3 years ago

That might be a good idea but I'm not yet entirely comfortable with the vim ecosystem, for instance I have no idea if I can load the julia highlighting without using a plugin manager.

Right now a non-minimal working example (a pruned variant of what I'm using for work) for me is in the attached files (a bit too long with the colorscheme to cite below). The extensions have been changed to comply with github's rules.

s-exam.txt exam.txt

I probably make some bad choices in there. For instance, I have in my documents about 50-100 snippets (that's a short document of a few pages) including the inline ones and using syntax highlighting adds about 10 seconds to the compilation going from 0.5 to 10.5 seconds. I'm thinking part of this might be due to loading vundle. Also this makes the compilation dependent on a vim package whereas I would prefere to give it to vim locally (adding the julia.vim file to the project). Simply sourcing it from the vimrc section of the style file doesn't work.