LoginSignup
4
10

More than 5 years have passed since last update.

よく使うtmuxコマンド/設定ファイル

Last updated at Posted at 2017-03-18

概要

tmuxを利用するときによく使うコマンドの個人用メモ
※すべてCtrl-bを前に打つ(~/.tmux.confでPrefixは変更可能)

Pane関連の操作

Command Description
% Paneを縦に分割
" Paneを横に分割
z 現在のPaneの最大化
o 分割した別のPaneに移動
; 直前に操作したPaneに移動
! 現在のパネルを別のWindowとして表示
x 現在のPanelの削除

Window関連の操作

Command Description
c windowの新規作成
n 次のWindowに移動
p 前のWindowに移動
l 最後に選択したWindowに移動
0-9 windowの選択
, windowの名前を変更
f 現在のWindowで文字列検索
& Windowを削除

 その他のコマンド

Command Description
[ コピーモード(開始箇所 : Space、終了箇所 : Enter)
] 最新のバッファ貼り付け
? key-bindを表示
C-z tmuxの終了
: tmuxコマンドプロンプト

参考

インストール

インストール
brew install tmux
brew install reattach-to-user-namespace

設定ファイル

設定ファイル(tmux2.4)
# Esc入力時の待ち時間をキャンセル
set-option -s escape-time 0

# アクティブウィンドウを目立たせる
setw -g window-status-current-fg white
setw -g window-status-current-bg red
setw -g window-status-current-attr bright

# アクティブペインを目立たせる
set -g pane-active-border-fg white
set -g pane-active-border-bg yellow

# rで設定読み込み
bind r source-file ~/.tmux.conf \; display "Config reloaded."

## ステータスバーを下部に表示する
set -g status-position bottom

# vim-ish keybind
set-window-option -g mode-keys vi
setw -g mode-keys vi

bind -T copy-mode-vi v send-keys -X begin-selection
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
unbind -T copy-mode-vi Enter
bind -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"

# クリップボード対応
set-window-option -g mode-keys vi
設定ファイル(tmux2.3)
# Esc入力時の待ち時間をキャンセル
set-option -s escape-time 0

# アクティブウィンドウを目立たせる
setw -g window-status-current-fg white
setw -g window-status-current-bg red
setw -g window-status-current-attr bright

# アクティブペインを目立たせる
set -g pane-active-border-fg white
set -g pane-active-border-bg yellow

# rで設定読み込み
bind r source-file ~/.tmux.conf \; display "Config reloaded."

## ステータスバーを下部に表示する
set -g status-position bottom

# マウス操作を有効にする
setw -g mode-mouse on
set -g mouse-select-pane on
set -g mouse-resize-pane on
set -g mouse-select-window on

## viのキーバインドを使用
setw -g mode-keys vi
# Setup 'v' to begin selection as in Vim
bind-key -t vi-copy v begin-selection
bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"

# Update default binding of `Enter` to also use copy-pipe
unbind -t vi-copy Enter
bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"

# クリップボード対応
set-window-option -g mode-keys vi

※参考設定ファイル
http://qiita.com/yukofeb/items/b9aad876c410863c4d4b

4
10
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
4
10