理系学生日記

おまえはいつまで学生気分なのか

tmux デビューしてから

先週までターミナルマルチプレクサとしては screen を使用していたのだけれど、どうも巷で tmux が良いという話がちらほら聞こえるので、一念発起して tmux を導入してみた。Homebrew を使えばインストールは一瞬ですね。

$ brew install brew

特に何かしらのこだわりはなくて、標準で用意されているのであればステータスラインは複数行にしたかったのだけれど、(できるかも含めて)やり方が良くわからなかった。たぶん、tmux から tmux を起動するみたいな変態的なことをすれば可能だと思うのだけれど、そこまでやる気もなく。

今の設定は以下のような感じ。設定ファイルの再読み込みは便利だと思う。他の使用感は screen と特に変わらず。ただ、設定ファイルは読みやすいし、このまましばらく使ってみるつもり。

## 規定の Prefox キーの割り当てを解除し、Ctrl+tを Prefox にする
unbind-key C-b
set-option -g prefix C-t
bind-key C-t send-prefix

# 文字コードの設定とコピーモードのキーバインドを emacs にする
set-window-option -g mode-keys emacs
set-window-option -g utf8 on

# ウィンドウ番号を 1 から開始する
set-option -g base-index 1

# メッセージの表示時間を延長する
set-option -g display-time 1000

# 設定ファイルの再読み込みを行う
bind-key r source-file ~/.tmux.conf\; display-message "$HOME/.tmux.conf reloaded."

# ウィンドウリストをステータスバーの左側に配置する
set-option -g status-justify left

# ステータスの更新感覚を 1 秒にする
set-option -g status-interval 1

# Look and Feel
set-option -g status-left "[#H] Session:#S"
set-option -g status-left-length 35
set-option -g status-fg red
set-option -g status-bg black

set-option -g status-right "#(date +'%Y/%m/%d %H:%M:%S')"
set-option -g status-right-length 30
set-option -g status-fg red
set-option -g status-bg black

set-window-option -g window-status-bg black
set-window-option -g window-status-fg blue
set-window-option -g window-status-format "\[#F#I:#W\]"
set-window-option -g window-status-attr "none"
set-window-option -g window-status-current-attr "bold"
set-window-option -g window-status-current-bg blue
set-window-option -g window-status-current-fg black
set-window-option -g window-status-current-format "\[#F#I:#W\]"

# アクティブなペーンの色を変更する
set-option -g pane-active-border-fg black
set-option -g pane-active-border-bg cyan

# ペーンの移動
bind j select-pane -D
bind k select-pane -U
bind h select-pane -L
bind l select-pane -R

# ペーンのサイズを変更する
bind-key -nr J resize-pane -D
bind-key -nr K resize-pane -U
bind-key -nr L resize-pane -L
bind-key -nr H resize-pane -R

# : でコマンド入力を行えるようにする
bind-key \; command-prompt