How does one get from
int lel = 123; // this is a comment
^
to
// this is a comment
int lel = 123;
preferably when starting in insert mode, and with the right indentation?
My current way of doing it is C-c l d$ O C-c p, but as my auto-indent isn't perfect, the inserted line in not indented at all.
I think some editors use space+enter or something for this (at least I think I've seen it).
Is this possible in vim by default?
Still not a very pretty answer, but assuming the cursor is where the "^" is above, another option would be:
d0=:puEnter
d0 deletes til the beginning of the line.= reindents over the next motion.:pu short for :putEnter to run the command.I would probably use
DO<c-r>"
D deletes to the end of line. O opens the line above in insert mode (with the correct indentation). <c-r>" pastes the part that was deleted with D.
(This ends in insert mode)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With