kakoune: Why can't I map key combinations?

It seems that map only supports single key mappings (with the exception of user mode which allows you to map , plus another single key).

  1. Is there a documented reason for this? I tried pretty extensively to find it myself but can’t seem to
  2. Obviously there are some combined keys in kakoune already, for example ge goes to the end of the file. Can I remap these somehow?
  3. Is there a way to change the key for user mode? I’d like to use space instead of comma

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 5
  • Comments: 16 (6 by maintainers)

Most upvoted comments

Exactly the same way you’d map any key. In kakoune mapping are not recursive, the target keys are kakoune commands, not whatever these keys are mapped to.

map global normal <space> ,
map global normal , <space>

Swaps the , and <space> keys.

Hi. For point 3, I also prefer <space> over , :

map global normal <space> ,

Single keys mapping is mostly a question of simplicity, supporting multi keys mapping means we need to disambiguate between ‘a’ being mapped, and ‘ab’. How do we do that ? with a timer ?

You can however implement your own multi key mappings with the on-key command, for example: map global normal i ':on-key %{ %sh{ case "$kak_key" in; 'a') echo 'exec blah'; ' ;; <a-b>') ... } }'

I guess you’d usually extract the on-key into a command, and just map the first key to :my-command<ret>