Files
dotfiles/config/tmux/tmux.conf
T
gitadmin 8657e77536 feat(tmux): add rename-window keybind and container export script
- Bind R to prompt for window rename in tmux
- Add script to export an incus container to /srv/backup
2026-07-16 01:09:55 -04:00

170 lines
4.7 KiB
Bash

# set-option -g default-terminal 'screen-256color'
# set-option -g terminal-overrides ',xterm-256color:RGB'
# set -g default-terminal "tmux-256color"
set -as terminal-feature ",foot*:RGB"
# screen mode
# set -g default-terminal "${TERM}"
# set -g default-terminal "tmux-256color"
# set -ag terminal-overrides ",xterm-256color:RGB"
# colors
# set -ag terminal-overrides ",xterm*:Tc"
# undercurl support
# set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm'
# underscore colours - needs tmux-3.0
# set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m'
# allow terminal scrolling
#set -g terminal-overrides 'xterm*:smcup@:rmcup@'
# default shell
set -g default-shell "/usr/bin/fish"
# auto rename windows
# set -g automatic-rename on
# set -g automatic-rename-format '#{pane_current_command} #{b:pane_current_path}'
set -g allow-rename on
# start with window 1 (instead of 0)
set -g base-index 1
# start with pane 1
setw -g pane-base-index 1
# history
set -g history-limit 5000
# loud or quiet?
set -g visual-activity off
set -g visual-bell off
set -g visual-silence off
set -g monitor-activity on
set -g bell-action none
set -g allow-passthrough on
#set -g bell-on-alert on
set -s escape-time 1
setw -g aggressive-resize on
set -g status-keys vi
set-window-option -g mode-keys vi
set -g extended-keys on
set -g extended-keys-format csi-u
set-option -g focus-events on # TODO: learn how this works
set-option -g set-titles on
set-option -g detach-on-destroy off
set-option -g renumber-windows on
set-option -g set-clipboard on
set-option -g set-titles-string "#S:#{pane_title}"
unbind C-Space
set -g prefix C-Space
bind C-Space send-prefix
#unbind C-s
unbind C-b
#set -g prefix C-s
#bind C-s send-prefix
# Reload the config.
bind r source-file ~/.config/tmux/tmux.conf \; display "Reloaded ~/.config/tmux/tmux.conf"
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel
bind c new-window -c "#{pane_current_path}"
bind e run "tmux split -h /usr/bin/nvim"
#bind o display-popup -w 80% -h 80% -E /usr/bin/opencode
#bind g display-popup -w 80% -h 80% -E /usr/bin/lazygit
# split windows like vim
# vim's definition of a horizontal/vertical split is reversed from tmux's
bind v split-window -h -c "#{pane_current_path}"
bind s split-window -v -c "#{pane_current_path}"
# Rotate windows
bind -r , select-window -t :-
bind -r . select-window -t :+
bind Space choose-tree
bind -r < previous-layout
bind -r > next-layout
# open man page in new window
bind / command-prompt "split window 'exec man %%'"
bind B command-prompt -p "New Session:" "new-session -A -s '%%'"
bind Tab switch-client -l
bind R command-prompt -p "Rename Window:" "rename-window '%%'"
bind t run-shell -b "~/.local/bin/t"
bind Enter run-shell -b "~/.local/bin/s"
bind Q confirm kill-session
bind P pipe-pane -o "cat >>~/#W.log" \; display "Toggled logging to ~/#W.log"
# join pane
bind-key C-h choose-window 'join-pane -h -s "%%"'
bind-key C-v choose-window 'join-pane -s "%%"'
bind-key C-x break-pane
bind -r h select-pane -L
bind -r j select-pane -D
bind -r k select-pane -U
bind -r l select-pane -R
# resize panes like vim
# feel free to change the "1" to however many lines you want to resize by, only
# one at a time can be slow
bind -r H resize-pane -L 5
bind -r L resize-pane -R 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
# bind : to command-prompt like vim
# this is the default in tmux already
# bind : command-prompt
# Alt+number to select window
bind -n M-1 select-window -t 1
bind -n M-2 select-window -t 2
bind -n M-3 select-window -t 3
bind -n M-4 select-window -t 4
bind -n M-5 select-window -t 5
bind -n M-6 select-window -t 6
bind -n M-7 select-window -t 7
bind -n M-8 select-window -t 8
bind -n M-9 select-window -t 9
set -g @continuum-restore 'on'
set -g status-position top
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
# prefix + ctrl-f - simple file search
# prefix + ctrl-g - jumping over git status files (best used after git status command)
# prefix + alt-h - jumping over SHA-1/SHA-256 hashes (best used after git log command)
# prefix + ctrl-u - url search (http, ftp and git urls)
# prefix + ctrl-d - number search (mnemonic d, as digit)
# prefix + alt-i - ip address search
set -g @plugin 'tmux-plugins/tmux-copycat'
set -g @plugin 'christoomey/vim-tmux-navigator'
# prefix + F
set -g @plugin 'sainnhe/tmux-fzf'
# prefix + u
set -g @plugin 'joshmedeski/tmux-fzf-url'
# prefix + a
set -g @plugin 'vieitesss/agent-radar'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.config/tmux/plugins/tpm/tpm'
source-file ~/.config/tmux/theme