# Command Completion

Note: As of version 9, this functionality is available and works out of the box.

I've a few questions about Command Completion in Mathematica. I recently discovered this feature, and it's really convenient. However, it gets tiring to hit Ctrl-K all the time.

Is there a way to turn Command Complete on after every keystroke, like autocompletion is for many programming IDE's?

Or, failing that, to map it to another key like Tab, which I find much more convenient to hit? I've looked up some internet sources on changing Keyboard shortcuts for Mathematica, but they all seem pretty complicated.

-
I know this doesn't answer your question, but, have you tried Ctr-Shift-K? Then you can Tab between fields in a complete expression. –  Eli Lansey Apr 20 '12 at 21:28
At least on Windows, you can use <F2> as an alternative to <Ctrl>-<K>. I can't test it right now but I'd be surprised if that didn't also work on other platforms. –  Oleksandr R. Apr 20 '12 at 21:28
@OleksandrR. F2 doesn’t work on Mac OS X –  F'x Apr 20 '12 at 21:33
@OleksandrR.You're right, F2 does work. My F2 key is extremely small, however, and it's always annoying to hit F1 when you meant to hit F2. I'm using Fedora 16 by the way. –  xiongtx Apr 20 '12 at 21:33
Version 9 has a completely reworked autocompletion system –  Sjoerd C. de Vries Nov 28 '12 at 22:00

Changing shortcuts isn't that complicated. All you have to do is change one line in the file KeyEventTranslations.tr in a location in your file system specified by this command:

FileNameJoin[{$InstallationDirectory, "SystemFiles", "FrontEnd", "TextResources",$OperatingSystem}]


Locate the following line in a text editor and change the key into the one you want:

Item[KeyEvent["F2"], FrontEndCompleteSelection[True]]


I wouldn't use tab, as that already has a built-in meaning.

CreateDocument[{}, InputAutoReplacements -> {"sync" -> SynchronousInitialization}]

You can set such replacements globally under Option Inspector` (CtrlShiftO). Of course no one would do it far all built-in commands, but it is useful for the more frequent ones.