Setting to Maintain Cursor Indentation When Vertically Navigating?


I can’t seem to find such a setting, but I figured I would ask: Is there a setting somewhere inside Atom that maintains the current indentation (based on the last line of code) when using the up and down arrow keys within a block? I know theres one when pressing the return key to insert a newline, but I’m strictly talking about navigating already blank lines and maintaining the indentation, so the user doesn’t have to tab over.

Here are some photos to illustrate wha I mean

Cursor before hitting down arrow key:

Cursor after hitting down arrow:

Where I’d like the cursor to be after hitting the down arrow:

So I was just curious if there is a setting for this at all. Thank you very much.


There’s something you’re forgetting or haven’t noticed. Look in the first two images. The file has been saved (no blue dot on the tab). In the third image, the file is unsaved. Why is that? It’s because you inserted two tab characters to get the cursor to be indented. If the line you are moving the cursor into is empty, the cursor is going to go to the leftmost column. If you move the cursor into a line that already has those tab characters, it should work like you expect.

Now, what you want to do is reconfigure or disable the whitespace package (and you also should not use atom-beautify on save). You can find it under Settings -> Packages, and you want to uncheck the last box. Then your tabs on otherwise empty lines will stick around and you won’t have to re-add them.


Right. I do know that when you save a file, the whitespace package strips out trailing whitespace from the ends of lines, which is what I prefer, so I would not like to lose that functionality. And I do understand that when moving vertically to an empty line, that no spaces exist to put the cursor at the proper indentation… I guess I’m just looking for a way to hack it so that when you arrow down into a blank line, the proper amount of spaces are automatically added to keep the indentation consistent with the previous line, without removing the functionality that strips trailing whitespace when saving a file.

Also, I’m not using atom-beautify at all.