Mercurial > dotfiles
annotate dot_tmux.conf @ 348:f220567b278e
Update tmux-vim mapping
author | Zeger Van de Vannet <zegervdv@me.com> |
---|---|
date | Thu, 04 Feb 2021 18:28:57 +0100 |
parents | 88d7010b5694 |
children | 44442a6b8aa6 |
rev | line source |
---|---|
257 | 1 set-environment -g PATH "/project/asic_fpga/tools/tmux/bin:$PATH" |
2 | |
3 # Nested TMUX sessions (from | |
4 # 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
|
5 bind -T root F11 \ |
257 | 6 set prefix None \;\ |
7 set key-table off \;\ | |
8 set status-right "#[fg=colour0,bg=colour1] DISABLED #[fg=colour3,bg=colour0] #{session_name}#[fg=colour1] | #[fg=colour2]%d %b %l:%M %p " | |
9 refresh-client -S \;\ | |
10 | |
348
f220567b278e
Update tmux-vim mapping
Zeger Van de Vannet <zegervdv@me.com>
parents:
297
diff
changeset
|
11 bind -T off F11 \ |
257 | 12 set -u prefix \;\ |
13 set -u key-table \;\ | |
14 set -u status-right \;\ | |
15 refresh-client -S | |
16 # improve colors | |
297
88d7010b5694
Set color config for tmux
Zeger Van de Vannet <zegervdv@me.com>
parents:
268
diff
changeset
|
17 set -g default-terminal 'xterm-256color' |
88d7010b5694
Set color config for tmux
Zeger Van de Vannet <zegervdv@me.com>
parents:
268
diff
changeset
|
18 set-option -ga terminal-overrides ",xterm-256color:Tc" |
257 | 19 set-option -g allow-rename off |
20 set-window-option -g automatic-rename off | |
21 | |
22 # Status bar | |
23 set -g set-titles 'off' | |
24 set -g status-position 'top' | |
25 set -g status-left "" | |
26 set -g status-right-length 200 | |
268 | 27 set -g status-right "#[fg=colour0,bg=colour5] vsim #[fg=colour0,bg=colour15] #(ps hux -u $(whoami) | grep 'vish' | grep -v -E 'grep|view' | wc -l) #[fg=colour3,bg=colour0] #[fg=colour0,bg=colour3] load #[fg=colour0,bg=colour15] #(cat /proc/loadavg | awk '{ print $3; }' | xargs printf '%2.2f') #[fg=colour3,bg=colour0] #[fg=colour0,bg=colour2] mem #[fg=colour0,bg=colour15] #(ps haux | awk -v user=$(whoami) '$1 ~ user { sum += $4 } END { print sum; }' | xargs printf '%2.2f')% #[fg=colour3,bg=colour0] #[fg=colour0,bg=colour1] time #[fg=colour0,bg=colour15] %d %b %l:%M %p #[fg=colour3,bg=colour0] #[fg=colour15,bg=colour8] #{session_name} #[fg=colour0,bg=colour0] " |
257 | 28 |
29 # Tabs | |
30 setw -g window-status-format " #I #W " | |
31 setw -g window-status-style fg=colour15 | |
32 setw -g window-status-current-format " #I #W " | |
33 setw -g window-status-current-style fg=red | |
34 | |
35 set -g status-justify "left" | |
36 set -g status-bg "colour0" | |
37 set -g status-fg "colour7" | |
348
f220567b278e
Update tmux-vim mapping
Zeger Van de Vannet <zegervdv@me.com>
parents:
297
diff
changeset
|
38 # set -g message-bg "colour0" |
f220567b278e
Update tmux-vim mapping
Zeger Van de Vannet <zegervdv@me.com>
parents:
297
diff
changeset
|
39 # set -g message-fg "colour8" |
257 | 40 |
41 setw -g window-status-bell-style "fg=colour0,bg=colour5" | |
42 | |
43 bind s split-window -v -c "#{pane_current_path}" | |
44 bind v split-window -h -c "#{pane_current_path}" | |
45 bind a split-window -v -p 15 -c "#{pane_current_path}" | |
46 # bind c new-window -c "#{pane_current_path}" | |
47 bind c command-prompt -p "Name:" "new-window -c \"#{pane_current_path}\" -n %%" | |
48 | |
49 # Enable delete in command sequencer | |
50 bind h send-keys 'c-h' | |
51 | |
52 # Open man pages in split | |
53 bind @ command-prompt -p "Man:" "split-window -v 'exec man %%'" | |
54 | |
55 # act like vim | |
56 bind Escape copy-mode | |
57 set-window-option -g mode-keys vi | |
58 bind-key -T copy-mode-vi 'v' send -X begin-selection | |
59 bind-key -T copy-mode-vi 'V' send -X select-line | |
60 bind-key -T copy-mode-vi 'r' send -X rectangle-toggle | |
61 bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel 'xclip -in -selection clipboard' | |
62 unbind-key -T copy-mode-vi MouseDragEnd1Pane | |
63 unbind -T copy-mode-vi MouseDragEnd1Pane | |
64 # unbind -t vi-copy MouseDragEnd1Pane | |
65 | |
66 # Smart pane switching with awareness of Vim splits. | |
67 # See: https://github.com/christoomey/vim-tmux-navigator | |
68 is_vim="ps -o state= -o comm= -t '#{pane_tty}' \ | |
69 | 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
|
70 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
|
71 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
|
72 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
|
73 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
|
74 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
|
75 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
|
76 "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
|
77 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
|
78 "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
|
79 |
f220567b278e
Update tmux-vim mapping
Zeger Van de Vannet <zegervdv@me.com>
parents:
297
diff
changeset
|
80 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
|
81 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
|
82 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
|
83 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
|
84 bind-key -T copy-mode-vi 'C-\' select-pane -l |
257 | 85 #act like GNU screen |
86 unbind C-b | |
87 set -g prefix C-Space | |
88 bind Space send-prefix | |
89 set -g escape-time 20 | |
90 | |
91 # start window numbers at 1 to match keyboard order with tmux window order | |
92 set -g base-index 1 | |
93 | |
94 # renumber windows sequentially after closing any of them | |
95 set -g renumber-windows on | |
96 | |
97 bind-key r source ~/.tmux.conf | |
98 | |
99 # Fix hightlighting in less | |
100 set -ga terminal-overrides ',*:sitm@,ritm@' | |
101 | |
102 # increase scrollback lines | |
103 set -g history-limit 100000 | |
104 | |
105 setw -g mouse on | |
106 | |
107 set -g focus-events on | |
108 | |
109 # Allow for visual bell when a command completes | |
110 set-window-option -g visual-bell on | |
111 set-window-option -g bell-action other | |
112 | |
113 set-option -g default-shell "/bin/bash" | |
114 # set-option -g default-command "/bin/bash" | |
115 # set-environment -g SHELL "/bin/bash" | |
116 # set-environment -g PATH "$PATH:/home/zvandeva/bin" | |
117 | |
118 # Local config | |
119 if-shell "[ -f ~/.tmux.conf.local ]" 'source ~/.tmux.conf.local' | |
120 | |
121 # Plugins | |
122 set -g @plugin 'tmux-plugins/tpm' | |
123 set -g @plugin 'nhdaly/tmux-better-mouse-mode' | |
124 set -g @plugin 'tmux-plugins/tmux-yank' | |
125 set -g @plugin 'Morantron/tmux-fingers' | |
126 set -g @plugin 'laktak/extrakto' | |
127 set -g @plugin 'tmux-plugins/tmux-resurrect' | |
128 set -g @plugin 'tmux-plugins/tmux-continuum' | |
129 | |
130 | |
131 # Config | |
132 set -g @fingers-skip-health-check '1' | |
133 set -g @fingers-compact-hints '0' | |
134 set -g @fingers-hint-format-nocompact " #[fg=colour1][%s]" | |
135 set -g @fingers-highlight-format-nocompact "#[fg=colour5]%s" | |
136 set -g @fingers-pattern-0 "[[:digit:]][[:digit:]][[:digit:]]+" | |
137 | |
138 set -g @scroll-without-changing-pane "on" | |
139 set -g @emulate-scroll-for-no-mouse-alternate-buffer "on" | |
140 | |
141 set -g @extrakto_fzf_tool "/home/zvandeva/.fzf/bin/fzf" | |
142 | |
143 set -g @resurrect-strategy-nvim 'session' | |
144 set -g @resurrect-capture-pane-contents 'on' | |
145 | |
146 run-shell "~/.tmux/plugins/tpm/tpm" |