VSCode: how to make Ctrl+k kill till the end of line?
Ran into the same problem. Adding this snippet to keybindings.json worked:
{
"key": "ctrl+k",
"command": "deleteAllRight",
"when": "terminalFocus"
}
If you have years of muscle memory of Unix shell and want to prevent VSCode to capture your keyboard shortcuts, turn off allowChords. In newer VSCode version you can simply open File -> Preferences -> User (tab)
, search for allowChords and uncheck it.
Or you can edit your %APPDATA%\Code\User\settings.json
file and put this:
"terminal.integrated.allowChords": false
Now a lot of commands will just work:
- Ctrl+K for killing till the end of the line,
- Ctrl-Y pastes the killed line from above
- Ctrl+R searches for your commands in your history,
- and Ctrl+A goes to the beginning of the line
I have another answer in this thread, but I think this is a better solution. Here is the documentation.
See other answers if you want to fix just the Ctrl-K behavior.
Just discovered it! You need to put a minus sign before the configuration. Edit %APPDATA%\Code\User\settings.json
and enter this key:
"terminal.integrated.commandsToSkipShell": [
"-workbench.action.terminal.clear"
]
It looks like the config option was renamed, so I edited to what is working for me now (Nov 2018).