`Terminal: Focus Next Terminal Group` doesn't work via default keybindings

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

When the terminal is open and focused, hitting Cmd + Shift + ] (the default keybinding for workbench.action.terminal.focusNext) triggers workbench.action.nextEditor to run instead.

Likewise for workbench.action.terminal.focusPrevious and workbench.action.previousEditor.

Steps to Reproduce

  1. Open two editors
  2. Open two terminal groups, and have one of them focused
  3. Hit Cmd + Shift + ] to try to switch to the other terminal group
  4. Observe that workbench.action.nextEditor is run instead, so the next editor is switched to and the Terminal loses focus

Expected Behavior

workbench.action.terminal.focusNext is run, Terminal focus persists, the next Terminal group is switched to

Operating System

MacOS

Current Cursor Version (Menu → About Cursor → Copy)

Version: 2.3.29
VSCode Version: 1.105.1
Commit: 4ca9b38c6c97d4243bf0c61e51426667cb964bd0
Date: 2026-01-08T00:34:49.798Z
Electron: 37.7.0
Chromium: 138.0.7204.251
Node.js: 22.20.0
V8: 13.8.258.32-electron.0
OS: Darwin arm64 21.6.0

Additional Information

For context, the default keybinding for workbench.action.terminal.focusNext has a When expression of terminalFocus && terminalHasBeenCreated && !terminalEditorFocus || terminalFocus && terminalProcessSupported && !terminalEditorFocus. And the default keybinding for workbench.action.nextEditor has no When expression.

I tried setting the When for workbench.action.nextEditor to !terminalFocus. This worked somewhat, i.e. sometimes allowed workbench.terminal.focusNext to be run instead of workbench.action.nextEditor, but not if the active terminal group is a running process like npm run watch.

I eventually realized that to fix this properly, workbench.action.nextEditor can remain without a When expression, but the When expression for workbench.action.terminal.focusNext needs to be changed to reference terminalFocusInAny instead of terminalFocus. I.e.:

terminalFocusInAny && terminalHasBeenCreated && !terminalEditorFocus || terminalFocusInAny && terminalProcessSupported && !terminalEditorFocus

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hey, thanks for the report and for finding a fix with terminalFocusInAny.

This is a known issue. Cursor sometimes sets context variables like terminalHasBeenCreated and terminalProcessSupported incorrectly, so the when conditions for the default keybindings don’t trigger. The team is working on a fix.

Your solution is correct. As a temporary workaround, you can add explicit bindings in keybindings.json:

{
  "key": "cmd+shift+]",
  "command": "workbench.action.terminal.focusNext",
  "when": "terminalFocusInAny && terminalHasBeenCreated && !terminalEditorFocus || terminalFocusInAny && terminalProcessSupported && !terminalEditorFocus"
},
{
  "key": "cmd+shift+[",
  "command": "workbench.action.terminal.focusPrevious",
  "when": "terminalFocusInAny && terminalHasBeenCreated && !terminalEditorFocus || terminalFocusInAny && terminalProcessSupported && !terminalEditorFocus"
}

Related cases: CMD+SHIFT+[ doesn't toggle terminals

1 Like

Yeah that’s what I’ve put in my keybindings :). Thanks for the reply (and your replies to the other issues I’ve recently filed), glad the team is aware and working on everything!

1 Like

This topic was automatically closed 22 days after the last reply. New replies are no longer allowed.