28
7
I'd like to join a lot (~1000) of lines, but only every odd with the next one. By hand I could do
Jj
500 times and have it done. However, how can I execute these two statements 500 times in one single command? Typing
500Jj
will join the next 500 lines and then moving down one line.
Example:
I have:
a
b
c
d
e
f
g
h
I want:
a b
c d
e f
g h
Edit: I tried mapping:
:map X Jj
500X
but apparently I should read the mapping docs again. Doesn't work.
:%normal J was very quick and easy (see 2nd top solution below)... compared to this macro solution running it on over 50,000 lines – ihightower – 2016-07-14T07:17:56.687
@ihightower that's why i upvoted that answer as well. 6 years ago :) – akira – 2016-07-15T10:56:42.797
@akira your macro just saved my day as i needed just this macro solution today for a different purpose. – ihightower – 2017-02-22T15:54:37.970
Cool, thanks for remembering the macros to me! – Boldewyn – 2010-07-29T09:21:06.793