Sublime Forum

Syntax highlighting with Pygments


Recently, I was writing man page with groff format, and noticed that Sublime Text 2 does not support the syntax highlight for it.
There are some languages which lacks the syntax highlight.

Pygments supports so many languages, and is written in Python.
Because the plugins are also written in Python, I thought that it would be easy to make a plugin which supports the syntax highlight for multiple languages using Pygments.

I want to make it, when I can take enough time.
But I don’t know If I can.
If someone can make it, please make it.

Are there any thoughts about it?



You can’t because of this and thus the lack of an API to color the foreground text.



Thank you for your information.
Then, I should write a program for automatically making .tmLanguage files from the source of Pygments.
After that, I will make the .tmLanguage files into a package.



Just wondering if anyone has achieved converting a Pygments lexer to a tmLanguage? If yes, that’d be a life savior for many!



I came here looking for this! Has anyone had an update on this?



Hi there.

I did a lot of research lately on groff and friends. It is true that currently there’s no adequate *.tmLanguage definition of roff/troff in the wild. But there are plenty of others available as parts of text editors’ distributions.

I am ready to start building roff language syntax and troff/mandoc snippets for Sublime Text 3, based on syntax definitions from vim, emacs, KTextEdit and VSCode. By the way, Pygments lexer is pretty rudimental, and doesn’t account for man/mandoc-specific markup requests.

My best hope and an ultimate goal is that such plugin would be included in the default Sublime Text distribution. Wish me luck — I gonna need it!