In vscode, when searching text in all files with ctrl + shift + f
, is there a fast way to cycle through the found results? Currently I press ctrl + arrow down
multiple times to navigate to the result list, but that still feels clumsy compared to fzf in Vim.
You can use a sequence of commands to go to the next or prev search when you are in the editor.
Use extension multi-command
Add this to keybindings.json
{
"key": "ctrl+alt+f3",
"command": "extension.multiCommand.execute",
"args": {
"sequence": [
"search.action.focusSearchList",
"list.focusDown",
"workbench.action.focusActiveEditorGroup"
]
}
},
{
"key": "shift+ctrl+alt+f3",
"command": "extension.multiCommand.execute",
"args": {
"sequence": [
"search.action.focusSearchList",
"list.focusUp",
"workbench.action.focusActiveEditorGroup"
]
}
}
If you are currently at the last or first hit for a file you have to use the key combi a second time.
Edit : modified the Up/Down command to use (list
instead of cursor
)
Just found out (Mark made a question/answer) that VSC now (v1.77 insiders) has a build in command to run a sequence of commands. In certain situations you can do without multi-command
. (Some users are not allowed to install extensions at work)
{
"key": "ctrl+alt+f3",
"command": "runCommands",
"args": {
"commands": [
"search.action.focusSearchList",
"list.focusDown",
"workbench.action.focusActiveEditorGroup"
]
}
},
{
"key": "shift+ctrl+alt+f3",
"command": "runCommands",
"args": {
"commands": [
"search.action.focusSearchList",
"list.focusUp",
"workbench.action.focusActiveEditorGroup"
]
}
}
Edit
If you modify an item text in the editor and it no longer matches the searched text you have to use a different method because the list has put the focus on the next item: use Ctrl+0
and Enter
Edit
Replaced workbench.action.focusSideBar
with search.action.focusSearchList
VSC will select the search bar if it is not visible.