-
Notifications
You must be signed in to change notification settings - Fork 2
/
.tmux.conf
170 lines (140 loc) · 5.64 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
# This had some useful starter settings for tmux:
# http://me.veekun.com/blog/2012/03/21/tmux-is-sweet-as-heck/
set-option -g prefix `
unbind-key C-b
bind-key e send-prefix
bind-key ` last-window
unbind-key Up
unbind-key Down
unbind-key Left
unbind-key Right
unbind-key M-Up
unbind-key M-Down
unbind-key M-Left
unbind-key M-Right
bind-key -r h select-pane -L
bind-key -r j select-pane -D
bind-key -r l select-pane -R
bind-key -r k select-pane -U
bind-key -r H resize-pane -L
bind-key -r J resize-pane -D
bind-key -r K resize-pane -U
bind-key -r L resize-pane -R
bind-key -r M-h resize-pane -L 5
bind-key -r M-j resize-pane -D 5
bind-key -r M-k resize-pane -U 5
bind-key -r M-l resize-pane -R 5
bind-key -r M-H resize-pane -L 10
bind-key -r M-J resize-pane -D 10
bind-key -r M-K resize-pane -U 10
bind-key -r M-L resize-pane -R 10
bind-key -T prefix M-p switch-client -T pane-select
bind-key -T pane-select 1 select-pane -t 1
bind-key -T pane-select 2 select-pane -t 2
bind-key -T pane-select 3 select-pane -t 3
bind-key -T pane-select 4 select-pane -t 4
bind-key -T pane-select 5 select-pane -t 5
bind-key -T pane-select 6 select-pane -t 6
bind-key -T pane-select 7 select-pane -t 7
bind-key -T pane-select 8 select-pane -t 8
bind-key -T pane-select 9 select-pane -t 9
bind-key -T pane-select 0 select-pane -t 10
bind-key -T prefix 0 select-window -t :=10
# bind-key -r C-M-h swap-pane -L
bind-key -r C-M-j swap-pane -D
bind-key -r C-M-k swap-pane -U
# bind-key -r C-M-l swap-pane -R
bind-key R send-key -R
bind-key C new-session
# Reduce the escape-vs-alt timeout to 50ms, otherwise wait 500ms in vim
# to exit insert mode
set-option -sg escape-time 50
# Start terminals at 1 instead of 0
set-option -g base-index 1
set-option -g pane-base-index 1
# Support fancy colors
set-option -g default-terminal screen-256color
# to make ctrl-arrow, etc. work
set-window-option -g xterm-keys on
# http://jasonwryan.com/blog/2010/01/07/tmux-terminal-multiplexer/
# Toggle status line using a keybinding
bind-key b set-option status
# From https://github.com/eevee/rc/blob/master/.tmux.conf
# COLORS.
# For reference, the xterm color cube points are: 00, 5F, 87, AF, D7, FF
# Status bar has a dim gray background
set-option -g status-style "bg=colour234,fg=colour0"
# Left shows the session name, in blue
set-option -g status-left-style "bg=default,fg=colour74"
# Right is some CPU stats, so terminal green
set-option -g status-right-style "bg=default,fg=colour71"
# Windows are medium gray; current window is white
set-window-option -g window-status-style "fg=colour244"
set-window-option -g window-status-current-style "bg=#000000,fg=#ffffff"
# Beeped windows get a blinding orange background
set-window-option -g window-status-bell-style "bg=#d78700,fg=#000000"
# Trim window titles to a reasonable length
# Disabled for now.
#set-window-option -g window-status-format '#[fg=yellow]#F#I#[default] #32W '
#set-window-option -g window-status-current-format '#[fg=yellow] #I#[default] #32W '
# From: http://tangledhelix.com/blog/2012/07/16/tmux-and-mouse-mode/
# Toggle mouse on with ^B m
bind m \
set -g mode-mouse on \;\
set -g mouse-resize-pane on \;\
set -g mouse-select-pane on \;\
set -g mouse-select-window on \;\
display 'Mouse: ON'
# Toggle mouse off with ^B M
bind M \
set -g mode-mouse off \;\
set -g mouse-resize-pane off \;\
set -g mouse-select-pane off \;\
set -g mouse-select-window off \;\
display 'Mouse: OFF'
# http://unix.stackexchange.com/questions/12032/create-new-window-with-current-directory-in-tmux
bind-key c new-window -c '#{pane_current_path}'
bind-key '"' split-window -c '#{pane_current_path}'
bind-key % split-window -h -c '#{pane_current_path}'
# Reload config
bind-key M-R \
source-file ~/.tmux.conf \;\
display-message "Reloaded ~/.tmux.conf"
# reattach-to-user-namespace on new shells
# https://github.com/atom/atom/issues/3093#issuecomment-59784274
set-option -g default-command "type reattach-to-user-namespace 1>/dev/null 2>&1 > /dev/null && exec reattach-to-user-namespace -l $SHELL || exec $SHELL -l"
# Reverting repeat-time to previous default (A new version of tmux
# changed the default repeat-time to something much longer, causing
# problems for my workflow)
set-option -g repeat-time 200
# http://stackoverflow.com/a/18777877
set-option -g history-limit 5000
# Switch to another session on last window close
set-option -g detach-on-destroy off
set -g @plugin 'tmux-plugins/tpm'
set-option -g @tmux_cluster_prompt_key M-C # Launch tmux-cluster
set -g @plugin 'davidscholberg/tmux-cluster'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'
# https://evertpot.com/osx-tmux-vim-copy-paste-clipboard/
# Use vim keybindings in copy mode
setw -g mode-keys vi
#
# Setup 'v' to begin selection as in Vim
bind -T copy-mode-vi v send -X begin-selection
bind -T copy-mode-vi y send -X copy-pipe "reattach-to-user-namespace pbcopy" \; display-message "copied to system clipboard" \; send-keys C-c
#
# Update default binding of `Enter` to also use copy-pipe
unbind -T copy-mode-vi Enter
unbind -T copy-mode-vi Enter
bind -T copy-mode-vi Enter send -X copy-pipe "reattach-to-user-namespace pbcopy" \; display-message "copied to system clipboard" \; send-keys C-c
#
# Bind ']' to use pbpaste
bind ] run "reattach-to-user-namespace pbpaste | tmux load-buffer - && tmux paste-buffer"
# Enable 24-bit color :hyperspace:
# https://github.com/dandavison/delta#24-bit-color
set -ga terminal-overrides ",xterm-256color:Tc"
# Clear scrollback
# https://stackoverflow.com/questions/10543684/how-can-i-clear-scrollback-buffer-in-tmux
bind -n C-k clear-history
run '~/.tmux/plugins/tpm/tpm'