Conditional keymapping not working

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

Hi all,
I’m trying to migrate from VSCode to Cursor, but some of my keyboard shortcuts are just not working as expected (I imported all settings), especially this particular example with a condition on when the shortcut should apply.
This works in VSCode.

Any thoughts here would be appreciated.
Thanks.

Steps to Reproduce

cmd+1 will not toggle the sidebar when it has focus. It instead returns the focus to the editor.

  {
    "key": "cmd+1",
    "command": "workbench.view.explorer"
  },
  {
    "key": "cmd+1",
    "command": "workbench.action.toggleSidebarVisibility",
    "when": "viewContainer.workbench.view.explorer.enabled && sideBarFocus"
  },
  {
    "key": "escape",
    "command": "workbench.action.focusActiveEditorGroup",
    "when": "sideBarFocus"
  }

Expected Behavior

When the sidebar is hidden, I want cmd+1 to open and focus it.
If I then hit cmd+1 again (while the sidebar has focus), I want it to close the sidebar.
If the sidebar is open, but doesn’t have focus, and I hit cmd+1, I want it to focus the sidebar.

Operating System

MacOS

Current Cursor Version (Menu → About Cursor → Copy)

Version: 1.5.9 (Universal)
VSCode Version: 1.99.3
Commit: de327274300c6f38ec9f4240d11e82c3b0660b20
Date: 2025-08-30T21:02:27.236Z
Electron: 34.5.8
Chromium: 132.0.6834.210
Node.js: 20.19.1
V8: 13.2.152.41-electron.0
OS: Darwin arm64 24.6.0

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hey, try these keybinding settings.

  {
    "key": "cmd+1",
    "command": "workbench.view.explorer",
    "when": "!sideBarVisible"
  },
  {
    "key": "cmd+1",
    "command": "workbench.action.toggleSidebarVisibility",
    "when": "sideBarVisible && explorerViewletFocus"
  },
  {
    "key": "cmd+1",
    "command": "workbench.view.explorer",
    "when": "sideBarVisible && !explorerViewletFocus"
  },
  {
    "key": "shift+cmd+e",
    "command": "-workbench.view.explorer",
    "when": "viewContainer.workbench.view.explorer.enabled"
  },
  {
    "key": "cmd+b",
    "command": "-workbench.action.toggleSidebarVisibility"
  }

Perfect, thank you. I see that it was the values I was using in the conditions that was the issue. I updated my esc command to utilise this too, so now I have the exact functionality I was expecting. :raising_hands:

  {
    "key": "escape",
    "command": "workbench.action.focusActiveEditorGroup",
    "when": "sideBarVisible && explorerViewletFocus"
  },

What’s interesting is that sideBarFocus doesn’t seem to work at all, but definitely does in VSCode, even for pretty simple commands (which could’ve been the reason I was struggling with my initial conditional command).

I’ve also seen the same issue when using conditionals such as activeViewlet == 'workbench.view.debug'. Is Cursor using different names here compared to VSCode? I don’t see these documented on the website, so I’m assuming I should be going by VSCode’s docs here. Thanks.

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