Add a Keyboard Shortcut to Switch Between the VSCode Workbench and the Integrated Terminal

Joe Previte
InstructorJoe Previte
Share this video with your friends

Social Share Links

Send Tweet
Published 5 years ago
Updated 3 years ago

In this video, you'll learn how to add a custom keyboard shortcut (also called "keybinding"), which will allow you to switch between the Workbench window and the Integrated Terminal window.

Instructor: [0:00] After we open VS Code, we're going to open the command palette. We can do this by going to view, command palette, or we can use the keyboard shortcut Command+Shift+P on Mac, or Control+Shift+P on Windows. The next thing we're going to do is search for preferences. Then, we're going to look for "Open Keyboard Shortcuts (JSON)".

[0:31] To define our custom shortcuts, we're going to first create an array. Then, we're going to type K. You should see this come up. We'll hit Enter. Then, first thing we'll do is type in the key. I'm going to use ctrl+=, meaning when I hit ctrl=, it'll run this command. If we hit tab, then let's type in "workbench.action.terminal.focus." This means the command that we want to run, so we want to focus the terminal from the workbench.

[1:10] We're going to delete that. Now what we're going to do is add in one more, same thing, key. We

[1:18] Use the same shortcut, ctrl+=, hit tab. This time we're going to say "workbench.action.focusActiveEditorGroup." Hit tab when and we're going to put terminal focus.

[1:39] Basically, what we're saying is when we hit control and equals from the workbench, we're going to focus the terminal. We're going to use that same keyboard shortcut until when the terminal's focused. We want to go to the workbench and focus the active editor group. Essentially, the active file that you're editing.

[2:04] Now let's try it out. I'm going to hit ctrl=, and we'll see that the cursor is now in the terminal window. Whoa, this is cool. If we hit ctrl= while we're focused in the terminal, we'll go back to the workbench and that's it. Now you can easily switch between the workbench and the terminal with a keyboard shortcut.

egghead
egghead
~ an hour ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today