I have an extensive DefaultKeyBinding.Dict file that mostly works very well for me. I use Karabiner Elements to change the behavior of the right-alt so that it sends §, which signals the beginning of a compose sequence, and then the keybinding table takes over. My DefaultKeyBinding.Dict starts like this:
{"§" = {
"g" = {
"h" = ("insertText:", "ȝ");
"," = ("insertText:", "ģ");
"." = ("insertText:", "ġ");
"(" = ("insertText:", "ğ");
"U" = ("insertText:", "ğ");
…
These bindings all work as expected. For example, right-alt g h produces ȝ and right-alt g . produces ġ.
But none of my sequences that involves ^ or ~ is working. I know these symbols have a special meaning in the DefaultKeyBinding.Dict syntax, but none of the escape sequences for them is working either. For example, I am supposed to be able to use \136 (octal) or \U005E to represent the caret ^, but keybindings involving this character never work. I've tried inserting each of the following in the same block as the bindings above, then typing right-alt g ^:
"\U005e" = ("insertText:", "yobgorgle"); // ^
"\U005E" = ("insertText:", "yobgorgle"); // ^
"\^" = ("insertText:", "yobgorgle"); // ^
"\136" = ("insertText:", "yobgorgle"); // ^
// These are not supposed to work but I tried them anyway
"\x5e" = ("insertText:", "yobgorgle"); // §g^
"\0136" = ("insertText:", "yobgorgle"); // §g^
// Different strategy
"$6" = ("insertText:", "yobgorgle"); // §g^
None of these has produced yobgorgle; all the advertised syntax has produced a plain ^ symbol. If they were being completely ignored, they would produce §g^ like the bottom three, so something is happening, but I don't understand what.
I don't understand why "$6" didn't work either, that is supposed to mean shift-6, which is where my caret symbol is.
The sequence \033 for the "esc" key does work as advertised.
I am using iTerm2 to test the binding changes. I have not forgotten that I need to kill and restart the app to get it to notice the new keybindings.
What might I be missing?