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

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.