How do I look up which two-character code produces a special character when using Vim's digraph system?
Answer
:digraphs
Explanation
:digraphs (abbreviated :dig) displays a full reference table of every digraph registered in Vim. Each entry shows the two-character sequence, the resulting character, and its decimal code point. Use this to discover the code you need before entering the character with <C-k>{char1}{char2} in Insert mode.
How it works
Running :digraphs opens a paged listing. Each row contains three columns:
! 33 " 34 # 35 ... Ct 162 Pd 163 Cu 164
- Two-letter code — the digraph sequence you type after
<C-k> - Character — the resulting glyph
- Decimal — the Unicode/ASCII code point
Once you find the code you need, insert the character with <C-k> in Insert mode. For example, <C-k>-> produces →.
Example
You want to type a copyright symbol © but don't know the code:
:digraphs
Scroll or search (with /Co) to find:
Co 169
Then in Insert mode, type <C-k>Co to insert ©.
Tips
:digraphs!(with bang) shows the same list but with^Xnotation for control characters- Filter the output with
:digraphs | grepif your Vim version supports piping help output, or redirect it::redir @a | digraphs | redir END - Add custom digraphs with
:digraph {two-chars} {decimal}— e.g.,:digraph !! 8252adds‼(double exclamation) - The default digraph set follows RFC 1345; run
:help digraph-tablefor the full reference