为什么vim中 是切换新行


Why is
a newline for Vim?

从问题如何在vim中替换换行符开始?。在为换行符替换文本时,必须使用
,如下所示

1
2
:%s/%/
/g

但是,当替换字符的行尾和换行符时,可以这样做:

1
2
:%s/
/%/g

手册的哪个部分记录了这些行为,它们背后的原因是什么?


从http:/ / / / vim.wikia.com维基搜索:_ _ replace布尔P></

When Searching

...


is newline,
is CR (carriage return = Ctrl-M = ^M)

When Replacing

...


is newline,
is a null byte (0x00).


模式八:从在线文档P></


matches


matches an end-of-line -
When matching in a string instead of
buffer text a literal newline
character is matched.


另一个层面\0is that which to this is,is taken traditionally空,在"to the Whole s//\0/均值匹配模式"。(which is,顺便,我一周比,和,&)。P></

  • 我知道你不能使用\0to均值NULL,知道你使用
  • 我知道你不能使用
    to均值

    ,知道你使用。
  • 我知道你不能使用
    to
    均值,但我不知道谁会想要的字符的文件,在线的目的。

-?P></


:help NL-used-for-Nul

Technical detail:

characters in the file are stored as in memory. In the display
they are shown as"^@". The translation is done when reading and writing
files. To match a with a search pattern you can just enter CTRL-@ or
"CTRL-V 000". This is probably just what you expect. Internally the
character is replaced with a in the search pattern. What is unusual is
that typing CTRL-V CTRL-J also inserts a , thus also searches for a
in the file. {Vi cannot handle characters in the file at all}


在第一:h :sto see of the section,开"SUBSTITUTE"4.2"change of documentation"。这是我的命令:accepts theP></

1
:[range]s[ubstitute]/{pattern}/{string}/[flags] [count]

通知patternabout the description和stringP></

For the {pattern} see |pattern|.
{string} can be a literal string, or something
special; see |sub-replace-special|.

我知道现在你知道the search和替代模式的不同模式的行动规则。如果你|pattern|to the后续链接,它需要你that explains the Whole to the section regexp模式是八。P></

同时,你需要|sub-replace-special|to the subsection"4.2 SUBSTITUTE",which contains the which is for取代模式,在
for在线霹雳/分裂。P></

(to this part of the shortcut is :h :s%手册)P></