tmux
tmux
■概要
terminal multiplexer
操作はコマンドを用いて実行する。
コマンドは C-b : で、入力可能状態となる。
コマンドとキーをバインドして、ショートカットも設定できる。
ショートカットキーは、プレフィックスキーの入力後に行う。
(デフォルトは、C-b)
・セッション
tmuxの仮想端末管理の単位
・ウィンドウ
仮想端末
・ペイン
ウィンドウを分割する単位
・アタッチ
$tmux attach (-t session-num)
・セッションの削除
$tmux kill-session (-t session-num)
!!注意点!!
カーソル移動の操作は、デフォルトでEmacsベース
■コマンド
・list-sessions
セッションの一覧表示
・list-window
ウィンドウの一覧表示
・split-window
ウィンドウの分割
デフォルトで、縦分割。 (C-b ")
- hオプションで、横分割。(C-b %)
・display-pane (C-b q)
ペインの識別番号の表示
・list-keys(C+b ?)
ショートカットキーのリスト表示
・new-window (C-b c)
ウィンドウ作成
・next-window/previous-window (C-b n/p)
ウィンドウ移動(次/前)
・choose-window (C-b w)
ウィンドウ選択メニュー表示
・detach-client (C-b d)
デタッチ
・clock-mode (C-b t)
時計表示
・select-pane (C-b o)
次ペインへの移動
・(C-b x)
ペインの破棄
・rename-window
ウィンドウのリネーム
■コピーモード
・コピーモードの開始 : C-b [
・カーソルの移動
次行 : C-n
前行 : C-p
次文字 : C-f
前文字 : C-b
先頭文字: C-a
末尾文字: C-e
・検索 : C-s
・開始位置のマーキング: C-Space
・バッファへのコピー : C-w
・バッファのペースト : C-b ]
■設定
設定ファイル: ~/.tmux.conf
(macportsでインストールすると、/opt/local/share/doc/tmux/ にサンプルがある)
・unbind
既存キーバインドの解除
・bind
キーバインドの設定
- rオプションで、同じショートカットキーを連続で入力する時、
初回以降C-b無しで、入力できるようになる。
(制限時間は、repeat-timeで設定できる)
・set-option
オプションの設定
(-gを付けるのが普通)
prefix
buffer-limit int
history-limit int
status-bg color
status-interval int : ステータスバー更新頻度
status-utf8 on/off
pane-border-fg
pane-active-border-fg color
mouse-select-pane on/off
mouse-select-window on/off
mouse-resize-pane on/off
mode-mouse on/off
・set-window-option
window-status-fg color
window-status-bg color
window-status-current-bg color
window-status-current-fg color
synchronize-panes on/off : 全てのペインへコマンドが入力される
# tmux config
# Split config
bind h split-window
bind v split-window -h# Status Bar
set-option -g status-left '#(whoami)'
set-option -g status-utf8 on
set-window-option -g window-status-current-fg white
set-window-option -g window-status-current-bg blue
# Pane config
set-option -g pane-active-border-fg white
# Mouse
set-option -g mode-mouse on
set-option -g mouse-select-pane on
set-option -g mouse-select-window on
set-option -g mouse-resize-pane on
# Pane split
bind -r + resize-pane -D
bind -r - resize-pane -U
bind -r < resize-pane -L
bind -r > resize-pane -R
# Reload config
bind C-r source-file ~/.tmux.conf