Entering Russian characters in Vim with digraphs
The purpose of this post is to expand on the following sentence [1]:
Russian letters are created by entering [Ctrl-k followed by] a corresponding Latin letter followed by an equals sign -, or, in a few places, a percent sign %.
The Russian alphabet has 33 letters, so there couldn't be a Latin letter for every Russian letter. Also, there are Latin letters that don't have a Russian counterpart and vice versa. So the mapping can't be simple. But still, the above summary is nice: try control-k followed by the English analog and the equal sign. If that doesn't work, try a percent sign instead.
Which Latin letters does Vim chose as corresponding to Russian letters? Does it go by sound or appearance? For example, the Russian letter looks like a Latin H but it sounds like a Latin N. Vim goes by sound. You would enter the Russian letter by typing Ctrl-k N =.
For full details, see the Vim documentation :h digraph-table. I give a simplified excerpt from the documentation below. I just look at capital letters because the lower case letters are analogous. All the official Unicode names begin with CYRILLIC CAPITAL LETTER and so I cut that part out.
char digraph hex official name A= 0410 A B= 0411 BE V= 0412 VE G= 0413 GHE D= 0414 DE E= 0415 IE IO 0401 IO Z% 0416 ZHE Z= 0417 ZE I= 0418 I J= 0419 SHORT I K= 041A KA L= 041B EL M= 041C EM N= 041D EN O= 041E O P= 041F PE R= 0420 ER S= 0421 ES T= 0422 TE U= 0423 U F= 0424 EF H= 0425 HA C= 0426 TSE C% 0427 CHE S% 0428 SHA Sc 0429 SHCHA =" 042A HARD SIGN Y= 042B YERU %" 042C SOFT SIGN JE 042D E JU 042E YU JA 042F YA
Note that the end of the alphabet is more complicated than simply using a Latin letter and either an equal or percent sign. Also, the table is in alphabetical order, which doesn't quite correspond to Unicode numerical order because of a quirk with the letter (U+0401) explained here.
[1] Arnold Robbins and Elbert Hannah. Learning the vi & Vim Editors, 8th edition
The post Entering Russian characters in Vim with digraphs first appeared on John D. Cook.