Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VIM digraph not working

Tags:

vim

I can't seem to get digraphs working for me in GVIM. According to this site (and the VIM wiki) I should be able to enter the mu character µ by being in insert mode then either Ctrl-Km* or Ctrl-Q956.

  • When I try Ctrl-Km* I get *
  • When I try Ctrl-Q956 I get ÿ

It's driving me mad... I hate using u when I mean µ. I normally use Alt-0181 but that doesn't work in VIM either!

like image 662
Erresen Avatar asked Oct 04 '13 14:10

Erresen


2 Answers

In addition to Ingo's answer, make sure that you (or one of your plugins) haven't remapped any keys. If you're using UltiSnips, for example, it remaps Ctrl-k in insert mode, so the first method you tried won't work. Since you're seeing a literal *, I suspect that's what's preventing that one from working.

To see if the key is mapped, and where it was mapped from, enter:

:verbose imap <C-k>

If it's mapped, you can remap it to something else, or just use the Ctrl-q solution.

For example, to make Ctrl-y perform the built-in digraph function, enter:

:inoremap <C-y> <C-k>

To make that permanent, put the line in your ~/.vimrc (without the leading :).

like image 186
Jim Stewart Avatar answered Nov 14 '22 08:11

Jim Stewart


:help i_CTRL-V_digit explains that the decimal number entry only works up to 255. To use that method, you'd have to enter the hexadecimal value 03BC. The keystrokes therefore would be <C-Q>u03bc.

The digraph method should work, too. Do you press Ctrl and K, together, then release both, then type first m, then * individually?

Depending on the font, Vim may not be able to correctly display the character. You can use ga over it to verify its character codes.

Also, your encoding must support the character. Best use :set encoding=utf-8.

like image 22
Ingo Karkat Avatar answered Nov 14 '22 06:11

Ingo Karkat