3

I am new to VS Code and also to stackoverflow. I am using VSCode 1.18 on OSX El Capitan. I would like to configure the switch between editor and integrated terminal as mentioned in this related question

However, I want to configure this with Command button on Mac laptop as it is more convenient to use for the keyboard layout. However, when I use the same solution, just by changing "ctrl" to "cmd", it does not work.

Given solution in referenced link: works

// Toggle between terminal and editor focus
{ "key": "ctrl+`", "command": "workbench.action.terminal.focus"},
{ "key": "ctrl+`", "command": "workbench.action.focusActiveEditorGroup", "when": "terminalFocus"}

My solution : does not work

// Toggle between terminal and editor focus
{ "key": "cmd+`", "command": "workbench.action.terminal.focus"},
{ "key": "cmd+`", "command": "workbench.action.focusActiveEditorGroup", "when": "terminalFocus"}

Anybody can help what is wrong in this ? Are there any limitations with combinations with "cmd" ?

Note: I had to open a new question as I am still not allowed to comment on the original question.

Fatemeh Abdollahei
  • 3,040
  • 1
  • 20
  • 25
arundeep78
  • 159
  • 11
  • If you have checked that that key combo does not already have a binding on OSX I would try adding "when": "editorFocus" to the first command. – Mark Nov 18 '17 at 17:00
  • When I press " cmd + ' " in VSCode, nothing happens. In either case, when I am in editor or when I am in Terminal. I checked in VScode, there is no other setting with same combination. I also just tried your suggestion, still no response. – arundeep78 Nov 18 '17 at 17:09
  • That is a backtick ` , not an apostrophe ' (just in case). – Mark Nov 18 '17 at 21:43
  • yes, you are right. My mistake while making the comment. The original question still remains valid with backtick. – arundeep78 Nov 18 '17 at 22:11

1 Answers1

6

[⌘ + `] (command + backtick) is already a built-in OS X keyboard shortcut for switching between open windows of the active application. If you want to use this combination for switching focus to the terminal in VS Code, you'll need to turn off the shortcut in your System Preferences, under Keyboard > Shortcuts > Keyboard, as shown below. Once you've disabled it, quit & re-open VS Code, and your keybinding will work. (Tested with OSX 10.13.3 & VS Code 1.22.0-insiders)

Location of the command+backtick shortcut in OSX System Preferences

Joshua Skrzypek
  • 448
  • 5
  • 9