Shortcut to create a javascript function stub in Sublime Text 2

1.2k Views Asked by At

Is it possible to quickly create a method stub in Sublime Text 2? Perhaps a package I could install?

For example, I bind something in jquery -

$("p").bind("click", {foo: "bar"}, handler)

Could I rightclick on handler, then choose an option to stub out a function?

Doesn't have to be a right click, a keyboard shortcut would be even better.

I've added textmate to the tags, as Sublime is compatible with text mate plugins.

2

There are 2 best solutions below

1
On

You just need to type f and then press tab
Bonus: typing fun and then pressing tab will give you a named function

0
On

This would be very easy to do with a plugin. Sublime Text has a very extendable API and uses python for its plugins. You will get a much better response if you post this on sublime text's forum: sublimetext.com/forum/

Many people are willing to help you there and will probably make the plugin for you in a matter of minutes.