-
Notifications
You must be signed in to change notification settings - Fork 26
/
.tmux.conf
228 lines (175 loc) · 7.19 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
unbind C-b
set -g prefix C-a
set-option -g prefix C-a
# set-option -g prefix C-b
bind-key -n C-b send-prefix
# bind C-b send-prefix
bind-key C-a last-window
bind-key C-c new-window
bind-key C-n next-window
bind-key C-p previous-window
bind-key C command-prompt -p "Name of new window: " "new-window -n '%%'"
# For mouse people
# set -g mode-mouse on
# set -g mouse-select-window on
# set -g mouse-select-pane on
# set -g mouse on
# set -g mouse onbind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t=; copy-mode -e; send-keys -M'"
# detach client
bind-key d detach
bind-key C-d detach
# choose a client to detach
bind-key D choose-client
# choose window/session
bind-key '"' choose-window
bind-key 'S' choose-session
bind-key "'" run-shell 'tmux choose-tree -Nwf"##{==:##{session_name},#{session_name}}"'
# display visible indicator of each pane
bind-key w display-panes
# swap panes
bind-key -r J swap-pane -D
bind-key -r K swap-pane -U
# kill current pane/window
bind-key q confirm-before kill-pane
bind-key Q confirm-before kill-window
bind-key C-q confirm-before kill-pane
# Ctrl-Left/Right cycles thru windows (no prefix)
bind-key -n "C-Left" select-window -t :-
bind-key -n "C-Right" select-window -t :+
# Ctrl-Up/Down cyles thru panes (no prefix)
bind-key -n "C-Up" select-pane -t :.-
bind-key -n "C-Down" select-pane -t :.+
# title (default key in tmux is ',')
bind-key A command-prompt "rename-window %%"
# toogle status bar
bind-key t set -g status
# displays
bind-key * list-clients
# reload config
bind R source-file ~/.tmux.conf \; display-message "Config reloaded..."
set -g history-limit 10000
# Start numbering at 0
set -g base-index 0
# Relax!
set -sg escape-time 0
set -sg repeat-time 600
# listen for activity on all windows
set -g bell-action any
# super useful when using "grouped sessions" and multi-monitor setup
setw -g aggressive-resize on
set -g display-time 400
# Automatically set window title
set-window-option -g automatic-rename on
setw -g automatic-rename on
set-option -g set-titles on
# y and p as in vim
# bind Escape copy-mode
# unbind p
# bind p paste-buffer
# bind -t vi-copy 'v' begin-selection
# bind -t vi-copy 'y' copy-selection
# bind -t vi-copy 'Space' halfpage-down
# bind -t vi-copy 'Bspace' halfpage-up
# Copy mode
setw -g mode-keys vi
bind [ copy-mode
unbind p
bind p paste-buffer
# bind -t vi-copy v begin-selection
# bind -t vi-copy y copy-selection
# easy-to-remember split pane commands
bind-key | split-window -h
bind-key - split-window -v
bind-key _ split-window -v
# moving between panes with vim movement keys
bind-key C-h select-pane -L
bind-key C-j select-pane -D
bind-key C-k select-pane -U
bind-key C-l select-pane -R
bind-key h select-pane -L
bind-key j select-pane -D
bind-key k select-pane -U
bind-key l select-pane -R
# resize panes with vim movement keys
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
# resize panes with vim movement keys - small step
bind -r < resize-pane -L 1
bind -r > resize-pane -R 1
# 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"
# enable activity alerts
setw -g monitor-activity on
set -g visual-activity on
set -g status-interval 15
# set default terminal - this is necessary for VIM begin and end to work
set -g default-terminal screen-256color
# THEME
set -g status-fg colour231
set -g status-bg colour234
set -g status-left-length 20
# set -g status-left '#[fg=colour16,bg=colour254,bold] #S #[fg=colour254,bg=colour234,nobold]'
# pane border
set-option -g pane-border-style fg=colour233
# set-option -g pane-border-bg colour0
# set-option -g pane-border-bg default
# set-option -g pane-active-border-fg colour173
# set-option -g pane-active-border-fg colour215
set-option -g pane-active-border-style fg=colour141
# set-option -g pane-active-border-bg colour0
# set-option -g pane-active-border-bg default
# help at http://manpages.ubuntu.com/manpages/trusty/man1/tmux.1.html
# non selected window format
set -g window-status-format "#[bg=colour234] #[default]#[fg=colour244]#I.#[default]#W#[fg=colour244]#{?window_zoomed_flag,#Z,}"
# Powerline
set -g status-left '#[fg=colour236,bg=colour114,bold]#S#[fg=colour114,bg=colour240,nobold]#[fg=colour240,bg=colour234,nobold]'
set -g window-status-current-format "#[fg=colour234,bg=colour173]#[fg=colour231,bg=colour173,nobold] #I.#[fg=colour231,bold]#W#[fg=colour231]#{?window_zoomed_flag,#Z,} #[fg=colour173,bg=colour234,nobold]"
set -g status-right '#[fg=colour240,bg=colour234]#[fg=colour234,bg=colour240] #(date +"%H:%M") #[fg=colour160,bg=colour240]#[fg=colour234,bg=colour160] #(hostname) '
# Simple fonts
# set -g status-left "#[fg=colour236,bg=colour114,bold]#S>"
# set -g window-status-current-format " #[fg=colour231,bg=colour173,nobold] #I.#[fg=colour231,bold]#W#[fg=colour231]#{?window_zoomed_flag,#Z,} "
# set -g status-right '#[fg=colour234,bg=colour240] #(date +"%H:%M") #[fg=colour234,bg=colour160] #(hostname) '
# Custom theme / settings for every PC
if '[ -f ~/.tmux.theme.conf ]' \
'source ~/.tmux.theme.conf'
set -g window-status-activity-style bold,fg=white,bg=colour237,bg=red
# """"""""""""""
# " tmux fixes "
# """"""""""""""
# " Handle tmux $TERM quirks in vim
# if $TERM =~ '^screen-256color'
# map <Esc>OH <Home>
# map! <Esc>OH <Home>
# map <Esc>OF <End>
# map! <Esc>OF <End>
# endif
# Copycat nN-next,prev, y-copy, ctrl+ap paste
# prefix + ctrl-f - simple file search
# prefix + ctrl-g - jumping over git status files (best used after git status command)
# prefix + alt-h - jumping over SHA-1/SHA-256 hashes (best used after git log command)
# prefix + ctrl-u - url search (http, ftp and git urls)
# prefix + ctrl-d - number search (mnemonic d, as digit)
# prefix + alt-i - ip address search
# List of plugins
# Install plugins with " c+a I "
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @plugin 'tmux-plugins/tmux-copycat'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-open'
# restore session for vim and neovim
set -g @resurrect-strategy-vim 'session'
set -g @resurrect-strategy-nvim 'session'
set -g @continuum-restore 'on' #set automatic sessions restore
set -g @continuum-save-interval '7' #set autosave interval to lower value
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
if "test ! -d ~/.tmux/plugins/tpm" \
"run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm'"
run '~/.tmux/plugins/tpm/tpm'