Search code examples
eclipsekeyboardeditorkeyboard-shortcutscurly-braces

How to autocomplete curly braces and move cursor into it automatically in Eclipse?


I am new into Eclipse. I found that when I type Ctrl + ( it will also generate ) automatically, and move the cursor into this pair at the same time. After I finish editing coding in the pair, the cursor will jump out the parentheses automatically when typing Ctrl + ).

It's very convenient because I don't need to take a long distance movement to operate the arrow keys with my right hand every time. I also found [] also has this functionality. Unfortunately, I still don't find any combine-keys with {} to perform this functionally. Does anyone know about it?


Solution

  • First, look on Eclipse jump to closing brace.

    Open in Eclipse Preferences from menu Window.

    Navigate on left side to Java - Editor - Typing.

    There is the option {Braces} in the group Automatically close. Check this option.

    Also in Preferences navigate to General - Keys.

    There is in the list the command Go to Matching Bracket with Editing Java Source in column When. You can redefine the key binding of this command.