1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-10-05 17:18:00 +03:00
17 Implementing user mode
Coleman McFarland edited this page 2022-10-08 20:21:59 -04:00

Kakoune provides a simple way to bind keys to a personal namespace, the user mode which is triggered by the <space> by default.

map global user e ':echo foo<ret>'

If the user keymode is not big enough, you can implement your own, triggered by the key you want. Good candidates can be <a-g> or <a-v> since g and v already work quite the same.

Start by declaring a new mode:

declare-user-mode cmd

add some bindings on it:

map global cmd w ':write<esc>'
map global cmd e ':e<space>'

and finally bind a key to trigger this custom mode:

map global normal <a-,> ':enter-user-mode<space>cmd<ret>'