So I just started using Neovim/Spacevim, and it's so awesome!
I am still getting used to everything, since I have never used Vim or anything like that before.
My question revolves around searching for particular text in all the files of the currently open project.
I am using the nerdtree
file manager, and I was wondering how I might search through all the files in the project for a specific string. Like if I wanted to search function thisExactFunction()
throughout the currently open folder/directory, how would I go about doing that? The main goal is to have a list of all the files that contain this search string.
I have fzf
installed (as well as ripgrep
), but seem to be having trouble in searching for specific text inside of all files. I can only search for files themselves, or some other search that does not yield what I need.
Can anyone point me in the right direction...? Thanks!
Check out the
Ggrep
command that Fzf supplies - see this series of vim screencasts to see how to use vim's in built features (quickfix list populated by :vimgrep) to achieve the same using other grepping tools.Custom functions
I have a function in my .vimrc that uses ag silver searcher to search within all the files in a directory (and any subdirectories). So if you install ag, this should work:
Bonus
Sometimes it's hard to find things in vim's help, so I also have a function that uses the one above to interactively search the help docs. This can be nice to hone in on the topic you want. Use
:H
for this function (as opposed to the classic:h
)