Is it possible to do searching in NERDTree window by the filenames and file content?
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.
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
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.
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.
© 2022 - 2024 — McMap. All rights reserved.