CLOVER🍀

That was when it all began.

Tmux Plugin Manager(tpm)をインストールする

Tmux Plugin Manager(tpm)を使ってみましょう、ということで。

GitHub - tmux-plugins/tpm: Tmux Plugin Manager · GitHub

tmux 1.9以上であれば使えるようです。自分の環境だとこのバージョンでした。

$ tmux -V
tmux 3.4

tpmをインストールします。

$ git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm

そして、tmuxの設定ファイルにこちらを追加します。

set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'

run '~/.tmux/plugins/tpm/tpm'

run '~/.tmux/plugins/tpm/tpm'は、tmuxの設定ファイルの最後に書く必要があるみたいです。

この後にtmuxを起動して、prefix+Iを実行するとこんな感じでtpmのインストールが始まります。

'~/.config/tmux/plugins/tpm/tpm' returned 127
Already installed "tpm"
Installing "tmux-sensible"
  "tmux-sensible" download success
'~/.config/tmux/plugins/tpm/tpm' returned 127

TMUX environment reloaded.

Done, press ESCAPE to continue.

ちょっとハマったのは、tmuxの設定ファイルであればどこに書いてもいいというわけではなく、以下のどちらかでないと効果がありません。

  • $XDG_CONFIG_HOME/tmux/tmux.conf
    • 通常は~/.config/tmux/tmux.conf
  • ~/.tmux.conf

$XDG_CONFIG_HOME/tmux/tmux.confの方が優先されます。

tpmのソースコードを見ていると、tmuxの設定ファイルをシェルスクリプトで解析しているのがわかります。

最初、source-fileで読み込んでいるファイルに書いてまったく動かずにハマりました…。プラグインの設定と通常の設定を分けたい場合は、
~/.tmux.confを通常の設定ファイルとして使っているのであれば$XDG_CONFIG_HOME/tmux/tmux.confにプラグインの設定を書くと
分離できたりします。

試しにということで、tmux-agent-sidebarを導入してみます。

GitHub - hiroppy/tmux-agent-sidebar: A tmux sidebar that monitors AI coding agents across all windows and sessions in real-time · GitHub

hiroppy/tmux-agent-sidebarを追加。

set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'hiroppy/tmux-agent-sidebar'

run '~/.tmux/plugins/tpm/tpm'

prefix+Iでインストール。

Claude Codeのマーケットプレイスとプラグインを追加。

$ claude plugin marketplace add ~/.tmux/plugins/tmux-agent-sidebar
$ claude plugin install tmux-agent-sidebar@hiroppy

prefix+eでコーディングエージェント向けのペインが開くようになります。