Picture of Michael Lee
:wave: Hey hey, I'm @michaelsoolee! I'm a full-stack developer, maker of one too many side projects and dad.

Search and replace all instances of a string in Vim with a confirmation prompt

Written on December 8, 2017

Vim’s search and replace command is really nice for quickly searching and replacing all instances of a string. But sometimes you need to be a little careful with the replacement process and might need to review the matched string before you replace it.

Thankfully, simply adding a c to the end of the search and replace all command in Vim will provide a confirmation prompt, allowing you to review before replacing. It also gives you the option to skip over an instance or stop the search and replace process altogether.

Search and replace with confirmation animation gif

Stay in touch

Thanks for reading this article. I'd love to stay in touch and share more tips on programming, design and side projects with you. Sign up and I'll send you my articles straight to your email.