I'm experimenting with a way to generate id/class names from the selected text when I trigger one of my headline commands. I really like the way this turned out and thought I would share it. Unless someone comes back and asks me to make changes, I promise I'll stop now. I prefer camel case in CSS files, but I've been known to be inconsistent. I made commands to switch between the two as well. I apologize to anyone who is currently rolling their eyes ;->.
I'm attaching the command for an h1 tag with a shortcut key of command-1 that will take selected text or the whole line and turn it into a headline. It removes leading spaces and tabs and there's a camel case version and an underscore version. On a long headline the id name gets ridiculous, so there's a command that will work on both to shorten it to the first three words. And lastly, in case you can't make up your mind either, or need to correct your own inconsistency like I do, there's a convert command that will switch back and forth. The shorten and convert commands are set to command-! (exclamation point). I also used an h1 tab trigger on the h1 commands which you may want to remove if you keep the original h1 snippets. If used with the tab trigger, they behave just like the old snippets, except they'll mirror and transform the text you type between the tags.
Enough rambling.
Brett
Figures. Embarrassed again ;-).
Thanks, Brett
On Oct 26, 2006, at 2:47 PM, Allan Odgaard wrote:
On 26. Oct 2006, at 20:57, Brett Terpstra wrote:
<Convert camelCase:underscore.tmCommand>
Actually, the Source bundle already has such command (scoped to source).
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate