[TxMt] Re: CSS bundle questions

Rob McBroom mailinglist0 at skurfer.com
Sun Oct 3 01:33:22 UTC 2010


On Oct 2, 2010, at 5:52 PM, plastichairdoo wrote:

> 1. 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 ⇥.

-- 
Rob McBroom
<http://www.skurfer.com/>




More information about the textmate mailing list