what's the difference between these two methods?
p inserts the content of a register
as it is, regardless of the encoding, but
encodes sequences of bytes before inserting them.
Special key combinations, such as Ctrl+→, are translated
into terminal keycodes like
^[[1;5C, then into vim keycodes like
and finally into a sequence of bytes starting with
This is a special case where the vim keycode is different than the terminal keycode
After assigning the register
q like this:
the sequence of bytes is what's actually saved:
Type Name Content
c "q <80><fd>V
Press ENTER or type command to continue
If I went to insert mode and put this sequence by hand as Unicode code points
- Ctrl+V u0080 for
- Ctrl+V u00fd for
- Ctrl+V u0056 for
This is what I would get:
which is the same result as the one I would get if I pressed
Ctrl+r Ctrl+r q in insert mode.
I have no idea what
If the cursor is moved on the opening angle bracket
< in the previous output:
and then press
g8 in normal mode, this is the output I'd get :
These are the hexadecimal numbers for the two-byte UTF-8 character under the cursor; so the
<c2> is the first byte of the two.
As a final note, what follows is the output of
"qp in normal mode:
If I again move the cursor on the first
< and press
g8 the output would be different:
because that's not a UTF-8 character but just a binary one.
Thanks to all the Vi and Vim community (including you) who made this answer possible. I hope this answer is useful.