Skip to content

Conversation

@nobriot
Copy link

@nobriot nobriot commented Oct 26, 2025

Introduce a command allowing to move lines with selections up or down.

I personally liked being able to move lines without having to yank or delete and paste.
I tried something like this in the config:

up = [
  "extend_to_line_bounds",
  "yank_main_selection_to_clipboard",
  "delete_selection",
  "move_line_up",
  "move_line_up",
  "paste_after",
  "keep_primary_selection",
]
down = [
  "extend_to_line_bounds",
  "yank_main_selection_to_clipboard",
  "delete_selection",
  "paste_after",
  "keep_primary_selection",
]

but it's totally broken and works only in some limited cases, it also modifies the selection and the clipboard.

So I've added a command for it.
It's implemented it to move the lines before, after the selection. e.g. to move the selected lines 2. and 3. down, we move line 4 before the selection.

  1.         1.
 |2.   =>    4.
 |3.        |2.
  4.        |3.

It gets a bit messy when multiple selections are present.
a count can be specified. If moving up, it will be capped to the top of the file.
If moving down, additional line returns are inserted after the last line.

Introduce a command allowing to move lines with
selections up or down.
@mi2ebi
Copy link
Contributor

mi2ebi commented Oct 26, 2025

duplicate functionality of #14121

@nobriot
Copy link
Author

nobriot commented Oct 26, 2025

duplicate functionality of #14121

Okay, sorry for the noise then 🙂
Should I close the PR?

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