How do I insert special characters like ©, ±, or → without leaving Vim?
Answer
<C-k>{char1}{char2}
Explanation
Vim has a built-in digraph system that lets you insert hundreds of special characters by typing two-character mnemonics. Press <C-k> in insert mode followed by two characters, and Vim replaces them with the corresponding special character.
How it works
- Enter insert mode
- Press
<C-k>— Vim shows a?in the status line, waiting for your digraph - Type two characters that form the digraph code
- Vim inserts the special character and you remain in insert mode
Common digraphs
<C-k>Co → © (copyright)
<C-k>Rg → ® (registered)
<C-k>+- → ± (plus-minus)
<C-k>-> → → (right arrow)
<C-k>!= → ≠ (not equal)
<C-k>=< → ≤ (less than or equal)
<C-k>=> → ≥ (greater than or equal)
<C-k>00 → ∞ (infinity)
<C-k>OK → ✓ (checkmark)
<C-k>*X → × (multiplication sign)
<C-k>My → µ (micro sign)
<C-k>DE → ° (degree)
<C-k>14 → ¼ (one quarter)
<C-k>12 → ½ (one half)
Example
To type Temperature: 72°F, enter insert mode and type:
Temperature: 72<C-k>DEF
The <C-k>DE inserts ° and the F is typed normally.
Tips
- Run
:digraphsto see the full list of available digraph codes - Digraph codes are case-sensitive:
<C-k>Cois©but<C-k>COis something different - Use
:help digraph-tablefor the complete reference organized by Unicode block - You can define custom digraphs with
:digraphs— e.g.,:digraphs el 8230mapselto…(ellipsis) - Digraphs work in command-line mode too — press
<C-k>while typing an Ex command