Find and replace whole words in vim

前端 未结 3 722
时光说笑
时光说笑 2020-12-22 22:29

To find and replace all instances of a word in vim, I use

%s/word/newword/g

How do I change this so that it only finds instances of \"word\

3条回答
  •  滥情空心
    2020-12-22 23:10

    For case-sensitive replace.. you can use "\C"

    :%s/\\C/newword/g
    

    It replaces only "word" with newword leaving others like Word,WORD... unreplaced.

提交回复
热议问题