-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.tmux.conf
179 lines (143 loc) · 6.43 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
# prefixキーをC-qに変更する
set -g prefix C-q
# C-bのキーバインドを解除する
unbind C-b
# C-q*2でtmux内のプログラムにC-qを送る
bind C-q send-prefix
# Shift-Tab を back_tab として送信
bind -rn S-Tab send-keys '[Z'
# 新規ウィンドウを同ディレクトリで開く
bind c new-window -c '#{pane_current_path}'
# 設定ファイルをリロードする
bind r source-file ~/.tmux.conf \; display "Reloaded!"
# | でペインを縦に分割する
bind | split-window -h -c '#{pane_current_path}'
# - でペインを横に分割する
bind - split-window -v -c '#{pane_current_path}'
# xterm のキーバインドを使用可能にする
set-option -gw xterm-keys on
# Shift + カーソルキー でペインを移動する
bind-key -nr S-Left select-pane -L
bind-key -nr S-Right select-pane -R
bind-key -nr S-Up select-pane -U
bind-key -nr S-Down select-pane -D
# Vim/Emacs のキーバインドでペインを移動する
bind-key -r h select-pane -L
bind-key -r j select-pane -D
bind-key -r k select-pane -U
bind-key -r l select-pane -R
bind-key -r C-b select-pane -L
bind-key -r C-f select-pane -R
bind-key -r C-p select-pane -U
bind-key -r C-n select-pane -D
# Shift + HJKL でペインをリサイズする
bind-key -r H resize-pane -L 2
bind-key -r J resize-pane -D 2
bind-key -r K resize-pane -U 2
bind-key -r L resize-pane -R 2
# Ctrl + HJKL でウィンドウ・セッションを移動する
bind-key -r C-h previous-window
bind-key -r C-j switch-client -n
bind-key -r C-k switch-client -p
bind-key -r C-l next-window
# Shift + ドラッグでペインをスワップ
bind-key -n S-MouseDragEnd1Pane swap-pane -t =
# ペイン境界線の設定
# ACSを強制してペイン境界線をきれいに表示 (*:U8=0)
set -ag terminal-overrides ',*:U8=0,xterm-256color:Tc'
set -g pane-border-lines heavy
# 256色端末を使う
set -g default-terminal "screen-256color"
# prefix + Tab でウィンドウを隣と入れ替え
bind-key -r Tab swap-window -t+ \; next-window
bind-key -r S-Tab swap-window -t- \; previous-window
# prefix なしの Ctrl-Tab でウィンドウを移動する
bind-key -rn C-Tab next-window
bind-key -rn C-S-Tab previous-window
# prefix なしの Ctrl+→, Ctrl+← でウィンドウを移動する
bind-key -rn C-Right next-window
bind-key -rn C-Left previous-window
# prefix なしの Ctrl+↑, Ctri+↓ でセッション間を移動する
bind-key -rn C-Up switch-client -p
bind-key -rn C-Down switch-client -n
# prefix - Shift+C で新規セッション
bind-key -r C new-session
# prefix-x で何かを kill
bind-key x display-menu -T 'Kill what?' \
Process p "display-menu -T 'By which signal?' \
'1 SIGHUP' h 'run-shell \"kill -1 $(\"${DOTPATH}/tmux/get-current-process-pid\")\"' \
'2 SIGINT' i 'run-shell \"kill -2 $(\"${DOTPATH}/tmux/get-current-process-pid\")\"' \
'3 SIGQUIT' Q 'run-shell \"kill -3 $(\"${DOTPATH}/tmux/get-current-process-pid\")\"' \
'9 SIGKILL' k 'run-shell \"kill -9 $(\"${DOTPATH}/tmux/get-current-process-pid\")\"' \
'15 SIGTERM' t 'run-shell \"kill -15 $(\"${DOTPATH}/tmux/get-current-process-pid\")\"' \
" \
Pane P kill-pane \
Window w kill-window \
Session s "run-shell 'tmux switch-client -n \\\; kill-session -t \"\$(tmux display-message -p \"#S\")\"'" \
Server S kill-server
# ウィンドウのナンバリングを詰める
set-option -g renumber-windows on
# セッションのナンバリングを詰める
set-hook -g session-created "run ~/dotfiles/tmux/reorder-sessions.sh"
set-hook -g session-closed "run ~/dotfiles/tmux/reorder-sessions.sh"
# マウス操作を有効にする
setw -g mouse on
bind-key -T copy-mode-vi WheelUpPane send-keys -X -N 1 scroll-up
bind-key -T copy-mode-vi WheelDownPane send-keys -X -N 1 scroll-down
# ステータスバーの色を設定する
set -g status-fg white
set -g status-bg colour29
# ウィンドウリストのデフォルト色
setw -g window-status-style 'fg=colour36'
# アクティブなウィンドウを目立たせる
setw -g window-status-current-style 'fg=black,bg=colour41'
# prefix ':' 入力時のコマンドラインの色を設定する
# set -g message-style 'fg=white,bg=black,bright'
# ペインの設定
## ペインのデフォルト色
set -g window-style 'bg=colour235,dim'
set -g pane-border-style 'bg=colour235,fg=colour245,dim'
## アクティブなペインを目立たせる
set -g window-active-style 'bg=colour232,fg=terminal,nodim'
set -g pane-active-border-style 'bg=colour232,fg=white,nodim'
## ペインボーダーに情報を表示
set -g pane-border-status bottom
set -g pane-border-format "#(bash ${HOME}/dotfiles/tmux/responsive-pane-status.sh '#{pane_width}' '#{pane_current_command}' '#{pane_pid}' '#{pane_current_path}')"
# ステータスバーを設定する
## 左パネルを設定する
set -g status-left-length 40
set -g status-left "#{prefix_highlight}#(bash ${HOME}/dotfiles/tmux/responsive-window-status-l.sh '#{client_width}')"
## 右パネルを設定する
set -g status-right-length 60
set -g status-right "#(bash ${HOME}/dotfiles/tmux/responsive-window-status-r.sh '#{client_width}')"
## リフレッシュの間隔を設定する(デフォルト 15秒)
set -g status-interval 30
## ウィンドウリストの位置を中心寄せにする
set -g status-justify centre
## ヴィジュアルノーティフィケーションを有効にする
setw -g monitor-activity on
set -g visual-activity on
## ステータスバーを上部に表示する
set -g status-position top
# コピーモードを設定する
## viのキーバインドを使用する
setw -g mode-keys vi
## コピーモードの操作をvi風に設定する
bind-key -T copy-mode-vi v send-keys -X begin-selection
# Tmux Plugin Manager
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
# tmux-prefix-highlight
set -g @prefix_highlight_show_copy_mode 'on'
set -g @prefix_highlight_prefix_prompt ' ^Q '
set -g @prefix_highlight_copy_prompt 'Copy'
set -g @prefix_highlight_copy_mode_attr 'fg=black,bg=yellow'
set -g @prefix_highlight_empty_prompt ' TMUX '
# Install tpm if not installed
if "test ! -d ~/.tmux/plugins/tpm" \
"run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'"
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run -b '~/.tmux/plugins/tpm/tpm'