Please see http://www.sublimetext.com/docs/plugin-examples (not sure if it will actually work, it looks like v1 examples) for starters, and http://sublimetext.info/docs/en/extensibility/plugins.html for more