简体   繁体   English

用于从搜索栏导航到突出显示的选择的 VSCode 键盘快捷键

[英]VSCode keyboard shortcut to navigate from search bar to highlighted selection

I'm constantly searching code within a file in VSCode.我经常在 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 .我知道我可以使用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 :如果您正在谈论从 find 小部件移动到第一个匹配项,那么您似乎有这个选项,假设您不想只用escape关闭 find 小部件:

  1. the workbench.action.focusActiveEditorGroup command is unbound you could use that. workbench.action.focusActiveEditorGroup命令未绑定,您可以使用它。 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:和 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.因此,在输入您的查找项后,只需Enter直到您到达您想要切换焦点的特定查找匹配项,然后使用Shift + E或 go 上面的任何键绑定。

Maybe I am just missing it but it seems odd there isn't an easier way to toggle focus from the find widget.也许我只是想念它,但似乎没有更简单的方法可以从查找小部件切换焦点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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