Initial plugin

These commits probably need a rebase but the plugin works for an initial release.

@kenips @zhaohanweng can you guys give this a once-over?