├── README.md └── plugin └── NERD_tree-ack.vim /README.md: -------------------------------------------------------------------------------- 1 | # NERDtree + Ack.vim 2 | 3 | This plugin add capability to search in folders via NERDtree. The search use ack.vim from the master branch (). 4 | This is ripped off from [NERDTree & ack plugin](http://www.vim.org/scripts/script.php?script_id=3357) by Tudor Barbu. It just doesn't fit my taste, so, yeah. 5 | 6 | ## How to Install 7 | 8 | 1. Install ack.vim first from . Or you can use [my branch](https://github.com/tyok/ack.vim) whose behavior is IMHO more NERDtree-friendly. 9 | 1. Copy the plugin file to your `.vim/plugin` directory, or install via pathogen/vundle 10 | 11 | ## How to Use 12 | 13 | 1. Open NERDtree 14 | 1. Point to a directory 15 | 1. Press `ms` 16 | 1. Enter search term (e.g. `control\ panel -i`) 17 | 1. Profit! 18 | 19 | ## Features 20 | 21 | 1. Doesn't change current open buffers! This feature is what necessitate the use of latest ack.vim 22 | 1. Uses ack.vim syntax: 23 | 1. Use `\ ` to write a space (e.g. `control\ panel`) 24 | 1. Or enclose the term in quotes (e.g. `"control panel"`) 25 | 1. The default behavior is case sensitive. Use `-i` params for case insensitive (e.g. `"control panel" -i`) 26 | 1. Uses ack.vim buffer behavior 27 | -------------------------------------------------------------------------------- /plugin/NERD_tree-ack.vim: -------------------------------------------------------------------------------- 1 | " ============================================================================ 2 | " File: NERD_tree-ack.vim 3 | " Description: Adds searching capabilities to NERD_Tree 4 | " Maintainer: Mohammad Satrio 5 | " License: This program is free software. It comes without any warranty, 6 | " to the extent permitted by applicable law. You can redistribute 7 | " it and/or modify it under the terms of the Do What The Fuck You 8 | " Want To Public License, Version 2, as published by Sam Hocevar. 9 | " See http://sam.zoy.org/wtfpl/COPYING for more details. 10 | " 11 | " ============================================================================ 12 | 13 | 14 | " don't load multiple times 15 | if exists("g:loaded_nerdtree_ack") 16 | finish 17 | endif 18 | 19 | let g:loaded_nerdtree_ack = 1 20 | 21 | " add the new menu item via NERD_Tree's API 22 | call NERDTreeAddMenuItem({ 23 | \ 'text': 'search files, case s(e)nsitive', 24 | \ 'shortcut': 'e', 25 | \ 'callback': 'NERDTreeAckSensitive' }) 26 | 27 | call NERDTreeAddMenuItem({ 28 | \ 'text': '(s)earch files, case insensitive', 29 | \ 'shortcut': 's', 30 | \ 'callback': 'NERDTreeAck' }) 31 | 32 | function! NERDTreeAck() 33 | " get the current dir from NERDTree 34 | let cd = g:NERDTreeDirNode.GetSelected().path.str() 35 | 36 | " get the pattern 37 | let pattern = input("Enter the pattern: ") 38 | if pattern == '' 39 | echo 'Maybe another time...' 40 | return 41 | endif 42 | exec "Ack! -i '".pattern."' '".cd."'" 43 | endfunction 44 | 45 | function! NERDTreeAckSensitive() 46 | " get the current dir from NERDTree 47 | let cd = g:NERDTreeDirNode.GetSelected().path.str() 48 | 49 | " get the pattern 50 | let pattern = input("Enter the pattern: ") 51 | if pattern == '' 52 | echo 'Maybe another time...' 53 | return 54 | endif 55 | exec "Ack! '".pattern."' ".cd 56 | endfunction 57 | --------------------------------------------------------------------------------