Reputation: 634
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. :(
Upvotes: 27
Views: 12978
Reputation: 11
Also, a very useful feature is filtering files on the sidebar Explorer tab:
Upvotes: 0
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
Upvotes: 0
Reputation: 94
If you have the Search active just press Esc. You can see that if you hover over the cross button.
Upvotes: 0
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
Reputation: 161
Press CTRL + SHIFT + E. It will switch to and focus the explorer.
Upvotes: 16
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
Reputation: 505
The best way to get rid of the search panel is by doing the following: -
Upvotes: 4
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
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.
Upvotes: 3