I ran :registers
and noticed a ^J
at the end of each line.
"" def^J
"0 abc^J
"1 def^J
Having never seen it before, I did some research and found this page describing digraphs.
Where I expect to find ^J
however, I find ^@
, and I find the same thing when I run :digraphs
.
The description to the right tells me it's a linefeed, which makes sense given that ^J
is at the end of the line, but why do both sources map LF to ^@
if ^@
is already assigned to the NULL digraph.
Is this a typo?
Update: LF
gets translated to NULL
: source
Apparently ^J
is the proper representation for a linefeed, while ^@
represents NULL. The documentation issue is probably related to the fact that trying to insert a linefeed literally, by any method, ends up inserting a null character.
I tested the following in insert mode:
^V^J
^V010
^Vx0a
^Vo012
^Vu000a
^KLF
All of them have the same result of inserting a null character, properly displayed as ^@
. This probably induced the documentation error.
Edit: This limitation of literal insertion is less surprising after learning that Vim uses the linefeed as an internal representation of the null character, as pointed out in yolenoyer's comment.