-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.tmux.conf
191 lines (148 loc) · 6.46 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
# prefixキーをC-kに変更する
set -g prefix C-k
# C-bのキーバインドを解除する
unbind C-b
# ステータスバーを上部に表示する
set-option -g status-position top
# 左右のステータスバーの長さを決定する
set-option -g status-left-length 120
set-option -g status-right-length 80
# ステータスライン設定
set-option -g status-left "#[default]#[bg=colour24,fg=colour16,bold] #S #[bg=colour234,fg=colour245] #T"
set-option -g status-right " \
#[fg=colour106]#{battery_percentage} #[fg=colour242]| \
#[fg=colour248]%Y/%m/%d(%a) #[fg=colour250]%H:%M "
# Address vim mode switching delay
set -s escape-time 0
# Increase scrollback buffer size from 2000 to 100000 lines
set -g history-limit 100000
# Increase tmux messages display duration from 750ms to 4s
set -g display-time 4000
# Refresh 'status-left' and 'status-right' more often, from every 15s to 5s
set-option -g status-interval 5
# (OS X) Fix pbcopy/pbpaste for old tmux versions (pre 2.6)
set -g default-command "reattach-to-user-namespace -l $SHELL"
# Use vi key bindings in copy mode
set -g mode-keys vi
# Emacs key bindings in tmux command prompt (prefix + :) are better than
# vi keys, even for vim users
set -g status-keys emacs
# Focus events enabled for terminals that support them
set -g focus-events on
# Super useful when using "grouped sessions" and multi-monitor setup
setw -g aggressive-resize on
# ウィンドウ番号などの位置
set-option -g status-justify right
# ウィンドウのインデックスを1から始める
set -g base-index 1
# ペインのインデックスを1から始める
setw -g pane-base-index 1
# ウィンドウを閉じた時にインデックス番号を振り直す
set-option -g renumber-windows on
# 設定ファイルをリロードする
bind-key r source-file ~/.tmux.conf \; display "Reloaded!"
# C-a*2でtmux内のプログラムにC-aを送る
bind-key C-a send-prefix
# | でペインを縦に分割する
bind-key | split-window -h
# - でペインを横に分割する
bind-key - split-window -v
# Vimのキーバインド(Prefix+hjkl)でペインを移動する
bind-key h select-pane -L
bind-key j select-pane -D
bind-key k select-pane -U
bind-key l select-pane -R
# Prefix + Ctrl-h/l でウィンドウ切り替え
# Prefix + Ctrl-h,h,h,h,...と連打できる
bind-key -r C-h select-window -t :-
bind-key -r C-l select-window -t :+
# Vimのキーバインドでペインをリサイズする
bind-key -r H resize-pane -L 5
bind-key -r J resize-pane -D 5
bind-key -r K resize-pane -U 5
bind-key -r L resize-pane -R 5
# Ctrl-o でペインをローテーションしながら移動
bind-key -n C-o select-pane -t :.+
# マウス操作を有効にする
set -g mouse on
# スクロールアップするとコピーモードに入る
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 -T root WheelDownPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; send-keys -M"
# 256色端末を使用する
set -g default-terminal "screen-256color"
set-option -sa terminal-overrides ",xterm-256color*:Tc"
# ステータスバーの色を設定する
set -g status-fg white
# set -g status-bg black
set -g status-bg colour234
# set -g status-bg colour233
# ウィンドウリストの色を設定する
setw -g window-status-style "bg=default fg=colour24"
# アクティブなウィンドウを目立たせる
setw -g window-status-current-style "bg=colour235 fg=colour172"
# ペインボーダーの色を設定する
set -g pane-border-style "fg=colour245"
# アクティブなペインを目立たせる
# set -g pane-active-border-style "fg=colour24"
set -g pane-active-border-style "fg=colour130"
# コマンドラインの色を設定する
set -g message-style "fg=white bg=black"
## ヴィジュアルノーティフィケーションを有効にする
# setw -g monitor-activity on
# set -g visual-activity on
# Prefix+v でコピーモード開始
bind-key v copy-mode \; display "Copy mode!"
bind-key -T copy-mode-vi v send-keys -X begin-selection
### コピーモード中 C-v で矩形選択開始
bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle
# Prefix+Enter/y でコピー
bind-key -T copy-mode-vi y send-keys -X copy-pipe "reattach-to-user-namespace pbcopy"
unbind -T copy-mode-vi Enter
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
### 1行選択
bind-key -T copy-mode-vi V send-keys -X select-line
### 1行コピー
bind-key -T copy-mode-vi Y send-keys copy-line
# Prefix+p でペースト
bind-key p paste-buffer
### Esc キーでコピーの反転を解除(コピーモードは抜けない)
bind-key -T copy-mode-vi Escape send-keys -X clear-selection
### Ctrl-c キーでコピーの反転を解除し、コピーモードから抜ける
bind-key -T copy-mode-vi C-c send-keys -X cancel
### Vi モード中に Ctrl-a で行頭に(Emacs ライク)
bind-key -T copy-mode-vi C-a send-keys -X start-of-line
### Vi モード中に Ctrl-e で行末に(Emacs ライク)
bind-key -T copy-mode-vi C-e send-keys -X end-of-line
### 単語の最初の1文字に移動
bind-key -T copy-mode-vi w send-keys -X next-word
### 単語の最後の1文字に移動
bind-key -T copy-mode-vi e send-keys -X next-word-end
### w の逆の動き back
bind-key -T copy-mode-vi b send-keys -X previous-word
### 画面上に映る最上行に移動
bind-key -T copy-mode-vi g send-keys -X top-line
### 画面上に映る最下行に移動
bind-key -T copy-mode-vi G send-keys -X bottom-line
### 前方検索
bind-key -T copy-mode-vi / send-keys -X search-forward
### 後方検索
bind-key -T copy-mode-vi ? send-keys -X search-backward
### ページスクロール
bind-key -T copy-mode-vi C-n send-keys -X page-up
bind-key -T copy-mode-vi C-f send-keys -X page-down
### ページ送り
bind-key -T copy-mode-vi C-u send-keys -X scroll-up
bind-key -T copy-mode-vi C-d send-keys -X scroll-down
# etc
set-option -g default-shell $SHELL
set-option -g default-command $SHELL
set -g set-clipboard off
set -s copy-command 'pbcopy'
# Plugiins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-battery'
# set -g @plugin 'tmux-plugins/tmux-copycat'
# set -g @plugin 'tmux-plugins/tmux-yank'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'