Create Your Own Syntax Highlighting in Vim | Linux Today

Create Your Own Syntax Highlighting in Vim

Written By
Web Webster
Web Webster
Sep 15, 2011

[ 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

Web Webster

Web Webster

Web Webster has more than 20 years of writing and editorial experience in the tech sector. He’s written and edited news, demand generation, user-focused, and thought leadership content for business software solutions, consumer tech, and Linux Today, he edits and writes for a portfolio of tech industry news and analysis websites including webopedia.com, and DatabaseJournal.com.

Linux Today Logo

LinuxToday is a trusted, contributor-driven news resource supporting all types of Linux users. Our thriving international community engages with us through social media and frequent content contributions aimed at solving problems ranging from personal computing to enterprise-level IT operations. LinuxToday serves as a home for a community that struggles to find comparable information elsewhere on the web.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.