ctrl+p in VSCode doesn't work #3907

Open
opened 2026-02-16 17:41:54 -05:00 by yindo · 4 comments
Owner

Originally created by @VDuchauffour on GitHub (Dec 27, 2025).

Originally assigned to: @rekram1-node on GitHub.

Question

Hi,
The keybindings ctrl+p to see commands doesn't work on my VSCode setup. On my setup, ctrl+p is mapped to go to file but the when condition is empty. I guess, there will be a condition to add to avoid running this keybinding when on a terminal or in the opencode extension. Any ideas how to do this ? Thanks

Originally created by @VDuchauffour on GitHub (Dec 27, 2025). Originally assigned to: @rekram1-node on GitHub. ### Question Hi, The keybindings ctrl+p to see commands doesn't work on my VSCode setup. On my setup, ctrl+p is mapped to go to file but the when condition is empty. I guess, there will be a condition to add to avoid running this keybinding when on a terminal or in the opencode extension. Any ideas how to do this ? Thanks
Author
Owner

@github-actions[bot] commented on GitHub (Dec 27, 2025):

For keybind-related issues, please also check our pinned keybinds documentation: #4997

This issue might be related to existing issues about keybind conflicts and configuration:

  • #5706: ctrl+p shortcuts not present in commands menu
  • #5752: Keybinding doesn't work when bound to non-default configuration
  • #2908: Keybinds conflicting with system/built-in shortcuts

The core issue here is that VSCode's built-in ctrl+p (Go to File) command is taking precedence over the OpenCode extension's keybinding. This is a known challenge with VSCode extension keybindings where the when condition needs to be properly configured to ensure the extension's keybind only triggers in the appropriate context.

@github-actions[bot] commented on GitHub (Dec 27, 2025): For keybind-related issues, please also check our pinned keybinds documentation: #4997 This issue might be related to existing issues about keybind conflicts and configuration: - #5706: `ctrl+p` shortcuts not present in commands menu - #5752: Keybinding doesn't work when bound to non-default configuration - #2908: Keybinds conflicting with system/built-in shortcuts The core issue here is that VSCode's built-in `ctrl+p` (Go to File) command is taking precedence over the OpenCode extension's keybinding. This is a known challenge with VSCode extension keybindings where the `when` condition needs to be properly configured to ensure the extension's keybind only triggers in the appropriate context.
Author
Owner

@altendky commented on GitHub (Jan 7, 2026):

yeah, everything is going to collide with something in vscode it seems... i reconfigured mine to map to ctrl+o to get around this conflict.

@altendky commented on GitHub (Jan 7, 2026): yeah, everything is going to collide with something in vscode it seems... i reconfigured mine to map to ctrl+o to get around this conflict.
Author
Owner

@jaens commented on GitHub (Feb 1, 2026):

FYI since Quick Open in VSCode can be activated with many different keys (eg. Ctrl+E or Ctrl+Shift+P & Backspace), one workaround is to just disable the Ctrl+P shortcut in terminals.

Add the following to keybindings.json:

    {
        "key": "ctrl+p",
        "command": "workbench.action.quickOpen",
        "when": "!terminalFocus",
    },
    {
        "key": "ctrl+p",
        "command": "-workbench.action.quickOpen",
    },
@jaens commented on GitHub (Feb 1, 2026): FYI since Quick Open in VSCode can be activated with many different keys (eg. Ctrl+E or Ctrl+Shift+P & Backspace), one workaround is to just disable the Ctrl+P shortcut in terminals. Add the following to `keybindings.json`: ```json { "key": "ctrl+p", "command": "workbench.action.quickOpen", "when": "!terminalFocus", }, { "key": "ctrl+p", "command": "-workbench.action.quickOpen", }, ```
Author
Owner

@remkolems commented on GitHub (Feb 13, 2026):

GUI mode also available.

See also https://code.visualstudio.com/docs/configure/keybindings.

My default keyboard mapping Ctrl+p was set to Go to File... (same command was also provided by Ctrl+e). So I simply removed the Ctrl+p mapping.

Use right mouse menu option Change when expression to alter the expression state. e.g. with !terminalFocus :
Image

@remkolems commented on GitHub (Feb 13, 2026): GUI mode also available. See also [https://code.visualstudio.com/docs/configure/keybindings](https://code.visualstudio.com/docs/configure/keybindings). My default keyboard mapping `Ctrl+p` was set to `Go to File...` (same command was also provided by `Ctrl+e`). So I simply removed the `Ctrl+p` mapping. Use right mouse menu option `Change when expression` to alter the expression state. e.g. with `!terminalFocus` : <img width="995" height="428" alt="Image" src="https://github.com/user-attachments/assets/4995a218-cea2-4d52-8340-70e0605ec4ff" />
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#3907