开发者

Change Eclipse tab to correctly indent line as Emacs does

开发者 https://www.devze.com 2023-01-31 23:27 出处:网络
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 re

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?

开发者_如何学JAVA

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

This question is a reposting of a superuser question.


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号