1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

VSCodeのターミナルでMSYS2を開く

Posted at

環境

  • 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など他にも使えるものがあるのがわかる。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?