1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

普通のターミナル(Ghostty)をWarpに限りなく近づける

1
Posted at

概要

Warpが重い・メモリを食う・AIへの依存が気になる、という理由でGhosttyに移行したものの補完の体験が落ちた。
zshプラグインを組み合わせてWarpの体験を再現したメモ。

先行記事として Warpの便利機能、Ghosttyで再現できるよ があるが、fzf-tab・Atuin・Starshipは含まれていないので、本記事はその続きとして読める。

環境

  • macOS(Apple Silicon)
  • Ghostty
  • zsh
  • Homebrew

Warpの何が良いのかを分解する

機能 説明
Ghost text 履歴をもとに入力中のコマンドをうっすら表示
構文ハイライト 打ちながらコマンドが赤/緑で色づく
Tab補完UI ポップアップで候補・引数説明が表示される
履歴検索 インタラクティブに絞り込める

役割ごとに別ツールで再現する。

Ghost text        → zsh-autosuggestions
構文ハイライト     → zsh-syntax-highlighting
Tab補完UI         → fzf + fzf-tab
履歴検索          → Atuin
プロンプト         → Starship

手順

1. zsh-autosuggestions / zsh-syntax-highlighting / fzf

すでに入っている人も多いはず。

$ brew install zsh-autosuggestions zsh-syntax-highlighting fzf

~/.zshrc に追加:

source $(brew --prefix)/share/zsh-autosuggestions/zsh-autosuggestions.zsh
ZSH_AUTOSUGGEST_STRATEGY=(history completion)  # 履歴になければ補完候補からサジェスト
source $(brew --prefix)/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source <(fzf --zsh)

2. fzf-tab(Tab補完のポップアップUI化)

Zinitというプラグインローダー経由で入れる。

$ brew install zinit

~/.zshrc に追加:

source $(brew --prefix)/opt/zinit/zinit.zsh
zinit light Aloxaf/fzf-tab

$(brew --prefix)/share/zinit/zinit.zsh というパスは存在しないのでエラーになる。
正しくは $(brew --prefix)/opt/zinit/zinit.zsh

fzf-tabのTab補完ポップアップ

3. Atuin(履歴検索の強化)

Ctrl+R をAtuinに置き換える。実行時刻・ディレクトリ・終了コードも記録されるのでfzfの履歴検索より高機能。

$ brew install atuin

~/.zshrc に追加:

eval "$(atuin init zsh)"

4. Starship(プロンプトの強化)

git branch・言語バージョン等を自動表示するプロンプト。Warpのリッチなプロンプトに近くなる。

$ brew install starship

~/.zshrc に追加:

eval "$(starship init zsh)"

カスタマイズは ~/.config/starship.toml で行う。

5. Ghosttyのシェル統合(おまけ)

Ghostty自体は補完に関与しないが、シェル統合を有効にするとプロンプトジャンプ(Cmd+Shift+↑/↓)や作業ディレクトリの引き継ぎが使える。

~/.config/ghostty/config に追加:

shell-integration = zsh

完成した .zshrc(補完まわりの抜粋)

# ===== zsh補完設定 =====
if type brew &>/dev/null; then
  FPATH=$(brew --prefix)/share/zsh-completions:$FPATH
  autoload -Uz compinit
  compinit
fi

zstyle ':completion:*' menu select
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'

# プラグイン読み込み
source $(brew --prefix)/opt/zinit/zinit.zsh
zinit light Aloxaf/fzf-tab
source $(brew --prefix)/share/zsh-autosuggestions/zsh-autosuggestions.zsh
ZSH_AUTOSUGGEST_STRATEGY=(history completion)  # 履歴になければ補完候補からサジェスト
source $(brew --prefix)/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source <(fzf --zsh)
eval "$(atuin init zsh)"
eval "$(starship init zsh)"

検討したが見送ったもの

Kiro CLI(旧Amazon Q CLI)

500以上のCLIの引数説明付き補完ができるAI補完ツール。導入前に調査した結果、以下の懸念があり見送り。

  • zsh-autosuggestions と共存不可との報告あり(GitHub Discussion
  • シェル起動に約1.5秒の遅延が発生するケースあり(Issue #3614
  • IDEの組み込みターミナルでは動かないケースあり(Issue #3522

※実際に試したわけではないので、状況が変わっている可能性あり。

fish shell

ゼロ設定でWarpに最も近い体験が得られるが、POSIX非互換でnvm・pnpm等の既存設定の移植コストが高いため見送り。


メモリ使用量の比較

以下のコマンドで計測:

$ ps aux | grep -iE "ghostty|warp|terminal" | grep -v grep
ターミナル メモリ
Terminal.app 約14MB
Ghostty 約17MB
Warp 未計測(1GB超との報告あり

GhosttyとTerminal.appはほぼ同等。Warpは手元で計測できていないが、先行記事では1GB超との報告がある。


Warpとの体験差

機能 Warp 今回の構成
Ghost text ネイティブ ほぼ同等
構文ハイライト ネイティブ ほぼ同等
Tab補完UI ネイティブ fzf-tab で近い体験
履歴検索 ネイティブ Atuin(機能的にはより高機能)
AI補完(引数説明) ネイティブ 再現できていない
設定不要 Yes セットアップに1〜2時間

AI補完だけはWarpに軍配が上がる。それ以外はほぼ再現できている。


まとめ

  • zsh-autosuggestions + zsh-syntax-highlighting + fzf はすでに入っている人も多いはず
  • そこに fzf-tabAtuinStarship を足すだけで体験が大きく変わる
  • AI補完だけはWarpに軍配が上がるが、それ以外はほぼ再現できている

参考

1
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?