How can I do quick searching in NERDTree?
Asked Answered
S

3

28

Is it possible to do searching in NERDTree window by the filenames and file content?

Shew answered 10/11, 2012 at 10:48 Comment(0)
K
41

You can do /foo like in any other normal Vim window but you are limited to the text currently displayed in NERDTree: you cannot search non-expanded subdirectories or non-listed files.

Assuming you are at the root of your project, you can do the following to search the word foo in JavaScript files across your project:

:vim foo **/*.js | copen

Or the following if the "working directory" (:pwd) is not the root of your project:

:vim foo /path/to/project/**/* | copen

Note the ** (:help starstar) that makes the search recursive.

If you want to open app/views/foobar.php for editing, you can do:

:e **/foo<tab>

Well, there are many ways.

Accessing files/buffers or searching across a project are relatively straightforward with native commands but there are quite a lot of third party plugins to make it even faster and easier. Ctrl+P is my favorite file/buffer finder plugin but you should get comfortable with the basics before turning to plugins.

Kath answered 10/11, 2012 at 11:14 Comment(0)
S
11

Command-t in one of my favorite vim plugins, it's ruby based plugin above integration with FZF.

By using Comamnd-T and FZF you can do the search with an extremely fast "fuzzy" mechanism for:

  • Opening files and buffers
  • Jumping to tags and help
  • Running commands, or previous searches and commands
  • with a minimal number of keystrokes.

As you can see

enter image description here

I always search in command history by opening a new terminal and hit:

CTRL+R

In addition to searching in all folders recursively by writing in any terminal tab:

fzf

Also, you can write inside vim

:CommandT 

But Still, I am looking for a powerful vim plugin to search inside files content. especially in large folders. if I found one I will update this answer.

Stearne answered 24/1, 2018 at 15:39 Comment(0)
R
4

Not answering the question directly, but check out fzf.vim instead. It provides search functionality for more than just files and it's lightning fast.

Rebound answered 8/11, 2019 at 21:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.