Isaac Sloan - Vim Find and Replace in Project: Episode 2
Banner700

Vim Find and Replace in Project: Episode 2

A while I ago I posted about an efficient way to do find and replace in files.

:args `ack -l keywords`
:argdo %s/keywords/replacement/ge | update

I recently found that ack -l wouldn't search within my *.haml files without added an .ackrc file and specifically allowing it. About that time I also found the_silver_searcher which was supposed to be a drop in replacement for ack. Unfortunately args ag -l "keywords" just interpreted that as a literal file name instead of a command that returned filenames no matter what I tried. I replaced ack.vim with ag.vim but it just populated the quicklist and I couldn't find a way to populate the args list. Eventually I found henric/vim-qargs which copies your quicklist into your args list before running argdo: https://github.com/henrik/vim-qargs

So now my find replace goes like this:

:Ag "search"
:Qdo %s/search/replace/gce | update
October 06, 2013
railsvimack
comments powered by Disqus