AltGr for a richer input
I switched from Vim to Kakoune 5 years ago, and the feature I missed the most was digraphs. Vim’s digraphs let you input non-ASCII characters by inputting multiple characters to generate a Unicode character.
Being French I need to type accented words like Sûreté and Dépêché when I write to my folks back in France. I use a QWERTY keyboard, and I relied on Vim’s digraphs to overcome the lack of Latin characters on my keyboard by entering the accented digraphs with Vim.
Once I switched to Kakoune, I had to find another solution. I looked at digraph.kak, but I didn’t want to depend on an external program or a plug-in to do this. I wanted something that required no dependency and that was straightforward to install across different computers.
After digging a bit more, I found this blog post mentioning the altgr-intl variant of the US keyboard layout in X.org. It uses the right Alt key as a dead key to input unusual characters. For example, to enter ‘é’ you press the right Alt key and the e key. There are also ways to combine diacritical accents and letters together to create additional symbols and letters. For example to produce the ‘ê’ letter I press the right Alt key and 6 together to tell it: the next letter will have a ‘^’ on top, release the keys, and press the e key.
It’s easy to set up the altgr-intl variant with X11, I added the following line in my .xsession
that gets executed when I log in:
setxkbmap -rules evdev -model evdev -layout us -variant altgr-intl
I got used to the US-altgr-intl layout in about a week; it doesn’t interfere with my typing since I rarely used the right Alt key before. For me, this is a better solution than Vim’s digraphs because it works with every X11 application like web browsers and terminals, and it keeps my Kakoune configuration lightweight.