Notepad++ new keywords defined with regex for the Styler configuration

Aravind Nadumane picture Aravind Nadumane · Dec 13, 2013 · Viewed 7.6k times · Source

If I want to add new keywords in the Styler configuration for the "c" language suppose, and I have my custom defined data type. for eg:

uint_8 a;
uint_16 b;
uint_32 c;
uint_12bla bla;*

is it possible to add somehow the keywords, instead of adding explictly harcoding each keywords, as a regex, (uint_\d+\w*) ?

mostly benifitted, incase I have thousands of intrinsics starting with naming format and I want to highlight all of them. eg:

vector_intrinsic_add(a,b);
vector_intrinsic_mul(a,b);
vector_intrinsic_shit_right(a,b);
vector_intrinsic_shift_left(a,b);
vector_intrinsic_fill_zero(a);
vector_intrinsic_do_bla(a,b);

Answer

Austin Hastings picture Austin Hastings · Jan 15, 2014

In the Styler configurator, you can declare a keyword "group" to have the "Prefix" property. That means that the patterns which match the group will still be colored if they have extra text following them.

If you're fairly confident that anything starting with uint_|vector_intrinsic_ should be highlighted, then go ahead and allocate a group for that purpose. Beware that you only get 4 groups, so you may need to shuffle some keywords around to get the configuration you want.

Source: http://npp-community.tuxfamily.org/documentation/notepad-user-manual/languages/user-defined-languages