List current key map

With key mappings being scattered through several kak files, and sometimes conditionally activated (such as plugin configs), it’d be helpful to get a list of all key map definitions in effect for the current session. This is mainly useful for remembering all the mappings I’ve made, so that I can see what keys are available for making new maps.

Though, if I need help remembering, maybe that’s a sign I have too many mappings.

My first idea is just a simple grep of the config dir:

!grep -rnw $kak_config -e 'map'

So that works well enough for most things, but it doesn’t show which are active, and one could override another.
Thoughts?

You may be be interested in :debug mappings :slight_smile:

3 Likes

Yes, exactly what I was looking for. Thanks!

I reckon many useful stuffs are hidden in the arcane output of the :debug command.

Most should be graduated in a something like :list command which will feel more “official” to consume by scripts.

For examples, the current :debug buffers command could be turned into :list buffers which would populate a *buffers* buffer with predictable and documented fields (name, filename, flags…). This output would be more detailed than %val{buflist} and offers easily parseable data not mixed with errors or other debug lines.

Same for :list faces populating a *faces* buffer, :list registers filling a *registers* buffer etc…

2 Likes

with respective colors!

Emacs has this nice feature:

1 Like

Sorry to necrobump.

As someone who has remapped over half the default mappings, I think I need “debug mappings” but also field addedshowing what it has been mapped to.

1 Like

My preference is that lots of plugins can define their own commands, modes, whatever, but all keymaps are consolidated to the right filetypes, or kakrc for global ones.

TIL about debug mappings and this sort of falls under the TETO category as well (Too Embarrassed To Ask). Thank you @FlyingWombat for asking!

So first should mention that I have no real experience with c++ so this is probably a thrown together mess but this is a patch to commands.cc that adds showing the current mapping to :debug mappings:

I install it using the command: patch src/commands.cc < ~/commands.cc.diff

2 Likes