Why is \r a newline for Vim

vim

From question How to replace a character for a newline in Vim?. You have to use \r when replacing text for a newline, like this

:%s/%/\r/g

But when replacing end of lines and newlines for a character, you can do it like:

:%s/\n/%/g 

What section of the manual documents these behaviors, and what's the reasoning behind them?

Best Answer

From http://vim.wikia.com/wiki/Search_and_replace :

When Searching

...

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

When Replacing

...

\r is newline, \n is a null byte (0x00).