Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
vsushkov committed Sep 25, 2012
0 parents commit c9e14cd
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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 changes: 38 additions & 0 deletions plugin/NERD_tree-ag.vim
Original file line number Diff line number Diff line change
@@ -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.