cursor icon indicating copy to clipboard operation
cursor copied to clipboard

Cursor should know how to disable ctrl-k (for terminal)

Open guettli opened this issue 1 year ago • 16 comments

I use ctrl-k on the command line to delete all characters starting from the current position.

This is hard-wired into my brain, since I use it for 20 years.

I asked Cursor how to update the config, so that ctrl-k in the terminal does not open the smart pop-up.

It failed badly. And I found no solution, too.

guettli avatar Aug 29 '24 12:08 guettli

I had this issue too. You can goto Keybindings and search for ctrl + k and remove the startComposer binding there.

spy16x avatar Aug 31 '24 13:08 spy16x

Same issue to me. I tried to remove all conditions that conflict with 'command+k', but the clear command still doesn't work in the terminal.

So far, I have to type cl to clear my terminal after done this alias cl=clear

image

Kain-90 avatar Sep 02 '24 06:09 Kain-90

that keybniding is still there i think? you can right click on it and select "Remove keybinding" option.

spy16x avatar Sep 02 '24 07:09 spy16x

that keybniding is still there i think? you can right click on it and select "Remove keybinding" option.

Yes, remove is ok with it, but I don't know why setting 'when' to empty is not work.

Kain-90 avatar Sep 02 '24 07:09 Kain-90

when only limits the scope of when this binding should work. without it, it is applicable everywhere reference

spy16x avatar Sep 02 '24 07:09 spy16x

Same issue to me. I tried to remove all conditions that conflict with 'command+k', but the clear command still doesn't work in the terminal.

Delete "Generate in Terminal" . Then it starts working.

n13 avatar Oct 03 '24 04:10 n13

This is an absurly annoying bug - what would drive you to pick basically the most used terminal shortcut and override it with an AI feature??

I finally took the time today to go to settings, search for "clear terminal", click on "same shortcut"

You could also search shortcuts with the phrase "Command+K"

Then delete Generate in Terminal.

then it started working.

I literally don't use any other shortcuts in terminal. CMD-K is very important so we can delete all the old output in one go, and have a new clean terminal and then run whatever we're running again, only seeing the latest outputs.

Please change this to pretty much anythiung else. Just not CMD=K in terminal. Thanks.

n13 avatar Oct 03 '24 04:10 n13

Ran into the same issue except ctrl + shift + k. (line delete)

eharris128 avatar Nov 06 '24 22:11 eharris128

Find cursorai.action.generateInTerminal in the keyboard shortcuts and remove it.

Or, add a new key binding for it, I used cmd + k cmd + k (hold down cmd and press k twice).

This way you can still get the AI feature quickly, but it doesn't mess with my muscle memory for cmd + k to clear.

stephen-last avatar Nov 22 '24 17:11 stephen-last

Thanks that’s what I did. Just took me a while to find the right shortcut to disable. On 23 Nov 2024, at 01:02, Stephen Last @.***> wrote: Find cursorai.action.generateInTerminal in the keyboard shortcuts and remove it. Or, add a new key binding for it, I used cmd + k cmd + k (hold down cmd and press k twice). This way you can still get the AI feature quickly, but it doesn't mess with my muscle memory for cmd + k to clear.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

n13 avatar Nov 23 '24 07:11 n13

I'm in the same boat but when I delete or remap or change the when condition for the ctrl+k command it inserts it into the bottom of my keybindings.json file. If I delete that and save the file. It undoes the global changes I made in the default settings. What the fuck!!!???

good-epic avatar Dec 17 '24 00:12 good-epic

Yep, quite annoying this mapping. I ended using @stephen-last suggestion.

jillesca avatar Feb 07 '25 09:02 jillesca

Open your user-level keybindings.json
Image
Add this to the very bottom
Image
Code
  • NOTE: the - at the head of the cursorai.action.generateInTerminal command negates the binding
 {
    "key": "cmd+k",
    "command": "-cursorai.action.generateInTerminal",
    "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported"
  }

