Vim commands to run a command over every entry in the quickfix list (:Cdo) or location list (:Ldo).
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
plugin
README.md

README.md

The Cdo plugin is now deprecated. Vim 8 adds almost identical native :cdo and :ldo commands, with additional functionality.


Cdo

Example: Find every instance of foo in the working directory and replace it with bar.

:grep foo
:Cdo s/foo/bar/c | update

Commands

: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.

Setup

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.

Credits

Cdo was written by Peter Jaros (@peeja), with contributions from Danielle Sucher (@DanielleSucher).