Easiest way to swap occurrences of two strings in Vim?

后端 未结 5 1748
逝去的感伤
逝去的感伤 2020-12-04 15:39

What is the easiest way to replace all occurrences of string_a with string_b while at the same time changing anything that was already string

5条回答
  •  隐瞒了意图╮
    2020-12-04 16:28

    Here is how I swap two words skip & limit:

    %s/skip/xxxxx/g | %s/limit/skip/g | %s/xxxxx/limit/g
    

    Pretty sure someone could turn it into a shorter command which accepts two arguments.

提交回复
热议问题