News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Adding new syntax highlights

Started by pozzugno, January 05, 2011, 12:40:21 PM

Previous topic - Next topic

pozzugno

When I open the window "Syntax hilighting", I can change the colours for a list of files type: C/C++, Matlab, HTML, ...
Each file type has a list of file extensions associated.

How can I add a new file type, like "Text" with extension "*.txt"? The Add button adds a colour theme, not a file type.

BentFX

#1
The syntax highlighting is defined by "lexers." On Linux they're in /usr/share/codeblocks/lexers

Each lexer consists of two files. lexer_Name.xml and lexer_Name.sample.

The xml file defines the different syntax types and keywords. The sample file is the text that appears in the highlighted preview.

If you're interested in experimenting with creating new lexers the files can be created within your personal config. Again, assuming Linux, create the directory ~/.codeblocks/share/codeblocks/lexers and any files created within that directory will be loaded on C::B startup.

The wiki has information on creating lexers.

Good Luck & Have Fun!

(In actuallity, the xml file can point to any file to use as the sample text. It's just that lexer_Name.sample is the standard naming convention.)
(new reply to old post. Since the question still shows up in search it should be answered.)
Whenever I go to Walmart I always request an intrusive pat-down from the greeter. It looks good on his resume, and it makes us all just a little bit safer.