The Cdo plugin is now deprecated. Vim 8 adds almost identical native :cdo
and :ldo
commands, with additional functionality.
Example: Find every instance of foo in the working directory and replace it with bar.
:grep foo
:Cdo s/foo/bar/c | update
:Cdo [command]
Runs the same command over every entry in the quickfix list.
:Ldo [command]
Runs the same command over every entry in the location list.
:Cdo/c [command]
Just like |:Cdo|, but asks for confirmation before changing each file.
:Ldo/c [command]
Just like |:Ldo|, but asks for confirmation before changing each file.
In order for :Cdo
to function, you must add the following line to your .vimrc file:
set hidden
Set hidden allows the buffers to stay open while :Cdo
makes changes to each file in the list.
Cdo was written by Peter Jaros (@peeja), with contributions from Danielle Sucher (@DanielleSucher).