Insert unusual characters by character code
Vim can insert any character by its numeric code. This can be handy for entering symbols that are not found on the keyboard.
We can tell Vim to insert any arbitrary character if we know its numeric code.
From Insert mode, we just have to type
Vim expects the numeric code to consist of three digits. Suppose, for example,
that we wanted to insert an uppercase “A” character. The character code is
65, so we would have to enter it as
But what if we wanted to insert a character whose numeric code is longer
than three digits? For example, the Unicode Basic Multilingual Plane has an
address space for up to 65,535 characters. It turns out that we can enter all
of these using a four-digit hexadecimal code if we type
If you want to find out the numeric code for any character in your document, just place the cursor on it and trigger the ga command. This outputs a mes- sage at the bottom of the screen, revealing the character code in decimal and hexadecimal notations (see :h ga ).