How do I type special characters and symbols using Vim's built-in digraph system in insert mode?
Answer
<C-k>{digraph}
Explanation
Vim's digraph system lets you insert special characters, accented letters, and symbols by typing a memorable two-character sequence. No need to memorize Unicode code points — Vim's built-in table covers hundreds of symbols including ©, ®, ±, µ, «, », and more.
How it works
- In insert mode, press
<C-k>to activate digraph input - Type the two-character code from the digraph table
- Vim replaces the pair with the corresponding special character
- Run
:digraphs(or:di) to browse the full table
Example
:digraphs
Partial output:
Co © 169 Rg ® 174 +- ± 177
12 ½ 189 14 ¼ 188 34 ¾ 190
<< « 171 >> » 187 My µ 181
With the cursor in insert mode, typing:
<C-k>Co → ©
<C-k>Rg → ®
<C-k>12 → ½
<C-k>+- → ±
<C-k>>> → »
Tips
- The codes are mnemonic:
Cofor copyright,Rgfor registered,<<and>>for guillemets - Define your own digraphs with
:digraph {xx} {char}— e.g.,:digraph ee 8364for € - Use
:help digraph-tablefor the complete reference list - In command-line mode,
<C-k>also works for digraph input