Fast grepping with vim

Navigating through code is one of the most common tasks a programmer has during his or her daily work. Therefore, anything to speed up this process is a valuable tool for developers. Here, I’m going to show you how to use the powerful ack command.


I think the ack command will be a replacement of grep, at least for developers. This is because grep is a general purpose tool without any optimization for a specific task, such as searching code. Ack uses perl regular expressions by default to improve performance. Ack won’t search on version control directories, non-code files, or minified web files, and can recognize the programming language of the file.


For Mac Users:

$  brew install ack

For Ubuntu users:

$ sudo apt-get ack-grep

Basic Usage

Let’s download some code to try ack.

$ git clone
This repository has C and shell code, and Documentation, let’s do a simple search:

You can also be more specific and tell ack what code you are looking for:

$ ack --shell test

Vim Plugin

The best thing to do is to integrate ack with vim. This is so you can use it in your workflows without leaving vim.

Install plugin

I always recommend using a plugin manager. If you don’t use one, start today. You can follow this article to start:

And if you use one, just check the installation process here:

Plugin usage

The plugin will do the search on the current project. To start a basic search, you must enter on command mode:


You also can immediately open a buffer of the first file matching a pattern:


Ack will open a quicklist window so that you can browse the matches and decide what you want to open. These are the keys to navigate through it:


the_silver_searcher is a “faster ack” according to his author and the benchmark that he shows in the official site:

In case you like this more than ack, you can tell Ack.vim to use it. You just have to add these lines to your .vimrc file:

Vim is one of the most powerful editors available. However, many don’t want to start working with it because of the perceived learning curve, but it’s totally worth it! You will soon thank me and become a vim ninja and code at the speed of light!

Gorilla Logic is always on the hunt for the best software engineers. Think you have what it takes to be a gorilla? Check out our careers section and follow us on Instagram to see what it’s like to be a gorilla.

Christopher Valerio

Christopher is a DevOps Engineer with 5 years of experience. He grew up in Valdivia, a town in Chilean Patagonia. Currently, he lives in San Jose, Costa Rica. He is married with 2 children and loves to spend time with his family. When he is not coding, he likes reading old American Horror, like Edgar Alan Poe, or weird terror like H.P Lovecraft. He also likes to build DIY projects with Arduino or Raspberry Pi's.

Related Articles

Ready to be Unstoppable?

Partner with Gorilla Logic, and you can be.