Keyboard shortcut for code completion in Eclipse on Mac OS X

30 April, 2010 - 18:39

Finally! I found how to get the keyboard shortcut for code completion working in Eclipse on Mac OS X. At work, on Linux, I use CTRL-SPACE all the time in Eclipse. Unfortunately that did not work on my MacBook: CMD-SPACE triggers the spotlight search widget and CTRL-SPACE is tied to the Quicksilver launcher in my case.

And there was much frustration.

First: don't say "code completion", but "content assist" in Eclipse. To bring even more confusion, there is also the "word completion" tool in the edit menu, but that's not what you normally want (it's just limited to completing a variable name without much context sensitivity). "Content assist" offers you the usual suggestions you expect from a completion tool (function names, variables, methods, properties, modules, ...).

Once I got this, it I just had to edit the keyboard shortcut for "content assist" to something that was still available (I chose ALT-SPACE).

And there was much rejoicing.

26 January, 2012 - 12:16

Thanks for this article. And

PerfectCarl (not verified)

Thanks for this article.
And thanks to @Matt for how to disable spotlight shortcut :)

Carl.

13 January, 2012 - 10:43

To use CMD-SPACE for code

Matt (not verified)

To use CMD-SPACE for code completion, turn off the Spotlight functionality:

1. Open System Preferences
2. Select Keyboard
3. Tap Keyboard Shortcuts tab
4. Click Spotlight
5. Deselect "Show Spotlight search field"

I also found a workaround for AUTOMATIC code completion:

1. Open Preferences in Eclipse
2. Type "Content Assist" into search box
3. For each Editor that you wish to have code completion:
a. Ensure "Enable auto activation" is checked
b. Put all characters into "Auto activation triggers for *" e.g.
  .abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789
c. Set "Auto activation delay" to 500 (or whatever works for you)

Enjoy!

8 December, 2011 - 18:03

Thank u

Alji (not verified)

thank you very much for this interesting post

27 November, 2011 - 18:18

Thank you!

AnonymousFrenchie (not verified)

Thank you!

16 November, 2011 - 18:36

thank you so much! very

Anonymous (not verified)

thank you so much! very helpful

21 November, 2011 - 18:20

Yesss!!! Thank you!!!:)

Another Anonymous (not verified)

Yesss!!! Thank you!!!:)

31 October, 2011 - 23:35

Merci

Anonymous (not verified)

Merci

19 September, 2011 - 07:26

Menu items in Eclipse Indigo

Anonymous (not verified)

Hi,

Thanks a lot for such valueable information. I have one more question. I'am using Eclipse indigo on my macbook. Is there any option by which i can get menu items like File, Edit, Source etc in eclipse indigo on macbook? I 'am quite new to mac :)

Thanks

19 September, 2011 - 18:58

CTRL-F2

slippens

It's not as handy as under Windows or Linux, but you can get to the menu items with the key combo "CTRL-F2", and then navigate with the arrow keys.
Note however that the F2 key on your mac book is probably already tied to increasing the screen intensity. In that case you need to press the "fn" key in the lower left corner as well to have a "real" F2 key press, so you need the trio "CTRL-fn-F2".

more tricks: http://support.apple.com/kb/HT1343

good luck :)

6 August, 2011 - 17:02

Hallelujah

Anonymous (not verified)

Thank you, thank you, thank you, thank you.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • No HTML tags allowed
  • Lines and paragraphs break automatically.

More information about formatting options