-
Notifications
You must be signed in to change notification settings - Fork 0
/
.tmux.conf
125 lines (98 loc) · 3.69 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
# options
# キーストロークのディレイを減らす
set -sg escape-time 1
# Prefix key: ^g
# #
# # Abbreviation:
# # - [key]
# # - {key} <- with Prefix key
# # - (key) <- with Alt (or in MacOS, Command key)
unbind-key C-b
# prefix key ^b -> ^g
set -g prefix C-g
bind-key C-g send-prefix
# C-g + rで設定をリロード
bind-key r source-file ~/.tmux.conf \; display-message "Reload Config!!"
#
# Structure in one session:
#
# ------------------
# | (Left,Right) ↓(num) OR click status bar ↓ (Enter)
# window1 <------> window2 window3 window4
# ===============================================================
# pane1 pane1 pane1 pane1
# ↕ (j,k)
# pane2 - - - pane2 - - - -> (pane2)
# | [Shift+Right]
# (pane3) <- - pane3
# [Shift+Left] ↓ (x) ↓ (X)
# x x
#
# resize panes
# vim like
bind-key -r C-h resize-pane -L 5
bind-key -r C-l resize-pane -R 5
bind-key -r C-j resize-pane -D 5
bind-key -r C-k resize-pane -U 5
# move between panes
# vim window like
bind-key h select-pane -L
bind-key j select-pane -D
bind-key k select-pane -U
bind-key l select-pane -R
# move between window
bind-key -n M-Right next-window
bind-key -n M-Left previous-window
# create new window
bind-key -n M-Enter new-window
# if session has > 1 windows in current, kill-pane without confirmation.
# # But confirm before killing pane when it is the last pane in the window.
bind-key -n M-x if "tmux display -p \"#{window_panes}\" | grep ^1\$" \
"confirm-before -p \"Kill the only pane in the window? It will kill this window too. (y/n)\" kill-pane" \
"kill-pane"
# if session has > 1 windows in current, kill-window without confirmation.
# But confirm before killing window when it is the last window in the session.
bind-key -n M-X if "tmux display -p \"#{session_windows}\" | grep ^1\$"\
"confirm-before -p \"Kill the only window in this session? It will kill the session too. (y/n)\" kill-window" \
"kill-window"
# pane の同期
bind-key 'e' setw synchronize-panes on
bind-key 'E' setw synchronize-panes off
# ステータスバーをトップに配置する
set-option -g status-position top
# 左右のステータスバーの長さを決定する
set-option -g status-left-length 90
set-option -g status-right-length 90
# #H => マシン名
# #P => ペイン番号
# 最左に表示
set-option -g status-left '#H:[#P]'
# 現在時刻
# 最右に表示
set-option -g status-right '[%Y-%m-%d(%a) %H:%M]'
# ステータスバーを1秒毎に描画し直す
set-option -g status-interval 1
# センタライズ(主にウィンドウ番号など)
set-option -g status-justify centre
# pane border
set-option -g pane-border-style "bg=black" #base02
set-option -g pane-active-border-style "bg=brightgreen" #base01
# Vi キーバインド
set-window-option -g mode-keys vi
# Prefix+v でコピーモード開始
bind-key v copy-mode \; display "Copy mode!"
# Prefix+Enter/y でコピー
bind-key -T copy-mode-vi 'Enter' send-keys -X copy-pipe-and-cancel "pbcopy"
bind-key -T copy-mode-vi 'y' send-keys -X copy-pipe-and-cancel "pbcopy"
# Prefix+p でペースト
# クリップボードにも保存されているので Cmd-v でもペースト可能
bind-key p paste-buffer
# pluginをtpmで管理
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'
set -g @resurrect-save 'S'
set -g @resurrect-restore 'R'
run -b '~/.tmux/plugins/tpm/tpm'
set -g default-terminal "xterm-256color"