Here is my problem:
I want to use the Ctrl J shortcut to switch between editing a file and writing in the terminal.
I have this keybinding:
{
"key": "ctrl+j",
"command": "workbench.action.togglePanel",
},
I can indeed toggle the terminal when i am editing but when the focuse is on the terminal, the terminal just understands it as a command and skips to a new line.
However, when i click back on the editor and press Ctrl J, the termminal indeed disappears.
Any clue ?
i tried to add a new terminalfocuse property but it did not work.
2
Answers
That issue has to do with the default bash shell bindings.
Ctrl+J is bound to ‘accept-line’ which does the same thing as the Enter/Return key (so it will create a new line if nothing is typed).
You can change how bash responds to keys using the bind keyword.
To check which action is currently bound to Ctrl+J you can run:
The default output is:
accept-line can be found on "C-j", "C-m"
.So, if you want your keybindings to work, you have to remove the ‘accept-line’ function from Ctrl+J.
You can do so by running:
And if you want this to happen every time you are in a bash shell, you can add the previous line to your
~/.bashrc
.This is perplexing. This sounds like the
terminal.integrated.commandsToSkipShell
setting’s default value isn’t doing it’s job, which makes me wonder if you overrode it.The description of that setting reads as follows:
So I would suggest that you check all your settings.json files (user-level settings.json, workspace .vscode/settings.json, and .code-workspace file if you are in a multi-root workspace) and see if you have something like the following in it anywhere: