Skip to content

Instantly share code, notes, and snippets.

@rummelonp
Last active December 10, 2015 08:58
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rummelonp/4411047 to your computer and use it in GitHub Desktop.
Save rummelonp/4411047 to your computer and use it in GitHub Desktop.
tmux 入れてみた

tmux 入れてみた

screen から tmux に乗り換える人をよく見るので入れて使ってみた

インストール

brew install tmux

設定

下記 .tmux.conf 参照

  • prefix は screen で使ってた C-z をそのまま使ってる
  • bind-key に -n オプションを付けることで prefix がいらなくなる C-t でペイン間の移動を出来るようにした
  • ウィンドウの分割は emacs ライクに prefix + 1〜3 で出来るようにした
  • tmux のリポジトリに screen-keys.conf というのがある
    これを適当な所に置いて souce-file .tmux/screen-keys.conf すれば screen ライクなキーバインドに出来る http://tmux.svn.sourceforge.net/viewvc/tmux/trunk/examples/screen-keys.conf
  • 環境によって .tmux.local に色が違う設定のシムリンクを貼って読み込んでる
    OS X だとシアン、Linux だとグリーンになるようにした
  • OS X の場合は tmux の中から C-z C-e で emacs を起動出来るようにしてある

基本的に man page を見つつ色んな人の設定から適宜コピペしてきた

雑感

数日使ってみたが特に tmux を使うメリットが見つからず使い慣れた screen に戻った

screen だとコピーモード中に処理がブロックされるのが嫌だったが tmux も同様のよう
それから screen で言う bindkey や caption という概念が tmux にはないようで地味に不便
設定をコマンドから弄ることが出来るのは便利だと思った

## Misc
set-window-option -g utf8 on
set-option -g default-terminal xterm-256color
set-window-option -g automatic-rename off
## Keybind
source ~/.tmux/screen-keys.conf
unbind-key ^a
set-option -g prefix ^z
bind-key z send-prefix
bind-key ^r source-file ~/.tmux.conf
bind-key -n ^t select-pane -t:.+
bind-key 1 break-pane
bind-key 2 split-window
bind-key 3 split-window -h
## Local
source-file ~/.tmux.local
## Message
set -g message-attr bold
set -g message-bg green
set -g message-fg black
## Status (green)
set-option -g pane-border-bg black
set-option -g pane-border-fg white
set-option -g pane-active-border-bg black
set-option -g pane-active-border-fg green
set-option -g status-fg white
set-option -g status-bg default
set-option -g window-status-format "#[fg=white,bg=default] #I #W "
set-option -g window-status-current-format "#[fg=black,bg=green,underscore] #I #W "
set-option -g status-left-length 30
set-option -g status-left '#[fg=green,bg=default]#(whoami)@#(hostname -s)#[default]'
set-option -g status-right-length 30
set-option -g status-right '#[fg=white,bg=default,bold] %Y/%m/%d(%a) %H:%M#[default]'
## Message
set -g message-attr bold
set -g message-bg cyan
set -g message-fg black
## Status (cyan)
set-option -g pane-border-bg black
set-option -g pane-border-fg white
set-option -g pane-active-border-bg black
set-option -g pane-active-border-fg cyan
set-option -g status-fg white
set-option -g status-bg default
set-option -g window-status-format "#[fg=white,bg=default] #I #W "
set-option -g window-status-current-format "#[fg=black,bg=cyan,underscore] #I #W "
set-option -g status-left-length 30
set-option -g status-left '#[fg=cyan,bg=default]#(whoami)@#(hostname -s)#[default]'
set-option -g status-right-length 30
set-option -g status-right '#[fg=white,bg=default,bold] %Y/%m/%d(%a) %H:%M#[default]'
## Keybind
bind-key ^e run "open -a emacs"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment