如何直接热键到 Eclipse 中的文件搜索选项卡

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/91984/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 18:23:34  来源:igfitidea点击:

How do I hotkey directly to File Search tab in Eclipse

eclipseeditorhotkeys

提问by svrist

When I use CTRL+HI end up on the Java Search tab. I would very much like a shortcut to go directly to File Search instead. Is that possible?

当我使用CTRL+H我最终在 Java 搜索选项卡上。我非常想要一个直接转到文件搜索的快捷方式。那可能吗?

See image here for what I'm talking about: enter image description here

请参阅此处的图片了解我在说什么: 在此处输入图片说明

回答by Martin

You can just define a key binding that opens the file search:

您可以定义一个打开文件搜索的键绑定:

  1. Go to Preferences> General> Keys
  2. Type "file search" in the search box. (If there are no results, and you have a really old Eclipse version, select the Include Unbound Commandscheck box.)
  3. Put the caret into the Bindingtext box and press the key combination you want to use:
  1. 转到首选项>常规>
  2. 在搜索框中键入“文件搜索”。(如果没有结果,并且您有一个非常旧的 Eclipse 版本,请选中Include Unbound Commands复选框。)
  3. 将插入符号放入Binding文本框中,然后按要使用的组合键:

enter image description here

在此处输入图片说明

You can either re-use the CTRL+Hbinding (delete the other binding in that case) or define another one (e.g. CTRL+SHIFT+H). To delete the other binding search for "Open Search Dialog" and click on Unbind Command.

您可以重新使用CTRL+H绑定(在这种情况下删除另一个绑定)或定义另一个绑定(例如CTRL+ SHIFT+ H)。要删除“打开搜索对话框”的其他绑定搜索,然后单击取消绑定命令



Other solution: You could press CTRL+3in your editor, type in "file s", press Enter. The next time you press CTRL+3"File Search" is at the top.

其他解决方案:您可以在编辑器中按CTRL+ 3,输入“file s”,然后按Enter。下次按CTRL+ 3“文件搜索”时位于顶部。

回答by Enrique Ramos

Another option is to open the search dialog (Ctrl+H) then click customize and hide java and task search tabs, next time you do Ctrl+H, file search will be the only one showing, thus it will be selected by default

另一种选择是打开搜索对话框(Ctrl+ H),然后单击自定义并隐藏 java 和任务搜索选项卡,下次执行Ctrl+ 时H,文件搜索将是唯一显示的,因此默认情况下会被选中

回答by joshmcode

I actually think the best (and easiest way) is to simply open the search dialog (ctrl + h), hit customize, and then select the checkbox for "Remember last page used." Then tab over to the File Search once. So long as that is the last search tab you used, it will always open there. The advantage to this is that you don't lose easy access to the other tabs, should you actually need them! (working in Eclipse Kepler).

我实际上认为最好(也是最简单的方法)是简单地打开搜索对话框(ctrl + h),点击自定义,然后选中“记住上次使用的页面”复选框。然后切换到文件搜索一次。只要这是您使用的最后一个搜索选项卡,它就会始终在那里打开。这样做的好处是,如果您确实需要它们,您不会失去对其他选项卡的轻松访问权限!(在 Eclipse 开普勒工作)。

Customize view

自定义视图

回答by akavel

I learnt to use a "pseudo-hotkey" ALT+AF(works also as ALT+AALT+F), which resolves to: "Menu Se[a]rch → [F]ile..."and has the advantage of being always present, without need for reconfiguration.

我学会了使用“伪热键” ALT+ AF(也可以用作ALT+ AALT+ F),它解析为:“Menu Se[a]rch → [F]ile...”并且具有始终存在的优点,无需用于重新配置。

回答by Jon Schneider

I've run into this problem before, too.

我以前也遇到过这个问题。

I tried following the advice in the question response given by @Martin to rebind Ctrl+Hto "File Search" in Window | Preferences | General | Keys, but for some reason, I don't have a "File Search" entry in the Command column. (I'm running Eclipse 3.3 currently; maybe the "File Search" entry was added in a subsequent release?)

我尝试按照@Martin 给出的问题回复中的建议将Ctrl+重新绑定H到 Window | 中的“文件搜索” 偏好 | 一般 | 键,但出于某种原因,我在命令列中没有“文件搜索”条目。(我目前正在运行 Eclipse 3.3;也许在后续版本中添加了“文件搜索”条目?)

