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

Handle re-selection consistently for horizontal block moves #38

Closed yukunlin closed 5 years ago

yukunlin commented 5 years ago

Changes

Info

I realized that PR #34 didn't address the root cause of the problem it's trying to fix.

The root cause is that P in virtualedit=all mode behaves inconsistently; the cursor sometimes moves one column right after pasting, other times it doesn't. This makes it difficult to rely on `[ to determine the start of the shifted selection.

PR #34 attempted to work around the inconsistencies but couldn't handle all cases:

34f

With this patch:

34ff

matze commented 5 years ago

Wow, great investigation and patch!