Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim: interactively check what's happening before substitute?

Tags:

vim

vim has very powerful command tools. I can substitute 'Set's for all 'Array's:

:%s/Array/Set/g

But can I do this interactively as Unix commands(e.g. rm)? I hope vim to ask me whether I really want to replace a word, rather than substitute them all at once.

like image 695
Lai Yu-Hsuan Avatar asked Jan 17 '23 18:01

Lai Yu-Hsuan


1 Answers

Yes, you can do this by appending another command as:

:%s/Array/Set/gc
like image 144
Li Dong Avatar answered Feb 22 '23 17:02

Li Dong