<tmux> 設定

16/4/13 ちょっと、update

ちと勉強して下記のように設定してみた。
ちょっと便利になった。

まずは、vimキーバインドkeybindを使いたかったので、テンプレートtemplateからコピー。

cp /usr/share/tmux/vim-keys.conf ~/.tmux.conf     # msysの場合

で、中をちといじる。
最終的にこうなった。

# my_tmux.conf
# Version 02
#**************************************

# $Id: vim-keys.conf,v 1.2 2010-09-18 09:36:15 nicm Exp $
#
# vim-keys.conf, v1.2 2010/09/12
#
# By Daniel Thau.  Public domain.
#
# This configuration file binds many vi- and vim-like bindings to the
# appropriate tmux key bindings.  Note that for many key bindings there is no
# tmux analogue.  This is intended for tmux 1.3, which handles pane selection
# differently from the previous versions

# split windows like vim
# vim's definition of a horizontal/vertical split is reversed from tmux's
bind s split-window -v
bind v split-window -h

# move around panes with hjkl, as one would in vim after pressing ctrl-w
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R

# resize panes like vim
# feel free to change the "1" to however many lines you want to resize by, only
# one at a time can be slow
bind < resize-pane -L 1
bind > resize-pane -R 1
bind - resize-pane -D 1
bind + resize-pane -U 1

# bind : to command-prompt like vim
# this is the default in tmux already
bind : command-prompt

# vi-style controls for copy mode
setw -g mode-keys vi

# my config -----
# copy/paste
bind v copy-mode
bind p paste-buffer
bind -t vi-copy v begin-selection
bind -t vi-copy V select-line
bind -t vi-copy C-v rectangle-toggle
bind -t vi-copy y copy-selection
bind -t vi-copy y copy-pipe "cat > /dev/clipboard"

# mouse
set-option -g mouse on

# highlight pane
set -g pane-border-fg green
set -g pane-border-bg black
set -g pane-active-border-fg green
set -g pane-active-border-bg yellow

# status bar
set -g status-fg "colour255"
set -g status-bg "colour238"
set -g status-left-length 40
set -g status-right-length 40
set -g status-left "#{?client_prefix,#[fg=colour255]#[bg=colour200],#[fg=colour255]#[bg=colour33]}
# set -g status-left "#[fg=colour255,bg=colour241]#{?client_prefix,#[reverse],}#H S<#S> P<#P>#[default] "
set -g status-right "#[fg=colour255,bg=colour241][%Y-%m-%d  %a  %H:%M]#[default]"
setw -g window-status-current-format "#[fg=colour255,bg=colour5]#I:#W#F#[default]"
  • Ctrl-JPrefixに割り当て。
  • copy-modevで起動。範囲選択開始と同じにする。
  • コピー範囲選択は、vimvisual modev
  • ヤンクはもちろんy
  • ペーストももちろんp
  • コピーしたら、クリップボードにもコピーする。
  • ステータスラインの色を変えた。
  • Prefix keyを押すとステータスラインの先頭文字MODEの背景が赤色になるようにした。
  • 選択中のペインがステータスラインで赤色になるようにした。
  • マウスを使えるようにした。

便利になった。

公式。

tmux

お世話になったところ。

qiita.com

qiita.com

(Windows|OSX)でtmuxのコピーバッファをクリップボードに送る

tmuxを使い始めたので基本的な機能の使い方とかを整理してみた - 完熟トマト