Hello all,
Two questions:
1. I noticed that in the stock CSS bundle the snippets do not have a 'source' namespace. this is inconvenient since it means they popup when they're not supposed to and take up abbreviations that I would like to use in other contexts for other snippets. so - since there are about 40+ of these things, is there an easy way to change the source on all of them at once?
2. I have little to no experience building TM commands but I am wondering if it is possible to pass parameters from snippet expander shortcuts. perhaps an example would be better:
In CSS bundle using snippet Tab Trigger: 'p' for 'padding', being able to input - for example - 'p20' and get 'padding: 20px;' and then later 'p10' and get 'padding: 10px'
in other words the number is a variable that gets written into the expanded snippet.
this seems like it should be possible but I'm not the man to figure it out.
that's it!
thanks, bennett
On Oct 2, 2010, at 5:52 PM, plastichairdoo wrote:
- I noticed that in the stock CSS bundle the snippets do not have a 'source' namespace.
Everything in my CSS bundle has `source.css` and I haven't messed with that. Maybe you should try to revert back to the default, or install the latest version from GitHub. (GetBundles is the easiest way to keep it up to date.)
In CSS bundle using snippet Tab Trigger: 'p' for 'padding', being able to input - for example - 'p20' and get 'padding: 20px;' and then later 'p10' and get 'padding: 10px'
Well, the tab trigger is based on whatever's to the left of the cursor, so you'd have to create a trigger for every possible value, which is obviously not realistic.
A better way, with the same number of keystrokes just in a different order, is to use a tab-stop in the snippet. So make the tab trigger work from just 'p' and have this as its content:
padding: ${1:0}px;$0
With that, when you hit tab, you'll get 'padding: 0px' and the 0 will be highlighted so you can type something else in its place.
See http://manual.macromates.com/en/snippets#tab_stops
I should mention that there are already a number of useful snippets defined if you're willing to type out 'padding' before hitting ⇥.