<?xml version="1.0" encoding="utf-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Open in TextMate</title>
	<atom:link href="http://blog.macromates.com/2007/open-in-textmate/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.macromates.com/2007/open-in-textmate/</link>
	<description>TextMate and OS X</description>
	<lastBuildDate>Wed, 03 Feb 2010 16:53:43 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Configurer Textmate pour le développement web (html-css-php-javascript) &#171; washaweb</title>
		<link>http://blog.macromates.com/2007/open-in-textmate/#comment-4273</link>
		<dc:creator>Configurer Textmate pour le développement web (html-css-php-javascript) &#171; washaweb</dc:creator>
		<pubDate>Fri, 02 Oct 2009 12:29:55 +0000</pubDate>
		<guid isPermaLink="false">http://macromates.com/blog/2007/open-in-textmate/#comment-4273</guid>
		<description>&lt;p&gt;[...] Open in Textmate Copiez cette petite extension n&#8217;importe où sur votre Mac, puis clic-droit dans la barre d&#8217;outil d&#8217;une fenêtre du Finder (dans la partie avec les petites icônes) et &#8220;Personnaliser la barre d&#8217;outils&#8230;&#8221;. Faites glisser l&#8217;extension dans la barre et cliquez sur &#8220;Terminé&#8221;. [...]&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>[...] Open in Textmate Copiez cette petite extension n&#039;importe où sur votre Mac, puis clic-droit dans la barre d&#039;outil d&#039;une fenêtre du Finder (dans la partie avec les petites icônes) et &#034;Personnaliser la barre d&#039;outils&#8230;&#034;. Faites glisser l&#039;extension dans la barre et cliquez sur &#034;Terminé&#034;. [...]</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Open in Textmate &#171; Sketch Blog</title>
		<link>http://blog.macromates.com/2007/open-in-textmate/#comment-3818</link>
		<dc:creator>Open in Textmate &#171; Sketch Blog</dc:creator>
		<pubDate>Thu, 11 Jun 2009 17:33:00 +0000</pubDate>
		<guid isPermaLink="false">http://macromates.com/blog/2007/open-in-textmate/#comment-3818</guid>
		<description>&lt;p&gt;[...] helpful, since I don&#8217;t have TM set as my default editor for HTML and CSS files.Check out the full post, as well as this other that talks about customizing the icon for the script.      [...]&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>[...] helpful, since I don&#039;t have TM set as my default editor for HTML and CSS files.Check out the full post, as well as this other that talks about customizing the icon for the script.      [...]</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Dustin Schau</title>
		<link>http://blog.macromates.com/2007/open-in-textmate/#comment-2965</link>
		<dc:creator>Dustin Schau</dc:creator>
		<pubDate>Wed, 12 Dec 2007 01:12:28 +0000</pubDate>
		<guid isPermaLink="false">http://macromates.com/blog/2007/open-in-textmate/#comment-2965</guid>
		<description>&lt;p&gt;Hey, cool idea!&lt;/p&gt;

&lt;p&gt;Here&#039;s a little something I whipped up...fits a little better with OS X toolbar.&lt;/p&gt;

&lt;p&gt;www.dustinschau.com/Downloads/TextMate.png&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hey, cool idea!</p>

<p>Here&#039;s a little something I whipped up&#8230;fits a little better with OS X toolbar.</p>

<p><a href="http://www.dustinschau.com/Downloads/TextMate.png" rel="nofollow">http://www.dustinschau.com/Downloads/TextMate.png</a></p>]]></content:encoded>
	</item>
	<item>
		<title>By: Allan Odgaard</title>
		<link>http://blog.macromates.com/2007/open-in-textmate/#comment-2893</link>
		<dc:creator>Allan Odgaard</dc:creator>
		<pubDate>Thu, 15 Nov 2007 06:48:03 +0000</pubDate>
		<guid isPermaLink="false">http://macromates.com/blog/2007/open-in-textmate/#comment-2893</guid>
		<description>&lt;p&gt;Darryl: The context is not entirely clear here, but simply using an unquoted &lt;code&gt;*&lt;/code&gt; in the file to open should work for “completion”, for example:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;DIR=/tmp
EXT=.php
mate &quot;$DIR/&quot;*&quot;$EXT&quot;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;That will open all files with extension &lt;code&gt;EXT&lt;/code&gt; (&lt;code&gt;.php&lt;/code&gt;) in the &lt;code&gt;DIR&lt;/code&gt; folder (&lt;code&gt;/tmp&lt;/code&gt;). And both &lt;code&gt;DIR&lt;/code&gt; and &lt;code&gt;EXT&lt;/code&gt; can contain spaces.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Darryl: The context is not entirely clear here, but simply using an unquoted <code>*</code> in the file to open should work for “completion”, for example:</p>

