Repository navigation
Expand file tree
/
Copy pathtmux.conf
More file actions
197 lines (144 loc) · 5.69 KB
/
Copy pathtmux.conf
File metadata and controls
197 lines (144 loc) · 5.69 KB
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
# tmux起動時のシェルをzshにするset-option -g default-shell /usr/bin/fish
# List of plugins
# set -g @plugin 'tmux-plugins/tpm'
# set -g @plugin 'tmux-plugins/tmux-sensible'
# set -g @plugin 'tmux-plugins/tmux-resurrect'
# set -g @plugin 'tmux-plugins/tmux-continuum'
# Other examples:
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin 'github_username/plugin_name#branch'
# set -g @plugin 'git@github.com:user/plugin'
# set -g @plugin 'git@bitbucket.com:user/plugin'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
# run '~/.tmux/plugins/tpm/tpm'
# set -g @continuum-boot 'on'
# set -g @continuum-restore 'on'
# set -g @continuum-save-interval '60'
set -g terminal-overrides 'xterm'
set-option -g default-terminal "tmux-256color"
set-option -ga terminal-overrides "tmux-256color"
# prefixキーをC-aに変更
set -g prefix C-a
unbind C-b
bind C-a send-prefix
# C-qのキーバインドを解除
unbind C-q
# ステータスバーをトップに配置する
set-option -g status-position top
# 左右のステータスバーの長さを決定する
set-option -g status-left-length 90
set-option -g status-right-length 90
# #P => ペイン番号
# 最左に表示
set-option -g status-left '#H:[#P]'
# Wi-Fi、バッテリー残量、現在時刻
# 最右に表示
set-option -g status-right '#(wifi) #(battery --tmux) [%Y-%m-%d(%a) %H:%M:%S]'
# ステータスバーを1秒毎に描画し直す
set-option -g status-interval 1
# センタライズ(主にウィンドウ番号など)
# set-option -g status-justify centre
# # ステータスバーの色を設定する
set-option -g status-bg "#91d7e3"
# # status line の文字色を指定する。
# set-option -g status-fg "colour255"
# 端末タイトルを tmux セッション名:カレントディレクトリ に設定する。
# これにより niri のウィンドウタイトル(`niri msg --json windows`)が
# 区別可能になり、rofiウィンドウスイッチャーで tmux セッションを判別できる。
set -g set-titles on
set -g set-titles-string "#{session_name}:#{b:pane_current_path}"
bind h select-pane -L
bind l select-pane -R
# Ctrl-tで新しいウィンドウを開く
bind -n C-t new-window
# vimのキーバインドでペインを移動する
bind H select-pane -L
bind J select-pane -D
bind K select-pane -U
bind L select-pane -R
# Alt-h/lでウィンドウを左右に移動
bind -n M-h previous-window
bind -n M-l next-window
# Alt-Shift-h/lでウィンドウの位置を左右に移動
bind -n M-H swap-window -t -1\; select-window -t -1
bind -n M-L swap-window -t +1\; select-window -t +1
# vimのキーバインドでペインをリサイズする
bind -r S-H resize-pane -L 5
bind -r S-J resize-pane -D 5
bind -r S-K resize-pane -U 5
bind -r S-L resize-pane -R 5
# | でペインを縦分割する
bind | split-window -h
# - でペインを横分割する
bind - split-window -v
# v で縦分割、j で横分割
bind v split-window -h
bind j split-window -v
# 番号基準値を変更
set-option -g base-index 1
# window名を自動的にカレントディレクトリ名に設定
set-option -g allow-rename on
set-window-option -g automatic-rename on
set-window-option -g automatic-rename-format '#{b:pane_current_path}'
# # マウス操作を有効にする
# set-option -g mouse on
# bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'copy-mode -e'"
# コピーモードを設定する
# コピーモードでvimキーバインドを使う
setw -g mode-keys vi
# 'b' でコピーモード(選択モード)を起動
bind b copy-mode
# 'v' で選択を始める
bind -T copy-mode-vi v send -X begin-selection
# 'V' で行選択
bind -T copy-mode-vi V send -X select-line
# 'C-v' で矩形択
bind -T copy-mode-vi C-v send -X rectangle-toggle
# 'y' でヤンク
bind -T copy-mode-vi y send -X copy-selection
# 'Y' で行ヤンク
bind -T copy-mode-vi Y send -X copy-line
# 'C-p'でペースト
bind-key C-p paste-buffer
# # mouse
set -g mouse on
# vi copy (clipboard)
set-window-option -g mode-keys vi
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xsel -bi"
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xsel -bi"
# Explicit `C-c` key fires copying the selection
unbind -T copy-mode MouseDragEnd1Pane
unbind -T copy-mode-vi MouseDragEnd1Pane
bind-key -T copy-mode C-c send-keys -X copy-pipe-and-cancel "xsel -bi"
bind-key -T copy-mode-vi C-c send-keys -X copy-pipe-and-cancel "xsel -bi"
## esc の効きを良くする
set-option -g escape-time 0
guibg=NONE
# --- wsl (win32yank) ---
# https://github.com/equalsraf/win32yank
if "which win32yank.exe" "bind-key -T copy-mode-vi y send-keys -X copy-p ipe-and-cancel 'win32yank.exe -i'"
if "which win32yank.exe" "bind-key -T copy-mode-vi Enter send-keys -X copy-p ipe-and-cancel 'win32yank.exe -i'"
# pでペースト
# if "which win32yank.exe" "bind-key p run 'tmux set-buffer -- \"$(win32yank.e xe -o)\"; tmux paste-buffer'"
# NOTE: you can use vars with $<var> and ${<var>} as long as the str is double quoted: ""
# WARNING: hex colors can't contain capital letters
# --> Catppuccin (Macchiato)
thm_bg="#24273a"
thm_fg="#cad3f5"
thm_cyan="#91d7e3"
thm_black="#1e2030"
thm_gray="#363a4f"
thm_magenta="#c6a0f6"
thm_pink="#f5bde6"
thm_red="#ed8796"
thm_green="#a6da95"
thm_yellow="#eed49f"
thm_blue="#8aadf4"
thm_orange="#f5a97f"
thm_black4="#5b6078"
# tmuxを256色表示できるようにする
# set -g default-terminal "screen-256color"
# set-option -sa terminal-overrides ',alacritty:RGB'
# set -g default-shell /usr/bin/fish