News for hackers. Stuff that matters.
Re:Show HN: I built an interactive course that helps you lea... by mknsri on Saturday July 09, 2022 @12:01PM (#32036331)
Oh yeah I did use "dd" and "p". They work OK, although they don't allow selecting multiple lines that don't follow each other.
Re:Show HN: I built an interactive course that helps you lea... by wruza on Saturday July 09, 2022 @12:56PM (#32037002)
What’s the use case for this disjoint selection?
Re:Show HN: I built an interactive course that helps you lea... by gbin on Saturday July 09, 2022 @12:27PM (#32036631)
Just use the number of lines you want to cut like 3dd This is consistent for all commands.
Re:Show HN: I built an interactive course that helps you lea... by maleldil on Saturday July 09, 2022 @02:40PM (#32038055)
> they don't allow selecting multiple lines that don't follow each other.

3dd won't work. You can use registers, though:

1. "ayy for the first line 2. "Ayy for the subsequent lines (repeat using .) 3. "ap to paste.

You can replace a/A with other letters to copy into multiple registers. If there are patterns (e.g. odd lines to A and even lines to B), you can even record a macro.

I think registers are not something most Vim users use, however. I have no data to back this up, but I wouldn't be surprised if Vim is like Git, where people learn the commands for 80% of scenarios and Google the rest. In Vim, case, they might even settle for a very inefficient solution if the problem is not recurring.