tmuxを使ってみる

いろいろなとこで記事になっているので書く必要はないが、とりあえずメモ。

screenで縦分割をしたくて探していたら、tmuxがはやっているとのことだったので試してみた。

tmux-1.5.0

インストールはlibeventのバージョンが低かったのでアップグレード。

今度はmemcachedが動かなくなったのでアップグレード。

※参考
http://d.hatena.ne.jp/jonki/20100805/1280980895

設定ファイル .tmux.conf

/usr/share/doc/tmux-1.2/examples/screen-keys.conf

ここにある程度用意してある。

いろんなブログからよさそうなものをコピーしてきた。
とりあえず貼る。

# prefixキーをctrl+tへ変更
set-option -g prefix C-t
unbind-key C-b
bind-key C-t send-prefix
# prefix + r で設定ファイルを再読み込み
bind r source-file ~/.tmux.conf
# prefixキー連打で直前のウィンドウと切り替え
unbind C-t
bind-key C-t last-window
# copyモードのキーバインドをvi風に
set-window-option -g mode-keys vi
# 日本語対応
set-window-option -g utf8 on
# ウィンドウ名固定
set-window-option -g automatic-rename off
# マウスで移動
set-option -g mouse-select-pane on
# 番号基準値
set-option -g base-index 1
set -g history-limit 100000

#---------------------------------------
# 色設定
set -g status-bg colour7
set -g status-fg black
set -g status-attr dim
# 左部:whoami@hostname
set -g status-left '#[fg=green,bold][#20(whoami)@#H]#[default]'
# 右部:[日時]
set -g status-right '#[fg=green,bold][%Y/%m/%d(%a)%H:%M]#[default]'
set -g message-attr bold
set -g message-fg white
set -g message-bg red

set -g pane-active-border-fg white
set -g pane-active-border-bg black

set-window-option -g mode-bg white
set-window-option -g mode-fg black
set-window-option -g window-status-bg black
set-window-option -g window-status-fg white
set-window-option -g window-status-current-fg white
set-window-option -g window-status-current-bg colour12
set-window-option -g window-status-current-attr bold

#-------------------------------------
# 直前のウィンドウ
bind C-t last-window

# 分割していたペインそれぞれをWindowに
bind b break-pane
# ペインの縦分割
bind s split-window -v
# ペインの横分割
bind v split-window -h

# 分割画面への移動をviライクに割当
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R

# ペイン番号表示
bind i display-panes

# prefix + spaceでウィンドウの一覧表示
bind Space choose-window

いろいろいじって試す。

以上