Searching all the files

Martin Engelke 11 years ago updated by Alice Bevan-McGregor 11 years ago 5

It would be very nice, if you could let us search trough all opened files or trough the folder in which we are. As a coder with mass of .c files I have to search for special functions and at the moment I have to do that via Finder to open the file in textastic after that. If I remember correctly you were thinking about that for iOS too, but you decided that it would take too much space and slows down the process. Maybe you could at least implement that on OSX :-)

Thank you for listening.

Ack.  Integrate ack searches.  It's great, fast, efficient (only searches code and text files, naturally avoids binary ones) and provides easily parseable results for GUI consumption.

I had a look at Ack. One problem I see is that it only searches one line at a time. So you can't for example do a regular expression search that spans several lines.

There are only two things Ack does not do well: searching of very large files (hundreds of megabytes+) and multi-line regexen.  However both of these are highly specialized tasks with a far lower occurrence count than standard searches, both non-regexen and regexen.

Ack has many benefits over pure grep for programmers:

  • Intelligent file selection: only searches known text files by default.  (And if you need it to search more you can either add to the known types or have it search all.)  Also ignores known bad files such as backup files, core dumps, and version control files (i.e. the contents of .svn or .git).

  • It naturally gives a configurable amount of context and provides other customizable settings, making machine parsing and formatting for GUI selection of the found lines quite easy.

  • Standard GUI search options exposed as simple switches.  (ignore-case, smart-case where if search terms are lowercase search is insensitive, filename sort, whole-word, etc.)

  • Configurable by advanced users through the ~/.ackrc file, i.e. to add additional types.

Standard grep can be a fallback if the regular expression contains explicit multiline matching.

Due to sandboxing requirements, you can override the ACKRC environment variable to point at an ackrc file within your application bundle, or the Application Support folder for the application.

Sounds good as beginning, but Multiple Line Searching would also be nice :/

I think I'll go through the tickets I've commented on so far and update them with "this can be implemented by users given a first-class scripting language like Lua".  Hint: this is one of the ones that can be implemented by users given a first-class scripting language like Lua.  ;)