Kakoune for non-qwerty layouts?

Hi, I’m trying to switch from vim to kakoune. It’s really cool, but I use a different keyboard layout (bépo, which is like dvorak but for French).

I was wondering: what is your experience using kakoune one non-qwerty based layouts?
Are there specific tools or configs to help with layouts?
Ideally, I would like to use qwerty physical mapping on normal mode and my bépo layout in insert mode only…
I already tried this: https://github.com/guillaumecherel/bepo
The script inside manually remap every key but:

  • It’s old. Some commands don’t even work anymore like
map -docstring "select next current search pattern match" global normal '\'' 'n'
map -docstring "select previous current search pattern match" global normal '<a-\'>' '<a-n>'

I could somehow fix the first one into

map -docstring "select next current search pattern match" global normal \' 'n'

but no idea for the second one.

  • It’s far from ideal: you still have to use the old keys in view mode. I dislike this kind of inconsistencies.

I switched from QWERTY to Dvorak when I was already a Vim user, but I just trained myself to learn the new key locations. Luckily, unlike videogames, most Vim and Kakoune keybindings don’t depend on particular keys being near each other, with the possible exception of hjkl—but at least jk are next to each other in Dvorak.

For the second map example you give, it looks like the code predates Kakoune’s string-quoting changes. As it is now, quotes are only significant at the beginning of a word, so you can just say:

map global normal <a-'> <a-n>

However, that still wouldn’t help with other modes. You may be interested in issue 2151.

I have been using dvorak for years from when I was still a vim user. Since then I preferred to use the semantic meaning of the bindings instead of learning the key position (Word-selection delete[Wd] for example. Delete inner Word[diW] or something similar on vim).
I don’t really find any weakness on dvorak layout for using kak (or vim), but bepo might be a bit complex, mainly the jk keys. I originally had some problems with sparated jk and lh but now I think it’s the best. Something similar might hapen for you.
Other than that, it might be interesting to see kakoune’s solution for different keyboard layouts.

Not sure if it will help you at all, but I use both Kakoune and Emacs with default keybindings (without Evil) every day, swapping between different editors for different tasks. It is something like changing keyboard layout from qwerty to emacsy because of really awkward shortcuts of Emacs. I mean that usual hjkl becomes Ctrl+bnpf. And bpnf are not close to each other in terms of location on the qwerty keyboard.

What I’m trying to say is that location of keys doesn’t really matter as long as you can type with comfort. In terms of entering commands (movement too) it is just a matter of habit.

Thank you all for your answers!

To conclude, I decided to use kakoune mostly without remapping because semantic meaning can be useful to learn as pointed out (though often there is no apparent semantic meaning like <a-;>, o, <a-o>, …).
However, there are numerous awkward mapping for bépo (I mean really uncomfortable).
I believe most of the <a-'something'> mappings for qwerty or maybe dvorak can be done using left hand for alt and right hand for the character, while with bépo it’s the left hand for both. I wish I could bind altgr to alleviate the issue, but it doesn’t seems possible. The worst I noted is <a-;>. On a qwerty keyboard, it would be alt+shift+f.
Also, the hjkl become >pbo. I don’t know if I would grow into liking this separation, but for now, I prefer to keep those on my home row.

So I decided to simply remap the critical parts to make it more comfortable and leave the rest as it.

Here is my current mapping for anyone intersted.

map global normal t j -docstring "move down"
map global goto   t j -docstring "buffer bottom"
map global view   t j -docstring "scroll down"
map global normal T J -docstring "extend down"
map global normal j t -docstring "select to next character"
map global goto   j t -docstring "window top"
map global view   j t -docstring "cursor on top"
map global normal J T -docstring "extend to next character"

map global normal s k -docstring "move up"
map global goto   s k -docstring "buffer top"
map global view   s k -docstring "scroll up"
map global normal S K -docstring "extend up"
map global normal k s -docstring "select regex matches in selected text"
map global normal K S -docstring "split selected text on regex matches"

map global normal r l         -docstring "move right"
map global normal <a-r> <a-l> -docstring "select to line end"
map global goto   r l         -docstring "line end"
map global view   r l         -docstring "scroll right"
map global normal R L         -docstring "extend right"
map global normal <a-R> <a-L> -docstring "extend to line end"
map global normal o r         -docstring "replace with character"
map global normal O R         -docstring "replace selected text with paired yanked text"
map global normal <a-O> <a-R> -docstring "replace selected text with all yanked texts"
map global normal l o         -docstring "insert on new line below"
map global normal <a-l> <a-o> -docstring "add a new empty line below"
map global normal <c-l> <c-o> -docstring "jump backward in jump list"
map global normal L O         -docstring "insert on new line above"
map global normal <a-L> <a-O> -docstring "add a new empty line above"

map global normal c h         -docstring "move left"
map global normal <a-c> <a-h> -docstring "select to line begin"
map global goto   c h         -docstring "line begin"
map global view   c h         -docstring "scroll left"
map global normal C H         -docstring "extend left"
map global normal <a-C> <a-H> -docstring "extend to line begin"
map global normal h c         -docstring "cut selected text"
map global normal <a-h> <a-c> -docstring "cut selected text without yanking"
map global goto   h c         -docstring "window center"
map global normal H C         -docstring "expand a new cursor below"

map global normal + (             -docstring "rotate selections"
map global normal <minus> )       -docstring "rotate selections backward"
map global normal <a-+> <a-(>     -docstring "rotate selections content"
map global normal <a-minus> <a-)> -docstring "rotate selections content backward"

map global normal à <a-`>   -docstring "swap case"
map global normal À '<a-;>' -docstring "flip the selections' direction"

Edit: updated version in my dotfiles repo: https://github.com/CBenoit/dotfiles/blob/master/kak/.config/kak/mappings.kak

@CBenoit The mnemonic for o is open a new line.

Oh. Okay. I didn’t know that “open a line” was making sense in english.
With my binding this is l like line.