I started using ack some time ago and I can say it’s much better than grep. Faster, more intuitive, much, much faster
And I wanted to integrated with my vim environment. I use NERD_Tree and I couldn’t find any suitable module that will add ack functionality to it, so I decided to write my own. So, voila, my first vim plugin.
Installation:
Install NERD_Tree first. Then download this module to ~/.vim/plugin/ or the appropriate location on your system and…you’re done.
Install ack (see details at betterthangrep.com ). Depending on your operating system, you need to type something like “sudo apt-get install ack-grep“, “brew install ack” or other. Most of the installers will add ack to your $PATH, so NERD_Tree_Ack.vim won’t require additional configuration. If you’re weird and don’t want to add ack to your $PATH, just add the following line to your .vimrc file:
let g:path_to_search_app = "/full/path/to/ack"
Using it
Open NERD_Tree and point it to your project folder, by typing :NERDtree /path/to/project or by using bookmarks. Place the cursor on a folder and type the letter m. In the menu that will pop up you will have the option “(s)earch directory”. Select it by pressing s and type your pattern. If your search will yield results, you will see a window in the lower part of your screen, with all the results. Navigate with the keys and press
Don’t forget to rate it if you like it