How do I insert special Unicode characters using digraphs in Vim?
Answer
<C-k>DG
Explanation
Vim's digraph system lets you insert special characters by pressing <C-k> followed by a two-character mnemonic code. This provides quick access to hundreds of Unicode characters — arrows, math symbols, accented letters, and more — without needing to look up character codes.
How it works
<C-k>{char1}{char2}— insert the digraph character- Two characters map to a specific Unicode character
- Works in insert mode and command-line mode
- Vim comes with hundreds of predefined digraphs
Example
In insert mode:
<C-k>DG → ° (degree sign)
<C-k>-> → → (right arrow)
<C-k>OK → ✓ (checkmark)
<C-k>XX → ✗ (cross mark)
<C-k>12 → ½ (one half)
<C-k>co → © (copyright)
<C-k>Eu → € (euro sign)
Tips
:digraphslists all available digraphs with their codes- Define custom digraphs:
:digraph <3 9829(♥ = heart) - Use
gaon any character to find its digraph code - For characters not in digraphs, use
<C-v>u{hex}to enter by Unicode code point