Garret Dimon posted a couple hints on using TextMate and I noticed most of them could also be done in BBEdit. To be clear, this isn’t meant to be a pissing match but if are using BBEdit and wondering “hey, why the hell do the TextMate folks get to have all the fun?” then you shouldn’t be.
First, let’s learn the key to being a happy and productive BBEdit user. Now, I see Phil Nelson raising his hand and I know where that is going… Look Whiskey is great, but it won’t help you bind all these crazy features to your keyboard. Find the “Set Menu Keys” item under the BBEdit menu. You’ll get a outline of BBEdit’s application menus and a method to set, delete, or re-assign key combinations to each item. Sometimes I find my favorite key-combo is taken and BBEdit will prompt you about this. It is all very simple and the time taken to configure your text editor will be well spent.
Comment Toggle
“By simply highlighting an area and pressing a simple two-key combination you can comment and uncomment a block of code. The best part is that it’s intelligent enough to know what kind of document you’re editing and use the appropriate commenting syntax.”
Easy enough, under BBEdit’s Text menu find the item called “Un/Comment Selection”. By default it is not mapped to a key which is a bit bonehead in my book, but apparently not every BBEdit user is a programmer. There’s something called… writing or copy-editing? I am not sure… sounds scary and I don’t want any part of it.
Inserting Close Element
This one is easy enough, under the Markup menu you’ll find the item “Close Current Tag” and it is already been mapped to Control-Command-C. This is really handy for non-HTML tasks like writing XSL stylesheets as well.
Easy Open & Closing HTML Tags
This one did stump for me a second and I even picked the brain of former BareBones employee John Gruber for ideas. John, who’s job at BareBones was to finish the coffee and not refill pot, came to the same conclusion I did. BBEdit doesn’t handle this exact feature out of the box (it could with a little bit of AppleScript) but there is a comparable feature “Tag Maker”.
Create a new HTML document in BBEdit and your cursor will be smack dab in the middle of the <body> tags. Now just type Command-M here to activate “Tag Maker” and it will bring up a list of all valid tags. You could start typing <table> here and it will jump you down to the tag, select it. Hit Command-M again, now you get a much shorter list of table related tags.
This isn’t really my preferred way of writing HTML, but it does work and it is especially good if you aren’t sure what tags are valid inside of an element. Such as the infamous “can I nest a <p> inside a <p>?” I get once a week. (No)
Wrap Selection in HTML Tag
Well in BBedit this isn’t as easy but it is doable by mapping your favorite key-combo to the HTML elements you commonly use from the Markup menu. Just highlight your text and hit Control-Command-L for example and it will start the process of making a list (<li>) of items from your selection. These days I use Markdown for just about anything HTML related so I can’t say I deal much with the tedious markup.