What's the vim way to select multiple instances of current word and change them?

前端 未结 3 1524
無奈伤痛
無奈伤痛 2021-02-01 22:20

Anyone familiar with Sublime Text\'s multiple cursor feature will recognize the pattern of doing the following: press a hotkey multiple times to select multiple instances of the

3条回答
  •  庸人自扰
    2021-02-01 22:52

    While waiting for other answers, I'm going to post what I'm experimenting with while waiting for vim experts to answer:

    :.,$s//foobar/gc
    

    to substitute (the s) from the current line (the .) to the last line ($) (with the comma denoting the line range), using the combo to copy the current word into the command, then using gc to change with confirmation, so I can hit yes/no for each instance then quit when I've done enough.

提交回复
热议问题