在 Eclipse for Java 中导航到下一个/上一个搜索匹配的键盘快捷键

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1674628/
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-19 14:06:37  来源:igfitidea点击:

Keyboard shortcut to navigate to next/previous search match in eclipse for java

eclipsekeyboard-shortcuts

提问by jumar

Is it possible to assign a shortcut to this function?

是否可以为此功能分配快捷方式?

采纳答案by tangens

If you hover over the arrows to get to the next or previous result, eclipse shows you the shortcut: Ctrl+ .and Ctrl+ ,.

如果您将鼠标悬停在箭头上以获得下一个或上一个结果,eclipse 会向您显示快捷方式:Ctrl+.Ctrl+ ,

回答by gordon

CTRL+Kforward and CTRL+SHIFT+Kback:

CTRL+K前进和CTRL+SHIFT+K后退

Highlight a word or phrase you want to search for. Hitting CTRL+K will take you to the next without having to open the Search control window. Please also upvote @feedbackloop for his comment here/below with the shortcut to go to the previous!

突出显示要搜索的单词或短语。按 CTRL+K 将带您进入下一个,而无需打开“搜索”控制窗口。还请在此处/下方为他的评论点赞@feedbackloop,并使用转到上一个的快捷方式!

I'm using CFEclipse. I don't know if the same applies to what workbench you're using.

我正在使用 CFEclipse。我不知道这是否同样适用于您使用的工作台。

回答by Inusable Lumière

The solution I use to go to next/previous search match even when the search result view is not focusedis as follows:

即使未聚焦搜索结果视图,我也用于转到下一个/上一个搜索匹配的解决方案如下:

  • Use the prev/next shortcuts as usual when the search view is focused: Ctrl+ .and Ctrl+ ,.
  • Configure the same keys to focus the search result view when it's not focused. Window > Preferences > General > Keys - Search: "Show View (Search)", Press "Copy Command", Set binding: "CTRL+.", when: "Editing Text" (and similar configuration for "CTRL+,").
  • 当搜索视图聚焦时,像往常一样使用上一个/下一个快捷方式:Ctrl+.Ctrl+ ,
  • 配置相同的键以在未聚焦时聚焦搜索结果视图。Window > Preferences > General > Keys - Search:“Show View (Search)”,按“Copy Command”,设置绑定:“CTRL+.”,当:“Editing Text”(和“CTRL+,”类似的配置)。

That way these keyboard shortcuts will work both when search results are active and inactive.

这样,当搜索结果处于活动状态和非活动状态时,这些键盘快捷键都将起作用。

Note:In order not to sacrifice the ability to use shortcut keys to navigate to previous/next results in other views (e.g. Problems view, etc) you can assign different keys for navigating the currently focused view.

注意:为了不牺牲使用快捷键导航到其他视图(例如问题视图等)中的上一个/下一个结果的能力,您可以分配不同的键来导航当前聚焦的视图。

回答by NateS

The best way I could find was to use AutoHotkey. Eg, when ctrl+alt+right is pressed, it focuses the search view (+!qs), does next (^.), then focuses the editor (^e).

我能找到的最好方法是使用 AutoHotkey。例如,当按下 ctrl+alt+right 时,它聚焦搜索视图 (+!qs),执行 next (^.),然后聚焦编辑器 (^e)。

#If WinActive("ahk_exe eclipse.exe") && WinActive("ahk_class SWT_Window0")
    ^!Right::Send +!qs^.^e
    ^!Left::Send +!qs^,^e
#If