Skip to main content

Question about using Unicode character set, how to insert them, how to display them and general use of the UTF8 encoding.

From :h unicode

The Unicode character set was designed to include all characters from other character sets. Therefore it is possible to write text in any language using Unicode (with a few rarely used languages excluded). And it's mostly possible to mix these languages in one file, which is impossible with other encodings.

Unicode can be encoded in several ways. The most popular one is UTF-8, which uses one or more bytes for each character and is backwards compatible with ASCII. On MS-Windows UTF-16 is also used (previously UCS-2), which uses 16-bit words. Vim can support all of these encodings, but always uses UTF-8 internally.

Vim has comprehensive UTF-8 support. It works well in:

  • xterm with utf-8 support enabled
  • Athena, Motif and GTK GUI
  • MS-Windows GUI
  • several other platforms

Double-width characters are supported. This works best with 'guifontwide' or 'guifontset'. When using only 'guifont' the wide characters are drawn in the normal width and a space to fill the gap. Note that the 'guifontset' option is no longer relevant in the GTK+ 2 GUI.