Chinmaya Pati
Chinmaya Pati

Reputation: 397

VSCode Mac BigSur option key not working as expected

When I press the [Option+Z] to toggle word wrap it instead prints a character (ˀ)

OS: Mac BigSur
Processor: M1

Keypress event log

[2021-04-21 11:15:15.609] [renderer3] [info] [KeybindingService]: / Received  keydown event - modifiers: [alt], code: AltLeft, keyCode: 18, key: Alt
[2021-04-21 11:15:15.609] [renderer3] [info] [KeybindingService]: | Converted keydown event - modifiers: [alt], code: AltLeft, keyCode: 6 ('Alt')
[2021-04-21 11:15:15.609] [renderer3] [info] [KeybindingService]: \ Keyboard event cannot be dispatched in keydown phase.
[2021-04-21 11:15:15.978] [renderer3] [info] [KeybindingService]: + Storing single modifier for possible chord alt.
[2021-04-21 11:15:16.283] [renderer3] [info] [KeybindingService]: + Clearing single modifier due to 300ms elapsed.

Upvotes: 8

Views: 1727

Answers (2)

Connor
Connor

Reputation: 640

This answer explains how to completely prevent Option+key from producing special characters, allowing you to use these combinations for shortcuts in VS Code and various other editors.

In short:

  1. Download this QWERTY keyboard layout file (or generate one yourself using the instructions in the linked answer).
  2. Move it to ~/Library/Keyboard Layouts/
  3. Go to System Settings > Keyboard > Text Input > Input Sources > Edit.
  4. Click + in the bottom left, scroll to the bottom of the list on the left and select Others then select QWERTY no option and click Add.
  5. Either delete your existing layout (probably called U.S.) or just switch to the QWERTY no option layout using the input-source select in the menu bar.

Upvotes: 0

Raghav Sharma
Raghav Sharma

Reputation: 191

Try changing the Keyboard Layout.

  • Goto System Preferences > Keyboard > Input Sources.
  • Add the English > ABC Source
  • Remove the existing source that is there. (In my case it was ABC India which contained that special character ˀ for Option+z key combination, the ABC input source will replace that with Ω, which somehow works with VS Code to trigger the special actions instead of inserting that as text)

Finally the input sources should look like this: Keyboard Settings Window

Upvotes: 19

Related Questions