-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path_tmux.conf
210 lines (169 loc) · 6.42 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
201
202
203
204
205
206
207
208
209
210
# Map prefix to CTRL-o
unbind C-b
set -g prefix C-o
bind C-o send-prefix
# split windows like vim
# vim's definition of a horizontal/vertical split is reversed from tmux's
bind s split-window -v
bind v split-window -h
# 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
# resize panes like vim
# feel free to change the "1" to however many lines you want to resize by, only
# one at a time can be slow
bind -r < resize-pane -L 2
bind -r > resize-pane -R 2
bind -r - resize-pane -D 1
bind -r + resize-pane -U 1
# force a reload of the config file
unbind r
bind r source-file ~/.tmux.conf
# copy mode
unbind p
bind p paste-buffer
bind PgUp copy-mode -u
bind -Tcopy-mode-vi 'v' send -X begin-selection
bind -Tcopy-mode-vi 'r' send -X rectangle-toggle
bind -Tcopy-mode-vi 'y' send -X copy-selection
# quick pane cycling
unbind ^F
bind ^F select-pane -t :.+
# switch panes
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# select window with meta+number
bind -n M-1 select-window -t 1
bind -n M-2 select-window -t 2
bind -n M-3 select-window -t 3
bind -n M-4 select-window -t 4
bind -n M-5 select-window -t 5
bind -n M-6 select-window -t 6
bind -n M-7 select-window -t 7
bind -n M-8 select-window -t 8
bind -n M-9 select-window -t 9
# use regular ctrl+hjkl to switch between tmux and vim panes
# Requires vim to respond to ctrl+hjkl in a certain way:
# https://github.com/aaronjensen/vimfiles/blob/41315d26407de7c3d2bbabd2d412b049642f09b5/vimrc#L466-L497
bind -n ^H run "(tmux display-message -p '#{pane_title}' | grep -iq vim && tmux send-keys ^H) || tmux select-pane -L"
bind -n ^J run "(tmux display-message -p '#{pane_title}' | grep -iq vim && tmux send-keys ^J) || tmux select-pane -D"
bind -n ^K run "(tmux display-message -p '#{pane_title}' | grep -iq vim && tmux send-keys ^K) || tmux select-pane -U"
bind -n ^L run "(tmux display-message -p '#{pane_title}' | grep -iq vim && tmux send-keys ^L) || tmux select-pane -R"
# splits
bind s split-window -v
bind v split-window -h
# resize panes
bind -r ^L resize-pane -R 5
bind -r ^J resize-pane -D 5
bind -r ^K resize-pane -U 5
bind -r ^H resize-pane -L 5
bind -n M-t next-window
bind -n M-r previous-window
# zoom
unbind ^M
bind ^M resize-pane -Z
# Copy/paste to system clipboard
bind C-c run "tmux save-buffer - | xsel -i" \; display-message "tmux buffer -> mouse clipboard"
bind C-v run "xsel -o | tmux load-buffer - && tmux paste-buffer"
# listen for activity on all windows
set -g bell-action any
# time for repeat keypress without prefix
set -g repeat-time 1000
# on-screen time for display-panes in ms
set -g display-panes-time 3000
# start window indexing at one instead of zero
set -g base-index 1
set -g pane-base-index 1
# enable wm window titles
set -g set-titles on
# wm window title string (uses statusbar variables)
set -g set-titles-string "tmux.#I.#W"
# center align the window list
set -g status-justify centre
# vi-style controls for copy mode
setw -g mode-keys vi
set -g history-limit 5000
set -g default-shell /bin/bash
# Time for display messages
set -g display-time 5000
################################################################################
# Mouse settings
################################################################################
setw -g mouse off
# Toggle mouse on
bind m \
set -g mouse on \;\
display 'Mouse: ON'
# Toggle mouse off
bind M \
set -g mouse off \;\
display 'Mouse: OFF'
################################################################################
# Other options
################################################################################
set -g default-terminal "screen-256color"
set -g status-keys vi
# Faster Command Sequences
set -s escape-time 0
# not really sure what this does, but with it, the scrollwheel works inside Vim
#set -g mouse-utf8 on
set -g set-clipboard on
set -g history-limit 50000
# copy environment variables
#set -g update-environment -r
# This enables iterm cursor changes from vim. In vim you'll need:
# if exists('$TMUX')
# let &t_SI = "\<Esc>[3 q"
# let &t_EI = "\<Esc>[0 q"
# endif
#
# Source: https://github.com/Casecommons/casecommons_workstation/blob/master/templates/default/dot_tmux.conf.erb
# https://github.com/Casecommons/vim-config/blob/master/init/tmux.vim
set-option -g terminal-overrides '*88col*:colors=88,*256col*:colors=256,xterm*:XT:Ms=\E]52;%p1%s;%p2%s\007:Cc=\E]12;%p1%s\007:Cr=\E]112\007:Cs=\E]50;CursorShape=%?%p1%{3}%<%t%{0}%e%p1%{2}%-%;%d\007'
# Window options
#setw -g utf8 on
setw -g xterm-keys on
setw -g automatic-rename on
setw -g monitor-activity on
setw -g aggressive-resize on
set -g visual-bell on
################################################################################
# B&W COLORS
################################################################################
#set -g status-bg black
#set -g status-fg white
#set -g window-status-current-bg white
#set -g window-status-current-fg black
#set -g window-status-current-attr bold
################################################################################
#### COLOUR (Solarized 256)
# default statusbar colors
set-option -g status-style fg=colour136,bg=colour235 #yellow and base02
# default window title colors
set-window-option -g window-status-style fg=colour244,bg=default #base0 and default
#set-window-option -g window-status-style dim
# active window title colors
set-window-option -g window-status-current-style fg=colour166,bg=default #orange and default
#set-window-option -g window-status-current-style bright
# pane border
set-option -g pane-border-style fg=colour235 #base02
set-option -g pane-active-border-style fg=colour240 #base01
# message text
set-option -g message-style fg=colour166,bg=colour235 #orange and base02
# pane number display
set-option -g display-panes-active-colour colour33 #blue
set-option -g display-panes-colour colour166 #orange
# clock
set-window-option -g clock-mode-colour colour64 #green
# bell
set-window-option -g window-status-bell-style fg=colour235,bg=colour160 #base02, red
#### COLOUR (Solarized 256)
################################################################################
bind C-a command-prompt -p "Command to all panes in this window:" \
"run \"tmux list-panes -F '##{pane_index}' | xargs -I PANE \
tmux send-keys -t PANE '%1' Enter\""
source "/usr/share/powerline/bindings/tmux/powerline.conf"