Disable auto-pairs.kak when in kakoune-mirror mode

I couldn’t figure out a way of doing this automatically.

I thought the following hooks would be enough but it seems the the ModeChange hook doesn’t work with with user-declared modes

    hook global ModeChange push:.*:mirror %{
    hook global ModeChange pop:mirror:.* %{

Figuring out the values to filter ModeChange with is not trivial. I usually use the following hook to figure out what I should be filtering on, then watch the *debug* buffer:

hook global ModeChange .* %{ echo -debug %val{hook_param} }

Using above, it looks like user modes appear in the form push:normal:next-key[user.mode], so something like below should work for you:

hook global ModeChange 'push:.*:next-key\[user\.mirror\]' %{ auto-pairs-disable %}
hook global ModeChange 'pop:next-key\[user\.mirror\]:.*'  %{ auto-pairs-enable %}


I’ll try to see if this does what I expect

Also this is very handy :ok_hand:

Wild. I filed an issue about that years ago, I didn’t realise it was fixed almost a year later to the day. Thanks for pointing that out!

1 Like