---

Create Your Own Syntax Highlighting in Vim

[ Thanks to Lee
Schlesinger
for this link. ]

“Before you start building your own syntax highlighting rules,
it may help to look at an existing set of rules. There are two ways
you can do this:

“Open a file for which Vim has preloaded rules (e.g. an HTML
file) and type :syntax.

“Edit one of the *.vim files in $VIM/syntax/.

“Most language syntax files have a lot of rules, so don’t get
overwhelmed; just take a quick look at the style of the rules.

“An easy way to get the right setup for your new syntax file is
to copy one of the existing files from $VIM/syntax/ and then delete
most of its content, keeping only what you need and modifying it as
you like. Alternatively, just create a file with the entries here.
The example I’m going to use is for a todo list, with categories
such as work, home, and personal. It might look a bit like
this:”


Complete Story

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends, & analysis