Quick access to echo kakoune state

I often have the need to inspect the content of an option or a value.
It happens mainly while working on a new kak script or debugging one.

The repetitive task of typing the :echo %foo{ prefix can be quite cumbersome, so I ended up with these few shortcuts.
It does not really deserve a proper plugin, but you may find this snippet useful:

declare-user-mode echo

map global echo o ':echo %opt{'        -docstring 'opt'
map global echo O ':echo -debug %opt{' -docstring 'opt debug'
map global echo r ':echo %reg{'        -docstring 'reg'
map global echo R ':echo -debug %reg{' -docstring 'reg debug'
map global echo s ':echo %sh{'         -docstring 'sh'
map global echo S ':echo -debug %sh{'  -docstring 'sh debug'
map global echo v ':echo %val{'        -docstring 'val'
map global echo V ':echo -debug %val{' -docstring 'val debug'

map global user e ': enter-user-mode echo<ret>'
1 Like

How about:

map global echo o ':echo %opt{}<left>'

…so the closing brace is already there for you?


Great! That’s even better. Forgot about this trick. Thanks @Screwtapello

I suspect you could use prompt and set up autocomplete for each, but I’m not familiar enough with wiring and expansion to figure out how to make that work.


That was supposed to be “quoting and expansion”. This works, though I feel it could be simpler:

prompt 'option name>' %{eval %sh{ printf 'echo %%opt{%s}' "$kak_text" }}