The Vim Syntax File

We know from The Structure of a Vim Plugin, that syntax files are kept in the syntax directory. Create a syntax directory under the main plugin directory if you haven’t done that yet. Then within it, create the file mpdv.vim.

Distinguishing Syntax Elements

We specify syntax elements by using the :syntax command. The command can define several different element types, but the ones we’re most commonly going to use are keyword, match, and region.


Used to specify a keyword element or a list of keyword elements.


Used to specify a class of elements defined by a provided regular-expression pattern.


Used to specify an element defined by starting and ending regular-expression patterns.

Get The VimL Primer now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.