Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add syntax highlighting support for GABC files #3058

Open
lbssousa opened this issue Dec 16, 2024 · 3 comments
Open

Add syntax highlighting support for GABC files #3058

lbssousa opened this issue Dec 16, 2024 · 3 comments

Comments

@lbssousa
Copy link

lbssousa commented Dec 16, 2024

Gregorio project, which provides a set of tools for typesetting gregorian chant in LaTeX (already shipped with MikTeX and TeX Live), provides a Vim syntax config for GABC files. Please consider including it in vimtex bundle.

Source: https://github.com/gregorio-project/gregorio/blob/master/contrib/gabc.vim

@lervag
Copy link
Owner

lervag commented Dec 18, 2024

That's definitely interesting. However, the project is GPLv3 licensed, so if I understand correctly, I would have to change my own license to GPLv3 if I included this?

Also, it would be very helpful if you could provide some example files here. Yes, I can look it up. But I don't have very much time and I have zero knowledge of this package from earlier. Thus, it would take me some time to find the correct and good examples. So, if I'm to support something here it would be very useful to have relatively specific requests that does not require me to read up on and learn the entire package.

Also, notice that the file you link to seems to be a separate type of syntax and not something that would be included in a tex file. I may be wrong, but the way it is defined sure looks like that; see e.g. the last line.

@lbssousa
Copy link
Author

That's definitely interesting. However, the project is GPLv3 licensed, so if I understand correctly, I would have to change my own license to GPLv3 if I included this?

Hmmm... I'm not sure about that, but I guess the mere bundling of gabc.vim from Gregorio project, given the authors' credits, doesn't violate the GPLv3.

Also, it would be very helpful if you could provide some example files here. Yes, I can look it up. But I don't have very much time and I have zero knowledge of this package from earlier. Thus, it would take me some time to find the correct and good examples. So, if I'm to support something here it would be very useful to have relatively specific requests that does not require me to read up on and learn the entire package.

Let me show you an example:

name: Puer natus est;
annotation: Intr.;
annotation: VII;
nabc-lines: 1;
%%
(c3)
Pu(ei|`````tvhl```peSlsm2lsim8)er(i|vilse4) *() na(iji|tolse4)tus(h|ta) est(hhh|ts) no(ih/ji|pflsl3lsp1lsc1)bis,(i|vi) (,)
et(fi~|ta>lsi7) fí(iji|to)li(hf|cllsc3)us(f|ta) da(h|vi-|hi|pe)tus(h|ta) est(h|ta) no(hihh|tr)bis:(efe|tolst2) (;)
cu(e|````talse4)jus(f|vi) im(h|vi)pé(gi!jk|peShjppt2lsi7)ri(ih|cllsc3)um(h|ta) (,?)
su(h|ta)per(h|ta) hú(ih/ji|pflsl3lsm4lsi7)me(hg|cl-lst2)rum(hhh|ts) e(hf|cl-lst2|hg/hgf~|pf>lsc2)jus:(gf|cl-) (;)
et(fhg|tolsc2lsi7) vo(h|vi)cá(hji|````tolse4)bi(h|ta)tur(hhh|ts) no(h|ta)men(hhh|ts)
e(hih|````toS2lssm2lse4|hgf~|cl->)jus,(gf|cl-) (,) ma(hj|````pe>1lss4)gni(i|vi) con(fh~|ta>lsiv8)sí(h|vi)lii(hh|ds|hf|cl-)
An(fhf!gwh|````toSlse4ql>lss3)ge(efe|//toS)lus.(e|ta) <i>Ps.</i>(::)

Can(hg~|vi>lss6)tá(hi|pe)te(i|vi) Dó(i|vi)mi(i|vi)no(i|vi) cán(ik|pe)ti(j|vi)cum(j|vi) no(ji|cl)vum:(ij|pe) *(:)
qui(ig|cl)a(hi|pe) mi(i|vi)ra(i|vi)bí(jwk|qi)li(i|vi)a(h|ta) fe(hhh|ts)cit.(fef|cl-vi-lsim8) (::)

This code with syntax highlighting enabled in NeoVim by Gregorio's gabc.vim should look like this:
image

You can find many other GABC examples in GregoBase repository. The reference documentation for GABC syntax can be found in this document, and NABC extension for GABC notation (which is used in the example above) is described in this other one.

Also, notice that the file you link to seems to be a separate type of syntax and not something that would be included in a tex file. I may be wrong, but the way it is defined sure looks like that; see e.g. the last line.

Ah, yes, this syntax is not intended for .tex files, but for .gabc ones. Gregorio has a transpiler that generates LaTeX code from GABC files.

@lervag
Copy link
Owner

lervag commented Dec 19, 2024

Let me show you an example: …

Thanks!

Also, notice that the file you link to seems to be a separate type of syntax and not something that would be included in a tex file. I may be wrong, but the way it is defined sure looks like that; see e.g. the last line.

Ah, yes, this syntax is not intended for .tex files, but for .gabc ones. Gregorio has a transpiler that generates LaTeX code from GABC files.

Ah, well; I'm not perfectly convinced that I want to add syntax rules for different file types here.

In my humble opinion, I think the best approach for making Gregorio more attainable to new users who want to use Vim or neovim would be the following:

  1. Contribute to the main home page, specifically to the editor pages. Currently, there is no information for Vim users.

  2. Ask the Gregorio devs if it is OK to take the Vim syntax file out into its own plugin, or perhaps even make a PR for Vim itself. If it is a separate plugin, then the docs (see step 1.) could easily explain how users should install that plugin. And, even better, if this were merged into Vim itself, it would "just work" for everyone immediately.

If I were to add this to VimTeX, I feel I have to spend some time learning this filetype so I would be able to maintain it properly. I think the approach I outlined above is better and would be more valuable to the community.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants