vim - 替换模式也替换新行

vim - replace mode to replace new lines too

在VIM的替换模式下,当您输入时,您不会添加任何新内容,您只是替换已经存在的内容。唯一的问题是您 可以 在按回车键时添加新内容。我想知道是否有一种方法可以让您在替换模式下按回车键(或 ^M)时被解释为 down arrow

如果您一定要知道,我正在处理一个文件,该文件包含给定行数固定的段。我无法添加新行,因为它会抵消后续段。

提前致谢!

据我了解您的要求,这可以在 virtual replace mode 中实现。您可以通过gR.

输入

Typing a <NL> still doesn't cause characters later in the file to appear to move. The rest of the current line will be replaced by the <NL> (that is, they are deleted), and replacing continues on the next line. A new line is NOT inserted unless you go past the end of the file.

请注意 vim 必须与 +vreplace 一起编译。