How to adjust the lexer used by pygments highlighting

Simon Sobisch simonsobisch@gnu.org
Sun Jan 22 14:30:19 GMT 2023


The highlighting via pygments actually works quite fine in general, but 
in some cases it uses the wrong lexer and then has bad results.

It _seems_ that pygments' "filename (extension) based" language lookup 
is not used, because tested files using `pygmentize` are always well 
colored, the ones in GDB sometimes use the wrong lexer.

Question: How can we adjust the lexer used by pygments syntax 
higlighting in GDB for a given file?

Is it possible to setup a filename extension-based selection when GDB 
does not know of the language ("set language " _seems_ to have no effect 
on highlighting, but that would only work if the language is known to 
GDB)? If not can the "normal" extension list [1] be added to GDB or the 
decision which lexer to be used passed on to pygments?

Thank you for any insights,
Simon

[1]: https://pygments.org/languages/


More information about the Gdb mailing list