-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.tmux.conf
209 lines (160 loc) · 7.28 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
# プレフィックス {{{
set -g prefix C-t
unbind C-b
bind C-t send-prefix
# }}}
# セッションオプション set-option (set) {{{
# show-options -g で確認
# ウィンドウ番号を1から開始
set -g base-index 1
# マウスクリックでペイン選択しない
# set -g mouse-select-pane off
# セッションで作成される新しいウィンドウのデフォルトの端末。環境変数TERMのデフォルト値。通常"screen"
# set -g default-terminal "screen-256color"
# メッセージ表示時間(ミリ秒)
set -g display-time 2000
# バッファ上限数
set -g buffer-limit 32
# ESCキー押下時の遅延(ミリ秒)
set -g escape-time 0
# tmuxは起動時に、環境変数をグローバル環境変数に格納する。
# かつ、セッションごとにも環境変数を持っている。
# なので新しいウインドウを作る時にグローバル環境変数をマージして子プロセスに渡す。
# tmux show-environment で確認可能。
set -g update-environment "SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION"
# ウィンドウマネージャ向けのタイトル
set -g set-titles on
set -g set-titles-string "[tmux]#T \"#W\"(#I/#P) @ #H"
# }}}
# ウィンドウオプション set-window-option (setw) {{{
# show-window-options -g で確認
# コピーモードのキーマップ。標準はemacs
setw -g mode-keys vi
# ウィンドウ名が自動的に更新されないように
# setw -g automatic-rename off
setw -g automatic-rename on
# }}}
# キーバインド bind-key (bind) / unbind-key (unbind) {{{
# list-keys で確認
# CtrlとAltが使える
# Ctrl : C-または^
# Alt : M-
# -rは連続で入力可能にする
# -nはプレフィックスキーをおさなくても動作するようになる
## 設定ファイルを再読込する
unbind r
bind r source-file ~/.tmux.conf\; display-message "[tmux] $HOME/.tmux.conf reloaded."
# prefix + C-c でも新規ウィンドウ作成
bind ^c new-window
# prefix + C-w でもウィンドウ一覧選択を表示
bind ^w choose-window
# prefix + C-f でもウィンドウ検索
bind ^f command-prompt "find-window %1"
# 直前にアクティブだったウィンドウを表示
bind ^t last-window
# ペイン分割
bind v split-window -h # 縦分割(ペインを水平に並べるの意味)
# bind s split-window -v # 横分割(ペインを縦に並べるの意味)
bind q kill-pane
bind T break-pane # 現在のペインを新しいウィンドウの単独ペインにする
# ペイン間の移動
bind j select-pane -D
bind k select-pane -U
bind h select-pane -L
bind l select-pane -R
bind l select-pane -R
# ペインのサイズ変更
bind -r ^j resize-pane -D 3
bind -r ^k resize-pane -U 3
bind -r ^l resize-pane -L 3
bind -r ^h resize-pane -R 3
# 新しいSSH接続を名前をつけたウィンドウで作成する。
unbind s
bind-key s command-prompt "new-window -n %1 'ssh -t %1'"
bind-key ^s command-prompt "split-window -h 'ssh -t %1'"
bind-key S command-prompt "split-window 'ssh -t %1'"
# 作業ログを取る
# bind-key H pipe-pane 'cat >> $HOME/.tmux/tmux-#W.log' \; display-message 'Started logging to $HOME/.tmux/tmux-#W.log'
# bind-key h pipe-pane \; display-message 'Ended logging to $HOME/.tmux/tmux-#W.log'
# }}}
# ステータスライン {{{
# ステータスラインを表示
set -g status on
#set -g status-utf8 on
# ステータス行更新間隔(1で毎秒更新・既定値15)
set -g status-interval 2
# tmux-powerline 用設定
set -g status-left "#(~/.vim/bundle/tmux-powerline/powerline.sh left)"
set -g status-right "#(~/.vim/bundle/tmux-powerline/powerline.sh right)"
set -g status-justify "left"
set -g status-left-length 100 # 左ステータスバーの幅
set -g status-right-length 120 # 右ステータスバーの幅
# 行の書式
# #(コマンド行) コマンド出力の最初の行
# #[属性] 色/属性の変更(例:#[fg=cyan,bright])
# #H ホスト名
# #I ウィンドウ番号
# #P ペイン番号
# #S セッション名
# #T ウィンドウタイトル
# #W ウィンドウ名
# ## 「#」の文字
#
# コマンドは繰り返し実行される (更新頻度はstatus-intervalによる・既定値は15秒)
# 指定可能な色は
# black red green yellow blue magenta cyan white
# の他、256色パレット上のcolour0,colour1, ... colour255が利用可能
# 指定可能な属性は
# bright(bold)[明るい(太字)], dim[暗い], underscore[下線], blink[点滅],
# reverse[反転], hidden[非表示], italics[イタリック], default[書式のクリア]
# (端末によっては効果がないものもある)
#
# 既定の属性
# 「xxx-fg」「xxx-bg」は色、「xxx-attr」は属性
# 透明にしたい場合、端末によっては
# status-bgを「default」にすると256色パレット色の表示が部分的におかしくなる?
# 背景色は端末エミュレータの背景色に近いものを設定すると良いかも
# 藤色:colour141
# 中央のウィンドウリスト
# set-window-option -g window-status-current-format "#[fg=colour235, bg=colour27]⮀#[fg=colour255, bg=colour27] #I ⮁ #W #[fg=colour27, bg=colour235]⮀"
set-window-option -g window-status-current-format "#[fg=colour235, bg=colour28]⮀#[fg=colour255, bg=colour28] #I:#W #[fg=colour28, bg=colour235]⮀"
set -g status-fg white
set -g status-bg colour235 # グレー
# set -g status-bg colour223
# set -g status-attr default
# 左ステータスバー
# set -g status-left-fg colour254
# set -g status-left-bg colour28
# set -g status-left-attr default
# 右ステータスバー
# set -g status-right-fg colour254
# set -g status-right-bg colour28
# set -g status-right-attr default
# ウィンドウ一覧部における現在非アクティブなウィンドウの項目の表示
# setw -g window-status-fg colour238
# setw -g window-status-bg default
# setw -g window-status-attr default
# ウィンドウ一覧部における現在アクティブなウィンドウの項目の表示
# 端末によっては256色の色を用いると正常に表示されない?
# setw -g window-status-current-fg colour254
# setw -g window-status-current-bg colour130
# setw -g window-status-current-attr bold
# メッセージ/プロンプト
#set -g message-fg colour254
#set -g message-bg colour34
#set -g message-attr bright
# スクロールの右上やコピーモード選択範囲のスタイル
#setw -g mode-fg colour254
#setw -g mode-bg colour34
# 256色パレットの色を付けると表示が変になる?(reverseすると回避可能?)
# setw -g mode-attr reverse,bold
# 左ステータス(現在時刻を表示)
# 日付/時刻部分はstrftime()と同様の書式
# set -g status-left "#%Y#[fg=colour211,bold]%m#[default,fg=colour212]/#[fg=colour218,bold]%d #[fg=colour81]%H#[default,blink,fg=colour45]:#[default,fg=colour75,bold]%M#[default]"
# set -g status-left "[%Y/%m/%d(%a)%H:%M]"
# set -g status-left-length 25 # 既定値は10
# 右ステータス(タイトルを表示)
# set-option -g status-right "[#T]"
# set-option -g status-right-length 99 # 右ステータスも長さ制限可
# }}}
# vim: set et fenc=utf-8 ff=unix ft=conf sts=2 sw=2 ts=2 fdm=marker: