kakoune
kakoune copied to clipboard
src: Allow `:on-key` to display an information box
Key mappings that use on-key
to emulate single hit prompts (like
the t
primitive) currently have no way of notifying the user that
an input is pending.
This commit allows passing an -info flag to on-key
, in order to
display the given string in an information box until a key is hit, e.g.
on-key -info "hit a key" 'echo %val{key}'
My usecase is for the following user-mapping, which I would like not to be running without any kind of notification that input is pending:
map -docstring "select after the given character" global user 't' %{: on-key 'exec / %val{key} \K.<lt>ret>'<ret>}
aren't you better served by doing info 'hit a key'; on-key 'echo %val{key}'
? that way you can use the full options of info
, title and all.
I just wanted a simple way to show a message on screen, adding a flag to :on-key
as a shortcut is ideal for mappings.
Also the following will show the information box until the screen needs to be refreshed (as opposed to being hidden as soon as any key is hit):
:info test; on-key 'echo -debug %val{key}'
Rebased on master.