426

How can I find a file by name in Visual Studio Code?

A Visual Studio shortcut I'm used to is CTRL+,, but it does not work here.

Paresh Mangukiya
  • 37,512
  • 17
  • 201
  • 182
Nenad
  • 22,498
  • 10
  • 68
  • 87
  • In Visual studio the shortcut is `[CTRL] + ';'` instead – RBT Apr 28 '17 at 04:04
  • Something similar [here](http://stackoverflow.com/questions/30095376/how-do-i-search-for-files-in-visual-studio-code) – RBT Apr 28 '17 at 04:06
  • 5
    It's Ctr+P. Not Ctr+, – Anand Raja Apr 03 '20 at 11:28
  • 3
    Does this answer your question? [How do I search for files in Visual Studio Code?](https://stackoverflow.com/questions/30095376/how-do-i-search-for-files-in-visual-studio-code) – Anand Raja Apr 03 '20 at 11:30
  • @AnandRaja I had the same discussion some time ago, maybe a year. This question is asking specifically for `Find file by name` functionality from Visual Studio. Question you suggested is more broad. Think also about search-ability, Lot of people search for this. – Nenad Apr 03 '20 at 12:39
  • @AnandRaja Regarding `Ctrl+P` - I am using En-US default configuration for Visual Studio and `Ctrl+P` for me brings Print Dialog. On the other hand `Ctrl+,` brings "omni box". One that finds files, sybols, etc... – Nenad Apr 03 '20 at 16:32
  • @Nenad may be, it may differ depending on the region(geo location). My keyboard is also US based, but geo location is India. – Anand Raja Apr 04 '20 at 16:53
  • @AnandRaja Yes, that could be the reason. Probably `EN-IN` culture in Windows, instead of `EN-US`? – Nenad Apr 05 '20 at 18:22
  • 1
    you can make it with `Explorer Tree` https://stackoverflow.com/a/61460276/2736742 – A. Morel Apr 27 '20 at 14:02

5 Answers5

597

When you have opened a folder in a workspace you can do Ctrl+P (Cmd+P on Mac) and start typing the filename, or extension to filter the list of filenames

if you have:

  • plugin.ts
  • page.css
  • plugger.ts

You can type css and press enter and it will open the page.css. If you type .ts the list is filtered and contains two items.

machineghost
  • 30,831
  • 28
  • 141
  • 212
Dick van den Brink
  • 12,557
  • 3
  • 29
  • 42
  • 10
    If you want to change the shortcut, look for `Go to file...` in File > Preferences > Keyboard Shortcuts – Dinei May 10 '17 at 15:11
  • 2
    { "key": "cmd+p", "command": "workbench.action.quickOpenNavigateNextInFilePicker", "when": "inFilesPicker && inQuickOpen" } – gdbj Mar 10 '18 at 21:45
  • 5
    We should notice that `Ctrl+P` opens file in Preview mode. In order to open file in new tab, let's follow https://stackoverflow.com/a/43707807/190309 – anticafe Jul 10 '18 at 07:38
  • 1
    This does not seem to work for me, only already open files show up when searching (they can still be found after closing, but never opened files does not show). – Zitrax Jun 26 '19 at 14:36
  • That is. Additionally you can run Ctrl+K+S to search all shortcuts – lyolikaa Jul 23 '19 at 08:40
  • anyone knows why it is the letter "P" ? knowing what it stands for helps remembering – Olivvv Nov 05 '19 at 08:54
  • 1
    @Zitrax is right: Ctrl+P [filename] does not work on all files in the Explorer, it only lists files that are already open -- at least when one is using a remote back-end like WSL, etc. The explorer needs a real search tool which works under all conditions. – Stabledog Aug 22 '21 at 13:16
22

Press Ctl+T will open a search box. Delete # symbol and enter your file name.

rajeev pani..
  • 4,959
  • 5
  • 25
  • 35
  • 29
    This is just a longer way around to arrive to exactly the same point as pressing directly `Ctrl + P`. – Nenad Aug 14 '19 at 09:42
  • 1
    It's a shame this does not get more upvotes; this is solving the OP's question, whereas the answer by @Dick both finds the file _and_ opens it, which was not the OP's request. – Mike Williamson Feb 23 '22 at 19:21
20

I believe the action name is "workbench.action.quickOpen".

Andrei Pokrovsky
  • 3,240
  • 2
  • 25
  • 17
13

It is CMD + P (or CTRL + P) by default. However the keyboard bindings may differ according to your preferences.

To know your bindings go to the "Keyboard Shortcuts" settings and search for "Go to File"

Kalpesh Popat
  • 1,148
  • 11
  • 12
0

It's Ctrl+Shift+O / Cmd+Shift+O on mac. You can see it if you close all tabs

Misha Akopov
  • 11,071
  • 26
  • 66
  • 81
Asaf Pinhassi
  • 14,849
  • 11
  • 103
  • 128
  • 2
    By default `Ctrl+Shift+O` is "Go to symbol..." binding. Lists all symbols on the currently open page. – Nenad Dec 18 '19 at 09:23