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

How do I see the Unicode code point of the character under the cursor?

Answer

ga

Explanation

The ga command displays the ASCII/Unicode value of the character under the cursor in decimal, hexadecimal, and octal. This is essential for debugging encoding issues, invisible characters, and Unicode problems.

How it works

Place the cursor on any character and press ga. Vim displays:

<A>  65,  Hex 41,  Oct 101

For Unicode characters:

<é>  233,  Hex 00e9,  Oct 351, Digr e'

Practical uses

  • Identify invisible characters: Is that a regular space (0x20) or a non-breaking space (0xa0)?
  • Debug encoding: Determine if a character is Latin-1 or UTF-8 encoded
  • Find lookalike characters: Distinguish between similar-looking glyphs (e.g., Cyrillic а vs Latin a)
  • Check line endings: Spot carriage returns (<^M> = 0x0d)

Related commands

g8      " Show the UTF-8 byte sequence of the character
8g8     " Show bytes of the next 8 characters
:ascii  " Same as ga

Tips

  • g8 is the complement to ga — it shows raw UTF-8 bytes rather than the code point
  • For a full character analysis including Unicode name, consider the vim-characterize plugin
  • Use :set list to make invisible characters visible in the buffer
  • Combine with ga to debug files that look correct but behave strangely

Next

How do I always access my last yanked text regardless of deletes?