Command-K and the terminal

It’s driving me nuts that command-k, the standard for clearing the terminal scroll back, opens the AI tools. Like, I get it that you’ve standardized on that for your tools, and that’s great, but you also didn’t change the shortcut to clear terminal scroll back.

9 Likes

Unfortunately, setting a different shortcut for cursorai.action.generateInTerminal doesn’t allow the terminal to be cleared. Cmd+K just fires the chord starter and you get the common message (Cmd+K) was pressed. Waiting for second key of chord….

Any ideas if there’s a way to make Cmd+K shortcut work standalone in the terminal, instead of waiting for a chord?

1 Like

This is really important for me as well. I’m so used to Command+K and it’s a crucial part in my workflow. It’s really uncomfortable for me to change this habit, of clearing the terminal without Command+K.

4 Likes

Same. Driving me nuts. There are other bindings too, like CMD + SHIFT + L which would otherwise select all other instances of the current selection. I don’t want to have to remap my mind for this.

1 Like

Not having this disrupted my flow, so I’m retraining with control+L to clear the terminal

1 Like

I was able to prevent the composer by adding the !terminalFocus condition to the composer.startComposerPrompt shortcut.

So following overrides work for me (cursorai.action.generateInTerminal is now shift+cmd+k)

  {
    "key": "shift+cmd+k",
    "command": "cursorai.action.generateInTerminal",
    "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported"
  },
  {
    "key": "cmd+k",
    "command": "-cursorai.action.generateInTerminal",
    "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported"
  },
  {
    "key": "cmd+k",
    "command": "composer.startComposerPrompt",
    "when": "composerIsEnabled && !terminalFocus"
  },
  {
    "key": "cmd+k",
    "command": "-composer.startComposerPrompt",
    "when": "composerIsEnabled"
  }
10 Likes

@rsngr Wow you are an angel! Thanks a lot!

<3 <3 <3

Should it? Ctrl + L is a shortcut to start a new chat. What does it have to do with the terminal? Or perhaps you meant something else?

You are a god among humans

I love you!

Better than AI, thanks for this snippet!! :heart:

Oh thank f*** this was driving me nuts, too. Cursor devs, please rethink this default. Cmd+K is one of the most used terminal shortcuts, at least in my workflow.

1 Like

Did this ‘fix’ break in the latest update?

Changed when to:

"when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported || terminalHasBeenCreated && terminalPromptBarVisible || terminalProcessSupported && terminalPromptBarVisible"

It seems to be working now.

1 Like

It seriously kicked me out of flow today as Command K didn’t clear terminal :slight_smile: … but this fix worked for me in the latest version

  1. Press Command + Shift + P (to open Command Palette)
  2. Search: “Keyboard Shortcuts (JSON)”
  3. Upload the following JSON content in the keybindings.json file
// Place your key bindings in this file to override the defaults
[
  {
    "key": "shift+cmd+k",
    "command": "cursorai.action.generateInTerminal",
    "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported"
  },
  {
    "key": "cmd+k",
    "command": "-cursorai.action.generateInTerminal",
    "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported || terminalHasBeenCreated && terminalPromptBarVisible || terminalProcessSupported && terminalPromptBarVisible"
  },
  {
    "key": "cmd+k",
    "command": "composer.startComposerPrompt",
    "when": "composerIsEnabled && !terminalFocus"
  },
  {
    "key": "cmd+k",
    "command": "-composer.startComposerPrompt",
    "when": "composerIsEnabled"
  }
]
2 Likes

Thank you for the update!