Ⅰ. 插件描述
Replace lines with the contents of a register, keeping the original indent.Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin '/replacewithsameindentregister'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle '/replacewithsameindentregister'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug '/replacewithsameindentregister'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/vim-scripts/ReplaceWithSameIndentRegister
Ⅳ. 文档说明
DESCRIPTION
Replacing existing lines with the contents of a register is a very common task
during editing. Often, one wants to adapt the indent of the pasted lines to
the current indent, e.g. when replacing a nested conditional from a yank that
originated at a different nesting level.
This plugin combines the replacement functionality of the
ReplaceWithRegister.vim plugin with the indent-adjustment done by the
built-in ]p command. With a simple mapping, you can replace line(s) with the
contents of a register while adjusting the indent to that of the first
replaced line.
SEE ALSO
- ReplaceWithRegister.vim (vimscript #2703) implements the general case of
replacing text including the indent (also with a {motion} mapping for
arbitrary text, not just lines).
USAGE
countgrR Replace [count] lines with the contents of register x
and adjust the indent to the first replaced line (like
pasting with ]p).
{Visual}["x]gR Replace the selection with the contents of register x
and adjust the indent to the first selected line.
As the replacement is always entire lines, this only
works with linewise selections (V).