开发者

Change hotkey for autocomplete selection

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 lis开发者_Go百科t.

Tab is a much better selection hotkey since I'm not likely to want a tab mid-line.

Any chance of changing this in Eclipse?

Using CDT, PDT, and PyDev, but interested in any solution related to Eclipse.


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.


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.

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)

Cheers, Max


Unfortunately it's not really possible to use tab instead of enter to auto-complete in PyDev (nor in Eclipse itself).

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).

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).


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.

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.

http://www.bettertouchtool.net/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