Using conceal with Syntax Regions

For the playlist highlighting, we’re going to use region syntax groups. We’ll use special characters to delimit each item in a track, but we won’t show those characters—they’re just to help us with highlighting. The effect will be to use different colors for each item that makes up a track. To do this, we’ll make use of a special feature of Vim’s syntax highlighting: conceal.

conceal is actually an argument that we can give to the :syntax command; it tells Vim that it can hide (or conceal) an element when it comes across it. The related argument concealends does the same thing, but for the start and end characters of a region: when we use it, the ends become concealable, and the text between the ends doesn’t. ...

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.