Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: shift-O should respect alignment of previous line #103

Closed
sophiajt opened this issue Sep 10, 2018 · 1 comment
Closed

Suggestion: shift-O should respect alignment of previous line #103

sophiajt opened this issue Sep 10, 2018 · 1 comment
Assignees

Comments

@sophiajt
Copy link

This might be a bit of vim muscle memory, but I noticed that if I hit o, I'd get the cursor indented on the new line at the same level as the current line. If, instead, I do shift-O, I don't get the indent of the previous line. Instead, I seem to get the indent of the current line.

Might be my workflow here, but I'm often on a blank line and want to add something to the previous line when I hit shift-O. Might be nice to make it the mirror of hitting o from the previous line.

@jmacdonald jmacdonald self-assigned this Sep 13, 2018
jmacdonald added a commit that referenced this issue Sep 17, 2018
Previously, we'd only consult the current line when determining
indentation for a new line. If the current line is blank, we don't
indent the new line at all; this is the wrong choice if the current
line is in an indented block.

We now search backwards from the current line, looking for a non-blank
line, and base the new line's indentation off of the that.

Fixes #103.
@jmacdonald
Copy link
Owner

Thanks for the context, @jonathandturner. I've updated the heuristic used in those commands to search backwards for the nearest non-blank line's indent and use that, rather than simply taking the current line's.

This also fixes the scenario in which you'd hit o to insert a newline below a blank line in an indented block and get no indent, either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants