3 March 2022

Setup Visual Studio Code as Markdown Editor and Terminal Manager.

Opinionated directions on how to setup Visual Studio Code (VSCode) for managing Powershell and Windows Subsystem for Linux 2 (WSL2) Ubuntu shells. The idea being that a handy tool for Writing blog posts and general text editing is always needed. Then add in support for multiple terminals. VSCode obviously has great utility on windows. My current development setup is building code using WSL2 terminals and running my IDE on Windows. We will need to download VSCode. If you haven’t already you need to install WSL2.

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            //Parent Task so all terminals can be launched using one task.
            "label": "Setup Developer Terminals",
            "dependsOn": [
              //Child tasks to be launched.
              "Powershell",
              "Code Excursion",
              "Code Excursion Source"
            ],
            // Mark as the default build task so cmd/ctrl+shift+b will create them
            "group": {
              "kind": "build",
              "isDefault": true
            },
            // Try start the task on folder open
            "runOptions": {

            }
          },
          {
            // The name that shows up in terminal tab
            "label": "Powershell",
            // The task will launch a shell
            "type": "shell",
            "command": "",
            // Set the shell type.  In this case its powershell with arguments to start in
            // specific directory.
            "options": {
              "shell": {
                "executable": "powershell.exe",
                "args": ["-noexit","-command \"cd \\\\wsl$\\Ubuntu\\home\\username\\source\\codeexcursion\""]
              }
            },
            // Mark as a background task to avoid the spinner animation on the terminal tab
            "isBackground": true,
            "problemMatcher": [],
            // Create the tasks in a terminal group
            "presentation": {

            }
          },
          {
            //Ubuntu WSL shell starting in a specific directory
            "label": "Code Excursion",
            "type": "shell",
            "command": "",
            "options": {
              "shell": {
                "executable": "wsl",
                "args": ["--distribution ubuntu","--cd /home/username/source/codeexcursion"]
              }
            },
            "isBackground": true,
            "problemMatcher": [],
            "presentation": {

            }
          },
          {
            //Ubuntu WSL shell starting in a specific directory
            "label": "Code Excursion Source",
            "type": "shell",
            "command": "",
            "options": {
              "shell": {
                "executable": "wsl",
                "args": ["--distribution ubuntu","--cd /home/username/source/codeexcursionsource"]
              }
            },
            "isBackground": true,
            "problemMatcher": [],
            "presentation": {

            }
          },
          {
            //Setup a terminal with Git Bash
            "label": "Bash",
            "type": "shell",
            "command": "",
            "options": {
              "shell": {
                "executable": "C:\\Program Files\\Git\\bin\\sh.exe",
                "args": []
              }
            },
            "isBackground": true,
            "problemMatcher": [],
            "presentation": {

            }       
          }
    ]
}
tags: vscode - visual studio code - markdown - jekyll - tasks - wsl - ubuntu - powershell

Less Is More