Permalink
Browse files

init

  • Loading branch information...
0 parents commit c9e14cddf9c39c4cc589d8fbbe72c2da80ae5dff @vsushkov committed Sep 25, 2012
Showing with 49 additions and 0 deletions.
  1. +11 −0 README.md
  2. +38 −0 plugin/NERD_tree-ag.vim
11 README.md
@@ -0,0 +1,11 @@
+This is almost a copypaste of http://www.vim.org/scripts/script.php?script_id=3878
+
+This plugin add capability to search in folders via NERDtree. The search use [ag.vim](https://github.com/epmatsw/ag.vim).
+
+## How to Use
+
+1. Open NERDtree
+2. Point to a directory
+3. Press `ms`
+4. Enter search term
+5. Profit!
38 plugin/NERD_tree-ag.vim
@@ -0,0 +1,38 @@
+" ============================================================================
+" File: NERD_tree-ack.vim
+" Description: Adds searching capabilities to NERD_Tree
+" Maintainer: Mohammad Satrio <wolfaeon at gmail dot com>
+" License: This program is free software. It comes without any warranty,
+" to the extent permitted by applicable law. You can redistribute
+" it and/or modify it under the terms of the Do What The Fuck You
+" Want To Public License, Version 2, as published by Sam Hocevar.
+" See http://sam.zoy.org/wtfpl/COPYING for more details.
+"
+" ============================================================================
+
+
+" don't load multiple times
+if exists("g:loaded_nerdtree_ag")
+ finish
+endif
+
+let g:loaded_nerdtree_ag = 1
+
+" add the new menu item via NERD_Tree's API
+call NERDTreeAddMenuItem({
+ \ 'text': '(s)earch directory',
+ \ 'shortcut': 's',
+ \ 'callback': 'NERDTreeAg' })
+
+function! NERDTreeAg()
+ " get the current dir from NERDTree
+ let cd = g:NERDTreeDirNode.GetSelected().path.str()
+
+ " get the pattern
+ let pattern = input("Enter the pattern: ")
+ if pattern == ''
+ echo 'Maybe another time...'
+ return
+ endif
+ exec "Ag ".pattern." ".cd
+endfunction

0 comments on commit c9e14cd

Please sign in to comment.