Update:As Martin pointed out in a comment on this answer, I didn't have the "Include unbound commands" checkbox checked in the Preferences | Keys dialog, which is why "File Search" wasn't showing up for me. I now have Ctrl+Hbound to "File Search", as Martin suggested in his answer on this page, and it works great. Thanks Martin!

更新:正如 Martin 在对此答案的评论中指出的那样,我没有在 Preferences | 中选中“Include unbound commands”复选框。键对话框,这就是为什么我没有显示“文件搜索”的原因。我现在Ctrl+H绑定到“文件搜索”,正如 Martin 在他在此页面上的回答中所建议的那样,并且效果很好。谢谢马丁!

I ended up working around the original problem by bringing up the Search dialog with Ctrl+H, then clicking the Customize button on the dialog, which brings up a "Search Page Selection" dialog which allows you to hide or show tabs on the Search dialog. I hid the tabs other than "File Search," which causes "File Search" to be activated by default on future uses of Ctrl+H.

我最终通过使用Ctrl+ 调出搜索对话框解决了原始问题H,然后单击对话框上的自定义按钮,这会调出一个“搜索页面选择”对话框,允许您在搜索对话框中隐藏或显示选项卡。我隐藏了除“文件搜索”以外的选项卡,这会导致在将来使用Ctrl+ 时默认激活“文件搜索” H

回答by gizmo

As far as I know, the search window tab depend of the open file you're on when calling the search function. So, for example if your on a web.xml file, it will open the "plug-in search" instead of the "java-search".

据我所知,搜索窗口选项卡取决于您在调用搜索功能时所在的打开文件。因此,例如,如果您在 web.xml 文件上,它将打开“插件搜索”而不是“java-search”。

Edit: there is a way to force the default open tab, by assigning a shortcut to the "File Search" action in the "Keys" preference panel.

编辑:有一种方法可以通过在“键”首选项面板中为“文件搜索”操作分配快捷方式来强制默认打开选项卡。

回答by Sankalp

Probably this feature came recently [confirmed its there in since Juno] and looks intelligent. Press Ctrl+H --> Customize --> [Checkbox]Remember last used page. This way you are not far from other options if required anytime. So if you use File search often then you will not get annoyed getting what you last chose.

可能这个功能最近出现了[确认自朱诺以来就存在]并且看起来很聪明。 按 Ctrl+H --> 自定义 --> [复选框]记住上次使用的页面。这样,如果需要,您离其他选择不远。因此,如果您经常使用文件搜索,那么您将不会因为获得上次选择的内容而烦恼。

回答by ulyssis2

I would like to provide a workaround here: you can 'remember last used page' to avoid opening it over and over again.

我想在这里提供一个解决方法:您可以“记住上次使用的页面”以避免一遍又一遍地打开它。

enter image description here

在此处输入图片说明

回答by Gabriel Staples

UPDATE: user @muescha, in the comments underneath the question, just pointed out to me that I accidentally answered the wrong question!Nevertheless, it is still a valuable answer (just not to this question), so I'm leaving it.

更新:用户@muescha,在问题下方的评论中,刚刚向我指出我不小心回答了错误的问题!尽管如此,它仍然是一个有价值的答案(只是不是这个问题),所以我要离开它。

My answer answers the question: How do I use a hotkey directly to search for a File in Eclipse?

我的回答回答了这个问题:如何直接使用热键在 Eclipse 中搜索文件?

Ctrl+ Shift+ Rworks fantastically!Use asterisks (*) for wildcards. It is very similar to the Ctrl+ Pfuzzy search in Sublime Text 3.

Ctrl+ Shift+R的作品充满了想象!使用星号 (*) 作为通配符。它与Sublime Text 3 中的Ctrl+P模糊搜索非常相似。

Sample searches using the Ctrl+ Shift+ R"Open Resource" search in Eclipse:

使用样本搜索Ctrl+ Shift+ R“开放资源”在Eclipse中搜索:

rea

rea

enter image description here

在此处输入图片说明

*.txt

*.txt

enter image description here

在此处输入图片说明

*32*f1*c

*32*f1*c

enter image description here

在此处输入图片说明

*3*1*c*h
Notice if you just put an asterisk *between every character in the search string it works just like Sublime Text 3's Ctrl+ P"fuzzy search"! Beautiful!

*3*1*c*h
请注意,如果您只是*在搜索字符串中的每个字符之间放置一个星号,它的工作方式就像 Sublime Text 3 的Ctrl+ P“模糊搜索”!美丽的!

enter image description here

在此处输入图片说明



Side note: you can also use the Search--> Filemenu dialog to search for files.

旁注:您还可以使用Search-->File菜单对话框来搜索文件。