How can I position the caret where there would be indentation on empty lines?

Answered

Hello! Oftentimes, with many editors, including IntelliJ IDEA, it is common to not keep indentation on empty lines, even if it is within a method or other such context in which code is indented.

If I wish to add code to such methods, I have to manually indent to the level at which the code is indented. Is there any feature in IntelliJ that allows you to have the caret snap to where the indentation would be if I click on the line at or past the point at which the code is indented?

1
3 comments

Settings | Editor | General | Smart Keys | End on blank line moves caret to indent position.

Pressing the End key will move the caret to the correct indent position when this option is enabled and if supported by the file type/formatter.

1

I see. It looks like that can be emulated via Command + Right on macOS. Thanks!

0

You can also customize it here: Settings | Keymap | All Actions | Editor Actions | Move Caret to Line End.

0

Please sign in to leave a comment.