172

What is the auto-alignment shortcut key in Eclipse?

Naftuli Kay
  • 87,710
  • 93
  • 269
  • 411
Praveen
  • 90,477
  • 74
  • 177
  • 219

5 Answers5

318

Ctrl+Shift+F to invoke the Auto Formatter

Ctrl+I to indent the selected part (or all) of you code.

Hulk1991
  • 3,079
  • 13
  • 31
  • 46
Peter Perháč
  • 20,434
  • 21
  • 120
  • 152
36

Auto-alignment? Lawful good?

If you mean formatting, then Ctrl+Shift+F.

Joey
  • 344,408
  • 85
  • 689
  • 683
18

The answer that the OP accepted is wildly different from the question I thought was asked. I thought the OP wanted a way to auto-align = signs or + signs, similar to the tabularize plugin for vim.

For this task, I found the Columns4Eclipse plugin to be just what I needed.

djeikyb
  • 4,470
  • 3
  • 35
  • 42
13

Want to format it automatically when you save the file???

then Goto Window > Preferences > Java > Editor > Save Actions

and configure your save actions.

Along with saving, you can format, Organize imports,add modifier ‘final’ where possible etc

jai
  • 21,519
  • 31
  • 89
  • 120
0

auto-alignment shortcut key Ctrl+Shift+F

to change the shortcut keys Goto Window > Preferences > Java > Editor > Save Actions

Akitha_MJ
  • 3,882
  • 25
  • 20