Mercurial > dotfiles
annotate dot_tmux.conf @ 706:679c3a5464d7
feat: add packer lock file
author | zegervdv <zegervdv@me.com> |
---|---|
date | Sun, 23 Oct 2022 11:30:22 +0200 |
parents | f2984842d6e2 |
children | eeaf0d561877 |
rev | line source |
---|---|
257 | 1 # Nested TMUX sessions (from |
2 # https://medium.freecodecamp.org/tmux-in-practice-local-and-nested-remote-tmux-sessions-4f7ba5db8795) | |
348
f220567b278e
Update tmux-vim mapping
Zeger Van de Vannet <zegervdv@me.com>
parents:
297
diff
changeset
|
3 bind -T root F11 \ |
257 | 4 set prefix None \;\ |
5 set key-table off \;\ | |
6 set status-right "#[fg=colour0,bg=colour1] DISABLED #[fg=colour3,bg=colour0] #{session_name}#[fg=colour1] | #[fg=colour2]%d %b %l:%M %p " | |
7 refresh-client -S \;\ | |
8 | |
348
f220567b278e
Update tmux-vim mapping
Zeger Van de Vannet <zegervdv@me.com>
parents:
297
diff
changeset
|
9 bind -T off F11 \ |
257 | 10 set -u prefix \;\ |
11 set -u key-table \;\ | |
12 set -u status-right \;\ | |
13 refresh-client -S | |
14 # improve colors | |
355
44442a6b8aa6
Set the smso option to make italics work in tmux
zegervdv <zegervdv@me.com>
parents:
348
diff
changeset
|
15 set -g default-terminal 'tmux-256color' |
44442a6b8aa6
Set the smso option to make italics work in tmux
zegervdv <zegervdv@me.com>
parents:
348
diff
changeset
|
16 set -as terminal-overrides ',xterm*:Tc:smso=\E[3m' |
44442a6b8aa6
Set the smso option to make italics work in tmux
zegervdv <zegervdv@me.com>
parents:
348
diff
changeset
|
17 set -g -a terminal-overrides ',*:Ss=\E[%p1%d q:Se=\E[2 q' |
257 | 18 set-option -g allow-rename off |
19 set-window-option -g automatic-rename off | |
20 | |
21 # Status bar | |
22 set -g set-titles 'off' | |
23 set -g status-position 'top' | |
697
f2984842d6e2
fix: set background color of tmux status line
zegervdv <zegervdv@me.com>
parents:
668
diff
changeset
|
24 set -g status-style 'bg=#fbfafc' |
257 | 25 set -g status-left "" |
26 set -g status-right-length 200 | |
668 | 27 set -g status-right "#[fg=white,bg=#7653c1] vsim #[fg=white,bg=#404a54] #(ps hux -u $(whoami) | grep 'vish' | grep -v -E 'grep|view' | wc -l) #[fg=colour3,bg=default] #[fg=colour0,bg=colour3] load #[fg=white,bg=#404a54] #(cat /proc/loadavg | awk '{ print $3; }' | xargs printf '%2.2f') #[fg=colour3,bg=default] #[fg=colour0,bg=#73b00a] mem #[fg=white,bg=#404a54] #(ps haux | awk -v user=$(whoami) '$1 ~ user { sum += $4 } END { print sum; }' | xargs printf '%2.2f')% #[fg=colour3,bg=default] #[fg=white,bg=#cf4f5f] time #[fg=white,bg=#404a54] %d %b %l:%M %p #[fg=colour3,bg=default] #[fg=colour15,bg=colour8] #{session_name} #[fg=colour0,bg=default]" |
257 | 28 |
29 # Tabs | |
30 setw -g window-status-format " #I #W " | |
668 | 31 setw -g window-status-style "fg=#404a54,bg=#e3ebf1" |
257 | 32 setw -g window-status-current-format " #I #W " |
668 | 33 setw -g window-status-current-style "bg=#404a54,fg=#ffffff" |
257 | 34 |
35 set -g status-justify "left" | |
36 | |
668 | 37 setw -g window-status-bell-style "fg=#ffffff,bg=#d44950" |
38 setw -g mode-style "bg=#fbe9ad" | |
257 | 39 |
40 bind s split-window -v -c "#{pane_current_path}" | |
41 bind v split-window -h -c "#{pane_current_path}" | |
42 bind c command-prompt -p "Name:" "new-window -c \"#{pane_current_path}\" -n %%" | |
43 | |
44 # Enable delete in command sequencer | |
45 bind h send-keys 'c-h' | |
46 | |
47 # Open man pages in split | |
48 bind @ command-prompt -p "Man:" "split-window -v 'exec man %%'" | |
49 | |
50 # act like vim | |
51 bind Escape copy-mode | |
52 set-window-option -g mode-keys vi | |
53 bind-key -T copy-mode-vi 'v' send -X begin-selection | |
54 bind-key -T copy-mode-vi 'V' send -X select-line | |
55 bind-key -T copy-mode-vi 'r' send -X rectangle-toggle | |
56 unbind-key -T copy-mode-vi MouseDragEnd1Pane | |
57 unbind -T copy-mode-vi MouseDragEnd1Pane | |
58 # unbind -t vi-copy MouseDragEnd1Pane | |
59 | |
60 # Smart pane switching with awareness of Vim splits. | |
61 # See: https://github.com/christoomey/vim-tmux-navigator | |
62 is_vim="ps -o state= -o comm= -t '#{pane_tty}' \ | |
63 | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'" | |
348
f220567b278e
Update tmux-vim mapping
Zeger Van de Vannet <zegervdv@me.com>
parents:
297
diff
changeset
|
64 bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L' |
f220567b278e
Update tmux-vim mapping
Zeger Van de Vannet <zegervdv@me.com>
parents:
297
diff
changeset
|
65 bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D' |
f220567b278e
Update tmux-vim mapping
Zeger Van de Vannet <zegervdv@me.com>
parents:
297
diff
changeset
|
66 bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U' |
f220567b278e
Update tmux-vim mapping
Zeger Van de Vannet <zegervdv@me.com>
parents:
297
diff
changeset
|
67 bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R' |
f220567b278e
Update tmux-vim mapping
Zeger Van de Vannet <zegervdv@me.com>
parents:
297
diff
changeset
|
68 tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")' |
f220567b278e
Update tmux-vim mapping
Zeger Van de Vannet <zegervdv@me.com>
parents:
297
diff
changeset
|
69 if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \ |
f220567b278e
Update tmux-vim mapping
Zeger Van de Vannet <zegervdv@me.com>
parents:
297
diff
changeset
|
70 "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'" |
f220567b278e
Update tmux-vim mapping
Zeger Van de Vannet <zegervdv@me.com>
parents:
297
diff
changeset
|
71 if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \ |
f220567b278e
Update tmux-vim mapping
Zeger Van de Vannet <zegervdv@me.com>
parents:
297
diff
changeset
|
72 "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'" |
f220567b278e
Update tmux-vim mapping
Zeger Van de Vannet <zegervdv@me.com>
parents:
297
diff
changeset
|
73 |
f220567b278e
Update tmux-vim mapping
Zeger Van de Vannet <zegervdv@me.com>
parents:
297
diff
changeset
|
74 bind-key -T copy-mode-vi 'C-h' select-pane -L |
f220567b278e
Update tmux-vim mapping
Zeger Van de Vannet <zegervdv@me.com>
parents:
297
diff
changeset
|
75 bind-key -T copy-mode-vi 'C-j' select-pane -D |
f220567b278e
Update tmux-vim mapping
Zeger Van de Vannet <zegervdv@me.com>
parents:
297
diff
changeset
|
76 bind-key -T copy-mode-vi 'C-k' select-pane -U |
f220567b278e
Update tmux-vim mapping
Zeger Van de Vannet <zegervdv@me.com>
parents:
297
diff
changeset
|
77 bind-key -T copy-mode-vi 'C-l' select-pane -R |
f220567b278e
Update tmux-vim mapping
Zeger Van de Vannet <zegervdv@me.com>
parents:
297
diff
changeset
|
78 bind-key -T copy-mode-vi 'C-\' select-pane -l |
568 | 79 |
257 | 80 unbind C-b |
81 set -g prefix C-Space | |
82 bind Space send-prefix | |
83 set -g escape-time 20 | |
84 | |
85 # start window numbers at 1 to match keyboard order with tmux window order | |
86 set -g base-index 1 | |
87 | |
88 # renumber windows sequentially after closing any of them | |
89 set -g renumber-windows on | |
90 | |
91 bind-key r source ~/.tmux.conf | |
92 | |
93 # Fix hightlighting in less | |
94 set -ga terminal-overrides ',*:sitm@,ritm@' | |
95 | |
96 # increase scrollback lines | |
97 set -g history-limit 100000 | |
98 | |
99 setw -g mouse on | |
100 | |
101 set -g focus-events on | |
102 | |
103 # Allow for visual bell when a command completes | |
104 set-window-option -g visual-bell on | |
105 set-window-option -g bell-action other | |
106 | |
614 | 107 # Allow OSC52 from applications |
108 set -s set-clipboard on | |
109 | |
257 | 110 # Local config |
111 if-shell "[ -f ~/.tmux.conf.local ]" 'source ~/.tmux.conf.local' | |
112 | |
113 # Config | |
114 set -g @scroll-without-changing-pane "on" | |
115 set -g @emulate-scroll-for-no-mouse-alternate-buffer "on" | |
116 | |
377
ce08bc71b455
Manually manage tmux plugins
Zeger Van de Vannet <zegervdv@me.com>
parents:
355
diff
changeset
|
117 run-shell ~/.tmux/plugins/tmux-better-mouse-mode/scroll_copy_mode.tmux |
ce08bc71b455
Manually manage tmux plugins
Zeger Van de Vannet <zegervdv@me.com>
parents:
355
diff
changeset
|
118 run-shell ~/.tmux/plugins/tmux-yank/yank.tmux |
505 | 119 run-shell ~/.tmux/plugins/tmux-thumbs/tmux-thumbs.tmux |
120 | |
121 set -g @thumbs-osc52 0 | |
122 # Swap behaviour | |
123 set -g @thumbs-command 'tmux set-buffer -w -- {} && tmux paste-buffer && tmux display-message \"Copied {}\"' | |
124 set -g @thumbs-upcase-command 'tmux set-buffer -w -- {} && tmux display-message \"Copied {}\"' | |
125 set -g @thumbs-hint-fg-color red | |
126 set -g @thumbs-reverse enabled | |
470
e4937efdf43e
Add some popup bindings for tmux
Zeger Van de Vannet <zegervdv@me.com>
parents:
377
diff
changeset
|
127 |
e4937efdf43e
Add some popup bindings for tmux
Zeger Van de Vannet <zegervdv@me.com>
parents:
377
diff
changeset
|
128 bind-key -n 'C-q' popup -w50% -h 90% -x 90% -E -d '#{pane_current_path}' chezmoi cd |
528
9af6e508f630
toggle zoom with c-z when zoomed, else fallback to backgrounding
zegervdv <zegervdv@me.com>
parents:
507
diff
changeset
|
129 |
9af6e508f630
toggle zoom with c-z when zoomed, else fallback to backgrounding
zegervdv <zegervdv@me.com>
parents:
507
diff
changeset
|
130 bind-key -n 'C-z' if -F '#{window_zoomed_flag}' "resize-pane -Z" "send-keys C-z" |
564
b251d808fa04
Add tmux mapping to select the last command output and open selection in quickfix
zegervdv <zegervdv@me.com>
parents:
528
diff
changeset
|
131 |
b251d808fa04
Add tmux mapping to select the last command output and open selection in quickfix
zegervdv <zegervdv@me.com>
parents:
528
diff
changeset
|
132 bind-key -n 'C-s' { |
b251d808fa04
Add tmux mapping to select the last command output and open selection in quickfix
zegervdv <zegervdv@me.com>
parents:
528
diff
changeset
|
133 copy-mode |
b251d808fa04
Add tmux mapping to select the last command output and open selection in quickfix
zegervdv <zegervdv@me.com>
parents:
528
diff
changeset
|
134 send -X clear-selection |
b251d808fa04
Add tmux mapping to select the last command output and open selection in quickfix
zegervdv <zegervdv@me.com>
parents:
528
diff
changeset
|
135 send -X start-of-line |
b251d808fa04
Add tmux mapping to select the last command output and open selection in quickfix
zegervdv <zegervdv@me.com>
parents:
528
diff
changeset
|
136 send -X start-of-line |
b251d808fa04
Add tmux mapping to select the last command output and open selection in quickfix
zegervdv <zegervdv@me.com>
parents:
528
diff
changeset
|
137 send -X cursor-up |
b251d808fa04
Add tmux mapping to select the last command output and open selection in quickfix
zegervdv <zegervdv@me.com>
parents:
528
diff
changeset
|
138 send -X cursor-up |
b251d808fa04
Add tmux mapping to select the last command output and open selection in quickfix
zegervdv <zegervdv@me.com>
parents:
528
diff
changeset
|
139 send -X start-of-line |
b251d808fa04
Add tmux mapping to select the last command output and open selection in quickfix
zegervdv <zegervdv@me.com>
parents:
528
diff
changeset
|
140 send -X start-of-line |
b251d808fa04
Add tmux mapping to select the last command output and open selection in quickfix
zegervdv <zegervdv@me.com>
parents:
528
diff
changeset
|
141 |
b251d808fa04
Add tmux mapping to select the last command output and open selection in quickfix
zegervdv <zegervdv@me.com>
parents:
528
diff
changeset
|
142 if -F "#{m:*->\u00A0*,#{copy_cursor_line}}" { |
b251d808fa04
Add tmux mapping to select the last command output and open selection in quickfix
zegervdv <zegervdv@me.com>
parents:
528
diff
changeset
|
143 send -X search-forward-text "->\u00A0" |
b251d808fa04
Add tmux mapping to select the last command output and open selection in quickfix
zegervdv <zegervdv@me.com>
parents:
528
diff
changeset
|
144 send -X stop-selection |
b251d808fa04
Add tmux mapping to select the last command output and open selection in quickfix
zegervdv <zegervdv@me.com>
parents:
528
diff
changeset
|
145 send -X -N 2 cursor-right |
b251d808fa04
Add tmux mapping to select the last command output and open selection in quickfix
zegervdv <zegervdv@me.com>
parents:
528
diff
changeset
|
146 send -X begin-selection |
b251d808fa04
Add tmux mapping to select the last command output and open selection in quickfix
zegervdv <zegervdv@me.com>
parents:
528
diff
changeset
|
147 send -X end-of-line |
b251d808fa04
Add tmux mapping to select the last command output and open selection in quickfix
zegervdv <zegervdv@me.com>
parents:
528
diff
changeset
|
148 send -X end-of-line |
b251d808fa04
Add tmux mapping to select the last command output and open selection in quickfix
zegervdv <zegervdv@me.com>
parents:
528
diff
changeset
|
149 if "#{m:*->\u00A0?*,#{copy_cursor_line}}" { |
b251d808fa04
Add tmux mapping to select the last command output and open selection in quickfix
zegervdv <zegervdv@me.com>
parents:
528
diff
changeset
|
150 send -X cursor-left |
b251d808fa04
Add tmux mapping to select the last command output and open selection in quickfix
zegervdv <zegervdv@me.com>
parents:
528
diff
changeset
|
151 } |
b251d808fa04
Add tmux mapping to select the last command output and open selection in quickfix
zegervdv <zegervdv@me.com>
parents:
528
diff
changeset
|
152 } { |
b251d808fa04
Add tmux mapping to select the last command output and open selection in quickfix
zegervdv <zegervdv@me.com>
parents:
528
diff
changeset
|
153 send -X end-of-line |
b251d808fa04
Add tmux mapping to select the last command output and open selection in quickfix
zegervdv <zegervdv@me.com>
parents:
528
diff
changeset
|
154 send -X end-of-line |
b251d808fa04
Add tmux mapping to select the last command output and open selection in quickfix
zegervdv <zegervdv@me.com>
parents:
528
diff
changeset
|
155 send -X begin-selection |
b251d808fa04
Add tmux mapping to select the last command output and open selection in quickfix
zegervdv <zegervdv@me.com>
parents:
528
diff
changeset
|
156 send -X search-backward-text "->\u00A0" |
b251d808fa04
Add tmux mapping to select the last command output and open selection in quickfix
zegervdv <zegervdv@me.com>
parents:
528
diff
changeset
|
157 send -X end-of-line |
b251d808fa04
Add tmux mapping to select the last command output and open selection in quickfix
zegervdv <zegervdv@me.com>
parents:
528
diff
changeset
|
158 send -X end-of-line |
b251d808fa04
Add tmux mapping to select the last command output and open selection in quickfix
zegervdv <zegervdv@me.com>
parents:
528
diff
changeset
|
159 send -X cursor-right |
b251d808fa04
Add tmux mapping to select the last command output and open selection in quickfix
zegervdv <zegervdv@me.com>
parents:
528
diff
changeset
|
160 send -X stop-selection |
b251d808fa04
Add tmux mapping to select the last command output and open selection in quickfix
zegervdv <zegervdv@me.com>
parents:
528
diff
changeset
|
161 } |
b251d808fa04
Add tmux mapping to select the last command output and open selection in quickfix
zegervdv <zegervdv@me.com>
parents:
528
diff
changeset
|
162 } |
b251d808fa04
Add tmux mapping to select the last command output and open selection in quickfix
zegervdv <zegervdv@me.com>
parents:
528
diff
changeset
|
163 |
565
697909624a17
Map quickfix edit on s (e is too useful in vi mode)
Zeger Van de Vannet <zegervdv@me.com>
parents:
564
diff
changeset
|
164 bind-key -T copy-mode-vi 's' send -X copy-pipe-and-cancel "cat > /tmp/error.txt && tmux new-window -n 'quickfix' -c \"#{pane_current_path}\" 'nvim -q /tmp/error.txt && rm -f /tmp/error.txt'" |