How to: Context-dependent word expansion in RubyMine

Updated . Posted . Visible to the public. Repeats.

One of the many useful features of TextMate is autocompletion of words. If I were in TextMate right now, I could write "au[tab]", and it would complete it to "autocompletion". RubyMine can do this, too. When you write a word (e.g. a variable name), just hit ALT + / repeatedly and it will offer all completions for the letters you typed. This action is called Cyclic Expand Word in RubyMine / IntelliJ IDEA.

This feature keeps you from mistyping variable names, saves you keystrokes and speeds up development. ~10 keystrokes to the price of 2!

German keyboards

You can't type ALT+/ on a German keyboard. I recommend setting the shortcut to Ctrl+. (period), which is the same that Eclipse uses for word completion.

To change the key mapping:

  • Go to File / Settings
  • Search for cyclic expand word in the settings dialog
  • In the right pane an entry Main menu / Code / Completion / Cyclic Expand Word should be highlighted
  • Right-click on that entry and select Add keyboard shortcut
  • In the new dialog, hold Ctrl and press .
  • Press OK
  • RubyMine will now warn you that this shortcut is already taken by a functionality you don't care about. Select Remove to confirm the new assignment.
  • Close the settings dialog with "OK"
Dominik Schöler
Last edit
Henning Koch
License
Source code in this card is licensed under the MIT License.
Posted by Dominik Schöler to makandra dev (2014-11-25 12:06)