---
title: "ターミナルがダサいとモテない。gh copilot suggestをスマートに使う。 | grasys blog"
url: "https://blog.grasys.io/post/yusukeh/terminal-copilot-suggest"
description: "gh copilot suggest使ってわからないコマンドはcopilotに聞こう！ Photo by Roman Synkevych on Unsplash 巷では Vibe Coding ってキーワードが流行ってますね。CursorやwindsurfやClineなどなど 弊社でもDevinやCursorを使い始…"
---

# ターミナルがダサいとモテない。gh copilot suggestをスマートに使う。

-   ![](/_astro/noicon.CTHOhNiB_1HMs6A.webp)[yusukeh](/authors/yusukeh/)
-   公開日：2025年5月28日
-   カテゴリー：[Tech](/categories/tech/)
-   タグ：[#シリーズ: ターミナル環境](/tags/シリーズ-ターミナル環境/)

![ターミナルがダサいとモテない。gh copilot suggestをスマートに使う。](/_astro/ogp.J-Zco49Q_ZgA3cj.webp)

gh copilot suggest使ってわからないコマンドはcopilotに聞こう！

![ターミナルがダサいとモテない。gh copilot suggestをスマートに使う](/_astro/01-0-qrdpEVAvfdEsyapG-09614447.CXJ2v8Ao_1uhI7A.webp)

Photo by [Roman Synkevych](https://unsplash.com/@synkevych?utm_source=medium&utm_medium=referral) on [Unsplash](https://unsplash.com/?utm_source=medium&utm_medium=referral)

巷では**Vibe Coding**ってキーワードが流行ってますね。[Cursor](https://www.cursor.com/)や[windsurf](https://windsurf.com/)や[Cline](https://github.com/cline/cline)などなど

弊社でも[Devin](https://devin.ai/)や[Cursor](https://www.cursor.com/)を使い始めました。  
社内では[PyCharm](https://www.jetbrains.com/ja-jp/pycharm/)が主流なので、今のところgithub copilotとのコンビネーションが多いのかな？

github copilot便利みたいですね。  
自分はNeoVimだからまだ活用してるぜ！ってテンションで言えないです😅

NeoVimのgithub copilotに関わるものはいくつかありますが、自分は今のところ[github/copilot.vim](https://github.com/github/copilot.vim)を暫定的に使っています。  
実は便利だなというほど使えてないというか、自分はSuggestを無視してることが多い気がします😅[](https://github.com/github/copilot.vim?source=post_page-----1105f56bc5f0---------------------------------------)

[GitHub - github/copilot.vim: Neovim plugin for GitHub Copilot](https://github.com/github/copilot.vim?source=post_page-----1105f56bc5f0---------------------------------------)

NeoVimにはVibe Coding系はいくつかありますが、[](https://github.com/joshuavial/aider.nvim?source=post_page-----1105f56bc5f0---------------------------------------)

[GitHub - joshuavial/aider.nvim](https://github.com/joshuavial/aider.nvim?source=post_page-----1105f56bc5f0---------------------------------------)[](https://github.com/yetone/avante.nvim?source=post_page-----1105f56bc5f0---------------------------------------)

[GitHub - yetone/avante.nvim: Use your Neovim like using Cursor AI IDE!](https://github.com/yetone/avante.nvim?source=post_page-----1105f56bc5f0---------------------------------------)

[GitHub - olimorris/codecompanion.nvim: ✨ AI-powered coding, seamlessly in Neovim](https://github.com/olimorris/codecompanion.nvim?source=post_page-----1105f56bc5f0---------------------------------------)

これらは一通り一度Installして使ってみたんですが、思いっきり使いこなせているかと言うとまだ使いこなせてません。  
個人的にchatgptもclaudeもgeminiも課金して使える環境がありますが・・・正直コストの話も大きいかも・・・😅

copilot系もいくつかあります。[](https://github.com/zbirenbaum/copilot.lua?source=post_page-----1105f56bc5f0---------------------------------------)

[GitHub - zbirenbaum/copilot.lua: Fully featured & enhanced replacement for copilot.vim complete…](https://github.com/zbirenbaum/copilot.lua?source=post_page-----1105f56bc5f0---------------------------------------)[](https://github.com/zbirenbaum/copilot-cmp?source=post_page-----1105f56bc5f0---------------------------------------)

[GitHub - zbirenbaum/copilot-cmp: Lua plugin to turn github copilot into a cmp source](https://github.com/zbirenbaum/copilot-cmp?source=post_page-----1105f56bc5f0---------------------------------------)

今日は**Vibe Coding**にあやかって、Terminalでもcopilotを便利に使おうというのが主題になっています。

## AI Terminal

まず最初にAIでTerminalという観点でwarp terminalを紹介しておきます。[](https://www.warp.dev/?source=post_page-----1105f56bc5f0---------------------------------------)

[Warp: The intelligent terminal](https://www.warp.dev/?source=post_page-----1105f56bc5f0---------------------------------------)

有償ですがLLMとやり取りしながらできるっぽいです。

自分もmacにwarp入れてますが、ちゃんと使ってないので詳しくないです。自分は[WezTerm](https://wezterm.org/index.html)使ってます。

だんだんこういう世界も始まってるんだなぁと・・・

**Vive Coding**なんておしゃれな名前ついてるから、Terminalでの作業も名前付けたい😂

-   Vive Terminal（う、う〜〜ん🤔）
    
-   Vive Shell（普通過ぎるけどこれかなぁ）
    
-   Vive Ops（これか？！！！だがしかし・・・わかりにくいかもなぁ🤔）
    
-   Vive ShellOps（う、う〜〜〜〜〜んくどいかなぁ🤔）
    

誰か決めてください🤣

## AIつかってTerminalでもVibe Shellしようぜ！

一旦**Vibe Shell**（2024/04/24時点）で進めます🤣

## Requirements

-   [GitHub CLI](https://docs.github.com/ja/github-cli/github-cli/about-github-cli)
    
-   [GitHub Copilot for CLI](https://docs.github.com/ja/copilot/managing-copilot/configure-personal-settings/installing-github-copilot-in-the-cli)
    
-   [gum](https://github.com/charmbracelet/gum)
    

この３つです。

## GitHub CLI

ここにInstall Documentがあります。[](https://github.com/cli/cli?source=post_page-----1105f56bc5f0---------------------------------------#installation)

[GitHub - cli/cli: GitHub’s official command line tool](https://github.com/cli/cli?source=post_page-----1105f56bc5f0---------------------------------------#installation)

さっと入れてしまいましょう！  
自分の場合はmacOSなのでHomebrewでInstallしてます。

Plain textcontent\_copy

```
brew install gh
```

## GitHub CLI クイックスタート

[](https://docs.github.com/ja/github-cli/github-cli/quickstart?source=post_page-----1105f56bc5f0---------------------------------------)[GitHub CLI クイックスタート - GitHub Docs](https://docs.github.com/ja/github-cli/github-cli/quickstart?source=post_page-----1105f56bc5f0---------------------------------------)

クイックスタートを読んで開始できる準備を始めましょう。

## GitHub Copilot for CLI

Install方法はここにあります。[](https://docs.github.com/ja/copilot/managing-copilot/configure-personal-settings/installing-github-copilot-in-the-cli?source=post_page-----1105f56bc5f0---------------------------------------)

[CLIG での GitHub Copilot のインストール - GitHub Docs](https://docs.github.com/ja/copilot/managing-copilot/configure-personal-settings/installing-github-copilot-in-the-cli?source=post_page-----1105f56bc5f0---------------------------------------)

これでInstallできます。

Plain textcontent\_copy

```
gh extension install github/gh-copilot
```

Installされたかの確認は

Plain textcontent\_copy

```
gh extension list
```

Plain textcontent\_copy

```
NAME        REPO                       VERSION
gh copilot  github/gh-copilot          v1.1.0
```

こんな形で出力されると思います。

## ghcs CLIでのGitHub Copilotの構成

ここにあります。[](https://docs.github.com/ja/copilot/managing-copilot/configure-personal-settings/configuring-github-copilot-in-the-cli?source=post_page-----1105f56bc5f0---------------------------------------)

[CLI での GitHub Copilot の構成 - GitHub Docs](https://docs.github.com/ja/copilot/managing-copilot/configure-personal-settings/configuring-github-copilot-in-the-cli?source=post_page-----1105f56bc5f0---------------------------------------)

Plain textcontent\_copy

```

echo 'eval "$(gh copilot alias -- bash)"' >> ~/.bashrc
```

初めてgh copilotを起動するといろいろ確認されます。  
分析用にLog送るかとかそんな内容です。  
ここの設定は個人の判断に任せます。

[](https://docs.github.com/ja/copilot/managing-copilot/configure-personal-settings/configuring-github-copilot-in-the-cli?source=post_page-----1105f56bc5f0---------------------------------------#changing-the-default-execution-confirmation)

[CLI での GitHub Copilot の構成 - GitHub Docs](https://docs.github.com/ja/copilot/managing-copilot/configure-personal-settings/configuring-github-copilot-in-the-cli?source=post_page-----1105f56bc5f0---------------------------------------#changing-the-default-execution-confirmation)

ここをみるとわかると思います。

## gh copilot suggest

それでは実際にgh copilot suggestをしてみましょう。

macOSなので、まずはDocumentsの配下の一覧を出力するコマンドを聞いてみます。

Plain textcontent\_copy

```
gh copilot suggest "Documents配下のファイルの一覧を出力したい"
```

![gh copilot suggestの画面（1）](/_astro/02-1-DhQd-WfzUkbTQHbROJcCgA-63df61d6.DO1gwY7r_14WfMM.webp)

何について聞いてるのか聞かれるので、ここでは普通にコマンドなので”generic shell command”を選択します。

![gh copilot suggestの画面（2）](/_astro/03-1-IvCECpyaggsYVYEh6MR69A-8dfdc438.CUjVf2n6_Z8gT8K.webp)

そうすると、これどうするか聞かれますね  
コピーするの？説明が欲しいの？みたいな感じですね  
一旦説明してもらいます。

![gh copilot suggestの画面（3）](/_astro/04-1-7ovNzIaOEnbMa1O_4NsQwg-a08b8dc4.DJTGaREo_1iKyRq.webp)

こんな感じになります。

Copyします。

![gh copilot suggestの画面（4）](/_astro/05-1-bUNQx8eekTT5fMUsyntluQ-208529aa.CZCLuSIw_Z1vWxhO.webp)

するとshellのpromptが返ってくるので  
おもむろにCmd+vすると

![gh copilot suggestの画面（5）](/_astro/06-1-5uzJ5E3O5Tl3q_Jv24VjlQ-7fd9f8ec.Df8TJSBT_bOXmr.webp)

コピペできました。

これが全体の流れです。

## gum

ちょっとこのままではスムーズじゃないのとコマンドも長いので、ちょっと工夫してスマートにしてみましょう。[](https://github.com/charmbracelet/gum?source=post_page-----1105f56bc5f0---------------------------------------)

[GitHub - charmbracelet/gum: A tool for glamorous shell scripts 🎀](https://github.com/charmbracelet/gum?source=post_page-----1105f56bc5f0---------------------------------------)

gumはとても多機能でTerminalでの入力をいろいろな形で表現、制御してくれます。

セレクタ用意したり、YES/NOの選択を求めたり、ちょっとTUIとしてもおしゃれな感じにしてくれます。

ここではgumのinputを利用してgh copilot suggestへ渡す入力をTUIで制御していきます。

## Install gum

普通にHomebrewもあります。  
go installでもInstallできます。

Plain textcontent\_copy

```
brew install gum
```

Plain textcontent\_copy

```
go install github.com/charmbracelet/gum@latest
```

## gum help

Installできたらhelpを確認しましょう。

prompt/placeholder/cursor/headerの４要素にそれぞれ内容のテキストと色設定があります。  
色設定については環境変数でも設定できるようです。

Plain textcontent\_copy

```
❯ gum input --help
Usage: gum input [flags]

Prompt for some input

Flags:
  -h, --help                               Show context-sensitive help.
  -v, --version                            Print the version number

      --placeholder="Type something..."    Placeholder value ($GUM_INPUT_PLACEHOLDER)
      --prompt="> "                        Prompt to display ($GUM_INPUT_PROMPT)
      --cursor.mode="blink"                Cursor mode ($GUM_INPUT_CURSOR_MODE)
      --value=""                           Initial value (can also be passed via stdin)
      --char-limit=400                     Maximum value length (0 for no limit)
      --width=0                            Input width (0 for terminal width) ($GUM_INPUT_WIDTH)
      --password                           Mask input characters
      --[no-]show-help                     Show help keybinds ($GUM_INPUT_SHOW_HELP)
      --header=""                          Header value ($GUM_INPUT_HEADER)
      --timeout=0s                         Timeout until input aborts ($GUM_INPUT_TIMEOUT)
      --[no-]strip-ansi                    Strip ANSI sequences when reading from STDIN ($GUM_INPUT_STRIP_ANSI)

Style Flags
  --prompt.foreground=""            Foreground Color ($GUM_INPUT_PROMPT_FOREGROUND)
  --prompt.background=""            Background Color ($GUM_INPUT_PROMPT_BACKGROUND)
  --placeholder.foreground="240"    Foreground Color ($GUM_INPUT_PLACEHOLDER_FOREGROUND)
  --placeholder.background=""       Background Color ($GUM_INPUT_PLACEHOLDER_BACKGROUND)
  --cursor.foreground="212"         Foreground Color ($GUM_INPUT_CURSOR_FOREGROUND)
  --cursor.background=""            Background Color ($GUM_INPUT_CURSOR_BACKGROUND)
  --header.foreground="240"         Foreground Color ($GUM_INPUT_HEADER_FOREGROUND)
  --header.background=""            Background Color ($GUM_INPUT_HEADER_BACKGROUND)
```

## setup bash

Installも済んだので組み込んでいきます。

自分の場合はBashなので.bashrcにセットアップしていきます。  
ここでは、先に紹介したghのSetupも含めて表記します。

Plain textcontent\_copy

```
if command -v gh &> /dev/null; then
  eval "$(gh completion --shell $(basename ${SHELL}))"
  eval "$(gh copilot alias -- $(basename ${SHELL}))"
```

.bashrc

Plain textcontent\_copy

```
if command -v gh &> /dev/null; then
  eval "$(gh completion --shell $(basename ${SHELL}))"
  eval "$(gh copilot alias -- $(basename ${SHELL}))"

  if command -v gum &> /dev/null; then
    function _gum_gh_copilot_suggest() {
      declare -x gum_gh_copilot_suggest_input=$(gum input --cursor.foreground="#80FFEA" --header="gh copilot suggest target shell" --header.foreground="#7766CC")
      gh copilot suggest --target shell "$gum_gh_copilot_suggest_input"
    }
    bind '"\C-g":"_gum_gh_copilot_suggest\n"'
  fi
fi
```

ちょっと書き方に癖がありますが・・・🤣  
yadmでmacOSだけじゃなく、Linux環境なども手元にあり管理を統合しているので、Installの漏れなどが発生しても良いように、このような形にしてます😂

適度に色付けたりちょっとDracula Themeっぽくしたりしてます🧛

bashのshortcut keyとして”Control + g”にしました。

これでBash上で”Ctl + g”することでいつでもgumを呼び出し、入力をしgh copilot suggestに渡すことができます。

自分の場合は shell-out optionは利用せず、TargetだけShellに設定してます。

## Execute

それでは実際に動かしましょう。

## おもむろにCtl + g

日本語もできます

![おもむろにCtl + gの画面](/_astro/07-1-l4TPBCrwQiWrg205ni7mEA-d31ec4dc.BrhVFgLH_Z9iGVq.webp)

## gh copilotのメニューが出るのでExplainして貰いましょう

![gh copilotのメニューが出るのでExplainして貰いましょうの画面（1）](/_astro/08-1-1eW0UWK8bC9utFSW1dE0QQ-15cd71dd.CrYUWtNt_oCSFK.webp)

![gh copilotのメニューが出るのでExplainして貰いましょうの画面（2）](/_astro/09-1-hbIRhTsIK1Ml2jxD9Lzpkw-596ee72c.i_ChHgl8_DnCwl.webp)

## Copy command to clipboardしましょう

macOSなのでCommand + vでclipboardからPasteできます。

![Copy command to clipboardしましょうの画面](/_astro/10-1-2UHVbYUtEJGc-39g17lZuQ-8a656573.BfVqaWgP_OlUwQ.webp)

実際に出力されたのはこのコマンドです。

Plain textcontent\_copy

```
ls -d ~/Documents/*/
```

ちょっぴり出力がかゆいけど目的は達成できると思います。

## lazygitをdeltaをinstallしたい

もう少し複雑なことを聞いてみましょう。

![lazygitとdeltaのインストール方法をCopilot Suggestに質問する画面](/_astro/11-1-ic9jGpxD6na0ynkcCSiWeQ-e125dfe2.DEA2hUf-_Z1YUNmp.webp)

![Copilot Suggestが生成したlazygitとdeltaのインストールコマンド](/_astro/12-1-cwhqjRq-XKe8mo9DKpyWhg-cf7232eb.BKAtVO0B_ZyCshS.webp)

おおおおおおお

lazygitからdeltaがgit-deltaだってわかってらっしゃる🤣

## 感想

もう少し複雑なことを依頼してみるのが良い気がするけど、思いつかなかったのでここまでにします。

ちょっとすぐ思いつくレベルのことしかGitHub Copilotに聞けませんでしたが・・・  
ほんとに困ったときに使えるかもしれないですね。  
自分にはあまり必要なものじゃないかもしれない。

**Vibe Shell**したい方はやってみてください。

## 注意点

こういったTerminalでのOperationでコマンドを聞きたくなる方は、Linuxのコマンドを苦手としていたり、コンピュータ的な経験値の観点で初心者な方が多いと思います。

CLIでのGitHub Copilot の責任ある使用について以下にあります。[](https://docs.github.com/ja/copilot/responsible-use-of-github-copilot-features/responsible-use-of-github-copilot-in-the-cli?source=post_page-----1105f56bc5f0---------------------------------------)

[CLI での GitHub Copilot の責任ある使用 - GitHub Docs](https://docs.github.com/ja/copilot/responsible-use-of-github-copilot-features/responsible-use-of-github-copilot-in-the-cli?source=post_page-----1105f56bc5f0---------------------------------------)

まず前提としてGitHub Copilotはとても優秀です。私自身もそう思います。

ただし、その出力されたものが正しいかの確認は自身でする必要があります。  
Unix/Linuxのコマンドラインの世界では、環境に対して破壊的なものもたくさんあります。  
例としてはファイルの削除などのコマンドは気をつけた方が良いです。  
Unix/Linuxの一部のコマンドは発行する権限次第では、簡単にOSを破壊することできます。

またExplainも活用した方が良いと思います。  
gh copilotが提供してくれるExplainだけではなく、実際に発行されるCommandのHelpもあわせて確認しましょう。

そしてセキュリティについての配慮も必要です。  
この場合はどんなコマンドかを問いかけているだけなのでセキュリティ的に気をつけることはそれほど必要ないと考えていますが、利用に関して必要以上の情報を渡さないといったことも注意しましょう。

最後に付け加えるとすれば、AIの力を借りることは良いことだと思います。生産性、効率向上などの観点ではとても良い効果を発揮してくれます。  
ですが2025年の現時点において、あらゆる面において信頼性の高いものでは残念ながらありませんし、少なくともコンピュータにおける何もかもを解決できるものではありません。  
現時点ではAIを活用するには、それなりのベースとなる基礎知識やスキルも必要だと考えています。  
もちろん近い将来、AIの発展で更に使いやすいものになっていくと思います。ただ現時点ではまだです。

なのでまだ経験値が足りない、知識が足りないと思う方々は自身のスキルアップや学習の補助として活用されることを念頭において触るのが良いと思います。

ターミナル環境について他の記事も書いているので、よろしければこちらもご覧ください！  
[『ターミナルがダサいとモテない』シリーズ一覧](https://blog.grasys.io/tags/series-terminal-update)

転載：[ターミナルがダサいとモテない。gh copilot suggestをスマートに使う。](https://medium.com/@yusuke_h/%E3%82%BF%E3%83%BC%E3%83%9F%E3%83%8A%E3%83%AB%E3%81%8C%E3%83%80%E3%82%B5%E3%81%84%E3%81%A8%E3%83%A2%E3%83%86%E3%81%AA%E3%81%84-gh-copilot-suggest%E3%82%92%E3%82%B9%E3%83%9E%E3%83%BC%E3%83%88%E3%81%AB%E4%BD%BF%E3%81%86-1105f56bc5f0)

## この記事を書いた人

[![](/_astro/yusukeh.BvUd2yKE_1mQ6Fp.webp)](/authors/yusukeh/)

### [yusukeh](/authors/yusukeh/)

Fly high. Think deep. Move fast. Go far.🦅

-   [X](https://x.com/yusukeh "X")
-   [GitHub](https://github.com/yusukeh "GitHub")
-   [Medium](https://medium.com/@yusukeh "Medium")
-   [Facebook](https://www.facebook.com/yusuke.exzm "Facebook")
-   [Instagram](https://www.instagram.com/yusukehasegawa/ "Instagram")
-   [LinkedIn](https://www.linkedin.com/in/hasegawa-yusuke-091b4164/ "LinkedIn")

[プロフィールと記事一覧](/authors/yusukeh/)