diff --git a/README.md b/README.md index fdd1e4c..2766cb9 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ Key improvements: - `⇧ + ⌘ + K`: Restored as "Delete Line" (previously "Open Edit" in Cursor, now `⌘ + E`) - `⌘ + L`: Restored as "Expand Line Selection" (previously "Open New Chat" in Cursor, now `⌘ + ]`) - `⇧ + ⌘ + L`: Restored as "Select All Occurrences of Find Match" (previously "Insert Selection Into Chat" in Cursor, now `⌘ + ⇧ + ]`) +- `⇧ + ⌘ + K`: Clear terminal output instead of `⌘ + K` [#3](https://github.com/tjx666/vscode-classic-experience/issues/3) This extension will not modify any of your Cursor settings or local application files. It simply removes certain Cursor shortcuts and restores the original VSCode shortcuts using the extension API. There's no hidden magic involved. If you ever wish to revert to Cursor's original shortcuts, you can easily do so by disabling or uninstalling this extension. @@ -34,10 +35,16 @@ this bring back the original vscode activity bar and side bar layout, just like ```jsonc { + // don't forget to restart to take effect "workbench.activityBar.orientation": "vertical", } ``` +How to custom vscode keybinding? + +- [Key Bindings for Visual Studio Code](https://code.visualstudio.com/docs/getstarted/keybindings) +- [Customize Visual Studio Code Video Tutorial](https://code.visualstudio.com/docs/introvideos/customize) + ## Alternatives While you can restore the `⌘ + K` keybinding prefix by changing the `workbench.action.keychord.leader` to `⌘ + K`, this approach has some drawbacks: diff --git a/package.json b/package.json index b9a8652..2b623a4 100644 --- a/package.json +++ b/package.json @@ -961,6 +961,11 @@ "command": "views.moveViewUp", "when": "focusedView != ''" }, + { + "key": "cmd+k", + "command": "-workbench.action.terminal.clear", + "when": "terminalFocus && terminalHasBeenCreated && !accessibilityModeEnabled || terminalFocus && terminalProcessSupported && !accessibilityModeEnabled || accessibilityModeEnabled && accessibleViewIsShown && terminalHasBeenCreated && accessibleViewCurrentProviderId == 'terminal' || accessibilityModeEnabled && accessibleViewIsShown && terminalProcessSupported && accessibleViewCurrentProviderId == 'terminal'" + }, { "key": "cmd+k", "command": "-composer.startComposerPrompt", @@ -1023,6 +1028,11 @@ "command": "expandLineSelection", "when": "textInputFocus" }, + { + "key": "shift+cmd+k", + "command": "workbench.action.terminal.clear", + "when": "terminalFocus && terminalHasBeenCreated && !accessibilityModeEnabled || terminalFocus && terminalProcessSupported && !accessibilityModeEnabled || accessibilityModeEnabled && accessibleViewIsShown && terminalHasBeenCreated && accessibleViewCurrentProviderId == 'terminal' || accessibilityModeEnabled && accessibleViewIsShown && terminalProcessSupported && accessibleViewCurrentProviderId == 'terminal'" + }, { "key": "cmd+r", "command": "-workbench.action.keychord.leader", diff --git a/src/extension.ts b/src/extension.ts index d12995e..2fa3869 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -35,7 +35,7 @@ async function generateKeybindings(extensionPath: string) { // cmd + k used as shortcut prefix, remove all 'cmd+k' shortcuts const removedCmdKKeybindings = keybindings - .filter((kb) => kb.key === 'cmd+k' && !kb.command.startsWith('workbench.')) + .filter((kb) => kb.key === 'cmd+k') .map((kb) => { return { ...kb, @@ -44,13 +44,15 @@ async function generateKeybindings(extensionPath: string) { }); // replace `cmd+k` to `cmd+e` - const cmdEKeybindings = removedCmdKKeybindings.map((kb) => { - return { - ...kb, - key: kb.key.replace('cmd+k', 'cmd+e'), - command: kb.command.slice(1), - }; - }); + const cmdEKeybindings = removedCmdKKeybindings + .filter((kb) => !kb.command.startsWith('-workbench.')) + .map((kb) => { + return { + ...kb, + key: kb.key.replace('cmd+k', 'cmd+e'), + command: kb.command.slice(1), + }; + }); // extra often used shortcuts in vscode to remove const shortcutsToRemoved: Keybinding[] = [ @@ -85,6 +87,12 @@ async function generateKeybindings(extensionPath: string) { command: 'expandLineSelection', when: 'textInputFocus', }, + + // clear terminal + { + ...keybindings.find((kb) => kb.command === 'workbench.action.terminal.clear'), + key: 'shift+cmd+k', + }, ]; const keyChordLeader = [