1

Please don't call me lazy, but has anybody compared all the available packages that allow to move a line up or down in the text? I have found:

  • move-lines
  • move-text
  • move-dup
  • drag-stuff

Or, just, to anybody who has chosen one of these over another, what made you prefer one over the other?

2 Answers 2

1

move-dup offers a minor mode with commands to move or duplicate the current line or region. When operating on a region, it first expands the region to only contain whole lines. It also has an option, enabled by default, that combines them into single undo entries, so you can undo a whole batch of line-moves at once (though it does make undoing line-moves slightly slow).

move-text offers commands to move lines or a region, and a command to set its default bindings (but no mode). When operating on a region that include partial lines, it only moves text that is actually in the region, which has some unusual behaviors and may be inconvenient to reverse without undoing. I would not recommend this package.

drag-stuff offers a minor mode and commands to move the current line or region. When operating on a region, it moves any line that contains any of the region, but does not expand the region. The mode offers simple customization of the keybindings (via drag-stuff-modifier), but you have to call drag-stuff-define-keys before you can actually use them. It also lets you drag words left and right (or the region left and right by characters).

move-lines is not in Melpa, so I won't look much at it, but I can see that it doesn't define a mode.

Personally, I'd say drag-stuff has the best behavior when it comes to moving a region (because it leaves the contents of the region alone), but move-dup is probably more convenient, because of how it amalgamates undo entries (which makes it much easier to put a line back where it came from without undoing more than you meant to).

1

Apparently,

move-text and move-lines do the same thing, a difference is that the latter is not available from melpa.

drag-stuff adds the capability of moving selections to the right or left.

move-dup adds a different capability, that of duplicating a line or selection.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.