I would like to create a new syntax highlighting files to colorize files with specific suffix (let's say .cext extenstion).

The .cext files are written with a syntax close to C++ but with some additional keywords and constructs.

Is there a way to create such new syntax highlighting without reinventing the wheel and by stating that the starting point is C++ syntax with some additional rules needed by the extensions used in .cext?

1 Answer 1


The user manual explains how to do this at :help 44.9.

In your new cext.vim syntax highlighting file, add the following line to include the Vim runtime's existing C++ highlighting:

:runtime! syntax/cpp.vim

You can then add/adjust rules to meet your requirements.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.