Last active
April 12, 2023 19:32
-
-
Save mklement0/d3d76e70b3494818a35865e22826b276 to your computer and use it in GitHub Desktop.
Sample keybinding.json file for https://stackoverflow.com/a/75980711/45375
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Content for a Visual Studio Code "keybindings.json" file. | |
// To open your file for editing, use the command palette's "Preferences: Open Keyboard Shortcuts (JSON)" command. | |
// CAVEAT: You can copy and paste this file's content as-is to REPLACE your file's existing content | |
// but in doing so you'll lose any PREEXISTING definitions. | |
// To preserve any existing definitions, append everything *inside* "[" and "]" below to the *preexisting* | |
// top-level "[" and "]" enclosure (a JSON array), and be sure to append a "," to the last preexisting object | |
// inside the array before appending (or place the new objects at the top and append a "," to the second of | |
// the two new objects). | |
[ | |
// General definition for all shells *except* PowerShell. | |
{ | |
"key": "ctrl+k", | |
"when": "terminalFocus && terminalShellType != 'pwsh'", | |
// Clear the screen and the scrollback buffer. | |
// For shells other than PowerShell that is sufficient. | |
"command": "workbench.action.terminal.clear" | |
}, | |
// Override for PowerShell, to compensate for the following bugs: | |
// * https://github.com/PowerShell/PSReadLine/issues/841 | |
// * https://github.com/PowerShell/PowerShell/issues/19479 | |
{ | |
"key": "ctrl+k", | |
"when": "terminalFocus && terminalShellType == 'pwsh'", | |
// Send a VT / ANSI escape sequence that clears the screen and | |
// and the scrollback buffers and resets the cursor position. | |
"command": "workbench.action.terminal.sendSequence", | |
"args": { | |
"text": "[Console]::Write(\"$([char] 0x1b)[2J$([char] 0x1b)[3J$([char] 0x1b)[H\")\u000d" | |
} | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment