sharkdp / bat

A cat(1) clone with wings.
Apache License 2.0
49.84k stars 1.26k forks source link

Collection of Syntaxes Available #56

Closed aatxe closed 6 years ago

aatxe commented 6 years ago

I have a pasting service that also uses syntect, and I have a bit of a collection of syntaxes to potentially contribute. I believe many were converted from tmbundles using a ruby gem for this purpose, but they seem to work well enough in my experience. Some of these may already been included, and so I'll list them as a checklist.

They're all available in an archive here. (Sorry in advance, but I unfortunately didn't keep track of the source 😦)

sharkdp commented 6 years ago

Thank you for the feedback!

Unfortunately, we will have to take performance considerations into account when adding lots of new syntax definitions, because (at least right now) the whole SyntaxSet is loaded into memory and deserialized on every run of bat.

Every user will still have the possibility to customize/extend his own syntax set, but I'm not sure we should "blindly" add all the syntax files we can get. When having to choose, I would probably go by popularity of the language (or the corresponding Sublime Text package).

Are there any languages from your list that you think should definitely be included?

aatxe commented 6 years ago

TOML is a must-have, but I see in #37 you already added it. :)

Otherwise, my 0.02 would be Nix (since it's an increasingly popular package manager and definitely the kind of thing where I ordinarily use cat to check out a project config). I was also able to discern that the source for the Nix one is here and converted.

Vue also probably has substantial reach as a popular JS framework.

The rest (ignoring Django) are largely "exotic" languages, and so should perhaps be left out by default. I would personally benefit from the Coq one though.

Porkepix commented 6 years ago

[First of all, sorry if that's not the right place to ask]

So, how/where are defined syntax languages for bat? Just discovered the project and saw that .ini files didn't have coloration. I tried to look a bit and quickly into this repository and syntect to see where is it and where should it be signaled, I'm still unsure though.

And maybe some could be loaded optionnaly if needed, to extend the number of managed language? (lazy load?) Especially, this could be potentially be extended with tools later on, like something doing syntaxic coloration for logs for example.

sharkdp commented 6 years ago

Otherwise, my 0.02 would be Nix (since it's an increasingly popular package manager and definitely the kind of thing where I ordinarily use cat to check out a project config). I was also able to discern that the source for the Nix one is here and converted.

I'd be okay with adding Nix, but I cannot find any .sublime-syntax files in that repo. I would like to avoid having to manually add syntax files somewhere, if possible.

So, how/where are defined syntax languages for bat?

Syntaxes are stored in the bat executable itself. They are loaded in there from this binary file which is, in turn, created by the assets/create.sh script.

Just discovered the project and saw that .ini files didn't have coloration. I tried to look a bit and quickly into this repository and syntect to see where is it and where should it be signaled, I'm still unsure though.

You can list all supported languages by calling

bat --list-languages

And maybe some could be loaded optionnaly if needed, to extend the number of managed language? (lazy load?)

Yes, this would be an option. However, loading .sublime-syntax files from disk and parsing them is quite costly and would significantly affect bat's speed. Have you seen the "Customization" chapter in the README?

sharkdp commented 6 years ago

I am going to close this ticket. Please feel free to open dedicated tickets for single languages that should be added to bat, preferably with a link to a repository with a .sublime-syntax file and some example source code to test it.