I’ve never been a fan of snippets, since you need to in some way or another learn someone else’s abbreviations1, but I’ve come to realize that repetitive typing is boring. Some characters are just a pain to type on a non-US keyboard too. Enter UltiSnips.
My favorite feature of UltiSnips is being able to use placeholders. Let’s take this snippet for example:
The cursor will first place itself on the
$1. When you hit
visually select the word
assert which you can operate on if you need to.
is the position for the last “tab” stop. If you need to go back to a previous
Another handy thing is
:UltiSnipsEdit, a neat command which will open the
snippets file for the current file’s language. This means that you can add or
edit your own snippets and they’ll be available as soon as you save it. Remember
that you may need to use
:UltiSnipsAddFiletypes <lang> to create the
snippets file if it isn’t already there.
In short, if you’re looking for a snippet engine for Vim you should definitively try UltiSnips!