Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This is going to be immensely useful.

I've one unrelated question for emacs users, since I'm trying to wean myself off of TextMate: How do you accomplish this same type of "find-in-multiple-files" in emacs?



Quite a few ways.

1. Start with M-x rgrep, it may do everything you need.

2. If not, M-x find-grep lets you run arbitrary grep commands. You may wish to customize grep-find-command to some reasonable default, e.g., mine:

    (setq grep-find-command
          (concatenate
           'string
           "find . \\( -path '*.svn' -o -path '*.git' -o -path '*.hg' \\)" 
           " "
           "-prune -o -type f -print0 | xargs -0 grep -I -i -n -e "))
3. If you want to just search open buffers, you may find M-x multi-occur-in-matching-buffers useful. I use this simple wrapper, which you invoke using M-x search-all-buffers:

    (defun search-all-buffers (regexp)
      (interactive "sRegexp: ")
      (multi-occur-in-matching-buffers "." regexp t))
4. You may find filtering files and query-based search replace useful, in which case you should try dired-mode. It does a lot, so try marking files (look in the Mark menu for various options), then operate on them (Operate menu). For example, hit "% m" to mark files by name regex, type "\.[c|h]" to mark all C and header files, then press "Q" to start interactive search-and-replace through all marked files.

5. I don't know of a direct equivalent to Nice Find, e.g., basing a search on "git grep" output, but if you look through the various Git modes, you may find something useful.


And, amazingly, you managed to get through this whole list without mentioning igrep-find, which is what I've been using:

http://www.emacswiki.org/cgi-bin/wiki/igrep.el

A lot of people have attacked the grep problem in emacs.


As a side note; check out find-cmd.el (comes with 23).


M-x rgrep

That's one option. There's also find-dired. I also believe there are a bunch of different extensions that can do this as well (find-in-project, etc.).


I have the same question, but for Vim. Also, for find-and-replace.

I think it requires a plugin, but I'm baffled why it isn't there out-of-the-box. (Unless it is there, and I haven't found it yet.)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: