In Vim how can I search and replace every other match?

后端 未结 7 1298
Happy的楠姐
Happy的楠姐 2020-12-23 23:41

Say I have the following file


    
    


    

        
7条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-24 00:07

    :let dosubs=1
    :%s/bar/\=[dosubs?'bar1':submatch(0),extend(g:,{'dosubs':!dosubs})][0]/g
    

提交回复
热议问题