10 years ago
Entering digraphs can be done in two different ways:
CTRL-K {char1} {char2}
{char1} <BS> {char2}
I find both of these inconvenient. The first one expects you to intentionally start "digraph mode" and enter the two keys, the second one just feels weird. For me, the easiest way to enter a digraph is to first have both characters visible on the line, then hit a keybinding to transform them. This mapping achieves that:
Moto:<c-n>head
Motörhead
inoremap <C-n> <esc>:call <SID>Digraph()<cr>a function! s:Digraph() let col = col('.') let chars = getline('.')[col - 2 : col - 1] exe "normal! s\<esc>s\<c-k>".chars endfunction
drasill 10 years ago
This is great, thank you.