[VS Code minor tips] How to open a new integrated terminal with current working directory?

Coder
1 min readDec 20, 2020

When you first install VSCode and open a project, you may want to build it through command line.

When I opened the integrated command line with Ctrl + Shift + ` , the terminal opened up at my home directory. Then I had to change directory to my home directory. It’s kind of cumbersome.

What if I can just open up a terminal with current working directory?

Fortunately, VS Code offers that customization!

First, go to File -> Preferences -> Keyboard Shortcuts

You will see Open Keyboard Shortcuts (JSON) button on the upper right corner. Click that icon.

Now, copy and paste the following code (or you can just append the inner configuration object to the list of your customized keymap setting.)

[    {        "key": "ctrl+shift+h",        "command": "workbench.action.terminal.newWithCwd",        "args": {            "cwd": "${fileDirname}"        }    }]

Now, restart the vscode and open any project you want to work on.

Open the integrated terminal and you will see the current working directory is the location of your project!

--

--