18

I'm using macOS Mojave (10.14.2) and VSCode (1.31.1).

My issue is that every time I use the "Move Line Down" command using Control + Command + Down arrow, I get the bell sound that signifies some kind of error. However, when I use the "Move Line Up" command using Control + Command + Up arrow, there is no error sound.

It's been like this for as long as I can remember. I even checked the shortcuts to make sure nothing else is mapping to this shortcut, but I couldn't find any other commands mapping to the same shortcut. The strange thing is that when I click on the command from the menu, there is no error. I feel that this points to something but I can't seem to figure out what's causing this.

EDIT: Just realized that this is an open issue and the command is making noise due to it being blocked in Electron.

2 Answers 2

24

This appears to be an issue with Chromium (used by Electron, used by VSCode). There's a workaround here: https://github.com/electron/electron/issues/2617#issuecomment-571447707 I'll copy the gist of it here for convenience:

You can establish system-global key bindings for the key combinations ^⌘←, ^⌘↓, and ^⌘→ that are mapped to no operation ("noop"). Simply having these declared as valid keystrokes at the OS level eliminates the system beep that occurs even when a Chromium app accepts and handles the keystroke.

In order to establish this, you need to create a ~/Library/KeyBindings/DefaultKeyBinding.dict – note that you'll probably need to create the directory as well, and that the directory name is plural (Bindings), but the file name is singular (Binding). This should be in your user Library folder, not the /Library folder or the /System/Library folder.

The file should be a text file with these contents:

{
  "^@\UF701" = "noop";
  "^@\UF702" = "noop";
  "^@\UF703" = "noop";
}

^ means Ctrl, @ means Command, and \UF701, \UF702, and \UF703 are the codes for the three arrow keys. There's a nice reference Gist for this file's syntax here: https://gist.github.com/trusktr/1e5e516df4e8032cbc3d I have attached a copy of my file in case that's easier for folks.

Also: don't forget to restart VSCode after adding that file! You have to restart for the changes to take effect.

3
  • Hey, I was receiving the sound when pressing Ctrl + Option + Command + DownArrow as well. "^@~\UF701" = "noop"; didn't work for me. Any suggestions? I'm getting crazy trying combinations and not getting this sound to stop Commented Jul 11, 2023 at 17:05
  • Opening up about your problems really helps. After 30 seconds I found the solution: "@^~\UF701" = "noop"; Commented Jul 11, 2023 at 17:21
  • For Sonoma 14.4 solution check here: github.com/electron/electron/issues/… Commented Mar 11 at 16:18
2

Based on the solutions already provided I needed to do some changes to make it work on Sonoma 14.4+

https://github.com/electron/electron/issues/2617#issuecomment-1988768016

{
    "@^\UF701" = "noop:";
    "@^\UF702" = "noop:";
    "@^\UF703" = "noop:";
    "@~^\UF701" = "noop:";
}

Basically I needed to add the : at the end of noop and invert the order for the Ctrl + Option + Cmd + DownArrow

1
  • This worked for me on Sonoma 14.4, weird!
    – aubreypwd
    Commented Mar 13 at 20:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .