6

i'm trying to get a list of all the files with a certain name in a project i opened with VS Code.

For example, all the .gitignore files in my project. I know i can ctrl+p and type ".gitignore", but i don't want to open all the files, i want to list them, and open them one by one afterwards. Also the "open file" popup disappears as it looses focus and brings recent files to the top, altering the order every time (this makes it difficult to keep track of the files i already opened).

I've found this cool extension that only opens all the files with a certain name (it even supports wildcards). The problem is that i have tens of files, i can't open all of them together, especially if the files are not simple .gitignore files, but something bigger.

Yes i could just use my OS' file search, but that is not always possible (eg. when using a remote filesystem) or quick (it depends on how many files are in the project folder).

4
  • Do the following similar shortcuts help : Ctrl+Shift+F, Ctrl+F or Ctl+T? As I'm not using VS Code I can't try it myself.
    – harrymc
    Commented Apr 4, 2023 at 10:01
  • hi! ctrl+shift+F is the global search: it searches for text inside files matching your pattern. - ctrl+F is the current file search: it searches for text inside the current file. - ctrl+T is the symbol search: it searches for classes/functions/whatever, anywhere (if i'm not mistaken). - what i need is a gnome-search-tool/Everything Search/Explorer.exe-like search, listing files matching my query. i'm not looking for any particular file contents, just the name/path
    – aetonsi
    Commented Apr 4, 2023 at 10:59
  • Which operating system ?
    – harrymc
    Commented Apr 4, 2023 at 12:42
  • windows, but also linux, and also virtual filesystems. it should be OS and FS agnostic..
    – aetonsi
    Commented Apr 6, 2023 at 16:57

1 Answer 1

8

First, select the Explorer sidebar button or open it with Ctrl + Shift + E shortcut: Explorer

Make sure it's focused by clicking on it. Then, use Ctrl + F, which is default keybinding before VSCode 1.89, or Ctrl + Alt + F after 1.89. A search bar will appear. Enter the phrase that you want to match. Files matching it will get highlighted

You can lastly press the Filter button to only show the matched files: Filter

4
  • 1
    works! but apparently there's a bug, it shows many many folders but when i expand them looking for my .gitignore files, the entire folder structure disappears, because it didn't contain the given file. also some times the folder is not even clickable, then i click something else, then it's clickable again. i think that's all a bit buggy
    – aetonsi
    Commented Apr 6, 2023 at 17:01
  • 2
    still, this is exactly what i was looking for. thanks. i'll report the bugs on github. have a nice day
    – aetonsi
    Commented Apr 6, 2023 at 17:02
  • @thepunsguy, thanks for the edit, it was doomed to be rejected though, as answer body should be kept in tact as much as possible. I included bindings for both pre 1.89 and post 1.89.
    – Destroy666
    Commented Jul 3 at 16:44
  • Ctrl + Alt + F was the missing part. This is exactly what I was looking for thanks! Commented yesterday

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .