How do I change the keyboard shortcuts that Cursor uses?

How do I change the keyboard shortcuts that Cursor uses?

2 Likes

We hope to build better UI for this in the future. For now,

  1. Type Command/Ctrl + Shift + P.
  2. Go to “preferences: open keyboard shortcuts”
  3. Edit the aipopup.action.modal.generate action to remap the inline edits / generation keybinding
  4. Edit the aichat.newchataction action to remap the new chat command
2 Likes

For future passersby, to fully remove Cursor’s cmd+K mappings, you also need to update cursorai.action.generateInTerminal

5 Likes

Hi! How can I change ai chat send message key? It’s “Enter” now, but I want it to be “Shift+Enter” and use “Enter” to insert a new line.

2 Likes

Is there any way to directly access the data / json that vscode / cursor use for the key mappings instead of having to do this manually? It would also make it easy to put things back if it gets messed up.

It’s utter madness that such an important keymapping was overwritten.

+1. I am wasting so many chat requests by mistakenly hitting Enter to create a new line…

You can edit default keybindings.json -

You can also specify overrides for yourself -

VS doesn’t have a chat window. How can we change the keyboard shortcut to submit a message in Cursor’s chat window?

1 Like

C:\Users\<yourUser>\AppData\Roaming\Cursor\User\keybindings.json

// Place your key bindings in this file to override the defaults
[
{
“key”: “ctrl+shift+k”,
“command”: “editor.action.deleteLines”,
“when”: “textInputFocus && !editorReadonly”
},
{
“key”: “ctrl+k ctrl+c”,
“command”: “editor.action.addCommentLine”,
“when”: “editorTextFocus && !editorReadonly”
},
{
“key”: “ctrl+k ctrl+u”,
“command”: “editor.action.removeCommentLine”,
“when”: “editorTextFocus && !editorReadonly”
},
{
“key”: “ctrl+k ctrl+/”,
“command”: “editor.foldAllBlockComments”,
“when”: “editorTextFocus && foldingEnabled”
},
{
“key”: “ctrl+k ctrl+0”,
“command”: “editor.foldAll”,
“when”: “editorTextFocus && foldingEnabled”
},
{
“key”: “ctrl+k ctrl+j”,
“command”: “editor.unfoldAll”,
“when”: “editorTextFocus && foldingEnabled”
},
{
“key”: “ctrl+k ctrl+k”,
“command”: “editor.action.defineKeybinding”,
“when”: “editorTextFocus”
},
{
“key”: “ctrl+k m”,
“command”: “workbench.action.editor.changeLanguageMode”,
“when”: “!notebookEditorFocused”
},
{
“key”: “ctrl+k p”,
“command”: “workbench.action.files.copyPathOfActiveFile”
},
{
“key”: “ctrl+k r”,
“command”: “workbench.action.files.revealActiveFileInWindows”
},
{
“key”: “ctrl+k o”,
“command”: “workbench.action.files.showOpenedFileInNewWindow”,
“when”: “emptyWorkspaceSupport”
},
{
“key”: “ctrl+k s”,
“command”: “workbench.action.files.saveAll”
},
{
“key”: “ctrl+k ctrl+w”,
“command”: “workbench.action.closeAllEditors”
},
{
“key”: “ctrl+k w”,
“command”: “workbench.action.closeEditorsInGroup”
},
{
“key”: “ctrl+k f”,
“command”: “workbench.action.closeFolder”,
“when”: “emptyWorkspaceSupport && workbenchState != ‘empty’”
},
{
“key”: “ctrl+k ctrl+up”,
“command”: “workbench.action.focusAboveGroup”
},
{
“key”: “ctrl+k ctrl+down”,
“command”: “workbench.action.focusBelowGroup”
},
{
“key”: “ctrl+k ctrl+left”,
“command”: “workbench.action.focusLeftGroup”
},
{
“key”: “ctrl+k ctrl+right”,
“command”: “workbench.action.focusRightGroup”
},

{
“key”: “ctrl+q c”,
“command”: “editor.action.addCommentLine”,
“when”: “editorTextFocus && !editorReadonly”
},
{
“key”: “ctrl+q u”,
“command”: “editor.action.removeCommentLine”,
“when”: “editorTextFocus && !editorReadonly”
},
{
“key”: “ctrl+q /”,
“command”: “editor.foldAllBlockComments”,
“when”: “editorTextFocus && foldingEnabled”
},
{
“key”: “ctrl+q 0”,
“command”: “editor.foldAll”,
“when”: “editorTextFocus && foldingEnabled”
},
{
“key”: “ctrl+q j”,
“command”: “editor.unfoldAll”,
“when”: “editorTextFocus && foldingEnabled”
},
{
“key”: “ctrl+q k”,
“command”: “editor.action.defineKeybinding”,
“when”: “editorTextFocus”
},
{
“key”: “ctrl+q m”,
“command”: “workbench.action.editor.changeLanguageMode”,
“when”: “!notebookEditorFocused”
},
{
“key”: “ctrl+q p”,
“command”: “workbench.action.files.copyPathOfActiveFile”
},
{
“key”: “ctrl+q r”,
“command”: “workbench.action.files.revealActiveFileInWindows”
},
{
“key”: “ctrl+q o”,
“command”: “workbench.action.files.showOpenedFileInNewWindow”,
“when”: “emptyWorkspaceSupport”
},
{
“key”: “ctrl+q s”,
“command”: “workbench.action.files.saveAll”
},
{
“key”: “ctrl+q w”,
“command”: “workbench.action.closeAllEditors”
},
{
“key”: “ctrl+q w”,
“command”: “workbench.action.closeEditorsInGroup”
},
{
“key”: “ctrl+q f”,
“command”: “workbench.action.closeFolder”,
“when”: “emptyWorkspaceSupport && workbenchState != ‘empty’”
},
{
“key”: “ctrl+q up”,
“command”: “workbench.action.focusAboveGroup”
},
{
“key”: “ctrl+q down”,
“command”: “workbench.action.focusBelowGroup”
},
{
“key”: “ctrl+q left”,
“command”: “workbench.action.focusLeftGroup”
},
{
“key”: “ctrl+q right”,
“command”: “workbench.action.focusRightGroup”
}
]

There is one thing left that I haven’t figured out yet, the prompts in cursor itself still mention Ctrl-K instead of the now correct Ctrl-Q

Thank you, you are a lifesaver! I was about to give up.

For those of us coming from vscode, Ctrl-K (Command-K) remapping is a complete killer. I kept bringing up chat trying to comment lines, split a window vertically, close a pane, etc… I was about to uninstall cursor before I read this thread and redefined the keymappings. Strongly recommend you allow the definitions to be nicely redefined by the installer (especially when you are migrating from vscode)

What the, why did you overwrite CMD+K this is insane.