Ctrl-[ not working as Esc

Bug report

I’ve added a custom keymapping for ‘Ctrl-[’. That seems to be working with one quirk.

On my MacBook Pro I’ve swapped the control and caps lock keys in the system preferences.

But this custom key mapping in Inkdrop seems to only work with the physical ‘control’ key and not the ‘caps lock’ thus ignoring the system level remapping.

Is this a feature or a bug?

Info

  • Platform: (macOS/Windows/Ubuntu/iOS/Android)
  • Platform version: (Mojave/10/16.04)
  • App Version: (4.3.0)

Reproduce

Added the following mapping to my keymap.cson file;

‘.CodeMirror.vim-mode.normal-mode textarea’:
‘Ctrl-[’: ‘vim-mode:reset-normal-mode’

It works, but only if I use the physical control key.

Hi Andy,

Thank you for the question.
Ctrl-[ is basically equivalent to pressing Esc without remapping if you have an American English keyboard (ref).
This is how Ctrl key works by design in ‘hardware layer’.
I use Karabiner Elements to swap Control and Cap lock keys.
Ctrl-[ works as Esc key as expected with this configuration.
Also you can do the same thing with macOS’s system preferences as I did before.

It it doesn’t work, I guess this would be your environment issue.

Thanks for the reply. I’ve turned off the system preference remapping of the keys

The change in my keymap.cson file doesn’t appear to be working. It appears when I check the Keybindings under Inkdrop Preferences but has no effect in the editor. See attached Keybindings screen shot.

You don’t need to set that custom keybinding in the app.
Please just swap ctrl and caps lock in macOS.

OK, I’ve removed the entry from keymap.cson and set the modifier keys in System Preferences.

Ctrl-[ is still not being recognised as equivalent to escape in Inkdrop using the Vim plugin. Would you like me to close this ticket and re-open under a more accurate description?

That’s weird but I can’t reproduce it.
Do you get Ctrl-[ working as Esc in other apps? Because it is a system-wide behavior.
Could you try restarting the mac?

No, you can stay here.

Thanks for the quick response. Ctrl-[ works in every other application I have with vim keybindings - including MacVim and PyCharm. I have rebooted the machine and no change.

Please read my replies more carefully.

I guess you are not using a US keyboard.
If you still don’t get what I mean above, I’m afraid that I can’t help you.

Thanks for the help.