(NB : my first post)
In a Vim file, how may I swap - in one move - line 15 and line 33 (e.g.) ?
Fastest way is to move lines:
:33m 15|15m 33
Move line 33 below line 15, then moves line 15 below line 33.
It's best to do it 'move high-number below low-number' first, otherwise you have to adjust offsets:
:15m 33|32m 14
Two ways I can think of. With Vim there are probably more!
:33 | delete | 15 | put | 15 | delete | 32 | put
...or...
13ggdd15ggPjdd33ggP
...which is fewer keystrokes but a little less comprehensible when written down!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With