Setting up some snippets for hacking away at C++.
UPDATE: Go to http://github.com/derekwyatt/vim-config to get the current version of this stuff.
I’m not entirely sure where the “snippet” concept came from but it certainly appears to have been made famous by TextMate. And in the great sprit of ripping stuff off, people have gone nuts in Vim community making snippet plugins:
I’ve used four snippet template systems…
- snippetsEmu was the first.
- snipMate came next and improved upon snippetsEmu in a big way
- xptemplate is what I’m using now - it’s still the best.
- UltiSnips is a new contender that I’ve tried but it’s a bit fragile at the moment. It has some serious potential but it’s not quite there.
Some of the snippets that are included in the xptemplate plugin file you can can download below.
test– Creates an entire C++ implementation file for CPPUNIT that lets you get right into coding up your test immediately.
tf– Test function definition that works with the automatic registration code defined in General C++ Settings.
try– Try/Catch blocks.
tsp– Typedef to a
header– Creates a header file for a given class, includes the namespace (if your directory to the file is like
include/name/space/goes/here), include guards, and the whole deal.
src– Creates a source file with a companion to the header file. Pulls in definitions using Protodef, and also requires FSwitch.
- … and more …
Download FSwitch here.
Download Protodef here.