-
Notifications
You must be signed in to change notification settings - Fork 0
/
.tmux.conf
212 lines (168 loc) · 6.65 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
# Set a different prefix key
unbind C-b
set -g prefix C-a
bind C-a send-prefix
# Make tmux create a new shell
set -g default-shell "/bin/zsh"
# Enable full mouse support
set -g mouse on
# Address vim mode switching delay (http://superuser.com/a/252717/65504)
set -s escape-time 0
# Set maximum number of lines in window history
set -g history-limit 50000
# Increase tmux messages display duration from 750ms to 4s
set -g display-time 4000
# Set default terminal (fallbacks to $TERM)
set -g default-terminal "xterm-256color"
# Make colors inside tmux look the same as outside
# see https://github.com/tmux/tmux/issues/696
# see https://stackoverflow.com/a/41786092
set -ga terminal-overrides ",xterm-256color:Tc"
# Focus events enabled for terminals that support them
set -g focus-events on
# Super useful when using "grouped sessions" and multi-monitor setup
setw -g aggressive-resize on
# Ensure window titles get renamed automatically
setw -g automatic-rename
# Ensure window index numbers get reordered on delete
set -g renumber-windows on
# Start windows and panes index at 1, not 0
set -g base-index 1
setw -g pane-base-index 1
# Required by tmux-yank plugin
set -s set-clipboard on
# Use vi bindings in copy mode
setw -g mode-keys vi
# Refresh status bar more often, from every 15s to 1s
set -g status-interval 1
# Vi bindings in status bar
set -g status-keys vi
# Move status bar to the top
set -g status-position top
# Minimal status bar colors when no coloscheme is enabled
set -g status-style 'bg=#262831'
set -g status-left-style 'fg=magenta'
set -g status-right-style 'fg=magenta'
set -g status-left-length 100
set -g status-right-length 100
set -g status-right "#{?window_bigger,[#{window_offset_x}#,#{window_offset_y}] ,}\"#{pane_title}\" %H:%M:%S %d/%m/%Y"
setw -g window-status-style 'fg=blue'
setw -g window-status-current-style 'fg=green'
# Order sessions by name
bind s choose-tree -sZ -O name
# Vi bindings for selecting and copying in copy mode
bind -T copy-mode-vi 'v' send -X begin-selection
bind -T copy-mode-vi 'C-v' send -X rectangle-toggle
bind -T copy-mode-vi 'y' send -X copy-selection-and-cancel
# Easier and faster switching between next/prev window
bind C-p previous-window
bind C-n next-window
# Better bindings to split windows
bind '\' split-window -h
bind '-' split-window -v
# Binding to source tmux config
bind r \
source-file ~/.tmux.conf\; \
display ".tmux.conf sourced"
# Bindings to move current window one position left or right
bind -r "<" swap-window -d -t -1
bind -r ">" swap-window -d -t +1
# Bindings to split windows with initial path as path of current pane
bind '|' split-window -h -c '#{pane_current_path}'
bind '_' split-window -v -c '#{pane_current_path}'
# Bindings to switch panes
bind -r C-k select-pane -U
bind -r C-j select-pane -D
bind -r C-h select-pane -L
bind -r C-l select-pane -R
# Bindings to create new window with initial path as path of current pane
bind C new-window -c '#{pane_current_path}'
# Binding to clear pane screen and history
# Need to wait before running clear-history for it to work
bind C-q \
send-keys C-l\; \
run 'sleep 0.1'\; \
clear-history\; \
display "cleared pane screen and history"
# Binding to toggle synchronize-panes on and off
bind C-y \
setw synchronize-panes\; \
display "synchronize-panes #{?synchronize-panes,on,off}"
# Binding to send command to all panes of current window
bind C-t \
command-prompt -p "Command to send to all panes of current window:" \
"run \"tmux list-panes -F '##{session_name}:##{window_index}.##{pane_index}' \
| xargs -I PANE tmux send-keys -t PANE '%1' Enter\""
# Binding to send command to all panes of all windows of current session
bind C-w \
command-prompt -p "Command to send to all panes of all windows of current session:" \
"run \"tmux list-panes -s -F '##{session_name}:##{window_index}.##{pane_index}' \
| xargs -I PANE tmux send-keys -t PANE '%1' Enter\""
# Binding to send command to all panes of all windows of all sessions
bind C-b \
command-prompt -p "Command to send to all panes of all windows of all sessions:" \
"run \"tmux list-panes -a -F '##{session_name}:##{window_index}.##{pane_index}' \
| xargs -I PANE tmux send-keys -t PANE '%1' Enter\""
################################################################################
# Plugin Management:
# tpm: https://github.com/tmux-plugins/tpm
################################################################################
# Plugins and their configurations
# TMUX plugin manager comes first
# Prefix + I = Install
# Prefix + U = Update
# Prefix + u = Clean
set -g @plugin 'tmux-plugins/tpm'
set -g @tpm-clean 'u'
# Gruvbox colorscheme
# set -g @plugin 'egel/tmux-gruvbox'
# set -g @tmux-gruvbox 'dark'
# Tokyonight colorscheme
# set -g @plugin 'cappyzawa/tmux-tokyonight'
# Save and restore sessions
# Prefix + Ctrl-s = Save
# Prefix + Ctrl-r = Restore
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @resurrect-capture-pane-contents 'on'
# Yank to system clipboard
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @yank_action 'copy-pipe'
# Easymotion in copy mode
# Prefix + `-<motion> in copy mode = Trigger
set -g @plugin 'IngoMeyer441/tmux-easy-motion'
set -g @easy-motion-prefix '`'
# Select, copy, insert, complete text
# Prefix + Tab = Trigger
# Tab in popup = Yank selection
# Enter in popup = Insert selection
set -g @plugin 'laktak/extrakto'
set -g @extrakto_key 'tab'
set -g @extrakto_fzf_tool 'fzf'
set -g @extrakto_popup_size '75%,50%'
set -g @extrakto_copy_key 'tab'
set -g @extrakto_insert_key 'enter'
set -g @extrakto_clip_tool_run 'tmux_osc52'
# Search scrollback buffer
# Prefix + b = Trigger
set -g @plugin 'roosta/tmux-fuzzback'
set -g @fuzzback-finder 'fzf'
set -g @fuzzback-bind 'b'
set -g @fuzzback-popup 1
set -g @fuzzback-popup-size '95%,50%'
# Utilities for manipulating sessions
# Prefix + g = Prompt for session name and switches to it. Performs 'kind-of' name completion.
# Prefix + S = Prompt for creating a new session by name.
# Prefix + X = Kill current session without detaching tmux.
# Prefix + @ = Promote current pane into a new session. Analogous to how ! breaks current pane to a new window.
# Prefix + t<secondary-key> = Join currently marked pane (Prefix + m) to current session/window, and switch to it.
# secondary-keys:
# h, -, " = join horizontally
# v, |, % = join vertically
# f, @ = join full scree
set -g @plugin 'tmux-plugins/tmux-sessionist'
set -g @sessionist-new "S"
# Zoom pane to separate window and then unzoom back to original location
# Prefix + Z = Toggle
set -g @plugin 'jaclu/tmux-power-zoom'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'