jmacdonald / amp

A complete text editor for your terminal.
https://amp.rs
Other
3.73k stars 105 forks source link

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

Closed sophiajt closed 6 years ago

sophiajt commented 6 years ago

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 commented 6 years ago

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.