VS Code の統合ターミナルを Cygwin にする

以前の記事

nodamotoki.hatenablog.com

で WSL を統合ターミナルにして C++ のビルドまでやるようにしてみた。

しかし、職場ではWSLが使えないらしいので、Cygwin を統合ターミナルとして使えるようにしてみる。

といっても、VSCode のサイト↓にやり方は書いてある模様。

code.visualstudio.com

なになに。

Can I use Cygwin's shell with the terminal on Windows?

Yes, to use the Cygwin shell, you will first need to install the chere package and then add the following settings to your settings.json file:

"terminal.integrated.shell.windows": "C:\Cygwin\bin\bash.exe", "terminal.integrated.shellArgs.windows": ["/bin/xhere", "/bin/bash"]

意訳すると、

Cygwin? もちろんできますよ。

まずはCygwin chere パッケージ入れてね。それから setting.json に下記の要領でかくだけ。

"terminal.integrated.shell.windows": "C:\\Cygwin\\bin\\bash.exe",
"terminal.integrated.shellArgs.windows": ["/bin/xhere", "/bin/bash"]

メニューで言うと、ファイル>基本設定>設定 で出てくる Settings タブから

  1. terminal.integrated.shell.windows
  2. terminal.integrated.shellArgs.windows

を検索すれば良い様子。

1 は Cygwinbash の path を書いておけばOK

2 は今のところまだUIがないらしく、「setting.json で編集」をクリックして手作業で書き込む必要あり。

  • 64bit cygwin 入れている場合は bash.exe への path はデフォルトで ”C:\cygwin64\bin\bash" になると思うので注意。
  • ちなみにメニューとかを日本語化するには Marketplaceで検索して Japanese Language Pack for Visual Studio Code を入れる。