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

Cleaning up the MoveUp and MoveDown functions #45

Closed hugomg closed 4 years ago

hugomg commented 4 years ago

This PR cleans up the code for moving things up and down, getting rid of some code duplication. Some of these ideas are from PR #27.

  1. Replace pairs of MoveUp and MoveDown functions by a single MoveVertically function.
  2. Don't treat the movement near the edge of the file as a special case -- a single call to min() or max() is all we need.
  3. Get rid of the separate functions for moving things up and down by half a page.
  4. Allow setting g:move_auto_indent to values other than 0 or 1
matze commented 4 years ago

Looks good, less code is always better :+1: