-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.tmux.conf
216 lines (167 loc) · 6.37 KB
/
.tmux.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
# 全般設定 ###############################
# 文字コード utf-8
# setw -g utf8 on
# set -g status-utf8 on
# 行数増 2000→10000
set-option -g history-limit 10000
# マウス操作用
# 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 on # from 2.1
# set-option -g mouse-utf8 on
# window の番号は 1 から始める
set-option -g base-index 1
# Prefix キーの遅延 ms
set -sg escape-time 150
# display-panes の表示時間
set -g display-panes-time 2500
# マウス ####################################
bind-key -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t=; copy-mode -e; send-keys -M'"
bind-key -n WheelDownPane select-pane -t= \; send-keys -M
setw -g mode-keys vi
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
unbind -T copy-mode-vi MouseDragEnd1Pane
# キーバインド ##############################
# C-q で操作
set -g prefix C-q
# コピー、選択モードのキーバインドvi/emacs
set-window-option -g mode-keys vi
setw -g mode-keys vi
# vでマーク開始
bind -T copy-mode-vi v send -X begin-selection
# yでヤンク
# bind -t vi-copy y copy-selection
# bind -t vi-copy y copy-pipe "xclip -i -sel p -f | xclip -i -sel c "
# To paste:
# bind-key -n C-y run "xclip -o | tmux load-buffer - ; tmux paste-buffer"
## copy to clipboard
# My Future Sight for Past: Copy to clipboard in tmux on Linux, Cygwin, Mac
# http://myfuturesightforpast.blogspot.jp/2014/09/copy-to-clipboard-in-tmux-on-linux.html
### for Linux
if-shell "which xclip" '\
bind -t vi-copy y copy-pipe "xclip -i -sel p -f | xclip -i -sel c "; \
bind-key -n C-y run "xclip -o | tmux load-buffer - ; tmux paste-buffer"; \
'
# if-shell "which xsel" '\
# bind-key -t vi-copy y copy-pipe "xsel -ib"; \
# bind-key -t vi-copy enter copy-pipe "xsel -ib"; \
# '
### for Cygwin
if-shell "which putclip" '\
bind-key -t vi-copy y copy-pipe "cat > /dev/clipboard"; \
bind-key -t vi-copy Enter copy-pipe "cat > /dev/clipboard"; \
bind-key -n C-y run "cat /dev/clipboard | tmux load-buffer - ; tmux paste-buffer"; \
bind-key C-] run "cat /dev/clipboard | tmux load-buffer - ; tmux paste-buffer"; \
'
### for Mac
if-shell "which pbcopy" '\
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "pbcopy"; \
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "pbcopy"; \
'
# 設定の再読み込み
bind C-r source-file ~/.tmux.conf
# Ctr おしっぱなしでコピーモード
bind -r ^[ copy-mode
bind -r ^] paste-buffer
# Ctr おしっぱなしで window 移動
# bind -r C-p previous-window
# bind -r C-n next-window
# shell の履歴と誤爆がおおいので解除
unbind p
unbind n
# window/pane移動を楽に
# bind -n C-t next-window
bind -n C-s next-window
# bind -n C-s display-panes
bind -n C-t select-pane -t :.+
# byobu 風の F キー利用
bind -n F2 new-window
bind -n F3 previous-window
bind -n F4 next-window
# 分割系は Emacs 風に
unbind 1
bind 1 break-pane
bind 2 split-window -v -c '#{pane_current_path}'
bind 3 split-window -h -c '#{pane_current_path}'
bind k kill-window
unbind &
# 分割後のリサイズ
bind -r C-h resize-pane -L
bind -r C-j resize-pane -D
bind -r C-k resize-pane -U
bind -r C-l resize-pane -R
# pane 移動
bind -r k select-pane -U
bind -r j select-pane -D
bind -r h select-pane -L
bind -r l select-pane -R
# xmonad 風の window 移動
bind -n M-1 select-window -t :1
bind -n M-2 select-window -t :2
bind -n M-3 select-window -t :3
bind -n M-4 select-window -t :4
bind -n M-5 select-window -t :5
bind -n M-6 select-window -t :6
bind -n M-7 select-window -t :7
bind -n M-8 select-window -t :8
bind -n M-9 select-window -t :9
# バッファ保存
bind s run "tmux capture-pane -S -10000; tmux show-buffer > ~/tmuxlog-`date '+%Y%m%d_%H%M%S'`.log ; display 'save log ~/tmuxlog-`date '+%Y%m%d_%H%M%S'`.log'"
# 複数のペインに同じコマンドを入力
# bind m setw synchronize-panes on
# bind M setw synchronize-panes off
bind m run "tmux set-option -q status-bg red; tmux set-option -q window-status-current-bg red; tmux set-option -q window-status-bg red; tmux set-option -q synchronize-panes on"
bind M run "tmux set-option -q status-bg black; tmux set-option -q window-status-current-bg black; tmux set-option -q window-status-bg black; tmux set-option -q synchronize-panes off"
# ステータスライン ##########################
set -g status-fg white
set -g status-bg black
set -g status-left-length 30
set -g status-left ''
set -g status-right ''
# 表示中のウィンドウ
setw -g window-status-current-style fg=yellow,bold,bg=black
# それ以外のウィンドウ
setw -g window-status-style fg=white,bg=black
# UTF-8サポート
# set -g status-utf8 on
# ステータスバーを更新
set -g status-interval 15
# ウィンドウリスト寄せ
# set -g status-justify left
set-option -g status-justify "centre"
# ステータスラインの上に空行を入れる
set -Fg 'status-format[1]' '#{status-format[0]}'
set -g 'status-format[0]' ''
set -g status-format[0] '#[fg=white,bg=black]'
set -g status 2
# 現在のディレクトリをステータスラインに表示する
set -g window-status-current-format ' #{window_index} #{b:pane_current_path}'
set -g window-status-format ' #{window_index} #{b:pane_current_path}'
# 他のウィンドウのアクティビティをステータスラインで表示する?
set -g monitor-activity off
# monitor-activity の際にステータスラインへメッセージを表示する?
set -g visual-activity off
# メッセージの表示時間 ms
set -g display-time 2000
# その他色 #############################
# アクティブなペインの背景職を変更する
# setw -g window-active-style 'bg=#F6F1E9'
# setw -g window-style 'bg=#ede8df'
# setw -g pane-active-border-style ''
# コピーモード選択色
set -g mode-style 'reverse'
# メッセージ色
set-option -g message-style bg=black,fg=red
# display-panes の色
set -g display-panes-colour blue
set -g display-panes-active-colour green
# ペインの境界色
set -g pane-active-border-style fg=green
set-option -g pane-border-style fg=blue
# 時計色
set-window-option -g clock-mode-colour black
# Screensaver
set -g lock-command "cmatrix -s -b"