-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtmux.conf
200 lines (157 loc) · 7 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
191
192
193
194
195
196
197
198
199
200
######################################################################
## BASICS ##
######################################################################
unbind C-b
set -g prefix C-a
# bind-key -r C-s send-prefix
bind-key C-a last-window
## set scrollback history to 10000 (10k)
set -g history-limit 10000
## Allows for faster key repetition
set -s escape-time 0
## terminal colors
set-option -g default-terminal "xterm-256color"
set -ga terminal-overrides ",xterm-256color:Tc"
## listen to alerts from all windows
set -g bell-action any
## mouse
set -g mouse on
# setw -g mode-mouse on
# don't rename windows automatically
set-option -g allow-rename off
setw -g mode-keys vi
### Allows us to use C-a a <command> to send commands to a TMUX session inside
### another TMUX session
#bind-key a send-prefix
### Start windows and panes at 1, not 0
#set -g base-index 1
#setw -g pane-base-index 1
## Open ~/.tmux.conf in vim and reload settings on quit
unbind e
bind e new-window -n '~/.tmux.conf' "sh -c 'vim ~/.tmux.conf && tmux source ~/.tmux.conf'"
## reload config
bind-key r source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded"
######################################################################
## STATUS LINE ##
######################################################################
set -g status-interval 5
# set -g status-justify centre # center align window list
# set -g status-left-length 20
# set -g status-right-length 100
# set -g status-left '#h'
set-option -g status-right "#(date '+%Y.%m.%d %H:%M') #(wemux status_users) | #{cpu_percentage} "
# set color for status bar
# set-option -g status-bg colour235 #base02
set-option -g status-bg "#304655"
set-option -g status-fg "#cccccc"
######################################################################
## WINDOWS ##
######################################################################
## open new windows in the current path
bind c new-window -c "#{pane_current_path}"
# bind-key b break-pane -d
#set -g renumber-windows on
## easier and faster switching between next/prev window
# COLLIDES WITH VIM?
# bind C-p previous-window
# bind C-n next-window
## Rather than constraining window size to the maximum size of any client
## connected to the *session*, constrain window size to the maximum size of any
## client connected to *that window*. Much more reasonable.
## super useful when using "grouped sessions" and multi-monitor setup
setw -g aggressive-resize on
# default window title colors
# set-window-option -g window-status-style fg=colour244,bg=default,dim # fg=base0
# active window title colors
# set-window-option -g window-status-current-style fg=default,bg=default,bright # fg=orange
# set -g window-status-current-bg black
# set -g window-status-current-fg
# set -g window-status-current-attr bold
set-window-option -g window-status-current-format "\
#[fg=colour250, bg=colour26] #I* \
#[fg=colour250, bg=colour26, bold] #W "
set-window-option -g window-status-current-format "#[fg=#eeeeee,bg=#111111, bold] #I #W "
set-window-option -g window-status-format " #I #W "
#set-window-option -g window-status-current-format "\
##[fg=colour237, bg=colour214]\
##[fg=colour239, bg=colour214] #I* \
##[fg=colour239, bg=colour214, bold] #W \
##[fg=colour214, bg=colour237]"
#set-window-option -g window-status-format "\
##[fg=colour237,bg=colour239,noitalics]\
##[fg=colour223,bg=colour239] #I \
##[fg=colour223, bg=colour239] #W \
##[fg=colour239, bg=colour237]"
#######################################################################
### PANES ##
#######################################################################
### splitters
bind-key - split-window -v -c '#{pane_current_path}'
bind-key '\' split-window -h -c '#{pane_current_path}'
### quick pane cycling
unbind ^A
bind ^A select-pane -t :.+
# Pane number display
set-option -g display-panes-active-colour colour1 #fg2
set-option -g display-panes-colour colour237 #bg1
### pane border
# INVALID?
# set-option -g pane-border-fg colour240 #base02
# set-option -g pane-active-border-fg yellow
# Set active pane border color
set-option -g pane-active-border-style fg=green
# Set inactive pane border color
set-option -g pane-border-style fg=colour240
# Move around panes with hjkl, as one would in vim after pressing ctrl + w
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
### Fine adjustment (1 or 2 cursor cells per bump)
#bind -n S-Left resize-pane -L 2
#bind -n S-Right resize-pane -R 2
#bind -n S-Down resize-pane -D 1
#bind -n S-Up resize-pane -U 1
### Coarse adjustment (5 or 10 cursor cells per bump)
bind -n C-Left resize-pane -L 10
#bind -n C-Right resize-pane -R 10
#bind -n C-Down resize-pane -D 5
#bind -n C-Up resize-pane -U 5
### Smart pane switching with awareness of Vim splits.
### See: https://github.com/christoomey/vim-tmux-navigator
## is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
## | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
## bind-key -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
## bind-key -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
## bind-key -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
## bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
## bind-key -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
## bind-key -T copy-mode-vi C-h select-pane -L
## bind-key -T copy-mode-vi C-j select-pane -D
## bind-key -T copy-mode-vi C-k select-pane -U
## bind-key -T copy-mode-vi C-l select-pane -R
### https://blog.bugsnag.com/tmux-and-vim/
#is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
# | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
#is_fzf="ps -o state= -o comm= -t '#{pane_tty}' \
# | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?fzf$'"
#bind -n C-h run "($is_vim && tmux send-keys C-h) || \
# tmux select-pane -L"
#bind -n C-j run "($is_vim && tmux send-keys C-j) || \
# ($is_fzf && tmux send-keys C-j) || \
# tmux select-pane -D"
#bind -n C-k run "($is_vim && tmux send-keys C-k) || \
# ($is_fzf && tmux send-keys C-k) || \
# tmux select-pane -U"
#bind -n C-l run "($is_vim && tmux send-keys C-l) || \
# tmux select-pane -R"
#bind-key -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
#######################################################################
### COPY/PASTE ##
#######################################################################
# git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-cpu'
set -g @plugin 'tmux-plugins/tmux-copycat'
set -g @plugin 'tmux-plugins/tmux-yank'
run -b '~/.tmux/plugins/tpm/tpm'