matze / vim-move

Plugin to move lines and selections up and down
http://www.vim.org/scripts/script.php?script_id=4687
MIT License
1.2k stars 56 forks source link

Preserve relative indentation in auto indent #50

Closed hugomg closed 4 years ago

hugomg commented 4 years ago

Fixes #40.

Instead of using == to reindent a block of code we now use < and > to shift the block by the appropriate number of spaces. This way we preserve the relative indentation between the lines, keeping the same "shape".

hugomg commented 4 years ago

Part of me asks if it is worth replacing a single line of obviously working code with 20 lines of much more complicated logic. But now that it is implemented, I guess it wouldn't hurt to create this PR.

matze commented 4 years ago

Part of me asks if it is worth replacing a single line of obviously working code with 20 lines of much more complicated logic.

Not a big deal in my opinion :-)

But apparently merging #51 is causing conflicts, so if you could rebase, I'll merge this as well.

hugomg commented 4 years ago

Huh, I wonder why it wasn't able to figure it out by itself. Anyway, it should be mergeable now.

matze commented 4 years ago

:+1: