tmuxの導入方法

Linux(CentOS)で複数のターミナルを扱うためのアプリケーションのscreen を
これまで使っていたが、最近、ターミナルマルチプレクサtmux に
乗り換えたのでそのときのインストール手順をφ(..)メモメモ

tmuxインストール手順

tmuxをインストールする時には、最新版をインストールしたいなと思い、
ソースからインストールすることにした。そのために、必要となるライブラリを
事前にいれておく。

ncurses
$ wget http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.7.tar.gz
$ tar zxvf ncurses-5.7.tar.gz
$ cd ncurses-5.7
$ ./configure
$ make
$ make install
ncurses-devel
$ yum -y install ncurses-devel
libevent
$ wget http://downloads.sourceforge.net/project/levent/libevent/libevent-2.0/libevent-2.0.17-stable.tar.gz
$ tar zxvf libevent-2.0.17-stable.tar.gz
$ cd libevent-2.0.17-stable
$ ./configure
$ make
$ make install
tmux
$ wget http://downloads.sourceforge.net/project/tmux/tmux/tmux-1.6/tmux-1.6.tar.gz
$ tar zxvf tmux-1.6.tar.gz
$ cd tmux-1.6
$ ./configure
$ make
$ make install
$ echo /usr/local/lib >> /etc/ld.so.conf
$ ldconfig

起動確認をする。起動成功!これでひとまず乗り換え完了。

$ tmux

設定ファイルまわり

いろいろtmuxについて取り上げている情報を基に情報を収集してみた。
その結果、できた設定ファイルは、下の通り。screenのキーバインドになれていたこともあり、
デフォルトのプレフィックスは、C-b ではなく、C-t設定を変更した。
これで快適なターミナルライフが。

(~/.tmux.conf)
#prefix C-b -> C-tに
set-option -g prefix C-t

# 日本語環境なら今のところ必須。
set-window-option -g utf8 on

# ウィンドウ名が自動的に更新されないように
set-window-option -g automatic-rename off

#マウス操作対応
set-option -g mouse-select-pane on
set-option -g mouse-select-window on
set-option -g mouse-resize-pane on
set-option -g mode-mouse on
set-option -g mouse-utf8 on

#ステータスバーの外観の設定
set -g status-fg cyan
set -g status-bg black
set -g status-left-length 30
set -g status-left '#[fg=white,bg=black]#H#[fg=white]:#[fg=white][#S#[fg=white]][#[default]'
set -g status-right '#[fg=black,bg=cyan,bold] [%Y-%m-%d(%a) %H:%M]#[default]'

# window-status-current
setw -g window-status-current-fg black
setw -g window-status-current-bg cyan
setw -g window-status-current-attr bold#,underscore

# ペインのアクティブなウインドウの外観の設定
set -g pane-active-border-fg black
set -g pane-active-border-bg cyan

# prefix + r で設定ファイルを再読み込みできるように。
unbind r
bind   r source-file ~/.tmux.conf