<pre><code>DIR=/tmp
EXT=.php
mate "$DIR/"*"$EXT"
</code></pre>

<p>That will open all files with extension <code>EXT</code> (<code>.php</code>) in the <code>DIR</code> folder (<code>/tmp</code>). And both <code>DIR</code> and <code>EXT</code> can contain spaces.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Darryl Zurn</title>
		<link>http://blog.macromates.com/2007/open-in-textmate/#comment-2891</link>
		<dc:creator>Darryl Zurn</dc:creator>
		<pubDate>Wed, 14 Nov 2007 21:51:07 +0000</pubDate>
		<guid isPermaLink="false">http://macromates.com/blog/2007/open-in-textmate/#comment-2891</guid>
		<description>&lt;p&gt;This is very close to what I want to do. I already have a command bound in TextMate that will take whatever text is selected and open either or both files with these filenames:&lt;/p&gt;

&lt;p&gt;open &quot;file://path/to/$TM_SELECTED_TEXT.pdf&quot;
open &quot;file://path/to/$TM_SELECTED_TEXT%20No%20PDF&quot;&lt;/p&gt;

&lt;p&gt;What I want is to open &lt;em&gt;any&lt;/em&gt; and &lt;em&gt;all&lt;/em&gt; files in this directory that starts with $TM_SELECTED_TEXT.&lt;/p&gt;

&lt;p&gt;And there are spaces in the filename but not the path.&lt;/p&gt;

&lt;p&gt;Any help is appreciated!
Thanks
Darryl&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>This is very close to what I want to do. I already have a command bound in TextMate that will take whatever text is selected and open either or both files with these filenames:</p>

<p>open &#034;file://path/to/$TM_SELECTED_TEXT.pdf&#034;
open &#034;file://path/to/$TM_SELECTED_TEXT%20No%20PDF&#034;</p>

<p>What I want is to open <em>any</em> and <em>all</em> files in this directory that starts with $TM_SELECTED_TEXT.</p>

<p>And there are spaces in the filename but not the path.</p>

<p>Any help is appreciated!
Thanks
Darryl</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Allan Odgaard</title>
		<link>http://blog.macromates.com/2007/open-in-textmate/#comment-2856</link>
		<dc:creator>Allan Odgaard</dc:creator>
		<pubDate>Fri, 02 Nov 2007 00:15:47 +0000</pubDate>
		<guid isPermaLink="false">http://macromates.com/blog/2007/open-in-textmate/#comment-2856</guid>
		<description>&lt;p&gt;That should work, also &lt;code&gt;find&lt;/code&gt; can be made to execute the &lt;code&gt;grep&lt;/code&gt; like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;find . -name &quot;$i&quot; -exec grep -sq &quot;$GREP&quot; &#039;{}&#039; \; -print0 &#124; xargs -0 mate
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I also suggest this addition to the script:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;echo -n &quot;$GREP&quot;&#124;pbcopy -pboard find
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then when the file(s) open, one can use ⌘E to jump to the match :)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>That should work, also <code>find</code> can be made to execute the <code>grep</code> like this:</p>

<pre><code>find . -name "$i" -exec grep -sq "$GREP" '{}' \; -print0 | xargs -0 mate
</code></pre>

<p>I also suggest this addition to the script:</p>

<pre><code>echo -n "$GREP"|pbcopy -pboard find
</code></pre>

<p>Then when the file(s) open, one can use ⌘E to jump to the match :)</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Rachel Greenham</title>
		<link>http://blog.macromates.com/2007/open-in-textmate/#comment-2855</link>
		<dc:creator>Rachel Greenham</dc:creator>
		<pubDate>Thu, 01 Nov 2007 22:51:16 +0000</pubDate>
		<guid isPermaLink="false">http://macromates.com/blog/2007/open-in-textmate/#comment-2855</guid>
		<description>&lt;p&gt;I know about -print0 and xargs -0. :-) The part I wasn&#039;t sure about whether it would work is the tmgrep one where we pipe through xargs twice, and I&#039;d just taken some headache pills when it occurred to me and didn&#039;t feel like testing it out. :-) In all the time I&#039;ve used these scripts I&#039;ve not found myself needing to use them where it&#039;s a problem, or it would have been fixed.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;find . -name &quot;$i&quot; -print0 &#124; xargs -0 grep -lZ &quot;$GREP&quot;  &#124; xargs -0 mate&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;I &lt;em&gt;think&lt;/em&gt; that would work, but wasn&#039;t really sure there might not be some wonky edge cases.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I know about -print0 and xargs -0. :-) The part I wasn&#039;t sure about whether it would work is the tmgrep one where we pipe through xargs twice, and I&#039;d just taken some headache pills when it occurred to me and didn&#039;t feel like testing it out. :-) In all the time I&#039;ve used these scripts I&#039;ve not found myself needing to use them where it&#039;s a problem, or it would have been fixed.</p>

