Hacker News new | ask | show | jobs
by dy 3179 days ago
Love the integrated terminal in VS Code! Great work by the team on this and appreciate the writeup.

Curious what keyboard shortcut people use to move focus from editors to the Terminal and create new terminals? Anyone use tmux inside terminal?

3 comments

Author of the blog post here. The standard shortcuts are ctrl+` for toggling the panel and ctrl+shift+` for creating a new terminal. This is what I use on top of that:

{ "key": "ctrl+`", "command": "workbench.action.terminal.focus", "when": "!terminalFocus" }

This will focus the terminal if the focus is anywhere else, if the terminal is focused it will close it.

You can add this one if you want ctrl+` to only toggle focus between the terminal and the last editor:

{ "key": "ctrl+`", "command": "workbench.action.focusActiveEditorGroup", "when": "terminalFocus" }

On tmux, Joao from the team did a write up on configuring persistent sessions in the terminal using tmux https://medium.com/@joaomoreno/persistent-terminal-sessions-...

Last I checked, this only makes sense on US keyboards. On most non-US keyboards, the backtick requires option/alt and isn't practical as a shortcut.
I think you could just add a custom keybinding now that you know the commands.
A big thing that I use is that if you do quick open (`ctrl+p`) and then type `term `, you can then type the terminal number to go to the specified terminal.
I added the following to my keybindings.json file. It changes ctrl+` behavior to toggle open/close the terminal.

``` { "key": "ctrl+`", "command": "workbench.action.terminal.focus", "when": "!terminalFocus" } ```