简体   繁体   中英

VSCode keyboard shortcut to navigate from search bar to highlighted selection

I'm constantly searching code within a file in VSCode.

Is there a keyboard shortcut to navigate from the search bar to the highlighted selection in the editor? That would make things much more efficient for me.

I know I can copy a highlighted selection from the editor to the search bar using CMD + F .

If you are talking about moving from the find widget to the first match, it looks like you have this option, assuming you don't want to just close the find widget with escape :

  1. the workbench.action.focusActiveEditorGroup command is unbound you could use that. But you have to hit escape twice to unselect the find match if you don't want it to remain selected.

That's a pain though so you might a macro that does it all at once. Like (in settings):

"multiCommand.commands": [

  {
    "command": "multiCommand.focusEditorFromFind",
    "sequence": [
      "workbench.action.focusActiveEditorGroup",
      "cancelSelection",
      "cancelSelection",
    ]
  }
]

and keybindings.json:

{
  "key": "shift+e",
  "command": "multiCommand.focusEditorFromFind",
  "when": "editorFocus && findWidgetVisible"
}

So after typing your find term, just Enter until you get to the particular find match you want to switch focus to, and the Shift + E or whatever keybinding you go with above.

Maybe I am just missing it but it seems odd there isn't an easier way to toggle focus from the find widget.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM