Here's a pattern I've often used in TM1 -- that doesn't work as well in TM2.
I've got a big project and want to either easily browse just a subset of files or I'm doing some complicated refactoring with regexes etc and dealing with just a subset would make my work much less error prone.
I use the grep replacement ack to find files meeting some criteria and pipe this list with xargs to the mate command.
The files appear in mate in the project drawer and are easily browsable and searchable as a set.
Here's an example where I want to work with only the files from the src/ dir in my project that have the string 'cursor' (there's a generated dist/ dir tree that ALSO has many files with the string 'cursor' in them but I don't want to deal with those files):
$ ack -l cursor src src/examples/complex-atoms-model/application.sass src/examples/components/components.sass src/examples/examples.sass src/examples/lennard-jones-potential/lennard-jones-potential.js src/examples/simple-atoms-model/application.sass src/examples/simple-atoms-model-controls-in-text/application.sass src/examples/simplemolecules/simplemolecules.sass src/index.sass src/lab/css/components.sass src/lab/grapher/samples/cities-sample.js src/lab/grapher/samples/lennard-jones-sample.js src/lab/grapher/samples/sample-graph.js src/lab/grapher/samples/simple-graph2.js src/lab/grapher/samples/surface-temperature-sample.js src/lab/graphx/graphx.js src/lab/layout/fullscreen.js src/lab/layout/potential-chart.js src/tests/two-graphs/index.html
Load those files in both TM2 and TM1:
$ ack -l cursor src | xargs mate $ ack -l cursor src | xargs mate1
In TM1 the files appear in the project drawer and the project search for cursor gives me all the locations in this collection of files.
However in TM2 the files do NOT appear in the project drawer (they are instead all opened as separate tabbed windows) and are not searchable as a collection.
Here's a screenshot caompring the two TM versions and the results of a search for files with the string 'cursor':
https://img.skitch.com/20120222-t6xxnk342b6wsgwjeh1ckyykmf.jpg
I'd like an arbitrary collection of files passed to TM2 via the mate command to be represented and searchable as a collection.
On 23/02/2012, at 02.31, Stephen Bannasch wrote:
Here's a pattern I've often used in TM1 […] $ ack -l cursor src | xargs mate
If you use ⇧⌘F (searching for ‘cursor’) you can set the folder to ‘src’ or enter ‘src/**/*.{c,h}’ in the ‘matching’ glob field to achieve something similar.
After the search, click first match and use ⌘G to go through all matches, switching file when it hits end of first etc. and/or click the disclosure triangle in the Find All results header to collapse all matches and get a (clickable) list that very much mimics the result of the project folder in 1.x resulting from your ‘xargs mate’.
[…] I'd like an arbitrary collection of files passed to TM2 via the mate command to be represented and searchable as a collection.
Noted, though for the use-case mentioned, it sounds like generalizing the filtering capabilities of file browser, file chooser (⌘T), and find in folder (⇧⌘F) would be ideal as it would then allow the same but be more discoverable + visual feedback (though I know that using ‘find … | xargs mate’ effectively has unlimited filtering potential that TextMate cannot capture).
At 9:18 AM +0700 2/26/12, Allan Odgaard wrote:
On 23/02/2012, at 02.31, Stephen Bannasch wrote:
Here's a pattern I've often used in TM1 [] $ ack -l cursor src | xargs mate
If you use Ü-F (searching for 'cursor') you can set the folder to 'src' or enter 'src/**/*.{c,h}' in the 'matching' glob field to achieve something similar.
After the search, click first match and use G to go through all matches, switching file when it hits end of first etc. and/or click the disclosure triangle in the Find All results header to collapse all matches and get a (clickable) list that very much mimics the result of the project folder in 1.x resulting from your 'xargs mate'.
My email client (Eudora) incorrectly parses the text between shift-command-F and command-G in your reply. I haven't noticedproblems parsing utf8 text before using Eudora.
I'm wondering whether this affects anybody else?
I'm also wondering if the garbled section in my message quoting of Allan's response is parsed correctly or incorrectly (I can check later on the list archive).
Here's what it looked like to me in the original message reply:
https://img.skitch.com/20120226-gbdaq2jjdca63p4qjxtgem229w.jpg
Here's what the garbled section said:
shift-command-F (searching for 'cursor') you can set the folder to 'src' or enter 'src/**/*.{c,h}' in the 'matching' glob field to achieve something similar.
After the search, click first match and use command-G
The text of your message appears fine here:
http://lists.macromates.com/textmate/2012-February/034566.html
I agree the new find command is much more powerful and does cover some of the use cases I described.
[] I'd like an arbitrary collection of files passed to TM2 via
the mate command to be represented and searchable as a collection.
Noted, though for the use-case mentioned, it sounds like generalizing the filtering capabilities offile browser, file chooser (T), and find in folder (Ü-F) would be ideal as it would then allow the same but be more discoverable + visual feedback (though I know that using 'find | xargs mate'effectively has unlimited filtering potential that TextMate cannot capture).
Generalizing the filtering would be quite powerful and useful.