Hacker News new | ask | show | jobs
by efnx 4829 days ago
This would be easily done by recording a macro and replaying it numlines/2-1 times. Possibly if starting on the first line: q,a,j,$,i, odd,esc,j,q,4@a

    qa // start recording into 'a' register
    j // move down
    $ // move last char on line
    i // insert mode
     odd //
    esc // back to command mode
    j // move down
    4@a // replay macro 4 times (if there are 8 more lines)
1 comments

Yep, using macros are the way to go for a task like this one. I'd use 'A' here to jump into the insert mode at the end of line though (commenting because '$i' part made me realize that I had probably never used '$' for movement at all).
That's a good point, '$i' starts inserting just before the last character, whereas with 'A' you'd save the '$i' but have to delete the quote. One cat with many ways to skin it!