LoginSignup
204
183

More than 5 years have passed since last update.

iTerm2 2.0の新機能: tmuxの統合

Posted at

今週、iTerm2のメジャーアップデートがあった。ちょっとややこしいのだが、これまでは"iTerm2"のv1.0.xだったのがv2.0になった。

http://www.iterm2.com/news.html に変更点が書かれているが、一つ目の

  • Deep tmux integration. iTerm2 can speak directly to tmux and display its virtual windows as native windows or tabs, making tmux much easier to navigate.

が気になる。これまでも当然iTerm2の上でtmuxは使えたはずだが何が違うのか。

ここに書いてあることをちょっと試してみた。
https://code.google.com/p/iterm2/wiki/TmuxIntegration

まずはいつものようにsshでリモートにログイン。

$ ssh remote_host

そしてtmuxコマンドを叩くのだが、-CCオプションを付けると良いらしい。

$ tmux -CC

すると新しいWindowがおもむろに立ち上がる。Shellは当然remote先のShell。ほほう。

ここで ⌘t とかして新しいWindowを作ってみると、これもremote先。なるほど。tmuxのコマンドで仮想Windowを作って一つのWindowの中で切り替えて使うのがこれまでだったが、このiTerm2 2.0からはiTermのタブ切り替えでそれができるということか。

元のWindowを見てみると

* tmux mode started **

Command Menu
----------------------------
esc    Detach cleanly.
  X    Force-quit tmux mode.
  L    Toggle logging.
  C    Run tmux command.

となっている。ここでescを押すと、

Detaching...
Detached

と出て、さっき出来たWindowがバツっと消えてなくなる。が、detachされただけであれば再attach可能なはず。

$ tmux -CC attach

とると、期待通り、先ほどのWindowが開いたタブそのままに復活する。ふむふむ。

上の紹介ページを読むと「tmuxのコマンド覚えるのも大変だし、キーが重なったりして無理ゲー。だからiTerm2のタブやウインドウがtmuxの仮想ウインドウになるようにしたさ―(かなり意訳)」ということらしい。

確かに使えそうな気がするのだが、私の場合はiTerm2のキーバインドよりもtmuxのキーバインドの方が身についているので微妙かなぁ。別Windowにしたい時に新たににSSHセッション作らなくて良いのは嬉しいかも。

204
183
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
204
183