Linux > 端末 > tmux

tmuxinator

インストール(Ubuntu12.04)

gem install tmuxinator

下記を環境変数を.zshrcや.zshenvなどに追加

export EDITOR='vim'
export SHELL='zsh'

プロジェクト作成

mux new dev
* 設定ファイル
# ~/.tmuxinator/dev.yml

name: dev
root: ~/

# Optional tmux socket
# socket_name: foo

# Runs before everything. Use it to start daemons etc.
# pre: sudo /etc/rc.d/mysqld start

# Runs in each window and pane before window/pane specific commands. Useful for setting up interpreter versions.
# pre_window: rbenv shell 2.0.0-p247
pre_window: touch test

# Pass command line options to tmux. Useful for specifying a different tmux.conf.
# tmux_options: -f ~/.tmux.mac.conf

# Change the command to call tmux.  This can be used by derivatives/wrappers like byobu.
# tmux_command: byobu

windows:
  - dev:
      layout: tiled
      panes:
        - 
        - cd Documents

起動

mux dev

gemが古い場合

sudo gem install rubygems-update
sudo gem update_rubygems

tmux

設定ファイル

.tmux.conf

# ctrl-t でコマンドモード
set-option -g prefix C-x
unbind C-b

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

#マウス操作対応
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

# 設定ファイルリロード
bind C-r source-file ~/.tmux.conf

# ウィンドウの移動
# Prefix(ここではCtrl+t)を連続入力することでウィンドウを移動させます。
bind -n M-t select-pane -t :+

# ウィンドウを強制的に終了
# <Prefix><k>でウィンドウを強制終了できるようにします。
bind k confirm-before -p "kill-window #W? (y/n)" kill-window

#ステータスバーの外観の設定
set -g status-interval 5
set -g status-left-length 16
set -g status-right-length 50

set -g status-fg cyan
set -g status-bg black
set -g status-left-length 60
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]'
set -g message-attr bold
set -g message-fg white
set -g message-bg red

set  -g pane-active-border-fg cyan
set  -g pane-active-border-bg black
setw -g window-status-current-fg blue

set-window-option -g mode-bg white
set-window-option -g mode-fg black
set-window-option -g window-status-fg white
set-window-option -g window-status-bg black
#set-window-option -g window-status-current-attr underline
set-window-option -g window-status-current-bg black
set-window-option -g window-status-current-fg green

# 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

# ウィンドウを(ペインに)分割
# <Prefix><v>、<Prefix><h>と入力するだけで分割できるようにします。
bind v split-window -v
bind h split-window -h

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

# ペインの移動
# Shift + 上下左右でペインを移動できるようにする。(<Prefix>不要)
# 行頭に"bind -n"をつけるとPrefixが不要になる。
bind -n S-left select-pane -L
bind -n S-down select-pane -D
bind -n S-up select-pane -U
bind -n S-right select-pane -R

# コピー関連の設定
# <Prefix><y>でコピーし、<Prefix><p>で貼付けをできるように設定。
bind y copy-mode
bind p paste-buffer

# window間でのヒストリーの共有
#function share_history {
#    history -a
#    history -c
#    history -r
#}
#PROMPT_COMMAND='share_history'
#shopt -u histappend
#export HISTSIZE=9999

# ペイン分割をemacsライクに
bind 0 kill-pane
bind 1 break-pane
bind 2 split-window -v
bind 3 split-window -h

# キーストロークのディレイを減らす
set -sg escape-time 1
最終更新:2014年11月13日 23:01