5 ms·
If I'm interpreting "cutting whole lines" correctly, in vim that's "dd" in normal mode. Then you can paste (put) with "p". I agree discoverability is not great
by afranchuk 4y ago
If I'm interpreting "cutting whole lines" correctly, in vim that's "dd" in normal mode. Then you can paste (put) with "p".
I agree discoverability is not great; to be honest I can't remember how I discovered the plethora of commands I use, though I do have a habit of reading the help a decent amount. That's how I discovered "g?" (Rot13) :D
- mknsri 4y agoOh yeah I did use "dd" and "p". They work OK, although they don't allow selecting multiple lines that don't follow each other.
- wruza 4y agoWhat’s the use case for this disjoint selection?
- gbin 4y agoJust use the number of lines you want to cut like 3dd This is consistent for all commands.
- maleldil 4y ago> 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.