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.21k stars 56 forks source link

Simplify the MoveVertically functions even more #47

Closed hugomg closed 4 years ago

hugomg commented 4 years ago

By taking advantage of '[ and '] we can use the same method to reindent the lines in MoveLineVertically and MoveBlockVertically. This lets us put all the line-moving logic in a single place. I suspect that it might also be possible to do something similar to the MoveHorizontally functions but I haven't figured out exactly how yet.

There is also a small improvement to the behavior of MoveBlockVertically when "nomodifiable" is set. Previously we would end up in normal mode after the function was called and now we stay in visual mode, with the current selection preserved.

matze commented 4 years ago

Thanks again!