Integrate Cygwin's Bash in VS Code

Photo by Jess Bailey on Unsplash

Integrate Cygwin's Bash in VS Code

Use Cygwin's Bash in VS Code Terminal

What is Cygwin?

Cygwin is a collection of open source tools that allows source code designed for Unix-like operating systems to compile and execute in Microsoft Windows OS.

Setup the system

You can download the installer from this link. You need to remember the location of installer (recommended C:\cygwin_installer) which is referred in next section.You can follow the steps in this video to install it in your windows OS.

Note: You need to install Cygwin in your windows system to follow next section.

Guidelines to integrate cygwin bash to vs code

  1. Open VS code market place by clicking on extensions icon in Activity Bar extension icon or shortcut Ctrl+Shift+X
  2. Search for Shell launcher by Daniel Imms and install it.
  3. Open keybindings.json file by clicking shortcut Ctrl+Shift+P and search for keybindings.json. We are including shortcut Ctrl+Shift+T to show list of all terminal shell. Add below code in the list
    {
         "key": "ctrl+shift+t",
         "command": "shellLauncher.launch"
    }
    
  4. Open settings.json by clicking shortcut Ctrl+Shift+P and search for settings.json. After opening settings.json, search for shellLauncher.shells.windows object and add below code in starting of the list
    {
         "shell": "C:\\cygwin64\\bin\\bash.exe",
         "args": ["--login"],
         "label": "Cygwin Bash",
         "launchName": "Cygwin Bash"
    },
    
    Note: Path to bash.exe may be different in your system. Please modify as per your local system.

After saving the settings in keybindings.json and settings.json, Ctrl+Shift+T will list terminal shells as shown below. vs code shell list