sublimehq / sublime_text

Issue tracker for Sublime Text
https://www.sublimetext.com
812 stars 39 forks source link

Is the "Insert" key bindable on macOS? #5187

Open ornamentist opened 2 years ago

ornamentist commented 2 years ago

Description of the bug

I'm trying to bind a command to the "insert" key on an m1 Mac running macOS 12.1.

Other keys in that cluster seem to be bindable (e.g. Home, End) but not that one. In the console I'm seeing "no command for selector: noop:" when that key is pressed after creating a user binding.

Steps to reproduce

  1. Bind the Insert key on an m1 mac with macOS 12.1
  2. Check the result

Expected behavior

The key should be bindable, like the other keys in that cluster.

Actual behavior

The key doesn't seem to be recognized.

Sublime Text build number

4125 (Dec Channel)

Operating system & version

macOS 12.1, m1 Mac.

(Linux) Desktop environment and/or window manager

No response

Additional information

No response

OpenGL context information

No response

BenjaminSchaaf commented 2 years ago

The insert key isn't recognized by macOS, see: https://stackoverflow.com/questions/25657633/using-pc-keyboard-on-mac-how-do-make-insert-key-work-vim-etc

The error you're seeing "no command for selector: noop:" - "noop" is the key that ST is receiving from macOS, so unfortunately there's nothing we can do on our end here.

ornamentist commented 2 years ago

Okay, thanks for investigating the issue,

ornamentist commented 2 years ago

For future reference, I created a work-around by remapping the Insert key to f20 with:

hidutil property --set '{"UserKeyMapping":[
{"HIDKeyboardModifierMappingSrc":0x700000049,"HIDKeyboardModifierMappingDst":0x70000006f}
]}'

Then binding actions to f20 in the Sublime keymap.

That binding at the shell with hidutil is not persistent so it needs to be repeated whenever the mac is restarted. Maybe also on re-login.

eugenesvk commented 1 year ago

Could you please reopen?

Other apps can rebind at least combo+Insert key, just tried out with Path Finder and it works when I rebind ⎇Insert or ⌘Insert or ⌃Insert (PF doesn't allow single key rebinds in general, so this test doesn't tell us about standalone rebind). Also Key Codes utility shows a regular F746 code for Insert, which I can use in defaultkeybinds to rebind to select a word in text fields with "\UF746" = (selectWord:);

So it's definitely possible to bind this key