Skip to content

Getting Ack to Work in Vim on Ubuntu

by mrchris on May 18th, 2010

As a Magento developer I often have need to search through hundreds to thousands of files just to find a specific piece of text. The tried and true work horse for this type of operation is grep. Unfortunately, grep is a bit sluggish when it comes to a directory tree as large as Magento’s. Enter ack. Ack is fast. I dare say ack is wickedly fast.

With any great search tool, text editor integration is important. For Vim there’s a great plugin for ack. If you’re running any fairly modern flavor of Ubuntu, when you try the plugin you’ll likely encounter the message ”/bin/bash: ack: command not found”.

According the the instructions on the ack Vim plugin page you have to install it with “sudo aptitude install ack-grep”. After that, you’ll still get “/bin/bash: ack: command not found”. The solution?

sudo ln -s /usr/bin/ack-grep /usr/local/bin/ack

After that, you’ll be searching in Vim at blazing speeds.

From → Linux, Ubuntu, Vim

9 Comments
  1. Thanks! iv tried using an alias but I guess that vim doesn’t see that.

  2. Fedyashev Nikita permalink

    Thanks a lot! It works now

  3. Bucketz permalink

    So I’ve delicious-ed this post and referred to it multiple times and realized I never said thanks.

    Thanks! I owe you one.

  4. sam permalink

    Thanks, that is helpful

  5. thedeeno permalink

    Thanks!

  6. Nedvajz permalink

    Thanks, helps me a lot!

  7. Rekky permalink

    Also you can just:

    sudo apt-get install ack

    Works at least at Ubuntu 11.10

  8. voodoologic permalink

    whoot^2!
    For anyone googling for mac OSX, I just reversed the arguments for the symbolic link:
    brew install ack
    sudo ln -s /usr/local/bin/ack /usr/bin/ack-grep

    supah fast!

  9. Filipe Chagas permalink

    Thank you!!!

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS