Ⅰ. 插件描述
Vim commands to run a command over every entry in the quickfix list (:Cdo) or location list (:Ldo).Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'peeja/vim-cdo'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'peeja/vim-cdo'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'peeja/vim-cdo'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/peeja/vim-cdo
Ⅳ. 文档说明
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).