Vim Tips Wiki

Extending keywords

Revision as of 06:19, November 4, 2007 by JohnBot (Talk | contribs)

1,619pages on
this wiki
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).

Around Wikia's network

Random Wiki