Tab indentation under Eclipse/Aptana IDEs
How to enable tab indentation under Aptana/Eclipse IDEs? I appreciate the way that my Emacs indents lines code by pressing TAB key independently of开发者_如何学Python the current cursor's position.
I usually cut some code and then paste it into its new place, when doing this the code has the same indentation that had before.
To fix it I do the following:
Select a block of code and press <Tab>
(To move the code to the right)
Select a block of code and press <Shift> + <Tab>
(To move the code to the left)
If you are in the middle of a line you can indent it by pressing Ctrl+i
, and of course you can do it for a block of text by selecting it and pressing Ctrl+i
.
If it is in java files, you can set many more formatting rules (Window > Preferences > Java > Code Style > Formatter
) and you can set it to auto-format whenever you save by going to Window > Preferences > Java > Editor > Save Actions
.
From the documentation of eclipse (see Eclipse actions) you will find and entry "Smart Indent Mode". If you press CTRL + SHIFT + INSERT
when inside an editor, the modeline below should show Smart Indent
instead of indent. The preferences of that mode are defined in Window > Preferences > Java > Editor > Typing
. The checkbox in the section indentation for Tab
says: "Tab key adjust the indentation of the current line".
That sounds pretty well, but it did not work for me :-( I did not find any indication of the bug database of eclipse that something is broken here. Perhaps it works for you.
Under Aptana, you can indent your code by taping CTRL + Shift + F.
精彩评论