-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.tmux.conf
More file actions
240 lines (164 loc) · 7.23 KB
/
Copy path.tmux.conf
File metadata and controls
240 lines (164 loc) · 7.23 KB
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
231
232
233
234
235
236
237
238
239
240
# for vim.g.clipboard = "osc52" sake.
set -s set-clipboard on
set -g focus-events on
set -g window-size latest
# for nvim ESC delay fix in tmux
set -sg escape-time 0
set -g status-style 'bg=#333333 fg=#5eacd3'
# Start window and pane numbering at 1
set -g base-index 1
# Renumber windows automatically to prevent gaps
set -g renumber-windows on
# Enable full mouse support
set -g mouse on
# Allow Tmux to use the OSC 52 escape sequences for copy/paste
set -g allow-passthrough on
# If you are still having issues, explicitly bind the copy/paste operations to OSC 52
# (These lines are sometimes only necessary if you use Tmux's copy mode, but they help.)
set -w -g automatic-rename on
set -g status-position bottom
# .setw
setw -g pane-base-index 1
####
#### .set-option
####
set-option -g default-terminal "tmux-256color"
# This may be better for certain TUI applications so the keys we send are kinda similar but I prefer tmux-256color color I think.
# for those specefic TUIs just use default kitty... it's alright and fine (only uses like a few mb it's fine.)
# set -g default-terminal xterm-256color
set-option -g status-right "%Y-%m-%d %H:%M"
set-option -g status-left-length 30
set-option -g status-right-length 0
# Set a higher history limit
set-option -g history-limit 10000
# I hate why have this when you can do tab+<keyd>
# Allow repeating commands without re-typing the prefix (e.g., C-a > >)
# set-option -g repeat-time 500
set-option -g repeat-time 0
# Use vi-style keys in copy mode
set-window-option -g mode-keys vi
# I hope this fking works
bind-key -T copy-mode-vi C-q send-keys -X rectangle-toggle
# Trying to make emacs like copy-mode in like vi mode for fun.
bind -T copy-mode-vi C-Left send -X previous-word
bind -T copy-mode-vi C-Right send -X next-word-end
bind -T copy-mode-vi M-< send -X history-top
bind -T copy-mode-vi M-> send -X history-bottom
# THIS IS A LIE THERE IS NO SUCH THING AS RECTRANGLE-TOGGLE!!!
# bind -T copy-mode-vi q send-keys -X rectangle-toggle
####
#### .bind
####
# New window in same path
bind c new-window -c "#{pane_current_path}"
# Split panes in same path (default keys)
bind '"' split-window -v -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
# Make sure you have this in tmux. for inserting new line. It fixes tui new line.
bind-key -n M-Enter send-keys "\e" Enter
# reload config convenience
bind r source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded"
# This is intended
# I hate default x because it asks (y/n). <-- But you know what. That's fine, just for safety
# bind -r x kill-pane
####### .ssh stuff
# [OFF] Toggle local tmux "On" for SSH purposes.
bind -T off F11 \
set -u prefix \;\
set -u key-table \;\
set -u status-style \;\
refresh-client -S
# [ON] Toggle local tmux "Off" for SSH purposes.
bind -T root F11 \
set prefix None \;\
set key-table off \;\
set status-style "fg=colour245,bg=colour235" \;\
if-shell -F '#{pane_in_mode}' 'send-keys -X cancel' \;\
refresh-client -S \;\
# A dropdown temrinal inside tmux sick. I call it scratchpad but it's whatever name you give it
bind "'" run-shell "~/.local/scripts/tmux-scratchpad.sh"
# ctrl-b 1234567890 is kinda annoying you know. I prefer holding alt.. or ctrl+b then s
# bind-key -n M-S-1 select-window -t :1
# bind-key -n M-S-2 select-window -t :2
# bind-key -n M-S-3 select-window -t :3
# bind-key -n M-S-4 select-window -t :4
# bind-key -n M-S-5 select-window -t :5
# bind-key -n M-S-6 select-window -t :6
# bind-key -n M-S-7 select-window -t :7
# bind-key -n M-S-8 select-window -t :8
# bind-key -n M-S-9 select-window -t :9
# bind-key -n M-S-0 select-window -t :10
bind-key -n 'M-`' last-window
################## .floating pop-up windows inside tmux.
# Git stuff
# Lazygit pop-up I'm not sure if I want this? maybe...
bind-key -r g display-popup -d '#{pane_current_path}' -w 90% -h 90% -E "lazygit"
# rofi for sessions.
# Fuzzy find windows in the current session
# bind s display-popup -E "tmux list-windows -F '#I:#W' | fzf --reverse | sed 's/:.*//' | xargs tmux select-window -t"
bind s display-popup -E "\
SESSION=\$(tmux display-message -p '#S'); \
tmux list-windows -F '#I:#W' | \
fzf --no-preview --layout=reverse --height=40% | \
cut -d: -f1 | \
xargs -I{} tmux select-window -t {}"
# bind s display-popup -E "\
# SESSION=\$(tmux display-message -p '#S'); \
# tmux list-windows -F '#I:#W' | \
# awk -v s=\"\$SESSION\" '{print \"[WIN] \" s \":\" \$1}' FS=: | \
# fzf --with-nth=3 --delimiter=: | \
# cut -d: -f2 | \
# xargs -I{} tmux select-window -t {}"
# qalc pop-up for calculating things.
bind C display-popup -w 70% -h 30% -E "qalc"
bind-key -r t run-shell "tmux neww tmux-sessionizer"
# bind-key -n M-m run-shell "tmux neww ~/.local/scripts/tmux-sessionizer"
bind-key M-l run-shell "tmux-sessionizer -s 1"
# Toggle pane synchronization it's so sick if you have multiple panes and you want to type in all of them at once
bind M-v set-window-option synchronize-panes
# Open the session chooser menu
bind M-w choose-session
# NOTICE: Just use & mate. No need to use X. Try it out later.
# kill the whole window with all it's panes
# bind X kill-window
bind -r "<" swap-window -d -t -1
bind -r ">" swap-window -d -t +1
####
#### .copy-mode-vi
####
# NOTICE:
# Make sure you have a macro to initially hit this twice. To that it's a toggle
# thing to see the number if you need to jump
#
# make seperate side pane have relative numbers for nvim jumps
bind - run-shell "~/.local/scripts/tmux-copy-mode-lines.sh"
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xclip -selection clipboard -in"
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi V send-keys -X select-line
bind-key -T copy-mode-vi C-Space send-keys -X begin-selection
bind-key -T copy-mode-vi C-g send-keys -X clear-selection
# bind-key -T copy-mode-vi V send-keys -X select-line
# Simulating viw and viW in nvim.
bind-key -T copy-mode-vi i send-keys -X select-word
bind-key -T copy-mode-vi I send-keys -X cursor-right \; send-keys -X previous-space \; send-keys -X begin-selection \; send-keys -X next-space-end
bind-key -T copy-mode-vi q send-keys -X rectangle-toggle
# This is for phone compatibility when using mosh. The idea is when you use mosh when you copy with tmux ssh it copies text to your clipboard as well. It's a cool idea.
bind-key -T copy-mode-vi s send-keys -X copy-pipe-and-cancel "ssh -i ~/.ssh/id_ed25519 -p 8022 u0_a662@100.126.224.121 'termux-clipboard-set'"
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xclip -selection clipboard -in"
######
###### .plugins
######
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-yank'
# set -g @yank_with_mouse 'on'
# I don't use these but I just put them here to remember their names. I prefer manual save and like manual restore thing.
# btw tmux-resurrect still sucks you know...
# set -g @plugin 'tmux-plugins/tmux-continuum'
# set -g @continuum-restore 'on'
# DEPRECATED: Keep this it makes the <leader>y in nvim work fine.
# No worries I fixed it in like my nvim config I think no need for this thing.
#
# ok like but my tmux yank doesn't work now what is this
set -g @override_copy_command 'xclip -selection clipboard'
run '~/.tmux/plugins/tpm/tpm'