Is there a way to search for text in all files in a directory using VS Code?
I.e., if I type find this
in my search, it will search through all the files in the current directory and return the files that matched.
What is NOT so obvious is that you can use the following pattern to recursively search
./src/**/*.html
so perhaps leave the following as the default for most of your typical searches to remind that there is such a thing
./src/**/
For example I was after an attribute for left-right justify/docking content, I could not remember except "start" so I did the following search which reveals to me "item-start"
I think these official guide should work for your case.
VS Code allows you to quickly search over all files in the currently-opened folder. Press Ctrl+Shift+F and enter in your search term. Search results are grouped into files containing the search term, with an indication of the hits in each file and its location. Expand a file to see a preview of all of the hits within that file. Then single-click on one of the hits to view it in the editor.
Search across files - Press Ctrl+Shift+F
Find - Press Ctrl+F
Find and Replace - Ctrl+H
For basic editing options follow this link - https://code.visualstudio.com/docs/editor/codebasics
Note : For mac the Ctrl represents the command button
Just in case you wanted to use PowerShell to search for and then open all text files in your current directory:
foreach($file in $(dir -recurse -include *.txt))
{
code $file
}
You could also be a little more specific or even change the file type:
foreach($file in $(dir <specificDir> -recurse -include *.<anyExtension>))
{
code $file
}