<p><code>find . -name "$i" -print0 | xargs -0 grep -lZ "$GREP"  | xargs -0 mate</code></p>

<p>I <em>think</em> that would work, but wasn&#039;t really sure there might not be some wonky edge cases.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Allan Odgaard</title>
		<link>http://blog.macromates.com/2007/open-in-textmate/#comment-2854</link>
		<dc:creator>Allan Odgaard</dc:creator>
		<pubDate>Thu, 01 Nov 2007 20:42:28 +0000</pubDate>
		<guid isPermaLink="false">http://macromates.com/blog/2007/open-in-textmate/#comment-2854</guid>
		<description>&lt;p&gt;Rachel: As for spaces in filenames, use &lt;code&gt;-print0&lt;/code&gt; instead of &lt;code&gt;-print&lt;/code&gt; and then give &lt;code&gt;-0&lt;/code&gt; to &lt;code&gt;xargs&lt;/code&gt; (this makes the printed names be null-terminated, and likewise has &lt;code&gt;xargs&lt;/code&gt; expect them to be that).&lt;/p&gt;

&lt;p&gt;And for naming it &lt;code&gt;xcgrep&lt;/code&gt;, I need to put the following on all my servers to avoid having my sessions littered with &lt;code&gt;command not found&lt;/code&gt; :)&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;alias mate=&#039;nano -w&#039;
&lt;/code&gt;&lt;/pre&gt;
</description>
		<content:encoded><![CDATA[<p>Rachel: As for spaces in filenames, use <code>-print0</code> instead of <code>-print</code> and then give <code>-0</code> to <code>xargs</code> (this makes the printed names be null-terminated, and likewise has <code>xargs</code> expect them to be that).</p>

<p>And for naming it <code>xcgrep</code>, I need to put the following on all my servers to avoid having my sessions littered with <code>command not found</code> :)</p>

<pre><code>alias mate='nano -w'
</code></pre>]]></content:encoded>
	</item>
	<item>
		<title>By: Rachel Greenham</title>
		<link>http://blog.macromates.com/2007/open-in-textmate/#comment-2853</link>
		<dc:creator>Rachel Greenham</dc:creator>
		<pubDate>Thu, 01 Nov 2007 20:34:27 +0000</pubDate>
		<guid isPermaLink="false">http://macromates.com/blog/2007/open-in-textmate/#comment-2853</guid>
		<description>&lt;p&gt;For people who like like living in the commandline, I thought I&#039;d share a couple of little scripts I made for working in projects (eg: websites, source trees...) They just want to sit in your &lt;code&gt;$PATH&lt;/code&gt; somewhere and be made executable:&lt;/p&gt;

&lt;p&gt;the first: &lt;code&gt;tm&lt;/code&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#/bin/bash
# tm &lt;pattern&gt;...
# Open all files under this location with the
# given (wildcarded) name(s).
# eg: tm \*Servlet.java

for i; do
    if [ -f &quot;$i&quot; ] ; then
        mate &quot;$i&quot;
    else
        find . -path &#039;./{arch}&#039; -prune -o -name &quot;$i&quot; -print &#124; xargs mate
    fi
done
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And the second: &lt;code&gt;tmgrep&lt;/code&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#/bin/bash
# tmgrep &lt;text&gt; &lt;pattern&gt;...
# Open all files matching the given pattern(s)
# under this location that contain
# the given text.
# eg: tmgrep &quot;extends SomeClass&quot; \*.java

for i; do
    if [ -z &quot;$GREP&quot; ] ; then
GREP=&quot;$i&quot;
else
    find . -path &#039;./{arch}&#039; -prune -o -name &quot;$i&quot; -print &#124; xargs grep -l &quot;$GREP&quot; &#124; xargs mate
fi
done
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;You can call them what you like; On my system I still call them &lt;code&gt;xcode&lt;/code&gt; and &lt;code&gt;xcgrep&lt;/code&gt; because the original of these scripts opened files in XCode rather than TextMate and that&#039;s what my fingers are used to typing now. (I also have a variant that opens in gedit under Linux, also called &lt;code&gt;xcode&lt;/code&gt; and &lt;code&gt;xcgrep&lt;/code&gt;.) But textmate is way nicer for doing this stuff especially as, when you use the above and it matches a bunch of windows, they all turn up in a sidebar in one new window, rather than covering your desktop in windows... which can get especially tiresome when you accidentally tell it to open a couple of thousand files...&lt;/p&gt;

