eclipse 更改自动完成选择的热键
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3663015/
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
Change hotkey for autocomplete selection
提问by ack
In Eclipse, I find it pretty annoying that Enter is the hotkey that selects an item from the Content Assist/Autocomplete list. Especially in PyDev where there is no end-of-line semicolon, pressing enter for a new line will instead give me whatever is selected in the Autocomplete list.
在 Eclipse 中,我发现 Enter 是从 Content Assist/Autocomplete 列表中选择一个项目的热键,这很烦人。尤其是在没有行尾分号的 PyDev 中,按回车键换行将给我在自动完成列表中选择的任何内容。
Tab is a much better selection hotkey since I'm not likely to want a tab mid-line.
Tab 是一个更好的选择热键,因为我不太可能想要一个 tab 中线。
Any chance of changing this in Eclipse?
有机会在 Eclipse 中改变这个吗?
Using CDT, PDT, and PyDev, but interested in any solution related to Eclipse.
使用 CDT、PDT 和 PyDev,但对与 Eclipse 相关的任何解决方案感兴趣。
回答by TK Gospodinov
All key bindings in Eclipse are defined in Window -> Preferences -> General -> Keys. I don't think you can change what is used to select stuff from the autocomplete list, but you can use space to select and then Enter for new line.
Eclipse 中的所有键绑定都在Window -> Preferences -> General -> Keys 中定义。我认为您无法更改用于从自动完成列表中选择内容的内容,但您可以使用空格进行选择,然后 Enter 换行。
回答by Max
The autocompletion selection key(s) is editor specific. For instance in Aptana Studio, you could define set of keys for proposal selection. See e.g. Preferences/Aptana Studio/Editors/JavaScript. Since PyDev shares some code with Aptana Studio, it has similar capabilities. See "Preferences/PyDev/Editor/Code Completion/Apply completion on *" checkboxes.
自动完成选择键是特定于编辑器的。例如,在 Aptana Studio 中,您可以为提案选择定义一组键。参见例如首选项/Aptana Studio/Editors/JavaScript。由于 PyDev 与 Aptana Studio 共享一些代码,因此它具有类似的功能。请参阅“首选项/PyDev/编辑器/代码完成/在 * 上应用完成”复选框。
Speaking of the Tab key as a selector, it doesn't seem possible w/o extra coding since it has special meaning to focus into proposals window. For these who interested could find Tab handling at org.eclipse.jface.text.contentassist.CompletionProposalPopup.verifyKey(VerifyEvent)
说到作为选择器的 Tab 键,它似乎不可能没有额外的编码,因为它具有特殊的意义,可以聚焦到建议窗口。对于那些感兴趣的人可以在 org.eclipse.jface.text.contentassist.CompletionProposalPopup.verifyKey(VerifyEvent) 找到 Tab 处理
Cheers, Max
干杯,马克斯
回答by Fabio Zadrozny
Unfortunately it's not really possible to use tab instead of enter to auto-complete in PyDev (nor in Eclipse itself).
不幸的是,在 PyDev(也不在 Eclipse 本身)中使用 tab 而不是 enter 来自动完成是不可能的。
So, what I do in these cases is use Shift-Enter to go to a new line: note that in this case, you can press Shift+Enter from any place in your line and it'll mimic a 'go to end of line, press enter' (which is a nice thing for me).
因此,在这些情况下,我所做的是使用 Shift-Enter 转到新行:请注意,在这种情况下,您可以从行中的任何位置按 Shift+Enter,它会模仿“转到行尾” ,按回车'(这对我来说是件好事)。
Implementation note: as Max pointed out, the '\t' and '\r,'\n' cases are actually hard-coded in Eclipse at: org.eclipse.jface.text.contentassist.CompletionProposalPopup.verifyKey(VerifyEvent) so, to fix that, you'd need a patch which changed that at Eclipse itself (so, if you feel it's worthwhile, create a bug-request in Eclipse itself to ask for that feature).
实施说明:正如 Max 所指出的,'\t' 和 '\r,'\n' 情况实际上是在 Eclipse 中硬编码的:org.eclipse.jface.text.contentassist.CompletionProposalPopup.verifyKey(VerifyEvent) 所以,要解决这个问题,您需要一个补丁来更改 Eclipse 本身(因此,如果您认为值得,请在 Eclipse 本身中创建一个错误请求以请求该功能)。
回答by halalbin
If you have a Mac, you can download the Better Touch Tool(BTT) and change the hotkey to tab. Just tried and it worked, however if you do this you can't use the tab-key to tab regularly with the text. Which is pretty good to be able to bo. I changed it to shift+space.
如果您有 Mac,您可以下载 Better Touch Tool(BTT) 并将热键更改为选项卡。刚刚尝试过,它奏效了,但是如果你这样做,你就不能使用 tab 键定期使用文本进行 tab。能够博是相当不错的。我把它改成了shift+space。
In BTT, select Keybord in the menu between Trackpads and Apple remote. Add eclipse with the + sign on the left side. Then press +Add new shortcut. In keybord shortcut press the hotkey or combination you want. In Trigger Other keybord Shortkey press ctrl+space and you are done! Just be sure that the new shortcut is enabled in the right corner.
在 BTT 中,在触控板和 Apple 遥控器之间的菜单中选择键盘。使用左侧的 + 号添加 eclipse。然后按+添加新快捷方式。在键盘快捷键中按您想要的热键或组合。在 Trigger Other keybord Shortkey 按 ctrl+space 就完成了!只需确保在右上角启用了新的快捷方式。