VS Code - Search for text in all files in a directory

后端 未结 15 1026
深忆病人
深忆病人 2020-12-12 09:32

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

相关标签:
15条回答
  • 2020-12-12 10:15

    A simple answer is to click the magnifying glass on the left side bar

    0 讨论(0)
  • 2020-12-12 10:16

    Ctrl + P (Win, Linux), Cmd + P (Mac) – Quick open, Go to file

    0 讨论(0)
  • 2020-12-12 10:17

    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.

    0 讨论(0)
  • 2020-12-12 10:18

    If you have a directory open in VSCode, and want to search a subdirectory, then either:

    • ctrl-shift-F then in the files to include field enter the path with a leading ./,

    or

    • ctrl-shift-E to open the Explorer, right click the directory you want to search, and select the Find in Folder... option.
    0 讨论(0)
  • 2020-12-12 10:19

    To add to the above, if you want to search within the selected folder, right click on the folder and click "Find in Folder" or default key binding:

    Alt+Shift+F

    As already mentioned, to search all folders in your project, click Edit > "Find in Files" or:

    Ctrl+Shift+F

    0 讨论(0)
  • 2020-12-12 10:23

    You can do Edit, Find in Files (or Ctrl+Shift+F - default key binding, Cmd+Shift+F on MacOS) to search the Currently open Folder.

    There is an ellipsis on the dialog where you can include/exclude files, and options in the search box for matching case/word and using Regex.

    0 讨论(0)
提交回复
热议问题