1. Code
  2. Web Development

Vim Essential Plugin: Sparkup

This post is part of a series called Vim Essential Plugins.
Vim Essential Plugin: Surround
Vim Essential Plugin: SnipMate

The sparkup plugin, inspired by the popular ZenCoding, allows you to rapidly create HTML structures. It's an essential tool in your Vim handbag!


Sparkup is incredibly easy to use. Let's review a handful of use cases.

1. Create an Unordered List of Links


Note that we can create nested elements by using the > symbol. Additionally, to create multiple elements of the same type, use the * symbol (think multiply). Lastly, we can set the value of each element by wrapping a string within curly braces.

2. Create a Basic Website Structure


This time, we're using the < symbol to travel back up the chain. This allows us to create nested HTML structures, and then return to the top of the chain to further create sibling elements.

3. Apply Attributes to Elements


Attributes can be applied to elements by placing them within brackets ([). If you omit the value -- like, a[href], you can then manually insert it after expansion. In MacVim, you can use the Control + N and Control + P shortcuts to toggle between the next and previous stop points.

Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.