Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change Eclipse tab to correctly indent line as Emacs does

Tags:

eclipse

In Emacs when I hit tab anywhere on a line, the line will indent correctly (or at least to the mode settings). When I hit tab again it will move back to the next block. When programming Python this really helps since closing a block is done by lowering the indention level.

Is there a way to configure Eclipse to do the same?

Currently, I have to erase the leading white space then hit tab.

This question is a reposting of a superuser question.

like image 349
aterrel Avatar asked Dec 20 '10 14:12

aterrel


2 Answers

Try ctrl-i (Cmd-i on osx) to indent the current line or a selection inside eclipse (if you're using default key binds as opposed to emacs). Or, if you want a different key bind, go to Appearances > General > Keys and change the bind for Correct Indentation to key(s) of your choice

like image 147
Bubbles Avatar answered Sep 26 '22 16:09

Bubbles


In Eclipse, go to Windows -> Preference -> Java -> Formatter.

In Active Profile drop down box, select any profile, click Edit on right of it.

In Profile Dialog box opened, you can change a lot of things like Indentation, New Line, Braces, White Spaces etc.

Alternatively, if your profile is altogether different than standard one, Create a new active profile and then edit it accordingly.

like image 28
PR4V33N Avatar answered Sep 23 '22 16:09

PR4V33N