Highlight matching braces of the pair that would be selected with `<a-a>B`

In other words, it’d be nice to always be reminded of what pair of braces I’m operating within as sometimes I think i would be selecting a larger block when in fact kakoune selects the more immediate one (such as when Im on the line where a brace begins, even though the cursor and selection are outside of the brace).

Some of my coworkers use a rainbow plugin that colors the preceding whitespace in such a way as to make it more visible but I think that is too much visual noise. I don’t need to know every match, just the one that I’m operating most immediately within.

Here is quickly hacked example:

declare-option range-specs show_in_braces
define-command hlinbrace %{
    set-option window show_in_braces "%val{timestamp}"
	evaluate-commands -draft -itersel %{ try %{
    	execute-keys '<a-a>B<a-S>'
    	evaluate-commands -itersel %{
    		set-option -add window show_in_braces "%val{selection_desc}|MatchingChar"
    	}
	}}
}
add-highlighter global/ ranges show_in_braces
hook global NormalIdle .* %{ hlinbrace }
hook global InsertIdle .* %{ hlinbrace }

This probably should be cleaned up and put into some kind *-enable *-disable command but it works.