How do I insert special characters and symbols in Insert mode using Vim's digraph system?
Answer
{char1}{char2}
Explanation
Vim's digraph system lets you type special Unicode characters — arrows, accented letters, math symbols, currency signs — by pressing <C-k> followed by a memorable two-character mnemonic. You never have to leave Insert mode or reach for a character map.
How it works
<C-k>{two chars}— inserts the digraph defined by those two characters:digraphs— lists all available digraphs (there are hundreds):dig {char1}{char2}— shows just that one digraph- Common patterns (first char is often a hint about the symbol family):
| Keys | Character | Meaning |
|---|---|---|
<C-k>-> |
→ | Right arrow |
<C-k><- |
← | Left arrow |
<C-k>-v |
↓ | Down arrow |
<C-k>Co |
© | Copyright |
<C-k>Rg |
® | Registered |
<C-k>TM |
™ | Trademark |
<C-k>14 |
¼ | One quarter |
<C-k>e' |
é | e acute |
<C-k>+- |
± | Plus-minus |
<C-k><< |
« | Left guillemet |
Example
Type a copyright notice in Insert mode:
<C-k>Co 2024 MyCompany
Produces: © 2024 MyCompany
Tips
- You can define your own digraphs with
:digraph {two chars} {decimal code}— e.g.,:digraph !! 8252maps<C-k>!!to‼ - In Normal mode,
gashows the decimal, hex, and octal code of the character under the cursor — useful for finding codes to define digraphs - Digraphs are standardized by RFC 1345, so many are intuitive once you learn the pattern
- Alternative:
<C-v>u{hex}inserts a Unicode character by its hex code point directly in Insert mode:<C-v>u00e9→é