-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtmux.conf
195 lines (172 loc) · 5.87 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
#$Id$: vim-keys.conf,v 1.2 2010-09-18 09:36:15 nicm Exp $
#
# vim-keys.conf, v1.2 2010/09/12
#
# By Daniel Thau. Public domain.
#
# This configuration file binds many vi- and vim-like bindings to the
# appropriate tmux key bindings. Note that for many key bindings there is no
# tmux analogue. This is intended for tmux 1.3, which handles pane selection
# differently from the previous versions
#change command sequence to alt-`
#unbind C-b
set-option -g prefix `
set-option -g prefix2 C-f
bind-key ` send-prefix
# Mouse
set -g mode-mouse on
setw -g mouse-select-window on
setw -g mouse-select-pane on
# This is hilariously absurd. How many nerds use tmux on OS X every day and
# it's still fundamentally broken?
set -g default-command "reattach-to-user-namespace -l zsh"
set -g default-command "reattach-to-user-namespace -l fish"
# split windows like vim
# vim's definition of a horizontal/vertical split is reversed from tmux's
bind v split-window -v
bind \ split-window -h
bind r source-file ~/.tmux.conf \; display-message "Config reloaded . . ."
# move around panes with hjkl, as one would in vim after pressing ctrl-w
#bottom pane
bind j select-pane -D
#top pane
bind k select-pane -U
#right pane
bind h select-pane -L
#right pane
bind l select-pane -R
bind -n M-k swap-pane -D
# Use Alt-arrow keys without prefix key to switch panes
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# Shift arrow to switch windows
bind -n S-Left previous-window
bind -n S-Right next-window
# 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 < resize-pane -L 5
bind > resize-pane -R 5
bind - resize-pane -D 5
bind = resize-pane -U 5
bind Z resize-pane -Z
bind-key S set-window-option synchronize-panes
#join panes
bind C-j command-prompt -p "join pane from:" "join-pane -s '%%'"
bind C-k command-prompt -p "send pane to:" "join-pane -t '%%'"
#split pane
bind C-b break-pane -t :
# vi-style controls for copy mode
setw -g mode-keys vi
bind p paste-buffer
bind-key -t vi-copy 'v' begin-selection
bind-key -t vi-copy 'y' copy-selection
bind-key -t vi-copy 'r' rectangle-toggle
bind-key -t vi-copy C-j page-down
bind-key -t vi-copy C-k page-up
bind-key -t vi-copy ? search-backward
bind-key -t vi-copy ^ back-to-indentation
bind-key -t vi-copy '$' end-of-line
#set -g default-command zsh
#set-option -g default-shell /opt/local/bin/zsh
set -g display-time 3000
#number windows starting from 1
#set -g base-index 1
set-option -g mouse-select-window on
set-option -g mouse-select-pan on
set-option -g mouse-resize-pan on
set-window-option -g mode-mouse on
# Bind function keys.
# And Alt Key!
bind 1 select-window -t 1
bind -n M-1 select-window -t 1
bind 2 select-window -t 2
bind -n M-2 select-window -t 2
bind 3 select-window -t 3
bind -n M-3 select-window -t 3
bind 4 select-window -t 4
bind -n M-4 select-window -t 4
bind 5 select-window -t 5
bind -n M-5 select-window -t 5
bind 6 select-window -t 6
bind -n M-6 select-window -t 6
bind 7 select-window -t 7
bind -n M-7 select-window -t 7
bind 8 select-window -t 8
bind -n M-8 select-window -t 8
bind 9 select-window -t 9
bind -n M-9 select-window -t 9
bind 0 select-window -t 0
bind -n M-0 select-window -t 0
#bind-key b set-option status
bind '~' split-window "exec htop"
#scrollback buffer n lines
set -g history-limit 50000
#listen for activity on all windows
set -g bell-action none
#set window notifications
setw -g monitor-activity off
set -g visual-activity off
#onscreen time for display panes in ms
set -g display-panes-time 2000
set-option -g display-panes-active-colour colour33 #blue
set-option -g display-panes-colour colour166 #orange
set-option -g pane-active-border-fg colour33
set-option -g pane-active-border-bg colour166
set-option -g status-left '#P'
#ctrl-pgup & pgdn work in vim
set -g xterm-keys on
#select-window -t 1
#highlight active 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.
setw -g aggressive-resize on
setw -g automatic-rename off
#osx clipboard
set-option -g default-command "reattach-to-user-namespace -l zsh"
set -g default-terminal "xterm-256color"
#set -g xterm-keys on
#supposedly fixes pausing in vim
set-option -sg escape-time 1
set-option -g status-utf8 on
set-option -g status-justify centre
#status bar
set -g status-bg black
set -g status-fg white
set-window-option -g window-status-format '#[fg=colour166,dim]#I#[fg=blue]:#[default]#W#[fg=grey,dim]#F'
set-window-option -g window-status-current-format '#[bg=red,fg=cyan]#I#[bg=red,fg=cyan]:#[fg=colour230,bg=red]#W#[fg=dim]#F'
#status right options
set -g status-right '#[fg=yellow][%a, %b %d %Y | #[fg=colour166]%r]#[default]'
set-option -g pane-active-border-fg red
set-option -g pane-active-border-bg white
set-option -g pane-border-fg yellow
set-option -g pane-border-bg black
set-option -g status-position top
bind C-v run "tmux set-buffer $(reattach-to-user-namespace pbpaste); tmux paste buffer"
bind C-c run "tmux save-buffer - | reattach-to-user-namespace pbcopy"
bind C-e command-prompt -p "session?,message?" "run-shell \"tmux list-windows -t %1 \| cut -d: -f1\|xargs -I\{\} tmux send-keys -t %1:\{\} %2\" Enter"
# Start windows and panes at 1, not 0
set -g base-index 1
set -g pane-base-index 1
# Command Prompt
bind -n M-: command-prompt
bind -n M-; command-prompt
# Autorename sanely.
setw -g automatic-rename on
# Better name management
bind c new-window
bind , command-prompt "rename-window '%%'"
# Copy mode
setw -g mode-keys vi
bind [ copy-mode
unbind p
bind p paste-buffer
bind -t vi-copy H start-of-line
bind -t vi-copy L end-of-line
bind -t vi-copy v begin-selection
bind -t vi-copy y copy-selection
bind -t vi-copy Escape cancel
bind y run "tmux save-buffer - | reattach-to-user-namespace pbcopy"