Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

init

  • Loading branch information...
commit c9e14cddf9c39c4cc589d8fbbe72c2da80ae5dff 0 parents
Valentin Sushkov authored

Showing 2 changed files with 49 additions and 0 deletions. Show diff stats Hide diff stats

  1. +11 0 README.md
  2. +38 0 plugin/NERD_tree-ag.vim
11 README.md
Source Rendered
... ... @@ -0,0 +1,11 @@
  1 +This is almost a copypaste of http://www.vim.org/scripts/script.php?script_id=3878
  2 +
  3 +This plugin add capability to search in folders via NERDtree. The search use [ag.vim](https://github.com/epmatsw/ag.vim).
  4 +
  5 +## How to Use
  6 +
  7 +1. Open NERDtree
  8 +2. Point to a directory
  9 +3. Press `ms`
  10 +4. Enter search term
  11 +5. Profit!
38 plugin/NERD_tree-ag.vim
... ... @@ -0,0 +1,38 @@
  1 +" ============================================================================
  2 +" File: NERD_tree-ack.vim
  3 +" Description: Adds searching capabilities to NERD_Tree
  4 +" Maintainer: Mohammad Satrio <wolfaeon at gmail dot com>
  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_ag")
  16 + finish
  17 +endif
  18 +
  19 +let g:loaded_nerdtree_ag = 1
  20 +
  21 +" add the new menu item via NERD_Tree's API
  22 +call NERDTreeAddMenuItem({
  23 + \ 'text': '(s)earch directory',
  24 + \ 'shortcut': 's',
  25 + \ 'callback': 'NERDTreeAg' })
  26 +
  27 +function! NERDTreeAg()
  28 + " get the current dir from NERDTree
  29 + let cd = g:NERDTreeDirNode.GetSelected().path.str()
  30 +
  31 + " get the pattern
  32 + let pattern = input("Enter the pattern: ")
  33 + if pattern == ''
  34 + echo 'Maybe another time...'
  35 + return
  36 + endif
  37 + exec "Ag ".pattern." ".cd
  38 +endfunction

0 comments on commit c9e14cd

Please sign in to comment.
Something went wrong with that request. Please try again.