15
votes

This is an extremely stupid question... but how do I close/toggle the search box in vscode?

I hit [ cmd + shift + f ] to do a global search, but then I need to reach for my mouse to actually close the box to allow for more screen space.

I've searched through their issues, and there seems to be another user in the past who also experienced something similar --> https://github.com/Microsoft/vscode/issues/32613 , but the solution provided of cmd - b only works for closing the sidebar.

My developer speed has drastically dropped since this issue, and I'm certain there's been a fix.

Please help. :(

**added in picture here --> enter image description here

6
Search results appear in the sidebar, so if you want to close it you have to close the sidebar...what behavior do you need exactly? - Amr Noman
@AmrNoman added in picture. that little search bar. - Brian Zhou
They should really make it so that is closes (goes back to the files panel) on Escape, like every other IDE. - frodo2975
you're lucky to have a cross to click on! - PatrickT

6 Answers

6
votes

Your search results are appearing in the panel not in the sidebar, so if you want to close the panel just press cmd + ` or ctrl + `

However, if you want your search results to appear in the sidebar (which I think is the default behavior), then add this line to your settings:

"search.location": "sidebar"
6
votes

Similar to what Vijey has mentioned, you can use the Toggle Panel keyboard shortcut which will do the job for me. On A mac the shortcut is ⌘ Command+J

I'm coming from sublime where the search results appear in a new tab - making it much easier to close the results (just like closing an other tab)

2
votes

There is no keyboard shortcut to close the search panel. However, you can create a shortcut yourself as shown in the attached image.

1) Go to File > Preferences > Keyboard Shortcuts. 2) Search for the command 'Close Panel' and set it to your convenient keyboard shortcut.

In the image below, I set it to Ctrl+F8.

enter image description here

2
votes

Press CTRL + SHIFT + E. It will switch to and focus the explorer.

1
votes

The best way to get rid of the search panel is by doing the following: -

  1. On a windows computer, press and hold CTRL + Q
  2. A window will then pop up, you can then release Q when the window pops up but you still have to hold down the CTRL key to keep the pop up open 3.Now use your mouse to click on the option called explorer and the search menu is now gone
0
votes

If the search box displays in the sidebar (see Amr Noman's answer on how to set that up if it isn't already), How do you close the search box and go back to your project folders? In this case, there is no tab you can close with a click of the mouse. One way is to set up a keymap shortcut, e.g.

{
    "key": "cmd+'",
    "command": "workbench.files.action.showActiveFileInExplorer"
},

You can figure this out by going to Preferences -> Keyboard Shortcuts and searching for sidebar. One of the hits is described as "File: Reveal Active File in Side Bar"

More generally, any action that hides your project folder view in the sidebar can be cancelled by this shortcut.