Vim Tips Wiki

Extending keywords

1,624pages on
this wiki
Add New Page
Talk0 Share
Tip 437 Printable Monobook Previous Next

created March 7, 2003 · complexity intermediate · author hzp · version 6.0

Sometimes when you are working with an extended language (such as uC++) there exist keywords that are not included as keywords in the vim release, so you can easily update keywords in two ways.

1. edit your c.vim file [if you are coding c/c++] try 'vim61/runtime/syntax/' for location of these files, and add the keywords in the correct groups,

2. the second way is you can put them all in a separate file, and source it, eg: say i had some new c types, called uTask or uMutex i could get them highlighted as types using the following command:

:syn keyword type uTask uMutex uNoMutex [etc..]


Rather than editing an existing syntax file which will get overwritten every time you upgrade to a newer revision or version of Vim, it's better if you simply create a file in the after/syntax directory (anywhere inside the 'runtimepath') that has the same name as the file you're enhancing (c.vim, for example).

See :help 'runtimepath' for more details on both the runtimepath as well as the order in which files are loaded (which explains why the "after" directory works).

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Also on Fandom

Random Wiki