Skip to content

Implementing user mode

Coleman McFarland edited this page Oct 9, 2022 · 17 revisions

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>'
Clone this wiki locally