VS Code - Cygwin as Integrated Terminal

2019-03-09 21:55发布

I would like to use Cygwin as the integrated terminal on Visual Studio Code on my Windows laptop (as this would give me use of the Linux terminal commands git and G++, etc.) but when I set the value for "terminal.integrated.shell.windows": to the address of the Cygwin application (.exe) then it opens a new Cygwin terminal rather than remaining in VS Code.

So my question is: can I use Cygwin integrated into the VS Code terminal and use that to use commands on it (mkdir, rm, etc.) but also use git commands and use it as an integrated compiler and debugger (for generically but for C++ at least)? And how would I go about this?

3条回答
劫难
2楼-- · 2019-03-09 22:10

Combining above answers, this is my working configuration.

{
    "terminal.integrated.shell.windows": "C:\\cygwin\\bin\\bash.exe",
    "terminal.integrated.env.windows": {
        "CHERE_INVOKING": "1"
    },
    "terminal.integrated.shellArgs.windows": [
        "--login",
        "-i"
    ],
}

{tested at ubuntu 18.04lts, running Windows 7 ultimate 32bt in Virtualbox 5.2.12}

查看更多
相关推荐>>
3楼-- · 2019-03-09 22:15

You could just call the Cygwin.bat without ENV issue:

{
    // Replace with your Cygwin.bat file path 
    "terminal.integrated.shell.windows": "C:\\cygwin64\\Cygwin.bat",
}

Make sure the BAT scripts fit to your Cygwin.

查看更多
男人必须洒脱
4楼-- · 2019-03-09 22:26

These config settings work for me:

{
  // start bash, not the mintty, or you'll get a new window
  "terminal.integrated.shell.windows": "C:\\cygwin\\bin\\bash.exe",
  // Use this to keep bash from doing a 'cd ${HOME}'
  "terminal.integrated.env.windows": {
    "CHERE_INVOKING": "1"
  },
  // Make it a login shell
  "terminal.integrated.shellArgs.windows": [
    "-l"
  ],
}
查看更多
登录 后发表回答