-
Notifications
You must be signed in to change notification settings - Fork 0
/
.tmux.conf
230 lines (199 loc) · 8.02 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
# always re-attach or create
new-session -n $HOST
# allow-passthrough of C-b key (especially to nvim)
bind -n C-b send-keys C-b
# better prefix key
# unbind C-b
# set -g prefix C-a
# set-option -g prefix C-a
# bind C-a send-prefix
# bind-key C-a send-prefix
# nvim :checkhealth
set-option -g focus-events on
# bind zoom to preix+f
unbind-key f
# fix yazi tmux preview
set -g allow-passthrough all
set -ga update-environment TERM
set -ga update-environment TERM_PROGRAM
# not -n, that breaks normally typing f
bind-key f resize-pane -Z
# find/jump to session
bind C-p display-popup -E "~/.local/bin/tmux-sessionizer"
bind C-w new-window -n "session-switcher" "tmux list-sessions | sed -E 's/:.*$//' | grep -v \"^$(tmux display-message -p '#S')\$\" | fzf --reverse | xargs tmux switch-client -t"
# better reloading
bind-key r source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded"
# kill without confirmation
# bind-key X kill-pane
# prefix+Q kill-window (with confirm)
bind-key Q confirm-before -p "kill-pane #W? (y/n)" kill-pane
# better splitting
## even better done by @plugin 'tmux-plugins/tmux-pain-control'
# bind | split-window -h -c "#{pane_current_path}"
# bind \\ split-window -h -c "#{pane_current_path}"
# bind - split-window -v -c "#{pane_current_path}"
# bind _ split-window -v -c "#{pane_current_path}"
set -g assume-paste-time 1
set -g base-index 0
set -g bell-action any
# set -g bell-on-alert off
# set -g default-command ""
set -g default-shell $SHELL
set -g destroy-unattached off
set -g detach-on-destroy on
set -g display-panes-active-colour red
set -g display-panes-colour blue
set -g display-panes-time 1000
set -g display-time 750
set -g history-limit 99999
set -g lock-after-time 0
set -g lock-command "lock -np"
set -g message-command-style fg=yellow,bg=black
set -g message-style fg=black,bg=yellow
set -g mouse on
set -g renumber-windows off
set -g repeat-time 500
set -g set-titles off
set -g set-titles-string "#S:#I:#W - "#T" #{session_alerts}"
set -g status on
set -g status-interval 15
set -g status-justify left
set -g status-keys vi
set -g status-left "[#S] "
set -g status-left-length 10
set -g status-left-style default
set -g status-position bottom
# set -g status-right " "#{=21:pane_title}" %d-%b-%y %H:%M"
set -g status-right-length 40
set -g status-right-style default
set -g status-style fg=black,bg=green
set -g update-environment "DISPLAY SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY"
set -g visual-activity off
set -g visual-bell off
set -g visual-silence off
set -g word-separators " -_@"
# switch current window to 0 (top)
bind-key T swap-window -t 0
# powerline plugin
# source "/home/joe/.local/lib/python2.7/site-packages/powerline/bindings/tmux/powerline.conf"
# Smart pane switching with awareness of Vim splits.
# See: https://github.com/christoomey/vim-tmux-navigator
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
# vim :checkhealth requirment
set-option -sg escape-time 10
# vim style keybindings for copy & paste
setw -g mode-keys vi
# Inside copy-mode keybindings:
# C-a [: Enter copy-mode
# Enter: Select, cancel and Paste
# C-c: Cancel
# v: select
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi V send-keys -X rectangle-toggle
# y: yank (also copy tmuxbuffer into clipboard)
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xsel -i --clipboard"
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xsel -i --clipboard"
# bind-key -T copy-mode-vi y send-keys -X copy-pipe "xclip -sel clip -i"
# C-a P: Paste from copy-mode
bind-key P paste-buffer
# C-u/d: scroll up and down
# vim style keybindings for pane navigator
bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L'
bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D'
bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U'
bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R'
tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'"
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'"
# less colourful status
set -g status-bg colour240
set -g status-fg white
# 256 colors support
set -g default-terminal "screen-256color"
set-option -sa terminal-overrides ',xterm-256color:RGB'
# sane scrolling
set -g mouse on
# Start tabs at index 1
# (they usually start at 0, which is too far from where my fingers usually are)
set -g base-index 1
# Make pane numbering consistent with windows
setw -g pane-base-index 1
# Renumber windows when a window is closed
# This guarantees it will be easier for you to switch
# between windows as you keep opening and closing them
set -g renumber-windows on
# Automatically set window title according to the running program
set-window-option -g automatic-rename on
set-option -g set-titles on
# list of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'christoomey/vim-tmux-navigator'
set -g @plugin "arcticicestudio/nord-tmux"
set -g @plugin 'tmux-plugins/tmux-yank'
# LIGHTWEIGHT TMUX UTILITIES FOR MANIPULATING TMUX SESSIONS.
# prefix + g - prompts for session name and switches to it. Performs 'kind-of' name completion.
# prefix + X - kills session without detach
# prefix + S (shift + s) - switches to the last session.
# prefix + C (shift + c) - prompt for creating a new session by name.
# prefix + @ - promote current pane into a new session. Analogous to how prefix + ! breaks current pane to a new window.
# prefix + t<secondary-key> - join currently marked pane (prefix + m) to current session/window, and switc
# secondary-keys
# h, -, ": join horizontally
# v, |, %: join vertically
# f, @: join full screen
set -g @plugin 'tmux-plugins/tmux-sessionist'
# TODO: find keybindings
## Ctl+! "Minimize Window"
bind-key C-! break-pane -d -n _hidden_pane
## Ctl+@ "Maximize Window"
bind-key C-@ join-pane -s $.1
# RESTORE TMUX ENVIRONMENT AFTER SYSTEM RESTART.
# prefix + Ctrl-s - save
# prefix + Ctrl-r - restore
set -g @plugin 'tmux-plugins/tmux-resurrect'
# PREDEFINED SEARCHES ARE PLUGIN KILLER FEATURE. IT SPEEDS THE WORKFLOW AND REDUCES MOUSE USAGE WITH TMUX.
# prefix + / - regex search (strings work too)
# prefix + ctrl-f - simple file search
# prefix + ctrl-g - jumping over git status files (best used after git status command)
set -g @plugin 'tmux-plugins/tmux-copycat'
# QUICKLY OPEN ANY PATH ON YOUR TERMINAL WINDOW IN YOUR $EDITOR OF CHOICE!
# In any tmux mode:
# f - "fpp" for a new window with a Facebook PathPicker selection of your tty.
# set -g @plugin 'jbnicolai/tmux-fpp'
# QUICKLY OPEN ANY URLS
# In any tmux mode:
# u - listing all urls on bottom pane
set -g @plugin 'tmux-plugins/tmux-urlview'
# Splitting panes
# prefix + | split current pane horizontally
# prefix + - split current pane vertically
# prefix + \ split current pane full width horizontally
# prefix + _ split current pane full width vertically
# Vim style keybindings for pane navigator
# 'C-h' select-pane -L
# 'C-j' select-pane -D
# 'C-k' select-pane -U
# 'C-l' select-pane -R
# 'C-\' select-pane -l
# shift-movement keys will resize panes
# bind J resize-pane -D 5
# bind K resize-pane -U 5
# bind H resize-pane -L 5
# bind L resize-pane -R 5
# Swapping windows
# prefix + { - moves current window one position to the left
# prefix + } - moves current window one position to the right
set -g @plugin 'tmux-plugins/tmux-pain-control'
# screen capture: prefix + alt + p
# Save complete history: prefix + alt + shift + p
set -g @plugin 'tmux-plugins/tmux-logging'
# install tpm automatically
if "test ! -d ~/.tmux/plugins/tpm" \
"run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'"
set -g @nord_tmux_no_patched_font "0"
# load TMUX plugin manager (keep at the bottom of tmux.conf)
run -b '~/.tmux/plugins/tpm/tpm'