I would like to delete every other line from a Vim buffer, starting with the second one, i.e., lines 2, 4, 6, etc. For example, if the buffer’s contents is:
aaa
bbb
ccc
ddd
eee
fff
then, after the desired line removal, it should become:
aaa
ccc
eee
Which Vim commands can be used to automate this operation?
You can use a macro for this. Do the following.
gg
.qq
.dd
after.q
.10000@q
PS: To go to command mode just press Escape a couple of times.