&lt;p&gt;Obvious and probably easy enhancements might include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;allow regexp expressions (optionally) in tmgrep. I didn&#039;t especially miss it myself as regexp has never quite become second-nature.&lt;/li&gt;
&lt;li&gt;be more generic in what application it uses to open the files. On OS X of course, you could actually just replace &lt;code&gt;mate&lt;/code&gt; with &lt;code&gt;open&lt;/code&gt; as long as you&#039;ve already configured the system to open the files in the right application. The grepping variant obviously is unlikely to be very useful on anything other than text files.&lt;/li&gt;
&lt;li&gt;cope with folders and filenames with spaces in them. I think I know how, I just haven&#039;t needed it enough to make it happen and get it all tested.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The &lt;code&gt;-path &#039;./{arch}&#039; -prune&lt;/code&gt; bit is just because we use &lt;code&gt;bazaar&lt;/code&gt; for our source control and I don&#039;t want this command picking up the files of the same name inside its working directories. You can lose it if you want; I&#039;ve left it in as an example.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>For people who like like living in the commandline, I thought I&#039;d share a couple of little scripts I made for working in projects (eg: websites, source trees&#8230;) They just want to sit in your <code>$PATH</code> somewhere and be made executable:</p>

<p>the first: <code>tm</code></p>

<pre><code>#/bin/bash
# tm &lt;pattern&gt;...
# Open all files under this location with the
# given (wildcarded) name(s).
# eg: tm \*Servlet.java

for i; do
    if [ -f "$i" ] ; then
        mate "$i"
    else
        find . -path './{arch}' -prune -o -name "$i" -print | xargs mate
    fi
done
</code></pre>

<p>And the second: <code>tmgrep</code></p>

<pre><code>#/bin/bash
# tmgrep &lt;text&gt; &lt;pattern&gt;...
# Open all files matching the given pattern(s)
# under this location that contain
# the given text.
# eg: tmgrep "extends SomeClass" \*.java

for i; do
    if [ -z "$GREP" ] ; then
GREP="$i"
else
    find . -path './{arch}' -prune -o -name "$i" -print | xargs grep -l "$GREP" | xargs mate
fi
done
</code></pre>

<p>You can call them what you like; On my system I still call them <code>xcode</code> and <code>xcgrep</code> because the original of these scripts opened files in XCode rather than TextMate and that&#039;s what my fingers are used to typing now. (I also have a variant that opens in gedit under Linux, also called <code>xcode</code> and <code>xcgrep</code>.) But textmate is way nicer for doing this stuff especially as, when you use the above and it matches a bunch of windows, they all turn up in a sidebar in one new window, rather than covering your desktop in windows&#8230; which can get especially tiresome when you accidentally tell it to open a couple of thousand files&#8230;</p>

<p>Obvious and probably easy enhancements might include:</p>

<ul>
<li>allow regexp expressions (optionally) in tmgrep. I didn&#039;t especially miss it myself as regexp has never quite become second-nature.</li>
<li>be more generic in what application it uses to open the files. On OS X of course, you could actually just replace <code>mate</code> with <code>open</code> as long as you&#039;ve already configured the system to open the files in the right application. The grepping variant obviously is unlikely to be very useful on anything other than text files.</li>
<li>cope with folders and filenames with spaces in them. I think I know how, I just haven&#039;t needed it enough to make it happen and get it all tested.</li>
</ul>

<p>The <code>-path './{arch}' -prune</code> bit is just because we use <code>bazaar</code> for our source control and I don&#039;t want this command picking up the files of the same name inside its working directories. You can lose it if you want; I&#039;ve left it in as an example.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Denny</title>
		<link>http://blog.macromates.com/2007/open-in-textmate/#comment-2852</link>
		<dc:creator>Denny</dc:creator>
		<pubDate>Thu, 01 Nov 2007 18:31:33 +0000</pubDate>
		<guid isPermaLink="false">http://macromates.com/blog/2007/open-in-textmate/#comment-2852</guid>
		<description>&lt;p&gt;It goes even easier: just drag the TextMate icon from the &quot;Applications&quot; folder to the finder titlebar.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>It goes even easier: just drag the TextMate icon from the &#034;Applications&#034; folder to the finder titlebar.</p>]]></content:encoded>
	</item>
</channel>
</rss>
