← Back to Upcase

The Art of Vim: Search and Replace

Hello! This is Laila Winner from thoughtbot with another installment of our Vim screencast series. Today I'm going to talk about search and replace using Vim's :substitute command, and the Greplace plugin. The :substitute command works by searchi...
This is a companion discussion topic for the original entry at https://thoughtbot.com/upcase/videos/search-and-replace-with-laila-winner

Most of the time I 'm having to search and replace across multiple files. or do a search and replace across the project that I am working on. Any recommendations for that ?

@PeytonF18, if you want to do a big search and replace in Vim, the greplace.vim plugin is a great option that lets you visually verify what you’re changing. There’s a clip of @jferris from thoughtbot using it around 8:28 in this Weekly Iteration.

Drew Neil at Vimcasts also has a screencast about using the argument list :argdo to edit multiple files in a single operation. I have never been comfortable enough to do this without needing to look up how to do it, but it’s built in to Vim and doesn’t require any plugins to use.

Our dotfiles also contain a replace script that you can use from the command line to replace strings in multiple files.

1 Like

argdo seems to take more effort . Sticking with greplace.vim :slight_smile: thanks for the suggestions. Much appreciated!

1 Like