How do I delete first word of each line in Vim?
How about a pattern on each line?
Going for cryptic here, in true vi style:
1Gq10dwjq100000@1
Randy fixed this up in the comments to work on more than 100000 lines:
ggqqdwj@qq@q
For those starting out with Vim, this breaks down to:
gg - Go to first line
qq - Record a macro into register 'q'
dwj@q - The macro:
dw - delete word at cursor
j - go down one line
@q - run the macro in register 'q'
q - Stop recording the macro
@q - Execute the macro in register 'q'
In essence, the macro is recursive - it deletes a word, moves down a line, then calls itself again, repeating for each line until end of file. The final '@q' is the initial (manual) call needed to set the macro off on every line.