3
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?

Windows Terminal での GitHub Copilot CLI の分割起動

Last updated at Posted at 2025-12-12

はじめに

GitHub Copilot CLI を使うと、Windows Terminalから直接 GitHub Copilot に質問できるので便利なのですが、作業中のウインドウで開くと作業が中断されてしまうので、必要なときに都度別のウインドウを分割して GitHub Copilot を起動する手間がかかってちょっとめんどくさいです。
この記事では、GitHub Copilot CLI を使いやすくするの個人的な設定を共有します。

GitHub Copilot CLIのインストール

Windows の場合、次の2パターンのどちらかでインストールできます。

npmを利用したインストール
npm install -g @github/copilot
wingetを利用したインストール
winget install GitHub.Copilot

始めて起動すると、GitHub Copilotのバナーが表示され、現在のフォルダーを信用してよいか尋ねられます。

image.png

ターミナル上でふと質問をしたくなったら、copilot -p で質問できます。デフォルトでは claude sonnet 4.5 が使われるので、プレミアムリクエストを消費したくないのであれば gpt-4.1 などでモデルを指定して実行します(Autoが使えればよいのに)。

image.png

Windows Terminal でプロファイルを作成する

Windows Terminal 上で Ctrl+, をタイプすると Windows Terminal の設定ページが表示されるので、 +新しいプロファイルを作成します からプロファイルを追加していきます。
image.png

+新しい空のプロファイルから新しいプロファイルを作成していきます。
image.png

プロファイルの名前を GitHub Copilot に、コマンドラインに次のテキストを設定します。

"C:\Program Files\PowerShell\7\pwsh.exe" -c copilot --banner --model git-4.1

image.png

この設定をすると、GitHub Copilotを選択して新しいウインドウや画面分割でGitHub Copilotを開けるのですが、残念ながらカレントディレクトリがシステムディレクトリになってしまいます。

image.png

カレントディレクトリを調整する

wt コマンドを利用すると、プロファイルを指定しつつカレントディレクトリを指定して画面分割できます。

wt -w 0 split-pane --profile "GitHub Copilot"

これを Windows Terminal のコマンドとして登録し、ショートカットに割り当てて実行できるとうれしいのですが、残念ながら Windows Terminal のアクションは組み込みのアクションを呼び出すことしかできません。
なので、次のようにアクティブなターミナルに上記のコマンドを送り込む形で実現します。

settings.json
{
    "$help": "https://aka.ms/terminal-documentation",
    "$schema": "https://aka.ms/terminal-profiles-schema",
    "actions": 
    [
        {
            "id": "GitHub.Copilot.SplitPane",
            "command": 
            {
                "action": "sendInput",
                "input": "wt -w 0 split-pane --profile \"GitHub Copilot\"\r"
            }
        }
    ],
    "keybindings": 
    [
        // ...  ...
        {
            "id": "GitHub.Copilot.SplitPane",
            "keys": "shift+alt+c"
        }
    ]
    // ...  ...
}

割り当てたショートカット(今回はShift+Alt+C)を入力すると、分割用のコマンドがアクティブなウインドウに送信され、GitHub Copilot が新しい分割ウインドウで表示されるようになります。

image.png

おわりに

まだまだ設定できることはありますが、いったんここまで

3
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
3
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?