Find in Folder in VIM with NERDTree and Ack

One of the most useful VIM plugins for me is the NERDTree. This is one reason why I cannot migrate to emacs even though I really love their ensime plugin. That usefulness is further augmented by integrating Ack to it. It allows me to find any line containing a given text pattern in all files inside the focused folder in NERDTree. Combine this with Command-T and MRU (Im considering CtrlP as replacement soon), then I can have a very useful and powerful text editor under my belt.

In this post, I am going to teach you how to do this.

You will need two prerequisites. Ack and Ack.vim


$ brew install ack

$ cd ~/.vim/bundle
$ git clone https://github.com/mileszs/ack.vim.git

(Yes I am using pathogen.vim)

Now that you have ack and ack.vim installed, go ahead and install nerdtree-ack


$ mkdir -p ~/.vim/bundle/NERD_tree-ack/plugin
$ cd ~/.vim/bundle/NERD_tree-ack/plugin
$ curl -so NERD_tree-ack.vim http://www.vim.org/scripts/download_script.php\?src_id\=17196

It should work now. Open NerdTree, focus a folder then press “ms” without the quote.

The screenshot is maybe from a Mac but I have been using it from Linux Mint with no problem, you just need to install ack differently.


$ sudo apt-get install ack-grep

Though English is my country's official language it is not my native tongue. If you find anything wrong with my phrases, or any incorrect information, write it out loud in the comments section. The world will be a bit better that way.
Posted in Javascript
One comment on “Find in Folder in VIM with NERDTree and Ack
  1. NERD_tree now has a “nerdtree_plugin” directory. The NERD_tree-ack.vim plugin should be placed into the nerdtree_plugin directory, or you will get an error.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre user="" computer="" escaped="">