vimtricks.wiki Concise Vim tricks, one at a time.

How do I insert a Unicode character by its code point?

Answer

<C-v>u{code} in insert mode

Explanation

In insert mode, <C-v>u followed by a 4-digit hex code inserts the Unicode character at that code point.

How it works

  • <C-v>u00e9 inserts e (e with acute accent, U+00E9)
  • <C-v>U0001F600 inserts a Unicode character above U+FFFF (8 digits)
  • Works in insert mode

Example

  • <C-v>u2714 inserts a checkmark
  • <C-v>u00b0 inserts the degree symbol
  • <C-v>u03b1 inserts Greek alpha

Tips

  • <C-v> followed by a decimal number (0-255) inserts by decimal code
  • <C-v>x{hex} inserts by 2-digit hex code
  • ga shows the Unicode code point of the character under cursor
  • <C-k> followed by digraph codes is often easier for common symbols
  • Requires a terminal and font that support the Unicode character

Next

How do you yank a single word into a named register?