Is it possible to have the Integrated Terminal open automatically on start of Visual Studio Code?

13,083

Solution 1

There is now an extension that lets you set terminals on startup, and even works with split terminal views!

https://marketplace.visualstudio.com/items?itemName=EthanSK.restore-terminals

ps i wrote it

Solution 2

As of VS Code v1.45.0, the experimental configuration mentioned in this other answer should now be the default behavior for VS Code. Just make sure to save your files/folders in a workspace. See the What is a VS Code "workspace"? section of the VS Code docs.

VS Code remembers the last state of your workspace and restores it. If I have the Integrated Terminal panel opened before I closed the window, it gets reopened when I reload or reopen the workspace (I can't seem to find the setting for this though). So basically, the Integrated Terminal is already auto displayed. (I use Ubuntu 18 and macOS 10.15.)

If you have a specific terminal setup (ex. multiple terminals opened to different directories, python envs, workspaces, etc.), you could check out Terminals Manager which is for "setting-up multiple terminals at once" and can be configured to auto-run on startup.

You just need to add a terminals.json file in your workspace (under .vscode) with something like this, and set autorun to true. This would auto-run the extension's Terminals: Run command on startup to auto-load your terminals.

{
    "autorun": true,
    "autokill": true,
    "terminals": [
        {
            "name": "GIT",
            "description": "For running git commands",
            "open": true,
            "focus": true,
            "commands": [
                "pwd",
                "git fetch -v"
            ]
        },
        {
            "name": "BUILD",
            "description": "For running build commands",
            "open": true,
            "focus": false,
            "commands": [
                "cd apps",
                "./clean.sh"
            ]
        },
        {
            "name": "SCRIPTS",
            "description": "For running python commands",
            "open": true,
            "focus": false,
            "commands": [
                "source $VENV_DIR/test-py38/bin/activate",
                "python -V"
            ]
        },
    ]
}

Solution 3

The following has worked for me:

// Whether to restore terminal sessions for the workspace automatically when launching VS Code. This is an experimental setting; it may be buggy and could change in the future.

Paste the below in your user settings:

"terminal.integrated.experimentalRestore": true

Solution 4

The Tasks feature is the current recommended way to handle this and worked for me. See Automating launching of terminals in the VS Code documentation.

Share:
13,083

Related videos on Youtube

Isak La Fleur
Author by

Isak La Fleur

Updated on September 15, 2022

Comments

  • Isak La Fleur
    Isak La Fleur over 1 year

    Is it possible to configure User Settings to have the Integrated Terminal to start automatically when opening Visual Studio Code?

    • ian0411
      ian0411 over 6 years
      Mine always open the Integrated Terminal whenever I start my VSCode but I didn't notice anything different in my USER SETTINGS. Which OS are you using?
    • Isak La Fleur
      Isak La Fleur over 6 years
      I'm using Mac OS Sierra.
    • ian0411
      ian0411 over 6 years
      Man, I guess this is probably OS issue but not sure. You can also install Shell Launcher since they have some cool features that may help you out. Also, I noticed that I have PowerShell installed on my machine. You can install that since it looks like it has some abilities to open the terminal automatically (maybe not the one you want). Sorry couldn't be more helpful...
  • Gino Mempin
    Gino Mempin almost 4 years
    As of VS Code 1.45.0, this has no effect anymore and is "Unknown Configuration Setting" :(
  • Mark
    Mark almost 4 years
    Thanks for making this extension - it looks pretty good!
  • Ilde
    Ilde over 3 years
    Thx!! It is very useful for me.... I configured my workspace config file to open three split terminals and start run my api code, my frontend code and tools code in each one!! save me a lot of time
  • Fadhil Ahmad
    Fadhil Ahmad almost 3 years
    i dont know why, it doesnt work anymore. always stuck at first terminal.
  • Ethan SK
    Ethan SK almost 3 years
    Increase the artificialDelay in the settings
  • L Co
    L Co over 2 years
    this is amazing, thank you for making this!
  • Nick Wills
    Nick Wills over 2 years
    Unfortunately, it does not really solve the question raised by TS. He mentions "on start of the VSCode". The enhancement u mention won't work if u restart VsCode (not window reload).
  • VonC
    VonC over 2 years
    @Bruce I agree. This is still not fully supported.
  • Vibran
    Vibran about 2 years
    Where is the artificialDelay please?