Mercurial > dotfiles
view dot_tmux.conf @ 1049:632e28eb77b2
feat: unmap tmux pane navigation shortcuts
author | Zeger Van de Vannet <zeger@vandevan.net> |
---|---|
date | Fri, 28 Jun 2024 15:37:25 +0200 |
parents | 7218c2192214 |
children |
line wrap: on
line source
# Nested TMUX sessions (from # https://medium.freecodecamp.org/tmux-in-practice-local-and-nested-remote-tmux-sessions-4f7ba5db8795) bind -T root F11 \ set prefix None \;\ set key-table off \;\ set status-right "#[fg=colour0,bg=colour1] DISABLED #[fg=colour3,bg=colour0] #{session_name}#[fg=colour1] | #[fg=colour2]%d %b %l:%M %p " refresh-client -S \;\ bind -T off F11 \ set -u prefix \;\ set -u key-table \;\ set -u status-right \;\ refresh-client -S # improve colors set -g default-terminal 'tmux-256color' set -as terminal-overrides ',xterm*:Tc:smso=\E[3m' set -g -a terminal-overrides ',*:Ss=\E[%p1%d q:Se=\E[2 q' set-option -g allow-rename off set-window-option -g automatic-rename off # Status bar set -g set-titles 'off' set -g status-position 'top' set -g status-style 'bg=#fbfafc' set -g status-left "" set -g status-right-length 200 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]" # Tabs setw -g window-status-format " #I #W " setw -g window-status-style "fg=#404a54,bg=#e3ebf1" setw -g window-status-current-format " #I #W " setw -g window-status-current-style "bg=#404a54,fg=#ffffff" set -g status-justify "left" setw -g window-status-bell-style "fg=#ffffff,bg=#d44950" setw -g mode-style "bg=#fbe9ad" bind s split-window -v -c "#{pane_current_path}" bind v split-window -h -c "#{pane_current_path}" bind c command-prompt -p "Name:" "new-window -c \"#{pane_current_path}\" -n %%" # Open man pages in split bind @ command-prompt -p "Man:" "split-window -v 'exec man %%'" # act like vim bind Escape copy-mode set-window-option -g mode-keys vi bind-key -T copy-mode-vi 'v' send -X begin-selection bind-key -T copy-mode-vi 'V' send -X select-line bind-key -T copy-mode-vi 'r' send -X rectangle-toggle unbind-key -T copy-mode-vi MouseDragEnd1Pane unbind -T copy-mode-vi MouseDragEnd1Pane # Copy and Paste selection on middle mouse bind-key -T copy-mode-vi MouseDown2Pane send-keys -X copy-pipe-and-cancel "tmux paste-buffer" bind-key h select-pane -L bind-key j select-pane -D bind-key k select-pane -U bind-key l select-pane -R bind-key -T copy-mode-vi 'C-h' select-pane -L bind-key -T copy-mode-vi 'C-j' select-pane -D bind-key -T copy-mode-vi 'C-k' select-pane -U bind-key -T copy-mode-vi 'C-l' select-pane -R bind-key -T copy-mode-vi 'C-\' select-pane -l bind-key -T copy-mode-vi ] send-keys -X next-prompt bind-key -T copy-mode-vi [ send-keys -X previous-prompt unbind C-b set -g prefix C-Space bind Space send-prefix set -g escape-time 20 # start window numbers at 1 to match keyboard order with tmux window order set -g base-index 1 # renumber windows sequentially after closing any of them set -g renumber-windows on bind-key r source ~/.tmux.conf # Fix hightlighting in less set -ga terminal-overrides ',*:sitm@,ritm@' # increase scrollback lines set -g history-limit 100000 setw -g mouse on set -g focus-events on # Allow for visual bell when a command completes set-window-option -g visual-bell on set-window-option -g bell-action other # Allow OSC52 from applications set -s set-clipboard on # Local config if-shell "[ -f ~/.tmux.conf.local ]" 'source ~/.tmux.conf.local' # Config set -g @scroll-without-changing-pane "on" set -g @emulate-scroll-for-no-mouse-alternate-buffer "on" run-shell ~/.tmux/plugins/tmux-better-mouse-mode/scroll_copy_mode.tmux run-shell ~/.tmux/plugins/tmux-yank/yank.tmux run-shell ~/.tmux/plugins/tmux-thumbs/tmux-thumbs.tmux set -g @thumbs-osc52 0 # Swap behaviour set -g @thumbs-command 'tmux set-buffer -w -- {} && tmux paste-buffer && tmux display-message \"Copied {}\"' set -g @thumbs-upcase-command 'tmux set-buffer -w -- {} && tmux display-message \"Copied {}\"' set -g @thumbs-hint-fg-color red set -g @thumbs-reverse enabled bind-key -n 'C-q' popup -w50% -h 90% -x 90% -E -d '#{pane_current_path}' chezmoi cd bind-key -n 'C-z' if -F '#{window_zoomed_flag}' "resize-pane -Z" "send-keys C-z" bind-key -T copy-mode-vi 'C-s' { copy-mode send -X clear-selection send -X start-of-line send -X start-of-line send -X cursor-up send -X cursor-up send -X start-of-line send -X start-of-line if -F "#{m:*->\u00A0*,#{copy_cursor_line}}" { send -X search-forward-text "->\u00A0" send -X stop-selection send -X -N 2 cursor-right send -X begin-selection send -X end-of-line send -X end-of-line if "#{m:*->\u00A0?*,#{copy_cursor_line}}" { send -X cursor-left } } { send -X end-of-line send -X end-of-line send -X begin-selection send -X search-backward-text "->\u00A0" send -X end-of-line send -X end-of-line send -X cursor-right send -X stop-selection } } 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'" bind-key 'o' { copy-mode send -X clear-selection send -X start-of-line send -X start-of-line send -X cursor-up send -X cursor-up send -X start-of-line send -X start-of-line if -F "#{m:*->\u00A0*,#{copy_cursor_line}}" { send -X search-forward-text "->\u00A0" send -X stop-selection send -X -N 2 cursor-right send -X begin-selection send -X end-of-line send -X end-of-line if "#{m:*->\u00A0?*,#{copy_cursor_line}}" { send -X cursor-left } } { send -X end-of-line send -X end-of-line send -X begin-selection send -X search-backward-text "->\u00A0" send -X end-of-line send -X end-of-line send -X cursor-right send -X stop-selection } send -X copy-pipe-and-cancel "grep -oE '([^\s]+)\/([^/]+)' | fzf-tmux -d20 --multi --bind alt-a:select-all,alt-d:deselect-all | paste -sd \" \" - | xargs -I {} tmux send-keys -t #{pane_id} \"{}\"" } # unbind after loading plugins unbind -T copy-mode-vi MouseDragEnd1Pane