Visual Studio Code integrates a terminal application. Terminals embedded that way can receive keyboard shortcuts, but these could be first caught by VS Code or its host (the local operating system). For example, the Ctrl+K combination has several uses:
- killing the remainder of the line in GNU Emacs
- killing the remainder of the line in GNU Bash
- cutting the line in GNU nano
- serving as a kind of prefix for Visual Studio Code chorded shortcuts.
Unfortunately, the first 3 can conflict with #4. Similarly, nano’s Ctrl+G is caught by VS Code.
These conflicts are treated in documentation, but:
- The only documented solutions are specific to certain shortcuts, just like the answers to this related question. These remedies are all about reconfigurations which are not general and can result in loss of useful VS Code shortcuts.
- …except for Terminal: Send Sequence
workbench.action.terminal.sendSequence, which is close to solving this, but does not seem to handle combinations.
Is there no way, which requires either no configuration or just setting 1 shortcut [prefix], to allow passing through all (or most) shortcuts to the terminal, without losing any shortcuts? For example, a shortcut indicating that the next combination should be passed, so that Ctrl+Alt+P, Ctrl+K would send a Ctrl+K interpreted by Bash/nano rather than being intercepted by Visual Studio Code for chorded shortcuts?
I guess this question is a proper version of How to send CTRL + v to terminal via terminal.sendSequence?. How to make Visual Studio Code forward caught keystrokes to shell? asks the same, but I will not accept answers which merely suggest workarounds involving tradeoffs between VS Code shortcuts and terminal shortcuts.
Workaround for text edition
When this affects edition with Emacs or GNU nano, a workaround is to edit using a VS Code editor instead. To edit foo.txt with the GUI:
code -r foo.txt
If this causes “Unable to connect to VS Code server: Error in request”, see the relevant bug report.