# @(#)$KimmoSuominen: .cfg/home/dot.tmux.conf,v 1.44 2026/05/03 05:59:57 kim Exp $ # Multiple clients sharing one session: # # tmux new -s base-session # tmux new-session -t base-session -s new-session # Change the prefix from C-b to C-z set -g prefix C-z bind -N "Send prefix" z send-prefix bind -N "Select the last window" C-z last-window unbind C-b # Screen compatibility bindings (really just ones I was using) bind -N "Select the previous window" Bspace previous-window # tmux: p bind -N "Select the next window" Space next-window # tmux: n bind -N "Select the next pane" Tab select-pane -t :.+ # tmux: o #bind -N "Choose a window from a list" \" choose-tree -Zw # tmux: w #bind -N "Choose a window by name" \' command-prompt { find-window -Z "%%" } # tmux: f bind -N "Break pane to a new window" Q break-pane # tmux: ! bind -N "Split window vertically" S split-window -v # tmux: " bind -N "Kill the active pane" X confirm-before -p "kill-pane #P: #W? (y/n)" kill-pane # tmux: x bind -N "Kill current window" k confirm-before -p \ "kill-window #W (#{window_panes} pane#{?#{==:#{window_panes},1},,s})? (y/n)" kill-window # Also shows pane count, so bind to & as well (enhancement) # tmux: & bind -N "Kill current window" \& confirm-before -p \ "kill-window #W (#{window_panes} pane#{?#{==:#{window_panes},1},,s})? (y/n)" kill-window bind -N "Split window horizontally" | split-window -h # tmux: % # Smarter replacements (inspired by sesh) # tmux uses L for last session; avoid shift key # tmux uses l for last window; we have it on "prefix prefix" from the top of this file bind -N "Select the last session" l run-shell "~/misc/tmux-last-session" bind L run-shell "~/misc/tmux-last-session" bind -N "Choose session" s run-shell "~/misc/tmux-session-switcher" #bind -N "Choose session" \" run-shell "~/misc/tmux-session-switcher" #bind -N "Choose window" w run-shell "~/misc/tmux-window-switcher" bind -N "Choose window" \' run-shell "~/misc/tmux-window-switcher" # XXX: Move to tmux-session-switcher / tmux-window-switcher, with commentary # I want to keep these around for now # Changes from tmux default: # - Format avoids duplicate information better # - No preview (preference as a prior screen user; subject to change) #bind -N "Choose a session from a list" s choose-tree -NZs \ # -F "#W#F#{?#{||:#{||:#{==:#T,},#{==:#T,#W}},#{||:#{==:#T,#H},#{==:#T,#h}}},,: #T}" bind -N "Choose a window from a list" w choose-tree -NZw \ -F "#W#F#{?#{||:#{||:#{==:#T,},#{==:#T,#W}},#{||:#{==:#T,#H},#{==:#T,#h}}},,: #T}" # Put newly missing tmux bindings back somewhere else bind -N "Select next layout" C-Space next-layout # tmux: Space bind -N "Split window vertically" @ split-window # tmux: " # Sometimes I'm not releasing Control fast enough # Screen has a lot of bindings both with and without control (YMMV) bind C-] paste-buffer -p # Finnish keyboard layout compatibility bind ö last-pane # ; bind Ö command-prompt # : bind ä run-shell "~/misc/tmux-window-switcher" # ' bind Ä run-shell "~/misc/tmux-session-switcher" # " bind å copy-mode # [ bind Å swap-pane -U # { bind ¨ paste-buffer -p # ] bind ^ swap-pane -D # } bind _ list-keys -N # ? # € # $ #unbind & # kill-window #unbind % # split-window -h bind -T copy-mode-vi Space send-keys -X page-down bind -T copy-mode-vi BSpace send-keys -X page-up bind -T copy-mode-vi Escape if -F '#{selection_present}' \ 'send-keys -X clear-selection' \ 'send-keys -X cancel' bind -T copy-mode-vi Enter if -F '#{selection_present}' \ 'send-keys -X copy-pipe-and-cancel' \ 'send-keys -X begin-selection' bind -T copy-mode-vi \$ { send-keys -X end-of-line ; send-keys -X cursor-left } bind -T copy-mode-vi ö send-keys -X jump-again # ; bind -T copy-mode-vi Ö command-prompt -p "(goto line)" { send-keys -X goto-line "%%%" } # : # ä # ' # Ä # " # å # [ bind -T copy-mode-vi Å send-keys -X previous-paragraph # { # ¨ # ] bind -T copy-mode-vi ^ send-keys -X next-paragraph # } bind -T copy-mode-vi € { send-keys -X end-of-line ; send-keys -X cursor-left } # $ set -g allow-rename on set -g allow-set-title on set -g alternate-screen off set -g command-alias screen=new-window set -g default-terminal tmux-256color set -g detach-on-destroy off set -g display-time 1250 #set -g escape-time 500 set -g history-limit 20000 set -g remain-on-exit failed set -g scroll-on-clear on set -as terminal-features ",xterm-256color:RGB" set -g update-environment '' setenv -g -u DISPLAY setenv -g -u SHLVL setenv -g -u SSH_ASKPASS setenv -g -u SSH_CLIENT setenv -g -u SSH_CONNECTION setenv -g -u SSH_TTY setenv -g -u REMOTEHOST setenv -g -u WINDOWID setenv -g -u XAUTHORITY # Only constrain the size of windows visible on a client # XXX: Not compatible with iTerm2 #setw -g aggressive-resize on # moving between panes #bind h select-pane -L #bind j select-pane -D #bind k select-pane -U #bind l select-pane -R # Quick pane selection #bind -r C-h select-window -t :- #bind -r C-l select-window -t :+ # Pane resizing #bind -r H resize-pane -L 5 #bind -r J resize-pane -D 5 #bind -r K resize-pane -U 5 #bind -r L resize-pane -R 5 # Activate OFF mode for nested sessions bind -N "Switch to OFF mode for nested sessions" Z { set prefix None set key-table off set status-style "fg=red,bg=black" } # Deactivate OFF mode # XXX: This collides with "prefix C-o" (rotate-window) bind -T off C-o { set -u prefix set -u key-table set -u status-style } set -g status-format[0] "#[align=left range=left #{E:status-left-style}]#[push-default]#{T;=/#{status-left-length}:status-left}#[pop-default]#[norange default]#[align=#{status-justify} range=window #{E:window-status-current-style}]#[push-default]#{T:window-status-current-format}#[pop-default]#[norange default]#[align=right range=right #{E:status-right-style}]#[push-default]#{T;=/#{status-right-length}:status-right}#[pop-default]#[norange default]" set -g window-status-current-format "#W#F#{?#{||:#{||:#{==:#T,},#{==:#T,#W}},#{||:#{==:#T,#H},#{==:#T,#h}}},,: #T}#{?window_bigger, [#{window_offset_x}#,#{window_offset_y}],}" set -g status-left "[#S:#I.#P] " set -g status-left-length 50 set -g status-right "#h" %if #{||:#{==:#h,beowulf},#{||:#{==:#h,wheeso26},#{==:#h,rhea38}}} set -g status-style "fg=green,bg=black" %else set -g status-style "fg=blue,bg=black" %endif # # tmux on macOS does not understand mouse settings # # mouse support - set to on if you want to use the mouse #setw -g mode-mouse off #set -g mouse-select-pane off #set -g mouse-resize-pane off #set -g mouse-select-window off # enable activity alerts #setw -g monitor-activity on #set -g visual-activity on # set the color of the window list #setw -g window-status-fg cyan #setw -g window-status-bg default #setw -g window-status-attr dim # set colors for the active window #setw -g window-status-current-fg white #setw -g window-status-current-bg red #setw -g window-status-current-attr bright # pane colors #set -g pane-border-fg green #set -g pane-border-bg black #set -g pane-active-border-fg white #set -g pane-active-border-bg yellow # Command / message line #set -g message-fg white #set -g message-bg black #set -g message-attr bright # tmux on macOS does not understand status-utf8 #set -g status-utf8 on # Update the status bar every sixty seconds #set -g status-interval 60 #set-option -g default-command "/opt/local/bin/reattach-to-user-namespace tcsh"