How to delete every other line in Vim?

前端 未结 12 1400
天涯浪人
天涯浪人 2020-12-04 06:13

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:

a         


        
12条回答
  •  南笙
    南笙 (楼主)
    2020-12-04 06:48

    :map ^o ddj^o
    ^o
    

    Here ^ stand for CTRL. Recursive macro to delete a line every two line. Choose well your first line and it's done.

提交回复
热议问题