-
Notifications
You must be signed in to change notification settings - Fork 16
/
.tmux.conf
141 lines (109 loc) · 4.19 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
# Set that stupid Esc-Wait off, so VI works again
set -sg escape-time 0
# All commands start with C-a
set -g prefix C-a
# Use True Colors
set -g default-terminal "tmux-256color"
set -ga terminal-overrides ",xterm-256color:Tc"
# Use mouse
set -g mouse on
# Start numbering at 1
set -g base-index 1
setw -g pane-base-index 1
set -g renumber-windows on
set -g allow-rename off
set -g history-limit 5000
set -g focus-events on
# Bindings
unbind %
bind | split-window -h -c "#{pane_current_path}"
bind _ split-window -v -c "#{pane_current_path}"
unbind [
bind Escape copy-mode
unbind p
bind p paste-buffer
bind -T copy-mode-vi 'v' send -X begin-selection
bind -T copy-mode-vi 'y' send -X copy-selection
bind -T copy-mode-vi 'V' send -X select-line
bind -T copy-mode-vi 'C-v' send -X rectangle-toggle
bind C-a send-prefix
bind a last-window
bind f run -b ftwind
# Smart pane switching with awareness of vim splits
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?|git$'"
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'
tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'"
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
"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
bind-key -T copy-mode-vi 'C-\' select-pane -l
bind C-l send-keys 'C-l'
bind -n M-h previous-window
bind -n M-l next-window
bind -n M-Left previous-window
bind -n M-Right next-window
# Re-order windows
bind-key -n C-S-Left swap-window -t -1\; select-window -t -1
bind-key -n C-S-Right swap-window -t +1\; select-window -t +1
# Reload the config.
bind r source-file ~/.tmux.conf \; display "Reloaded ~/.tmux.conf"
# Set panel title
bind t command-prompt -p "(rename-pane)" -I "#T" "select-pane -T '%%'"
# status bar
set -g status-style "bg=colour234,fg=white"
setw -g window-status-current-style "bg=colour234,fg=yellow"
# pane border
set -g pane-border-style "fg=colour237"
set -g pane-active-border-style "fg=colour221"
# message text
set -g message-style "bg=colour234,fg=brightblue"
set -g message-command-style "bg=colour234,fg=green"
# monitor activity
setw -g monitor-activity on
set -g visual-activity off
setw -g window-status-activity-style "bg=colour234,fg=brightblue,bold"
# mode colors
set -g mode-style "bg=colour67,fg=colour235"
set -g window-status-format "#{window_index}:#{window_name} "
set -g window-status-current-format "#{window_index}:#{window_name} "
set -g status-interval 2
set -g status-left-length 55
set -g status-right-length 150
set -g status-left '#{prefix_highlight} #[fg=blue]#{session_name} #[fg=brightblack]•#[default]'
set -g status-right '#{pane_title} #[fg=blue]#(tmux-mem-cpu -i 2 --colors) %H:%M#[default]'
# set -g status-right '#{pane_title} #[fg=blue]%H:%M#[default]'
set -g display-panes-time 1500
# Use F12 to switch between local and nested tmux
bind -T root F12 \
set prefix None \;\
set key-table off \;\
set window-status-current-style "bg=colour234,fg=green" \;\
if -F '#{pane_in_mode}' 'send-keys -X cancel' \;\
refresh-client -S \;\
bind -T off F12 \
set -u prefix \;\
set -u key-table \;\
set -u status-style \;\
set -u window-status-current-style \;\
set -u window-status-current-format \;\
refresh-client -S
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
set -g @resurrect-processes 'ssh'
set -g @resurrect-strategy-vim "session"
set -g @resurrect-capture-pane-contents 'on'
set -g @resurrect-save-shell-history 'on'
# initializes TMUX plugin manager
run '~/.tmux/plugins/tpm/tpm'