How to quickly change variable names in Vim?

前端 未结 7 1897
庸人自扰
庸人自扰 2020-12-12 08:55

I am using Vim to read through a lot of C and Perl code containing many single letter variable names.

It would be nice to have some command to change the name of a va

7条回答
  •  借酒劲吻你
    2020-12-12 09:10

    You could use the 'c' modifier in the global search and replace that would ask you for confirmation for each replace. It would take longer but it might work for a non-humongous code file:

    %s/\$var/\$foo/gc
    

    The c stands for confirm.

提交回复
热议问题