sábado, 5 de diciembre de 2009

search in multiple buffers in emacs and vim

Want to look for a word in a number of buffers?

No problem, emacs can do it with a simple command (the problem is remembering hundreds of "simple commands" :/ )

emacswiki gave me the solution .

The command is multi-occur.

It lets you select in which buffers you wanna perform the search.

My use case though was knowing in which irc channels appeared a given user.

Then, the command is:
  C-u M-x multi-occur-in-matching-buffers
it lets you write a regex for buffers to search, so I wrote "#.*" , and then the word.

As simple as it can get.

Thinking how I'd do it in vim, normally I'd do a normal grep (using ack) or vimgrep, but as emacs can map buffers to non-files, grep wouldn't work.

Vim offers quickfix window that can be easily combined with both grep and vimgrep, and one can download theese two plugins. AFAIK none of theese plugins can search in some but not all opened buffers.

Any other vim solutions are very welcome.

No hay comentarios: