简体   繁体   English

是否有一个键绑定来聚焦 VSCode 中已经打开的搜索编辑器?

[英]Is there a keybinding to focus an already-open search editor in VSCode?

I would like to use the recently-added Search Editor functionality as my primary method of searching across files.我想使用最近添加的搜索编辑器功能作为跨文件搜索的主要方法。 I set my keybinding for search.action.openNewEditor to "shift+command+f" to override the default search, and that works great.我将search.action.openNewEditor的键绑定设置为“shift+command+f”以覆盖默认搜索,效果很好。 But if I enter that keybinding again, it opens a new Search Editor.但是,如果我再次输入该键绑定,它会打开一个新的搜索编辑器。 What I want it to do is open the Search Editor on the first press, and if the Search Editor is already open but not focused -- for example, if I'm working in a different tab in the same window -- I want the "shift+command+f" to just focus the already-open Search Editor.我想要它做的是在第一次按下时打开搜索编辑器,如果搜索编辑器已经打开但没有聚焦——例如,如果我在同一个 window 的不同选项卡中工作——我想要"shift+command+f" 只关注已经打开的搜索编辑器。

Is this possible?这可能吗?

I've tried monkeying with "When" clauses on several of the Search Editor keybindings, and so far nothing is working.我已经尝试在几个搜索编辑器键绑定上使用“When”子句,但到目前为止没有任何效果。 I've also looked through the Default Keybindings JSON and nothing jumps out at me as relevant.我还查看了默认键绑定 JSON 并没有任何相关的东西跳出来。

Basically, I only ever want one Search Editor tab open, and any new searches should just append to the bottom.基本上,我只希望打开一个搜索编辑器选项卡,任何新搜索都应该只是 append 到底部。 I believe this is how Sublime and Atom both do it and I've missed that functionality.我相信这就是 Sublime 和 Atom 都是这样做的,我错过了这个功能。

Just added to the Insiders' Build (so presumably in v1.48)刚刚添加到 Insiders' Build 中(大概在 v1.48 中)

Added search.action.openEditor , also available in command pallet[e] as "Open Search Editor" (as opposed to "New Search Editor" né "Open new Search Editor"), which will open an existing search editor if one exists, otherwise create a new one.添加了search.action.openEditor ,也可在命令pallet[e] 中作为“打开搜索编辑器”(与“新搜索编辑器”né“打开新搜索编辑器”相反),如果存在,它将打开现有的搜索编辑器,否则创建一个新的。

see Reuse a single search editor tab per window and https://github.com/microsoft/vscode-docs/blob/vnext/release-notes/v1_48.md#search-editor .请参阅每个 window 和https://github.com/microsoft/vscode-docs/blob/vnext/release-notes/v1_48.md#search-editor重复使用单个搜索编辑器选项卡

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

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