Brian Zhou
Brian Zhou

Reputation: 634

How to close the search toggle for vscode?

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

Upvotes: 27

Views: 12978

Answers (9)

Mironek
Mironek

Reputation: 11

  • Ctrl+B or Cmd+B on Mac - to toggle the sidebar
  • Ctrl+Shift+F or Cmd+Shift+F on Mac - opens and sets the focus strictly on the search tab in the sidebar
  • Ctrl+Shift+E or Cmd+Shift+E on Mac - to toggle the focus between the sidebar explorer and the editor window (if your focus is on the search tab, for example, you will first go to the explorer tab, and pressing the combination again will jump to the editor window)
  • Ctrl+1 or Cmd+1 on Mac - Set the focus strictly on the editor window

Also, a very useful feature is filtering files on the sidebar Explorer tab:

  • Ctrl+Alt+F or Cmd+Alt+F on Mac - to toggle the filter widget in Explorer tab

Upvotes: 0

Pravin W
Pravin W

Reputation: 2521

I was facing similar issue, I have slightly different approach for this. By simply dragging, I moved the search panel to the right side of the editor (Secondary side bar). I used "runCommands" to run multiple commands (which is inbuilt), keymap is as follows,

{
    "key": "ctrl+shift+a",
    "command": "runCommands",
    "args": {
        "commands": [
            "workbench.action.closeAuxiliaryBar",
            "workbench.action.focusActiveEditorGroup"
        ]
    }
},
{
    "key": "ctrl+shift+e",
    "command": "runCommands",
    "args": {
        "commands": [
            "workbench.action.closeAuxiliaryBar",
            "workbench.explorer.fileView.focus"
        ]
    }
}

"workbench.action.focusActiveEditorGroup" - focus on active editor

"workbench.action.closeAuxiliaryBar" - close the secondary side bar (i.e. search panel)

Note: Shortcut keys used here are just for examples you can choose your own, making sure it do not overwrite other command

enter image description here

Upvotes: 0

VC Healy
VC Healy

Reputation: 94

If you have the Search active just press Esc. You can see that if you hover over the cross button.

Upvotes: 0

Amr Noman
Amr Noman

Reputation: 2647

Your search results are appearing in the panel, not the sidebar.

To toggle the panel:
pc/mac: ctrl + ` (backtick)
mac: ⌘ + J

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"

Upvotes: 8

Salman Shaik
Salman Shaik

Reputation: 161

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

Upvotes: 16

PatrickT
PatrickT

Reputation: 10540

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.

Upvotes: 0

Paul M
Paul M

Reputation: 505

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

Upvotes: 4

Sam J
Sam J

Reputation: 724

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)

Upvotes: 8

Vijey
Vijey

Reputation: 6626

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

Upvotes: 3

Related Questions