In Visual Studio Code, the Ctrl-k shortcut is bound to clearing the terminal.
I've configured bash as my terminal in Windows and would like it to behave as the traditional Emacs key bindings, that is, to make it kill the end of the line.
I've tried to disable the default key binding with this configuration in the user settings, but it didn't work:
"commandsToSkipShell": [
"workbench.action.terminal.clear"
]
How to make the terminal obey my 20 years trained muscle memory?
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 → Settings → 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 terminal shortcuts will just work:
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.