Nov 21, 2009

Gedit Find in Files - Now with Ack!

I've been hacking away on the Find in Files plugin for a while now. As of the last iteration I was fairly happy with the way things were, but there was one thing really missing: Speed.

I could search through my Rails app directory with no problem but if I was in the full root then searching through the development log and plugins would result in the machine freezing up for up to 2 minutes while grep worked its way through the filesystem. Thankfully, Find in Files now uses Ack which speeds things up tremendously.


Ack is perfect for this plugin. Looking at the benchmarks, you can see it's over 4x faster than grep for searching through documents and subdirectories. This will be clearly noticeable to anyone who uses this new version of the plugin. It is much faster.

The issue is that we can't assume people have Ack installed so the plugin gracefully degrades to grep if it can't detect Ack properly. One warning, on Debian and Ubuntu systems, the package is not installed by default. Actually, the ack package in Karmic Koala is a Kanji translator.. so in order to get the right version to use with this plugin, get the ack-grep package instead.

sudo apt-get install ack-grep


If you need to run this plugin on another platform you may need to change the command or create a symlink between ack-grep and your local ack command. Sorry about that.. Linux is a bit too diverse for me to cleanly figure out how to access ack across all distributions. But for Debian and Ubuntu you should be good to go out of the box assuming you have ack-grep installed.

Get the updated plugin from GitHub. Happy hacking everyone!

5 comments:

  1. Glad you're doing this. Would it make sense to let ack users know in the ack docs about how to do this integration?

    ReplyDelete
  2. Hi Vince, I couldn't figure out how to install this plugin... I've copied the folder into ~/.gnome2/gedit/plugins but it wouldn't show in my Plugins list. Then I moved it into /usr/share/gedit2/plugins and even though it's now activated, I can only see "Find in Open Documents", not your plugin. I'm running gedit v2.28 on Karmic with the gmate setup http://github.com/lexrupy/gmate .

    ReplyDelete
  3. plugins go in /usr/lib/gedit-2/plugins not .gnome2/gedit in ubuntu now

    ReplyDelete
  4. press [Ctrl]+[F9] to show the search pane!

    ReplyDelete
  5. The Case Sensitive checkbox is doing the opposite of what it should do.

    ReplyDelete