<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Ciarán Walsh’s Blog</title>
	
	<link>http://ciaranwal.sh</link>
	<description />
	<lastBuildDate>Thu, 02 Oct 2008 10:38:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<feedburner:info uri="ciaranwalsh" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://ciaranwal.sh/feed" /><feedburner:feedFlare href="http://add.my.yahoo.com/rss?url=http%3A%2F%2Fciaranwal.sh%2Ffeed" src="http://us.i1.yimg.com/us.yimg.com/i/us/my/addtomyyahoo4.gif">Subscribe with My Yahoo!</feedburner:feedFlare><feedburner:feedFlare href="http://www.newsgator.com/ngs/subscriber/subext.aspx?url=http%3A%2F%2Fciaranwal.sh%2Ffeed" src="http://www.newsgator.com/images/ngsub1.gif">Subscribe with NewsGator</feedburner:feedFlare><feedburner:feedFlare href="http://feeds.my.aol.com/add.jsp?url=http%3A%2F%2Fciaranwal.sh%2Ffeed" src="http://o.aolcdn.com/favorites.my.aol.com/webmaster/ffclient/webroot/locale/en-US/images/myAOLButtonSmall.gif">Subscribe with My AOL</feedburner:feedFlare><feedburner:feedFlare href="http://www.bloglines.com/sub/http://ciaranwal.sh/feed" src="http://www.bloglines.com/images/sub_modern11.gif">Subscribe with Bloglines</feedburner:feedFlare><feedburner:feedFlare href="http://www.netvibes.com/subscribe.php?url=http%3A%2F%2Fciaranwal.sh%2Ffeed" src="http://www.netvibes.com/img/add2netvibes.gif">Subscribe with Netvibes</feedburner:feedFlare><feedburner:feedFlare href="http://fusion.google.com/add?feedurl=http%3A%2F%2Fciaranwal.sh%2Ffeed" src="http://buttons.googlesyndication.com/fusion/add.gif">Subscribe with Google</feedburner:feedFlare><feedburner:feedFlare href="http://www.pageflakes.com/subscribe.aspx?url=http%3A%2F%2Fciaranwal.sh%2Ffeed" src="http://www.pageflakes.com/ImageFile.ashx?instanceId=Static_4&amp;fileName=ATP_blu_91x17.gif">Subscribe with Pageflakes</feedburner:feedFlare><item>
		<title>Minor ProjectPlus Update</title>
		<link>http://feedproxy.google.com/~r/ciaranwalsh/~3/x_sPzd_ChQw/projectplus-update-2</link>
		<comments>http://ciaranwal.sh/2008/08/29/projectplus-update-2#comments</comments>
		<pubDate>Fri, 29 Aug 2008 18:21:04 +0000</pubDate>
		<dc:creator>Ciarán</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[TextMate]]></category>

		<guid isPermaLink="false">http://ciaranwal.sh/2008/08/29/projectplus-update-2</guid>
		<description><![CDATA[Just a bug-fix. More to come as I get time. Get it here, or wait for Sparkle to update it for you.]]></description>
			<content:encoded><![CDATA[<p>Just a bug-fix. More to come as I get time.</p>

<p>Get it <a href="http://ciaranwal.sh/projectplus-files/releases/ProjectPlus_v1_2.tmplugin.zip">here</a>, or wait for Sparkle to update it for you.</p>
<img src="http://feeds.feedburner.com/~r/ciaranwalsh/~4/x_sPzd_ChQw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://ciaranwal.sh/2008/08/29/projectplus-update-2/feed</wfw:commentRss>
		<slash:comments>40</slash:comments>
		<feedburner:origLink>http://ciaranwal.sh/2008/08/29/projectplus-update-2</feedburner:origLink></item>
		<item>
		<title>ProjectPlus Update</title>
		<link>http://feedproxy.google.com/~r/ciaranwalsh/~3/arl4WLuDEbM/projectplus-update</link>
		<comments>http://ciaranwal.sh/2008/08/21/projectplus-update#comments</comments>
		<pubDate>Wed, 20 Aug 2008 23:38:40 +0000</pubDate>
		<dc:creator>Ciarán</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[TextMate]]></category>

		<guid isPermaLink="false">http://ciaranwal.sh/?p=50</guid>
		<description><![CDATA[Release notes: Sidebar TextMate does not load plug-ins until after the application is finished launching, which was causing problems when launching by double-clicking a project file (the project would open without a drawer or pane). This is now handled gracefully, but projects opened in this way will always have the drawer as they are opened [...]]]></description>
			<content:encoded><![CDATA[<p>Release notes:</p>

<ul>
<li><p>Sidebar</p>

<ul>
<li>TextMate does not load plug-ins until after the application is finished launching, which was causing problems when launching by double-clicking a project file (the project would open without a drawer or pane). This is now handled gracefully, but projects opened in this way will always have the drawer as they are opened before ProjectPlus is loaded.</li>
</ul></li>
<li><p>SCM Badges</p>

<ul>
<li>Added support for Mercurial, Svk and Bazaar (these should be considered experimental – I don’t use them so please report issues)</li>
<li>Hopefully more to come, based on demand and how easy they are to implement</li>
<li>Since there are now quite a few, and some of them are expensive to have enabled (as all except SVN use shell execution), all of the SCM modules are disabled by default and you must selectively enable the ones you want</li>
<li>Fixed a memory leak that could occur when using SVN badging</li>
<li>Misc. performance improvements and bugfixes</li>
</ul></li>
<li><p>General:</p>

<ul>
<li>Added Sparkle for automatic updates to future versions</li>
<li>Added an icon (thanks to Oliver Busch)</li>
<li>Other miscellaneous tweaks and improvements</li>
</ul></li>
</ul>

<p><a href="http://ciaranwal.sh/projectplus-files/releases/ProjectPlus_v1_1.tmplugin.zip">Download</a>.</p>

<p><p>Please report any issues you find at the new <a href="http://ciaranwal.sh/projectplus-files/ticket">bug tracker</a>.</p>
<img src="http://feeds.feedburner.com/~r/ciaranwalsh/~4/arl4WLuDEbM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://ciaranwal.sh/2008/08/21/projectplus-update/feed</wfw:commentRss>
		<slash:comments>28</slash:comments>
		<feedburner:origLink>http://ciaranwal.sh/2008/08/21/projectplus-update</feedburner:origLink></item>
		<item>
		<title>TextMate Plug-in: ProjectPlus</title>
		<link>http://feedproxy.google.com/~r/ciaranwalsh/~3/q8JWnUzuKEg/textmate-plug-in-projectplus</link>
		<comments>http://ciaranwal.sh/2008/08/05/textmate-plug-in-projectplus#comments</comments>
		<pubDate>Tue, 05 Aug 2008 17:35:58 +0000</pubDate>
		<dc:creator>Ciarán</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[TextMate]]></category>

		<guid isPermaLink="false">http://ciaranwal.sh/?p=48</guid>
		<description><![CDATA[I put this plug-in together some time ago and never released it; I just recently returned to it to while doing the SVN 1.5 update, added some more features and fixed some bugs, and I’m going to put this up as a beta release now. Mostly it’s a compilation of some of my other plug-ins, [...]]]></description>
			<content:encoded><![CDATA[<p>I put this plug-in together some time ago and never released it; I just recently returned to it to while doing the SVN 1.5 update, added some more features and fixed some bugs, and I’m going to put this up as a beta release now. Mostly it’s a compilation of some of my other plug-ins, plus some miscellaneous new features.</p>

<p>Feature list:</p>

<ul>
<li><p>SCM status badges:</p>

<ul>
<li>Support for SVN and Git</li>
<li>Displayed in the project file list and the window proxy icon</li>
</ul></li>
<li><p>Swapping the project drawer for a panel</p>

<ul>
<li>Support for <code><abbr title="Control-Option-Command-D">⌃⌥⌘D</abbr></code> and <code><abbr title="Control-Command-R">⌃⌘R</abbr></code> is kept</li>
<li>The sidebar can be placed on either side of the window</li>
<li>Since I created this someone has updated the MissingDrawer plug-in with these features, if you wish to use this plug-in instead then you can disable the feature</li>
</ul></li>
<li><p>Finder colour labels</p>

<ul>
<li>Labelled files are displayed in the project drawer</li>
<li>Label can be set through the context menu</li>
</ul></li>
<li><p>Project-tree state can be preserved when re-opening the project</p></li>
<li>QuickLook preview of files in the project file list through the context menu (or <code><abbr title="Option-Space">⌥␣</abbr></code> when the file list is focused)</li>
<li>Sorting options through the project file list context menu</li>
<li>Display folders on top</li>
<li>Sort by file extension</li>
<li>“Open With” option</li>
</ul>

<p>You should remove any conflicting plug-ins before installing, by deleting them from <code>~/Library/Application Support/TextMate/PlugIns</code>.</p>

<p><a href="http://ciaranwal.sh/files/ProjectPlus.tmplugin.zip">Download ProjectPlus</a>.</p>
<img src="http://feeds.feedburner.com/~r/ciaranwalsh/~4/q8JWnUzuKEg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://ciaranwal.sh/2008/08/05/textmate-plug-in-projectplus/feed</wfw:commentRss>
		<slash:comments>185</slash:comments>
		<feedburner:origLink>http://ciaranwal.sh/2008/08/05/textmate-plug-in-projectplus</feedburner:origLink></item>
		<item>
		<title>SVNMate Update for Subversion 1.5</title>
		<link>http://feedproxy.google.com/~r/ciaranwalsh/~3/5h_ec3smGdA/svnmate-update-for-subversion-15</link>
		<comments>http://ciaranwal.sh/2008/07/30/svnmate-update-for-subversion-15#comments</comments>
		<pubDate>Wed, 30 Jul 2008 16:24:38 +0000</pubDate>
		<dc:creator>Ciarán</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[TextMate]]></category>

		<guid isPermaLink="false">http://ciaranwal.sh/?p=47</guid>
		<description><![CDATA[Well, after a long night of hacking I’ve finally got this up and running. I’ve used the libraries in a different way to the previous version which will make the whole update process easier in future. Get it here]]></description>
			<content:encoded><![CDATA[<p>Well, after a long night of hacking I’ve finally got this up and running. I’ve used the libraries in a different way to the previous version which will make the whole update process easier in future.</p>

<p><a href="http://ciaranwal.sh/files/SVNMate.tmplugin.zip">Get it here</a></p>
<img src="http://feeds.feedburner.com/~r/ciaranwalsh/~4/5h_ec3smGdA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://ciaranwal.sh/2008/07/30/svnmate-update-for-subversion-15/feed</wfw:commentRss>
		<slash:comments>12</slash:comments>
		<feedburner:origLink>http://ciaranwal.sh/2008/07/30/svnmate-update-for-subversion-15</feedburner:origLink></item>
		<item>
		<title>TextMate Plug-in – Find and Replace History Keyboard Navigation</title>
		<link>http://feedproxy.google.com/~r/ciaranwalsh/~3/lD_sQ9SQhRg/find-and-replace-history-keyboard-navigation</link>
		<comments>http://ciaranwal.sh/2008/05/25/find-and-replace-history-keyboard-navigation#comments</comments>
		<pubDate>Sat, 24 May 2008 23:03:14 +0000</pubDate>
		<dc:creator>Ciarán</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[TextMate]]></category>

		<guid isPermaLink="false">http://ciaranwal.sh/2008/05/25/textmate-plug-in-%e2%80%93-find-and-replace-history-keyboard-navigation</guid>
		<description><![CDATA[Someone recently asked for a plug-in to navigate the find/replace history with the keyboard. After installing it you can use <abbr title="Control-Up">⌃↑</abbr>/↓ to move to the next/previous value.]]></description>
			<content:encoded><![CDATA[<p>Someone recently asked for a <a href="http://ciaranwal.sh/files/FindHistory.tmplugin.zip">plug-in to navigate the find/replace history with the keyboard</a>.
After installing it you can use <code><abbr title="Control-Up">⌃↑</abbr></code>/<code>↓</code> to move to the next/previous value.</p>
<img src="http://feeds.feedburner.com/~r/ciaranwalsh/~4/lD_sQ9SQhRg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://ciaranwal.sh/2008/05/25/find-and-replace-history-keyboard-navigation/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		<feedburner:origLink>http://ciaranwal.sh/2008/05/25/find-and-replace-history-keyboard-navigation</feedburner:origLink></item>
		<item>
		<title>Cocoa Developer Meetup in Manchester</title>
		<link>http://feedproxy.google.com/~r/ciaranwalsh/~3/H_s6GgcuGqc/cocoa-developer-meetup-in-manchester</link>
		<comments>http://ciaranwal.sh/2008/05/08/cocoa-developer-meetup-in-manchester#comments</comments>
		<pubDate>Wed, 07 May 2008 23:37:40 +0000</pubDate>
		<dc:creator>Ciarán</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://ciaranwal.sh/?p=45</guid>
		<description><![CDATA[If anyone is local to Manchester (England) and is interested in writing applications for OS X or the iPhone then come and join us next Thursday for our first meetup. Hopefully there’ll be a mix of old hands and people just starting out with Cocoa, so whatever your skill level is you’ll still be welcome. [...]]]></description>
			<content:encoded><![CDATA[<p>If anyone is local to Manchester (England) and is interested in writing applications for OS X or the iPhone then come and join us next Thursday for our first meetup. Hopefully there’ll be a mix of old hands and people just starting out with Cocoa, so whatever your skill level is you’ll still be welcome.</p>

<p>Check out the <a href="http://upcoming.yahoo.com/event/594138">Upcoming</a> event page for all the details.</p>
<img src="http://feeds.feedburner.com/~r/ciaranwalsh/~4/H_s6GgcuGqc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://ciaranwal.sh/2008/05/08/cocoa-developer-meetup-in-manchester/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://ciaranwal.sh/2008/05/08/cocoa-developer-meetup-in-manchester</feedburner:origLink></item>
		<item>
		<title>TextMate Tip – Using PHP for Commands</title>
		<link>http://feedproxy.google.com/~r/ciaranwalsh/~3/q8Ut3L1JUeI/textmate-tip-using-php-for-commands</link>
		<comments>http://ciaranwal.sh/2008/04/04/textmate-tip-using-php-for-commands#comments</comments>
		<pubDate>Fri, 04 Apr 2008 02:37:33 +0000</pubDate>
		<dc:creator>Ciarán</dc:creator>
				<category><![CDATA[TextMate]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://ciaranwal.sh/2008/04/03/textmate-tip-using-php-for-commands</guid>
		<description><![CDATA[Not many people realise that all the commands given to you by TextMate are written as simple scripts, editable by anyone, and in any language. PHP is a widespread language, but not many people are accustomed to using PHP for writing shell scripts, so they don’t know how to start writing a command – here [...]]]></description>
			<content:encoded><![CDATA[<p>Not many people realise that all the commands given to you by TextMate are written as simple scripts, editable by anyone, and in any language. <a href="http://www.php.net/" title="PHP: Hypertext Preprocessor">PHP</a> is a widespread language, but not many people are accustomed to using PHP for writing shell scripts, so they don’t know how to start writing a command – here I’ll explain how.</p>

<p><span id="more-43"></span></p>

<p>Let’s pretend we’re going to be writing some FAQ lists, so we’ll have a list of questions, like this:
<pre CLASS="textmate-source"><code>This is the first question 
This is the second question 
This is the &#42;third&#42; question</code></pre>
And we want to convert it to a list of links to the questions, like this:
<pre CLASS="textmate-source"><span CLASS="text text_html text_html_basic"><span CLASS="meta meta_tag meta_tag_inline meta_tag_inline_any meta_tag_inline_any_html">&lt;a <span CLASS="entity entity_other entity_other_attribute-name entity_other_attribute-name_html">href</span>=<span CLASS="string string_quoted string_quoted_double string_quoted_double_html">"faqlist.html#this-is-the-first-question"</span>&gt;</span>This is the first question<span CLASS="meta meta_tag meta_tag_inline meta_tag_inline_any meta_tag_inline_any_html">&lt;/a&gt;</span></span>
<span CLASS="text text_html text_html_basic"><span CLASS="meta meta_tag meta_tag_inline meta_tag_inline_any meta_tag_inline_any_html">&lt;a <span CLASS="entity entity_other entity_other_attribute-name entity_other_attribute-name_html">href</span>=<span CLASS="string string_quoted string_quoted_double string_quoted_double_html">"faqlist.html#this-is-the-second-question"</span>&gt;</span>This is the second question<span CLASS="meta meta_tag meta_tag_inline meta_tag_inline_any meta_tag_inline_any_html">&lt;/a&gt;</span></span>
<span CLASS="text text_html text_html_basic"><span CLASS="meta meta_tag meta_tag_inline meta_tag_inline_any meta_tag_inline_any_html">&lt;a <span CLASS="entity entity_other entity_other_attribute-name entity_other_attribute-name_html">href</span>=<span CLASS="string string_quoted string_quoted_double string_quoted_double_html">"faqlist.html#this-is-the-third-question"</span>&gt;</span>This is the <em>third</em> question<span CLASS="meta meta_tag meta_tag_inline meta_tag_inline_any meta_tag_inline_any_html">&lt;/a&gt;</span></span></pre>
First, you’ll need to make a new command – open the bundle editor (<em>Bundles → Bundle Editor → Show Bundle Editor…</em> or <code><abbr title="Control-Option-Command-B">⌃⌥⌘B</abbr></code>) and use the bottom left button (with a plus sign and an arrow) to create a “New Command”, and name it “Create FAQ Index”. The large text field on the right is where you’ll be entering the code for the command.</p>

<p>To start, you’ll need to tell TextMate that the command needs to run with PHP, which is done with a shebang:
<pre CLASS="textmate-source"><code>#!/usr/bin/env php 
&lt;?php
<span CLASS="comment comment_line comment_line_double-slash comment_line_double-slash_php"><span CLASS="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_php">//</span>Our code will go here</span>
?&gt;
</code></pre>
TextMate commands basically have 3 factors:</p>

<ul>
<li>Reading input (provided on standard input, and some information is given in environment variables)</li>
<li>Processing the input</li>
<li>Doing something with the result (generally either inserting some text into the current document, or showing a HTML window or tooltip)</li>
</ul>

<p>So first we need to get the input from the document – if you look at the pop-up below the big text field you can see that the input for our command will come from the current selection (or the entire document if there is no selection). This is perfect for what we want.</p>

<p>We need to read the selection from standard input, the easiest way to do this is with:
<pre CLASS="textmate-source"><span CLASS="text text_html text_html_basic"><span CLASS="source source_php source_php_embedded source_php_embedded_block source_php_embedded_block_html"><span CLASS="variable variable_other variable_other_php">$input</span> <span CLASS="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php">=</span> <span CLASS="support support_function support_function_file support_function_file_php">file&#95;get&#95;contents</span>(<span CLASS="string string_quoted string_quoted_single string_quoted_single_php">'php://stdin'</span>);</span></span></pre>
We also need to know the name of the current file, which is given to us as an environment variable <code>TM_FILENAME</code> (Use the <em>Show TM&#95;* Variables</em> command in the <em>Bundle Development</em> bundle to see a full list)– these are accessible from PHP with either the <code>getenv()</code> function or the <code>$_ENV</code> superglobal.
<pre CLASS="textmate-source"><span CLASS="text text_html text_html_basic"><span CLASS="source source_php source_php_embedded source_php_embedded_block source_php_embedded_block_html"><span CLASS="variable variable_other variable_other_php">$filename</span> <span CLASS="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php">=</span> <span CLASS="variable variable_other variable_other_global variable_other_global_safer variable_other_global_safer_php">$&#95;ENV</span>[<span CLASS="string string_quoted string_quoted_single string_quoted_single_php">'TM&#95;FILENAME'</span>]</span></span></pre>
Now we want to split the input into lines and then print out the link for each line:
<pre CLASS="textmate-source"><span CLASS="text text_html text_html_basic"><span CLASS="source source_php source_php_embedded source_php_embedded_block source_php_embedded_block_html"><span CLASS="variable variable_other variable_other_php">$lines</span> <span CLASS="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php">=</span> <span CLASS="support support_function support_function_string support_function_string_php">explode</span>(<span CLASS="string string_quoted string_quoted_double string_quoted_double_php">"<span CLASS="meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_double meta_string-contents_quoted_double_php"><span CLASS="constant constant_character constant_character_escape constant_character_escape_php">\n</span></span>"</span>, <span CLASS="variable variable_other variable_other_php">$document</span>); 
<span CLASS="keyword keyword_control keyword_control_php">foreach</span> (<span CLASS="variable variable_other variable_other_php">$lines</span> <span CLASS="keyword keyword_operator keyword_operator_logical keyword_operator_logical_php">as</span> <span CLASS="variable variable_other variable_other_php">$index</span> <span CLASS="keyword keyword_operator keyword_operator_key keyword_operator_key_php">=&gt;</span> <span CLASS="variable variable_other variable_other_php">$line</span>) { 
  <span CLASS="variable variable_other variable_other_php">$link</span> <span CLASS="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php">=</span> <span CLASS="support support_function support_function_php_pcre support_function_php_pcre_php">preg_replace</span>(<span CLASS="string string_regexp string_regexp_single-quoted string_regexp_single-quoted_php">'/\W+/', '<span CLASS="meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php">-</span>'</span>, <span CLASS="support support_function support_function_string support_function_string_php">strtolower</span>(<span CLASS="variable variable_other variable_other_php">$line</span>)); 
  <span CLASS="support support_function support_function_construct support_function_construct_php">echo</span> <span CLASS="string string_quoted string_quoted_double string_quoted_double_php">"<span CLASS="meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_double meta_string-contents_quoted_double_php">&lt;a href=<span CLASS="constant constant_character constant_character_escape constant_character_escape_php">\"</span><span CLASS="variable variable_other variable_other_php">$link</span><span CLASS="constant constant_character constant_character_escape constant_character_escape_php">\"</span>&gt;<span CLASS="variable variable_other variable_other_php">$line</span>&lt;/a&gt;<span CLASS="constant constant_character constant_character_escape constant_character_escape_php">\n</span></span>"</span>; 
}</span></span></pre>
And that’s it! It’s not very interesting though, so let’s make the titles in the result into snippets:
<pre CLASS="textmate-source"><span CLASS="text text_html text_html_basic"><span CLASS="source source_php source_php_embedded source_php_embedded_block source_php_embedded_block_html"><span CLASS="keyword keyword_control keyword_control_php">foreach</span> (<span CLASS="variable variable_other variable_other_php">$lines</span> <span CLASS="keyword keyword_operator keyword_operator_logical keyword_operator_logical_php">as</span> <span CLASS="variable variable_other variable_other_php">$index</span> <span CLASS="keyword keyword_operator keyword_operator_key keyword_operator_key_php">=&gt;</span> <span CLASS="variable variable_other variable_other_php">$line</span>) { 
   <span CLASS="variable variable_other variable_other_php">$tabstop</span> <span CLASS="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php">=</span> <span CLASS="variable variable_other variable_other_php">$index</span> <span CLASS="keyword keyword_operator keyword_operator_arithmetic keyword_operator_arithmetic_php">+</span> <span CLASS="constant constant_numeric constant_numeric_php">1</span>; 
   <span CLASS="support support_function support_function_construct support_function_construct_php">echo</span> <span CLASS="string string_quoted string_quoted_single string_quoted_single_php">'<span CLASS="meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php">&lt;a href="$filename#${</span>'</span> <span CLASS="keyword keyword_operator keyword_operator_string keyword_operator_string_php">.</span> <span CLASS="variable variable_other variable_other_php">$tabstop</span> <span CLASS="keyword keyword_operator keyword_operator_string keyword_operator_string_php">.</span> <span CLASS="string string_quoted string_quoted_single string_quoted_single_php">'<span CLASS="meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php">/\W+/-/g}"&gt;</span>'</span> <span CLASS="keyword keyword_operator keyword_operator_string keyword_operator_string_php">.</span>
      <span CLASS="string string_quoted string_quoted_single string_quoted_single_php">'<span CLASS="meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php">${</span>'</span> <span CLASS="keyword keyword_operator keyword_operator_string keyword_operator_string_php">.</span> <span CLASS="variable variable_other variable_other_php">$tabstop</span> <span CLASS="keyword keyword_operator keyword_operator_string keyword_operator_string_php">.</span> <span CLASS="string string_quoted string_quoted_single string_quoted_single_php">'<span CLASS="meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php">:</span>'</span> <span CLASS="keyword keyword_operator keyword_operator_string keyword_operator_string_php">.</span> <span CLASS="meta meta_function-call meta_function-call_php">e&#95;sn</span>(<span CLASS="variable variable_other variable_other_php">$line</span>) <span CLASS="keyword keyword_operator keyword_operator_string keyword_operator_string_php">.</span> <span CLASS="string string_quoted string_quoted_single string_quoted_single_php">'<span CLASS="meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php">}&lt;/a&gt;</span>'</span> <span CLASS="keyword keyword_operator keyword_operator_string keyword_operator_string_php">.</span> <span CLASS="string string_quoted string_quoted_double string_quoted_double_php">"<span CLASS="meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_double meta_string-contents_quoted_double_php"><span CLASS="constant constant_character constant_character_escape constant_character_escape_php">\n</span></span>"; 
}   </p>

<p><span CLASS="comment comment_line comment_line_double-slash comment_line_double-slash_php"><span CLASS="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_php">//</span> escape text for use in a TextMate snippet 
</span><span CLASS="meta meta_function meta_function_php"><span CLASS="storage storage_type storage_type_function storage_type_function_php">function</span> <span CLASS="entity entity_name entity_name_function entity_name_function_php">e&#95;sn</span>(<span CLASS="meta meta_function meta_function_arguments meta_function_arguments_php"><span CLASS="meta meta_function meta_function_argument meta_function_argument_no-default meta_function_argument_no-default_php"><span CLASS="variable variable_other variable_other_php">$str</span></span></span>)</span> { 
   <span CLASS="keyword keyword_control keyword_control_php">return</span> <span CLASS="support support_function support_function_php_pcre support_function_php_pcre_php">preg_replace</span>(<span CLASS="string string_regexp string_regexp_double-quoted string_regexp_double-quoted_php">'/[$`<span CLASS="constant constant_character constant_character_escape constant_character_escape_php">&#92;&#92;</span>]</span>/', <span CLASS="meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php">'<span CLASS="constant constant_character constant_character_escape constant_character_escape_php">&#92;</span></span>'</span>, <span CLASS="variable variable_other variable_other_php">$str</span>); 
}</span></pre></p>

<p>This will echo some lines like</p>

<pre CLASS="textmate-source"><code>&lt;a href="#${1:/\W+/-/g}&gt;${1:title}&lt;/a&gt;</code></pre>

<p>Which is TextMate’s <a href="http://macromates.com/textmate/manual/snippets#tab_stops" title="Snippets — TextMate Manual">syntax for snippets</a>. <code>e_sn()</code> is used to escape the characters which are special inside a snippet.</p>

<p>The completed command is repeated below (with an extended <a href="http://macromates.com/textmate/manual/snippets#transformations" title="Snippets — TextMate Manual">transformation</a> to handle lower-casing the anchor name):</p>

<pre CLASS="textmate-source"><span CLASS="text text_html text_html_basic">#!/usr/bin/env php 
<span CLASS="source source_php source_php_embedded source_php_embedded_block source_php_embedded_block_html"><span CLASS="punctuation punctuation_section punctuation_section_embedded punctuation_section_embedded_begin punctuation_section_embedded_begin_php">&lt;?php</span>
<span CLASS="variable variable_other variable_other_php">$document</span> <span CLASS="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php">=</span> <span CLASS="support support_function support_function_file support_function_file_php">file_get_contents</span>(<span CLASS="string string_quoted string_quoted_single string_quoted_single_php">'<span CLASS="meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php">php://stdin</span>'</span>); 
<span CLASS="variable variable_other variable_other_php">$lines</span>    <span CLASS="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php">=</span> <span CLASS="support support_function support_function_string support_function_string_php">explode</span>(<span CLASS="string string_quoted string_quoted_double string_quoted_double_php">"<span CLASS="meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_double meta_string-contents_quoted_double_php"><span CLASS="constant constant_character constant_character_escape constant_character_escape_php">\n</span></span>"</span>, <span CLASS="variable variable_other variable_other_php">$document</span>); 
<span CLASS="variable variable_other variable_other_php">$filename</span> <span CLASS="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php">=</span> <span CLASS="variable variable_other variable_other_global variable_other_global_safer variable_other_global_safer_php">$_ENV</span>[<span CLASS="string string_quoted string_quoted_single string_quoted_single_php">'<span CLASS="meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php">TM_FILENAME</span>'</span>]   

<span CLASS="keyword keyword_control keyword_control_php">foreach</span> (<span CLASS="variable variable_other variable_other_php">$lines</span> <span CLASS="keyword keyword_operator keyword_operator_logical keyword_operator_logical_php">as</span> <span CLASS="variable variable_other variable_other_php">$index</span> <span CLASS="keyword keyword_operator keyword_operator_key keyword_operator_key_php">=&gt;</span> <span CLASS="variable variable_other variable_other_php">$line</span>) { 
    <span CLASS="variable variable_other variable_other_php">$tabstop</span> <span CLASS="keyword keyword_operator keyword_operator_assignment keyword_operator_assignment_php">=</span> <span CLASS="variable variable_other variable_other_php">$index</span> <span CLASS="keyword keyword_operator keyword_operator_arithmetic keyword_operator_arithmetic_php">+</span> <span CLASS="constant constant_numeric constant_numeric_php">1</span>; 
    <span CLASS="support support_function support_function_construct support_function_construct_php">echo</span> <span CLASS="string string_quoted string_quoted_single string_quoted_single_php">'<span CLASS="meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php">&lt;a href="$filename#${</span>'</span> <span CLASS="keyword keyword_operator keyword_operator_string keyword_operator_string_php">.</span> <span CLASS="variable variable_other variable_other_php">$tabstop</span> <span CLASS="keyword keyword_operator keyword_operator_string keyword_operator_string_php">.</span> <span CLASS="string string_quoted string_quoted_single string_quoted_single_php">'<span CLASS="meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php">/(?:(\W+)|(.))/(?1:-:\L$2)/g}"&gt;</span>'</span> <span CLASS="keyword keyword_operator keyword_operator_string keyword_operator_string_php">.</span>
       <span CLASS="string string_quoted string_quoted_single string_quoted_single_php">'<span CLASS="meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php">${</span>'</span> <span CLASS="keyword keyword_operator keyword_operator_string keyword_operator_string_php">.</span> <span CLASS="variable variable_other variable_other_php">$tabstop</span> <span CLASS="keyword keyword_operator keyword_operator_string keyword_operator_string_php">.</span> <span CLASS="string string_quoted string_quoted_single string_quoted_single_php">'<span CLASS="meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php">:</span>'</span> <span CLASS="keyword keyword_operator keyword_operator_string keyword_operator_string_php">.</span> <span CLASS="meta meta_function-call meta_function-call_php">e_sn</span>(<span CLASS="variable variable_other variable_other_php">$line</span>) <span CLASS="keyword keyword_operator keyword_operator_string keyword_operator_string_php">.</span> <span CLASS="string string_quoted string_quoted_single string_quoted_single_php">'<span CLASS="meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php">}&lt;/a&gt;</span>'</span> <span CLASS="keyword keyword_operator keyword_operator_string keyword_operator_string_php">.</span> <span CLASS="string string_quoted string_quoted_double string_quoted_double_php">"<span CLASS="meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_double meta_string-contents_quoted_double_php"><span CLASS="constant constant_character constant_character_escape constant_character_escape_php">\n</span></span>"</span>; 
}   

<span CLASS="comment comment_line comment_line_double-slash comment_line_double-slash_php"><span CLASS="punctuation punctuation_definition punctuation_definition_comment punctuation_definition_comment_php">//</span> escape text for use in a TextMate snippet 
</span><span CLASS="meta meta_function meta_function_php"><span CLASS="storage storage_type storage_type_function storage_type_function_php">function</span> <span CLASS="entity entity_name entity_name_function entity_name_function_php">e_sn</span>(<span CLASS="meta meta_function meta_function_arguments meta_function_arguments_php"><span CLASS="meta meta_function meta_function_argument meta_function_argument_no-default meta_function_argument_no-default_php"><span CLASS="variable variable_other variable_other_php">$str</span></span></span>)</span> { 
   <span CLASS="keyword keyword_control keyword_control_php">return</span> <span CLASS="support support_function support_function_php_pcre support_function_php_pcre_php">preg_replace</span>(<span CLASS="string string_regexp string_regexp_double-quoted string_regexp_double-quoted_php">'/[$`<span CLASS="constant constant_character constant_character_escape constant_character_escape_php">\\\\</span>]</span>/', <span CLASS="meta meta_string-contents meta_string-contents_quoted meta_string-contents_quoted_single meta_string-contents_quoted_single_php">'<span CLASS="constant constant_character constant_character_escape constant_character_escape_php">\\</span></span>'</span>, <span CLASS="variable variable_other variable_other_php">$str</span>); 
}
?&gt;</span></pre>
<img src="http://feeds.feedburner.com/~r/ciaranwalsh/~4/q8Ut3L1JUeI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://ciaranwal.sh/2008/04/04/textmate-tip-using-php-for-commands/feed</wfw:commentRss>
		<slash:comments>13</slash:comments>
		<feedburner:origLink>http://ciaranwal.sh/2008/04/04/textmate-tip-using-php-for-commands</feedburner:origLink></item>
		<item>
		<title>TextMate Tip – The Ruby Bundle</title>
		<link>http://feedproxy.google.com/~r/ciaranwalsh/~3/Bt4_UYRdj8Y/textmate-tip-the-ruby-bundle</link>
		<comments>http://ciaranwal.sh/2008/02/20/textmate-tip-the-ruby-bundle#comments</comments>
		<pubDate>Wed, 20 Feb 2008 15:39:27 +0000</pubDate>
		<dc:creator>Ciarán</dc:creator>
				<category><![CDATA[TextMate]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://ciaranwal.sh/2008/02/20/textmate-tip-the-ruby-bundle</guid>
		<description><![CDATA[Today’s tip is a look at the Ruby bundle, which the bundle maintainer James Edward Gray II has kindly agreed to guest write. Take it away, James! The Ruby bundle is a large collection of automations that will help you write and run Ruby code. If you are a Rails user, switch the language menu [...]]]></description>
			<content:encoded><![CDATA[<p>Today’s tip is a look at the Ruby bundle, which the bundle maintainer <a href="http://blog.grayproductions.net/">James Edward Gray II</a> has kindly agreed to guest write. Take it away, James!</p>

<p>The Ruby bundle is a large collection of automations that will help you write and run Ruby code.  If you are a Rails user, switch the language menu at the bottom of each editor window to "Ruby on Rails" to gain access to these automations plus those defined in the Rails bundle.</p>

<h3>Writing Ruby Code</h3>

<p>The Ruby bundle includes a large collection of snippet that simplify day to day coding in the language.  At first glance through the menus, this may seem like an overwhelming amount of information to try and become familiar with.  The truth is though that there are patterns to the snippets so that you can access what you need without having to memorize a bunch of triggers.  The main things you need to know are:</p>

<ul>
<li>Snippet triggers for Ruby's flow control keywords are just the full name of the first keyword used:  <code>if<abbr title="Tab">⇥</abbr></code>, <code>case<abbr title="Tab">⇥</abbr></code>, <code>while<abbr title="Tab">⇥</abbr></code>, etc.</li>
<li>Other snippet triggers are usually the first three letters of the first word in the code you want, plus the first letter of any additional words.  That means you can use <code>cla<abbr title="Tab">⇥</abbr></code> to bring up a menu of <code>Class</code> definition snippets, <code>sor<abbr title="Tab">⇥</abbr></code> to get the <code>sort()</code> iterator, or <code>sorb<abbr title="Tab">⇥</abbr></code> for <code>sort_by()</code>.</li>
<li>There are exception to the rule, mainly when the shortcuts can be made to read better.  For example, the triggers for <code>attr_reader()</code>, <code>attr_writer()</code>, and <code>attr_accessor()</code> are <code>r<abbr title="Tab">⇥</abbr></code>, <code>w<abbr title="Tab">⇥</abbr></code>, and <code>rw<abbr title="Tab">⇥</abbr></code> respectively.  You also get the <code>each()</code> iterator with the common abbreviation <code>ea<abbr title="Tab">⇥</abbr></code>, which means you would use <code>eal<abbr title="Tab">⇥</abbr></code> for <code>each_line()</code> or <code>eawi<abbr title="Tab">⇥</abbr></code> for <code>each_with_index()</code>.</li>
<li>Some snippets are based on fictional method names like <code>map_with_index()</code>, <code>deep_copy()</code>, or <code>application_code()</code>.  These functional names tend to be easier to recall than the actual idioms they represent.</li>
</ul>

<p>If this is the first time you are hearing of these mnemonics, practice a bit with my examples above to become familiar with them and then take a fresh look through the Ruby bundle menu.  I suspect you will be surprised by how much you can retain without stressing your memory.</p>

<p>Don't be too surprised if some of the triggers are smarter than you expect.  Some of them will add requires to your document (unless they are already present) to make sure needed libraries are available.  If you want to bypass this feature for any reason, just tack an extra <code>-</code> onto the end of the trigger.</p>

<p>The bundle also contains several commands that can be useful in writing Ruby code.  Here are two examples I use every day:</p>

<ul>
<li>All of the iterator snippets insert a block using the braces syntax, but you can quickly get to the do/end variation by tabbing into the body of the block and triggering the "Toggle 'do … end' / '{ … }'" command (it's on <code><abbr title="Control-{">⌃{</abbr></code> by default).</li>
<li>Rails fans will appreciate the "Insert ERb's &lt;% .. %&gt; or &lt;%= .. %&gt;" command (on <code><abbr title="Control-&amp;">⌃&amp;</abbr>gt;</code> by default).  You actually use this tool in HTML files even though it's defined in the Ruby bundle, since that's by far the most common usage of ERb.  Trigger it once to insert the tags or repeat the keystroke to cycle through the variations.</li>
</ul>

<p>Finally, if you are addicted to Ruby, you may just enjoy the possibility to use a little of it when writing any TextMate document.  The "Execute Line / Selection as Ruby" command (on <code><abbr title="Control-Shift-E">⌃⇧E</abbr></code> by default) will hand-off any content you can select to the Ruby interpreter and replace the selection with the results of evaluating that Ruby expression.  Aside from the neat possibilities of being able to generate code, or any other content for that matter, with code, this makes for a darn handy calculator at times.</p>

<h3>Running Ruby Code</h3>

<p>As soon as you have some Ruby code, you are going to want TextMate to run it for you.  The Ruby bundle offers several ways to do that:</p>

<ul>
<li>The "Run" command (on <code><abbr title="Command-R">⌘R</abbr></code> by default) will run the code currently in the editor window in the RubyMate environment.  This command has a lot of advantages over going to the command-line:  output is shown in an HTML window with the standard TextMate styling; exceptions are captured by TextMate and formatted to stand out; Test::Unit files are recognized and receive a modified path that helps them locate other files; test failures and errors are hyperlinked back to the code in TextMate; and STDIN is modified to prompt with a GUI dialog when a line of input is required.</li>
<li>While you can handle full test files with the above, the "Run Focused Unit Test" command (on <code><abbr title="Shift-Command-R">⇧⌘R</abbr></code> by default) will run just the test method your caret is currently inside of.  This can be quite a time saver for spot-checking changes.</li>
<li>Another tool definitely worth knowing is the "Execute and Update '# =&gt;' Markers" command (on <code><abbr title="Control-Shift-Command-E">⌃⇧⌘E</abbr></code> by default).  To use it, add some comment markers (there is a snippet on <code>#<abbr title="Tab">⇥</abbr></code> that will insert these for you) to the end of lines you would like to see the results of and then trigger the command.  TextMate will run your code and report the result of the marked line inline in the comments.  This feature is great for code posted online since it shows the source and the results together.</li>
</ul>

<p>There's more inside the Ruby bundle, but I've tried to hit the highlights that any Rubyist can probably benefit from knowing.  You can get a lot of mileage out of knowing just this much.</p>

<p>Thanks a lot to James for writing this post, I hope you learned something.  If you’ve still got a craving for more TextMate learning, James is also the author of <a href="http://www.pragprog.com/titles/textmate/index.html">TextMate: Power Editing for the Mac</a>, which explains all about the robot ninjas hidden under TextMate’s shell and how to bend them to your will.</p>
<img src="http://feeds.feedburner.com/~r/ciaranwalsh/~4/Bt4_UYRdj8Y" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://ciaranwal.sh/2008/02/20/textmate-tip-the-ruby-bundle/feed</wfw:commentRss>
		<slash:comments>15</slash:comments>
		<feedburner:origLink>http://ciaranwal.sh/2008/02/20/textmate-tip-the-ruby-bundle</feedburner:origLink></item>
		<item>
		<title>TextMate Tip – The HTML Bundle</title>
		<link>http://feedproxy.google.com/~r/ciaranwalsh/~3/wm36INkFJlA/textmate-tip-the-html-bundle</link>
		<comments>http://ciaranwal.sh/2008/02/13/textmate-tip-the-html-bundle#comments</comments>
		<pubDate>Wed, 13 Feb 2008 22:51:00 +0000</pubDate>
		<dc:creator>Ciarán</dc:creator>
				<category><![CDATA[TextMate]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://ciaranwal.sh/2008/02/13/textmate-tip-the-html-bundle</guid>
		<description><![CDATA[I’m going to kick off a look at some of the bundles with an overview of the HTML bundle. Inserting Tags Most of your time using the HTML bundle will of course be spent writing HTML, so learning just a few commands to make the process easier can save you a lot of time. In [...]]]></description>
			<content:encoded><![CDATA[<p>I’m going to kick off a look at some of the bundles with an overview of the HTML bundle.</p>

<p><span id="more-40"></span></p>

<h3>Inserting Tags</h3>

<p>Most of your time using the HTML bundle will of course be spent writing HTML, so learning just a few commands to make the process easier can save you a lot of time. In fact, you really only need to remember one – the “Insert Open/Close Tag (With Current Word)” command (bound to <code><abbr title="Control-&lt;">⌃&lt;</abbr></code> – remember you must press the keys required to generate the characters, so likely you will use <code><abbr title="Control-Shift-Comma">⌃⇧,</abbr></code>).</p>

<p>This command can be used to insert HTML tag pairs in a few ways:</p>

<ul>
<li>Press <code><abbr title="Control-&lt;">⌃&lt;</abbr></code> on its own to get an empty paragraph tag; the “p” will remain selected so you can type whatever tag name you need and it will be mirrored in the closing tag – you can also add attributes to the tag without them being mirrored. Once you’re done, hit tab to move the caret between the tags and enter the content, then hit tab again to move after the closing tag.</li>
<li>Type a tag name and then press <code><abbr title="Control-&lt;">⌃&lt;</abbr></code> right after it to turn the word into a tag pair, with the caret between them.</li>
<li>It’s also possible to invoke with a selection to convert it to a tag (including any attributes you have selected) but this is of limited use – if you want to enter attributes you should use the first form.</li>
</ul>

<p>Using this command will not only save you time, but also ensure your tags are balanced as it inserts both tags together. If you have some unbalanced tags you can use the “Insert Close Tag” command (<code><abbr title="Option-Command-Period">⌥⌘.</abbr></code>) to close the first tag above the caret which has not been finished.</p>

<p>Two other useful commands are for when you have existing content which you wish to wrap in a tag – you can select some text and then use “Wrap Selection in Open/Close Tag” (<code><abbr title="Control-Shift-W">⌃⇧W</abbr></code>) to enclose the text in a paragraph tag, which you can then alter by typing over it and tabbing out as in the first command.</p>

<p>If you have a few lines of text which you want to wrap in tags, for example some paragraphs or list items, you can select each line and run “Wrap Each Selected Line in Open/Close Tag” (<code><abbr title="Control-Shift-Command-W">⌃⇧⌘W</abbr></code>).</p>

<p>There are also snippets to insert tags or groups of tags; a few useful examples are <em>doctype</em><abbr title="Tab">⇥</abbr>, <em>style</em><abbr title="Tab">⇥</abbr>, <em>script</em><abbr title="Tab">⇥</abbr>, <code><abbr title="Control-Return">⌃↩</abbr></code> (a break tag) and <code><abbr title="Option-Space">⌥␣</abbr></code> (a non-breaking space). Take a look in the <em>Insert Tag</em> submenu of the HTML bundle for a full list.</p>

<p>One final useful command is “Wrap Word / Selection as Link” (<code><abbr title="Control-Shift-L">⌃⇧L</abbr></code>), which encloses the word or selection in an &lt;a&gt; tag, using the contents of the clipboard as the URL, and the page’s title if the URL begins with <code>http://</code> (<em>Note</em>: this command is actually part of the Hyperlink Helper bundle, as it is designed to be used in multiple scopes).</p>

<h3>Writing Valid HTML</h3>

<p>There are also other commands to help you while writing HTML, such as:</p>

<ul>
<li>Validate Syntax (<code><abbr title="Control-Shift-V">⌃⇧V</abbr></code>) – this sends the document to the W3C’s validation service and displays the results in a HTML window, adding links to jump back to errors</li>
<li>Tidy (<code><abbr title="Control-Shift-H">⌃⇧H</abbr></code>) – this command invokes the <code>tidy</code> tool on the document to format it and provide feedback on warnings/errors</li>
<li>Documentation for Tag (<code><abbr title="Control-H">⌃H</abbr></code>) – use this on a tag to view the W3C’s reference page on the subject</li>
<li>Various entity/escaping-related commands (<code><abbr title="Command-&amp;">⌘&amp;</abbr></code>) – the bundle includes commands to encode and decode characters, URL escape text, and insert character entities from a list</li>
</ul>

<p>Also, for people writing XHTML you should use the <a href="http://macromates.com/textmate/manual/environment_variables#static_variables">TextMate preferences</a> to set a variable called <code>TM_XHTML</code> with the value ‘&nbsp;/’, to make all the commands and snippets insert XHTML-compliant tags.</p>

<p>As with all the bundles, there is really more functionality than I can cover here, so be sure to check out the bundle menu to get a good overview of the bundle’s features.</p>
<img src="http://feeds.feedburner.com/~r/ciaranwalsh/~4/wm36INkFJlA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://ciaranwal.sh/2008/02/13/textmate-tip-the-html-bundle/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		<feedburner:origLink>http://ciaranwal.sh/2008/02/13/textmate-tip-the-html-bundle</feedburner:origLink></item>
		<item>
		<title>Terminal Plug-in Updates</title>
		<link>http://feedproxy.google.com/~r/ciaranwalsh/~3/exvogBGHm38/terminal-plug-in-updates</link>
		<comments>http://ciaranwal.sh/2008/02/12/terminal-plug-in-updates#comments</comments>
		<pubDate>Tue, 12 Feb 2008 21:00:04 +0000</pubDate>
		<dc:creator>Ciarán</dc:creator>
				<category><![CDATA[OS X]]></category>
		<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://ciaranwal.sh/2008/02/12/terminal-plug-in-updates</guid>
		<description><![CDATA[10.5.2 was just released, apparently bringing with it some changes to Terminal (anyone know what they are?). This caused Terminal’s version number to change, and thus my plug-ins to fail, so I’ve updated the downloads to account for it. Note: if you already edited the plug-ins by hand to work in 10.5.2 you do not [...]]]></description>
			<content:encoded><![CDATA[<p>10.5.2 was just released, apparently bringing with it some changes to Terminal (anyone know what they are?). This caused Terminal’s version number to change, and thus my plug-ins to fail, so I’ve updated the downloads to account for it.
<em>Note:</em> if you already edited the plug-ins by hand to work in 10.5.2 you do not need to download them again, as that is the only change that has been made.</p>

<p>Downloads:</p>

<p><a href="http://ciaranwal.sh/files/Blurminal.bundle.zip">Blurminal</a> – <a href="http://ciaranwal.sh/2007/11/16/blurminal">Original Post</a></p>

<p><a href="http://ciaranwal.sh/files/TerminalTabSwitching.bundle.zip">Terminal Tab Switching</a> – <a href="http://ciaranwal.sh/2007/12/10/tab-switching-in-terminal">Original Post</a></p>

<p><a href="http://ciaranwal.sh/files/TerminalColours.bundle.zip">TerminalColours</a> – <a href="http://ciaranwal.sh/2007/11/01/customising-colours-in-leopard-terminal">Original Post</a></p>
<img src="http://feeds.feedburner.com/~r/ciaranwalsh/~4/exvogBGHm38" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://ciaranwal.sh/2008/02/12/terminal-plug-in-updates/feed</wfw:commentRss>
		<slash:comments>12</slash:comments>
		<feedburner:origLink>http://ciaranwal.sh/2008/02/12/terminal-plug-in-updates</feedburner:origLink></item>
	</channel>
</rss><!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->

