-
Notifications
You must be signed in to change notification settings - Fork 2
/
tmux.conf
231 lines (168 loc) · 7.09 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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# Configuration
###########################
# use 256 term for pretty colors
set -g default-terminal "screen-256color"
# increase scroll-back history
set -g history-limit 5000
# use vim key bindings
setw -g mode-keys vi
# decrease command delay (increases vim responsiveness)
set -sg escape-time 1
# increase repeat time for repeatable commands
set -g repeat-time 1000
# start window index at 1
set -g base-index 1
# start pane index at 1
setw -g pane-base-index 1
# highlight window when it has new activity
setw -g monitor-activity on
set -g visual-activity on
# re-number windows when one is closed
set -g renumber-windows on
# enable pbcopy and pbpaste
# https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard/blob/master/README.md
# uncomment next line if mac
# set-option -g default-command "reattach-to-user-namespace -l zsh"
###########################
# Key Bindings
###########################
# tmux prefix
unbind C-b
set-option -g prefix C-Space
bind-key C-Space send-prefix
# paste
unbind C-p
bind C-p paste-buffer
# window splitting
unbind %
bind | split-window -h -c '#{pane_current_path}'
bind \\ split-window -h -c '#{pane_current_path}'
unbind '"'
bind - split-window -v -c '#{pane_current_path}'
bind c new-window -c "#{pane_current_path}"
# break a pane to a new window
bind-key b break-pane -d
# quickly switch panes
unbind ^J
bind ^J select-pane -t :.+
# force a reload of the config file
unbind r
bind r source-file ~/.tmux.conf \; display "~/.tmux.conf Reloaded!"
# renumber windows sequentially after closing any of them
set -g renumber-windows on
# act like vim
setw -g mode-keys vi
# bind -T copy-mode C-c send -X copy-pipe-no-clear "xsel -i --clipboard"
# Setup 'v' to begin selection as in Vim
bind-key -T copy-mode-vi v send -X begin-selection
# bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
# Update default binding of `Enter` to also use copy-pipe
unbind -T copy-mode-vi Enter
# uncomment next line if mac
# bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"
# bind-key -T copy-mode-vi y send-keys -X copy-selection
bind-key -T copy-mode-vi r send-keys -X rectangle-toggle
bind P paste-buffer
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind-key -r C-h select-window -t :-
bind-key -r C-l select-window -t :+
# enable mouse support for switching panes/windows
set -g mouse on
# maximizing and restoring windows
unbind Up
bind Up new-window -d -n fullscreen \; swap-pane -s fullscreen.1 \; select-window -t fullscreen
unbind Down
bind Down last-window \; swap-pane -s fullscreen.1 \; kill-window -t fullscreen
# Fine adjustment (1 or 2 cursor cells per bump)
bind -n S-Left resize-pane -L 2
bind -n S-Right resize-pane -R 2
bind -n S-Down resize-pane -D 1
bind -n S-Up resize-pane -U 1
# Resize pane shortcuts
bind -r H resize-pane -L 10
bind -r J resize-pane -D 10
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
# smart pane switching with awareness of vim splits
bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L"
bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-j) || tmux select-pane -D"
bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-k) || tmux select-pane -U"
bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-l) || tmux select-pane -R"
bind -n C-\\ run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys 'C-\\') || tmux select-pane -l"
bind C-j split-window -v "tmux list-sessions | sed -E 's/:.*$//' | grep -v \"^$(tmux display-message -p '#S')\$\" | fzf --reverse | xargs tmux switch-client -t"
# Prompted join-pane
bind-key j command-prompt -p "join pane from: " "join-pane -h -s '%%'"
# Easily swap a pane (targeted by pane number) with the current pane
bind-key s display-panes\; command-prompt -p "pane #: " "swap-pane -t '%%'"
bind-key C-b send-keys 'tat && exit' 'C-m'
bind-key K run-shell 'tmux switch-client -n \; kill-session -t "$(tmux display-message -p "#S")" || tmux kill-session'
# alt+ middle keys to change window
bind-key -n M-a select-window -t 0
bind-key -n M-s select-window -t 1
bind-key -n M-d select-window -t 2
bind-key -n M-f select-window -t 3
bind-key -n M-g select-window -t 4
# disable this because of iterm2`
# setw -g aggressive-resize on
###########################
# Status Bar
###########################
# set refresh interval for status bar
set -g status-interval 12
# center the status bar
set -g status-justify left
# show session, window, pane in left status bar
set -g status-left-length 40
set -g status-left '#[fg=green]#S#[fg=blue] #I:#P #[default]'
# show hostname, date, time, and battery in right status bar
# set-option -g status-right '#[fg=green]#H#[default] %m/%d/%y %I:%M\
#[fg=red]#(battery discharging)#[default]#(battery charging)'
# color status bar
set-option -g status-style bg='#444444',fg='#ffffff'
set -g status-right-length 100 # #(~/.tmux/current_track.sh | cut -c1-50)
# set-option -g status-right "#[fg=yellow,bold] #(battery_icon) |#(is-online)| #(date '+%a, %b %d - %I:%M') "
set -g status-right "K.I.S.S."
# set -g status-right "#{battery_status_bg} #{battery_icon} #{battery_percentage} #{battery_remain} | #{online_status} | #(date '+%a, %b %d - %I:%M')"
# Quickly view system & process info in htop
bind-key h split-window -h "htop"
# Quickly edit todo list
bind-key t split-window -h "vim ~/todo."
# Quickly edit a file in your wiki
bind-key w split-window -h -c ~/vimwiki "reattach-to-user-namespace vim +CtrlP"
###########################
# Colors
###########################
# highlight current window
set -g window-status-current-style fg=black
set -g window-status-current-style bg=green
set -g window-status-current-style bold
# set color of active pane
set -g pane-border-style fg=colour235
set -g pane-border-style bg=black
set -g pane-active-border-style fg=green
set -g pane-active-border-style bg=black
# List of plugins
set -g @plugin 'tmux-plugins/tpm' # Tmux package manager
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-open' # Open highlighted selection directly from Tmux
set -g @plugin 'tmux-plugins/tmux-resurrect' # Restore previous sessions on reboot
set -g @plugin 'tmux-plugins/tmux-continuum' # Restore previous sessions on reboot
# set -g @plugin 'tmux-plugins/tmux-battery' #Show battery icon/status
set -g @plugin 'christoomey/vim-tmux-navigator' # integration with vim
set -g @plugin 'tmux-plugins/tmux-online-status'
#set -g @plugin 'tmux-plugins/tmux-urlview'
# How to install other plugins from Github:
# To install new plugins press: prefix + I
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin '[email protected]/user/plugin'
# set -g @plugin '[email protected]/user/plugin'
## Override plugin defaults
set -g @yank_selection_mouse 'clipboard'
set -g @continuum-restore 'on'
# Initializes Tmux plugin manager.
# Keep this line at the very bottom of tmux.conf.
run-shell '~/.tmux/plugins/tpm/tpm'