-
Notifications
You must be signed in to change notification settings - Fork 4
/
tmux.conf
199 lines (148 loc) · 5.35 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
# .tmux.conf
#
# Tmux configuration of Champions
#
# By: Brandon Bayer
# Found: http://github.com/mutewinter/
# Cobbled: Together
# ------------------------
# tmux prefix key
# ------------------------
unbind C-b
set -g prefix C-t
bind C-t send-prefix
# Use different prefix to send prefix to nested (server) sessions
bind-key -n C-s send-prefix
# ------------------------
# Preferences
# ------------------------
# Use VI Bindings in Copy Mode
set-window-option -g mode-keys vi
# Don't limit size from a client that's not actively viewing the session
setw -g aggressive-resize on
# Huge history
set-option -g history-limit 100000
# Use low timeout so ESC isn't delayed in vim
set -g escape-time 10
# Enable mouse (requires tmux 2.1+)
set -g mouse on
# Disable new activity notice
set -g monitor-activity off
# ensure 256 colors in terminal recognized by vim
# set -g default-terminal "screen-256color"
set -ga terminal-overrides ",xterm-256color:Tc"
# Start window numbering at 1
set -g base-index 1
set-window-option -g pane-base-index 1
# Update status bar interval
set-option -g status-interval 1
# ------------------------
# Status Bar
# ------------------------
set -g status-left ''
set -g status-right ''
# Make windows slightly more readable
set -g window-status-format " #I: #W "
# OSX style anyone?
set -g status-position top
# Put the windows in the center
set -g status-justify centre
# ------------------------
# Bindings
# ------------------------
is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?)(diff)?$"'
# Reload tmux.conf on the fly
unbind r
bind r source-file ~/.tmux.conf
# Toggle current and previous panes full screen.
bind -n M-t select-pane -l\; resize-pane -Z
# Resize panes with arrow keys
bind -n M-Up if-shell "$is_vim" "send-keys M-Up" "resize-pane -U"
bind -n M-Down if-shell "$is_vim" "send-keys M-Down" "resize-pane -D"
bind -n M-Left if-shell "$is_vim" "send-keys M-Left" "resize-pane -L"
bind -n M-Right if-shell "$is_vim" "send-keys M-Right" "resize-pane -R"
# Zoom pane to full screen
bind-key -nr M-z resize-pane -Z
# Horizontal and vertical pane splits
bind -n M-\ split-window -h -c "#{pane_current_path}"
bind -n M-- split-window -v -c "#{pane_current_path}"
# Next / Previous Window
bind -n M-i next-window
bind -n M-u previous-window
bind -n M-y last-window
# Kill current session & switch to previous
bind-key k confirm-before -p "Kill #S (y/n)?" "run-shell 'tmux switch-client -n \\\; kill-session -t \"\$(tmux display-message -p \"#S\")\"'"
# Copy and Paste Mode
# bind-key -n M-v copy-mode
# bind-key -n M-i paste-buffer
# -------------------------------------------------------
# Smart pane switching with awareness of vim splits
# from: https://github.com/christoomey/vim-tmux-navigator
# -------------------------------------------------------
bind -n M-h if-shell "$is_vim" "send-keys M-h" "select-pane -L"
bind -n M-j if-shell "$is_vim" "send-keys M-j" "select-pane -D"
bind -n M-k if-shell "$is_vim" "send-keys M-k" "select-pane -U"
bind -n M-l if-shell "$is_vim" "send-keys M-l" "select-pane -R"
# For switching vim panes through an ssh session
# (these require the tmux-prefix to first be pressed)
bind -r C-h run "tmux send-keys M-h"
bind -r C-j run "tmux send-keys M-j"
bind -r C-k run "tmux send-keys M-k"
bind -r C-l run "tmux send-keys M-l"
# -------------
# Vim Copy Mode
# from: http://cl.ly/0e2U2v062D3d
# -------------
# Setup 'v' to begin selection as in Vim
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind -T copy-mode-vi y send -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
# bind-key -t vi-copy y copy-pipe "xsel -i -p -b"
# bind-key p run "xsel -o | tmux load-buffer - ; tmux paste-buffer"
# Update default binding of `Enter` to also use copy-pipe
unbind -T copy-mode-vi Enter
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel 'reattach-to-user-namespace pbcopy'
# bind-key -t vi-copy Enter copy-pipe "xsel -i -p -b"
# Fix tmux to use system clipboard
set-option -g default-command "reattach-to-user-namespace -l $SHELL"
bind -n M-y run "tmux save-buffer - | reattach-to-user-namespace pbcopy"
# ---------------
# Change Sessions
# ---------------
# List
bind -n M-8 choose-session
# Previous
bind -n M-9 switch-client -p
# Next
bind -n M-0 switch-client -n
# No More Accidental Pane Killing
bind ^x kill-pane
# ------------------------
# Colors (Solarized)
# From: https://github.com/seebi/tmux-colors-solarized
# ------------------------
# default statusbar colors
set-option -g status-bg default
set-option -g status-fg blue
# set-window-option -g status-left-fg blue
# set-window-option -g status-left-bg default
# set-window-option -g status-right-fg blue
# set-window-option -g status-right-bg default
# default window title colors
# set-window-option -g window-status-fg brightblue
# set-window-option -g window-status-bg default
# active window title colors
# set-window-option -g window-status-current-fg black
set-window-option -g window-status-current-bg white
# pane border
# set-option -g pane-border-fg black
# set-option -g pane-active-border-fg yellow
# message text
# set-option -g message-bg black
# set-option -g message-fg yellow
# pane number display
# set-option -g display-panes-active-colour blue
# set-option -g display-panes-colour yellow
# clock
# set-window-option -g clock-mode-colour green
# bell
set-window-option -g window-status-bell-style fg=black,bg=red