John Elliott

How to Type an Em-Dash in Vim

TL;DR

From insert mode, type CTRL-K '-' M

Explanation

Inserting special characters in insert mode is something I’ve never tried before 2023 but I’ve wanted to for this blog, so I found out how using :help and remembering that digraphs were a thing in Vim.

In short, you type control-k while in insert mode and then a sequence of characters that map to the character you want as enumerated in :help digraph-table. They seem to be somewhat mnemonic as is the Vim way. An em-dash code is a - (hypeh/minus) keypress followed by an m keypress. For an en-dash is - n.

For more, see the Vim help with :help digraph-use.