Jake Worth

Jake Worth

Keyword, Match, and Region in VimScript

Published: April 20, 2016 2 min read

  • vim

After a recent talk I gave that included VimScript, an attendee asked a question about the differences between keyword, match, and region following syn in a Vim syntax highlighting file.

These three short chapters from ‘Learn VimScript the Hard Way’ help explain:

Here’s the short version:

  • keyword assigns a variable name directly to a word or multiple words
  • match assigns a variable name to a Vim regex
  • region assigns a variable name to something between a “start” pattern and an “end” pattern

For more info, check out the Vim help pages for each:

:help syn-keyword
:help syn-match
:help syn-region

What are your thoughts on this? Let me know!


Join 100+ engineers who subscribe for advice, commentary, and technical deep-dives into the world of software.