-
Notifications
You must be signed in to change notification settings - Fork 8
/
tmux.conf
175 lines (136 loc) · 4.01 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
#
# general settings
#
# {{{
# prefix
set -g prefix C-s
# terminal name
set -g default-terminal "screen-256color"
# use 24bit color support
set -ga terminal-overrides ",xterm-256color:Tc"
# history size
set -g history-limit 10000
# escape key delay
set -s escape-time 0
# repeat timeout when -r bindings are used
set -g repeat-time 1000
# start index from 1
set -g base-index 1
# binding in choice mode
setw -g mode-keys vi
# binding in status line
set -g status-keys emacs
# mouse
set -g mouse on
# enable extra key combinations
set -g xterm-keys on
bind -n WheelUpPane select-pane -t= \; copy-mode -e \; send-keys -M
bind -n WheelDownPane select-pane -t= \; send-keys -M
# }}}
#
# key bindings
#
# {{{
# split window
bind-key s split-window -v -c "#{pane_current_path}"
bind-key v split-window -h -c "#{pane_current_path}"
# traverse panes in current window
bind-key -r C-j select-pane -t :.+
bind-key -r C-k select-pane -t :.-
# move to neighbor window
bind-key C-h previous-window
bind-key C-l next-window
# close pane
bind-key C-x kill-pane
# resize pane
bind-key -r Up resize-pane -U
bind-key -r Down resize-pane -D
bind-key -r Left resize-pane -L
bind-key -r Right resize-pane -R
# move to pane
bind-key h select-pane -L
bind-key j select-pane -D
bind-key k select-pane -U
bind-key l select-pane -R
# create window
bind-key n new-window -c "#{pane_current_path}"
# relocate panes
bind-key t select-layout main-vertical
# message
bind-key m display-message
# into choice mode
bind-key C-i copy-mode -u
bind-key i copy-mode
# toggle status line
bind-key b set-option status
# move windows to left or right
bind-key -r > swap-window -d -t :+
bind-key -r < swap-window -d -t :-
# swap ; and :
bind-key : last-pane
bind-key \; command-prompt
# make new window with current pane
bind-key C-b break-pane
# clock
bind-key C-q clock-mode
# re-source config
bind-key C-r source-file ~/.tmux.conf \; display-message "sourced ~/.tmux.conf"
# open mini window
bind-key C-m split-window -h -p 20 -c "#{pane_current_path}"
# reset width of each pane and relayout them vertical
bind-key C-v select-layout even-horizontal
# capture the buffer
bind-key C command-prompt -p 'save history to filename:' -I '~/tmux.history' 'capture-pane -S -32768 ; save-buffer %1 ; delete-buffer'
# Typing prefix twice sends itself
bind-key C-s send-prefix
# Scroll up to previous prompt U'w')
bind-key C-p copy-mode\; send-keys -X start-of-line\; send-keys -X search-backward "^U[;']w[;']) { "
# more vi key binds
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-selection
bind-key -T copy-mode-vi u send-keys -X page-up
bind-key -T copy-mode-vi d send-keys -X page-down
bind-key -T copy-mode-vi J send-keys -X bottom-line
bind-key -T copy-mode-vi K send-keys -X top-line
bind-key -T copy-mode-vi H send-keys -X back-to-indentation
bind-key -T copy-mode-vi L send-keys -X end-of-line
bind-key -T copy-mode-vi C-p send-keys -X start-of-line\; send-keys -X search-backward "^U[;']w[;']) { "
# }}}
#
# colors
#
# {{{
# status line colors
set-window-option -g window-status-current-style fg=green,bg=black
# }}}
#
# status bar
#
# {{{
# While prefix key is pressed, reverse color of 'status-left'
set-window-option -g status-left '#[fg=black,bg=green]#{?client_prefix,#[reverse],} [#S] #[default]'
# }}}
#
# others
#
# {{{
# $TERM_PROGRAM should be forwarded because we can distinguish
# Terminal.app and iTerm2.app by it.
# $COLORTERM should be forwarded because it is set by terminal.
set -ga update-environment " TERM_PROGRAM COLORTERM"
# }}}
#
# plugins
#
# {{{
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-open'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-cpu'
set -g @resurrect-save 'S'
set -g @resurrect-restore 'R'
# Set CPU percentage in status bar
set -g status-right '"#T" #{cpu_bg_color} CPU: #{cpu_icon} #{cpu_percentage} #[fg=black,bg=green]| %m/%d %H:%M '
run '~/.tmux/plugins/tpm/tpm'
# }}}