[[📜2025-03-12 Clineに賭けてみる]] の経緯で公式の[[copilot.vim]]を試してみようということになった。
## 環境
| 対象 | バージョン |
| --------------- | ----------- |
| [[Ubuntu]] | 24.04.1 LTS |
| [[Neovim]] | 0.10.3 |
| [[copilot.vim]] | `5015939` |
## インストール
[[lazy.nvim]]で設定追加。
```lua
{
"github/copilot.vim",
}
```
起動して `:Copilot setup` を実行。
```error
Error detected while processing function copilot#Command[33]..function copilot#Command[25]..3:
line 50:
E121: Undefined variable: status
E116: Invalid arguments for function get
```
いきなりトラブル発生、`apps.json` 削除でなおった。
<div class="link-card-v2">
<div class="link-card-v2-site">
<img class="link-card-v2-site-icon" src="https://publish-01.obsidian.md/access/35d05cd1bf5cc500e11cc8ba57daaf88/favicon-64.png" />
<span class="link-card-v2-site-name">Minerva</span>
</div>
<div class="link-card-v2-title">
📝copilot.vimでsetupコマンドを実行するとE121 Undefined variable statusエラーになる
</div>
<div class="link-card-v2-content">`~/.config/github-copilot/apps.json` に今インストールしているcopilot.vimで認証できない情報が既に設定されていた。</div>
<img class="link-card-v2-image" src="https://publish-01.obsidian.md/access/35d05cd1bf5cc500e11cc8ba57daaf88/Notes/attachments/troubleshooting.webp" />
<a data-href="📝copilot.vimでsetupコマンドを実行するとE121 Undefined variable statusエラーになる" class="internal-link"></a>
</div>
%%[[📝copilot.vimでsetupコマンドを実行するとE121 Undefined variable statusエラーになる]]%%
コマンドに成功すると以下の画面が出るので、赤枠の8桁をメモっておく。
![[Pasted image 20250312193010.png]]
`Enter` 押して先に進むと、ブラウザでコード入力を促されるので入力。成功すれば `~/.config/github-copilot/apps.json` が以下のようになる。
```json
{
"github.com:Iv1.aaaaaaaaaaaaaaaa": {
"user": "tadashi-aikawa",
"oauth_token": "ghu_....................................",
"githubAppId": "Iv1.aaaaaaaaaaaaaaaa"
}
}
```
## コレジャナイ感
[[copilot.vim]]はどうやら補完機能しか提供してなさそう。たしかに[[GitHub Copilot]]の初めはその機能だけだったな... 懐かしい。
ただ、今欲しい機能はそれではないのでアンインストール。
[[Neovim]]のchatなら[[CodeCompanion]]でいい(今はブロックされてない)し、ガッツリ使うなら公式の[[VSCode Extension]]を使った方がよさそう。