Credit: https://github.com/getcursor/cursor/issues/1756#issuecomment-2494288147

Thanks @stephen-last for finding the setting, my sanity was waning

UPDATE:

And only two weeks later they changed it again ...

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

😭

brianwarsing avatar Apr 05 '25 17:04 brianwarsing

Hey, can the Cursor devs maybe pick a new keybinding and quit overriding Command+K in general? It's a very commonly used keybinding for devs using the integrated terminal, and it broke again when I updated Cursor after I specifically defined a custom keybinding to override it.

It seems user-hostile to change my keybindings without asking me, and even more so for a shortcut that's so regularly used.

danrice92 avatar Apr 23 '25 15:04 danrice92

Hey, can the Cursor devs maybe pick a new keybinding and quit overriding Command+K in general? It's a very commonly used keybinding for devs using the integrated terminal, and it broke again when I updated Cursor after I specifically defined a custom keybinding to override it.

It seems user-hostile to change my keybindings without asking me, and even more so for a shortcut that's so regularly used.

I second this! Exactly the same thing happened to me again a few days ago...

stephen-last avatar Apr 23 '25 15:04 stephen-last

Open your user-level keybindings.json
Image ##### Add this to the very bottom Image ##### Code * NOTE: the `-` at the head of the `cursorai.action.generateInTerminal` command negates the binding

{ "key": "cmd+k", "command": "-cursorai.action.generateInTerminal", "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" } Credit: #1756 (comment)

Thanks @stephen-last for finding the setting, my sanity was waning

UPDATE:

And only two weeks later they changed it again ...

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

😭

Thank you!

My final working configuration (read https://github.com/getcursor/cursor/issues/1756#issuecomment-2781003573 for details):

  {
    // https://github.com/getcursor/cursor/issues/1756
    "key": "cmd+k",
    "command": "-cursorai.action.generateInTerminal",
    "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported || terminalHasBeenCreated && terminalPromptBarVisible || terminalProcessSupported && terminalPromptBarVisible"
  },
  {
    // https://github.com/getcursor/cursor/issues/1756
    "key": "cmd+i",
    "command": "cursorai.action.generateInTerminal",
    "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported || terminalHasBeenCreated && terminalPromptBarVisible || terminalProcessSupported && terminalPromptBarVisible"
  },
  • Invalidate ⌘ command + k in terminal.
  • Add ⌘ command + i to use the cursorai.action.generateInTerminal command.

reduardo7 avatar Apr 23 '25 20:04 reduardo7

Just passing to give my opinion as well: this cdm + k in terminal is the worst default ever!

You shouldn't use as a default a keyboard shortcut that people are already used to do something else, for decades!

alestuber avatar Jun 03 '25 19:06 alestuber

Just passing to give my opinion as well: this cdm + k in terminal is the worst default ever!

Agreed. First thing I changed.

aariacarterweir avatar Jun 18 '25 06:06 aariacarterweir

Same thing goes for Ctrl + L. Very annoying that that it automatically jumps to the chat.

A possible solution to allow multiple uses of the hotkeys for both terminal and other Cursor functionality would be to perform actions based on the active window, e.g:

  • If terminal window is active: use hotkeys for terminal actions
  • If the code window is active: use hotkeys for Cursor chat etc.

Edit 1: Will try some of the workarounds mentioned above. Edit 2: Similar to @brianwarsing I achieved what I wanted with:

    // Custom addition to unbind and rebind the above definition(s) if we are in terminal window.
    // This allows regular functionality if you are anywhere else than in an active terminal window.
    {
        "key": "ctrl+l",
        "command": "workbench.action.terminal.clear",
        "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported || terminalHasBeenCreated && terminalPromptBarVisible || terminalProcessSupported && terminalPromptBarVisible"
    }

nicolaipre avatar Jul 02 '25 11:07 nicolaipre