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.

keyword

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

match

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

region

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

Get The VimL Primer now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.