Vim and newlines
Last substantive revision: 2016-09-12
Questions:
- Does Vim use NUL to represent newlines, or vice versa?
- Why does Vim represent NUL and newlines the same way sometimes? Is it just some historical thing, or is there still a valid technical reason for doing this?
- What do
\n,\r,^J, and^@mean in different contexts? For instance\nmeans something different on each side of:substitute. - Why does Vim append
^Jto the end of a register ending in^M? For instance, try:let @a='a^M'then:reg a, where^Mis inserted by doing<C-V><C-M>. - How does this newline representation come into play with the different line endings used on Windows, Mac, and Unix?
Some references to check out:
- “Newlines and nulls in Vim script”
- Various help pages