If you’re not using SublimeText2, you really don’t know what you’re missing…
Just head on over to the home page and see a few of the features that make
this just a fantastic editor. I won’t go into detail just yet…
Snippets
What I wanted to write about today is snippets. The snippet system in SublimeText2
is quite… well… sublime. But I was originally having trouble getting them to work (or
so I thought).
My snippet (javascript) looked like this:
1 | <!-- Note: not actually working --> |
… and what I failed to realize was that the source.javascript
line should
actually by source.js
. Ah well, problem solved.
1 | <!-- Working, hooray! --> |
What this snippet does
The snippet in question is for firing off blazing fast ko.computed
definitions.
By typing comp<tab>
you get a bit of code that looks like this:
1 | self.method = ko.computed(function () { |
To start with, both self
s are highlighted, as per Sublime Text 2’s multi-select
style. Sweet. Hit <tab>
and we jump to method
selected, fill that in, hittab
one more time, and now // content
is the current selection, fill in to finish.
This snipped can be got here.
Tip: can’t find your
Packages
folder? In Sublime Text 2, selectPreferences > Browse Packages
and browse to theUser
folder.
Cheers,
Aaron