Skip to content

Conversation

@hugomg
Copy link
Contributor

@hugomg hugomg commented Jul 5, 2020

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

hugomg added 6 commits July 4, 2020 12:42
The calls to min() and max() ensure that these conditions are never
true.
Reduce code duplication by replacing MoveLineUp and MoveLineDown by a
single function, MoveLineVertically.
Reduce code duplication by replacing MoveBlockUp and MoveBlockDown by a
single function, MoveBlockVertically.
Reduce code duplication by putting the computation of half page size in
a separate function.
People might expect that any truthy value should work to enable auto
indent, and not just 1.
@matze
Copy link
Owner

matze commented Jul 5, 2020

Looks good, less code is always better 👍

@matze matze merged commit 0745906 into matze:master Jul 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants