環境
- Wingows Server 2022
- VSCode 1.81.1
- MSYS2 msys2-x86_64-20230718
設定
以下の設定をsetting.jsonに追加する。
setting.json
{
"terminal.integrated.profiles.windows": {
"MSYS2 UCRT": {
"path": "cmd.exe",
"args": [
"/c",
"C:\\msys64\\msys2_shell.cmd -defterm -here -no-start -ucrt64"
]
}
}
// デフォルトに設定する場合は以下追加。
"terminal.integrated.defaultProfile.windows": "MSYS2 UCRT",
}
デフォルトにしておくとコンテキストメニューのOpen in integrated terminal
でも想定通りのディレクトリで開いてくれて嬉しい。
上記だとUCRT64
の環境が開く。
clang64
環境にしたい場合はargsの-ucrt64
を-clang64
とすれば良いみたい。
$ ./msys2_shell.cmd -help
Usage:
msys2_shell.cmd [options] [login shell parameters]
Options:
-mingw32 | -mingw64 | -ucrt64 | -clang64 | -msys[2] Set shell type
-defterm | -mintty | -conemu Set terminal type
-here Use current directory as working
directory
-where DIRECTORY Use specified DIRECTORY as working
directory
-[use-]full-path Use full current PATH variable
instead of trimming to minimal
-no-start Do not use "start" command and
return login shell resulting
errorcode as this batch file
resulting errorcode
-shell SHELL Set login shell
-help | --help | -? | /? Display this help and exit
Any parameter that cannot be treated as valid option and all
following parameters are passed as login shell command parameters.
msys2_shell.cmd
を見ると-clang32
など他にも使えるものがあるのがわかる。