Why is \r a newline for 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?
From vim docs on patterns:
r
matches <CR>
n
matches an end-of-line - When matching in a string instead of buffer text a literal newline character is matched.
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
).
Another aspect to this is that