Files
dotfiles/config/tmux/tmux.conf
Ismo Vuorinen 9b7942a9fb refactor(tmux): combine sesh scripts into single bash script
Replace sesh-gum.sh and sesh-tmux.fish with a unified sesh.sh that
cascades through available tools: gum, fzf-tmux, fzf, bash select.
Falls back to native tmux choose-tree if sesh is not installed.
2026-02-04 03:22:17 +02:00

138 lines
6.9 KiB
Bash

# ~/.config/tmux/tmux.conf, or .dotfiles/config/tmux/tmux.conf
#
# Contains configuration from the following sources:
# - https://tmuxguide.readthedocs.io/en/latest/tmux/tmux.html
# - https://github.com/dreamsofcode-io/tmux/blob/main/tmux.conf
#
# ╭──────────────────────────────────────────────────────────╮
# │ Settings │
# ╰──────────────────────────────────────────────────────────╯
# set [flags] [command] [value]
# Flags can be combined, e.g. -as
# -a : Append the value to the existing setting.
# -s : Apply the setting to the current session.
# -g : Apply the setting globally to all sessions.
# -o : Set the option only if it is not already set.
# -u : Unset the specified option.
set -as terminal-features ",xterm-256color:RGB:clipboard:usstyle:strikethrough:overline"
set -s escape-time 0 # Address vim mode switching delay
set -s set-clipboard on # System clipboard via OSC 52
set -g default-terminal "tmux-256color" # Set default terminal to 256 colors
set -g detach-on-destroy off # don't detach tmux when killing a session
set -g display-time 0 # Hide clock
set -g focus-events on # Focus events enabled for terminals that support them
set -g history-limit 50000 # Increase scrollback buffer size
set -g mouse on # Mouse support
set -g set-titles on # Allow tmux to set the terminal title
set -g status on # Setting status on
set -g status-interval 5 # Refresh status more often
set -g status-keys vi # vi keys to move between panes
set -wg aggressive-resize on # Better for grouped sessions and multi-monitor
# Keep Tmux alive when the initial command is finished
set -g remain-on-exit off
# Start windows and panes at 1, not 0
set -g base-index 1
set -g pane-base-index 1
set -g renumber-windows on
# ╭──────────────────────────────────────────────────────────╮
# │ Theme │
# ╰──────────────────────────────────────────────────────────╯
set -g status-position "bottom"
set -g @catppuccin_window_left_separator "█"
set -g @catppuccin_window_right_separator ""
set -g @catppuccin_window_middle_separator " "
# ╭──────────────────────────────────────────────────────────╮
# │ Bindings │
# ╰──────────────────────────────────────────────────────────╯
# bind flags
# -N = Note / description of the command
# -r = repeatable, only needs prefix once
# -n = doesn't need prefix
# -t = binds to a certain key-table (root, copy-mode, prefix, etc.)
# Set <prefix> to Control + Space, keeping the default of C-b intact.
# C-Space send-prefix line doubles the prefix when in nested tmux session.
set -g prefix C-Space
bind C-Space send-prefix
# Use Ctrl-arrow keys without prefix key to switch panes
bind -n C-Left select-pane -L
bind -n C-Right select-pane -R
bind -n C-Up select-pane -U
bind -n C-Down select-pane -D
# Reload tmux config with <prefix> + r
unbind r
bind r "source-file ~/.dotfiles/config/tmux/tmux.conf; display 'tmux cfg reloaded!'"
# copy mode using 'Esc'
unbind [
bind Escape copy-mode
# paste using 'p'
unbind p
bind p paste-buffer
# copy-mode-vi: y copies to system clipboard, Y copies and pastes
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel
bind -T copy-mode-vi Y send-keys -X copy-pipe-and-cancel "tmux paste-buffer"
# easier switching between next/prev window
bind C-p previous-window
bind C-n next-window
# global sessions
bind -N "sesh selection" t display-popup -E "$HOME/.dotfiles/config/tmux/sesh.sh"
bind -N "last-session (via sesh) " L run-shell "sesh last"
bind -N "sesh ui" N display-popup -E "sesh ui"
# ╭──────────────────────────────────────────────────────────╮
# │ Plugins │
# ╰──────────────────────────────────────────────────────────╯
# ── Plugins related configurations ────────────────────────────────────
# Plugin that lets you suspend local tmux session,
# so that you can work with nested remote tmux session painlessly.
# https://github.com/MunifTanjim/tmux-suspend
set -g @suspend_key 'F8' # Default is F12
set -g @suspend_suspended_options " \
status-left-style::bg=brightblack\\,fg=black, \
status-left:: ⏸ , \
"
# https://github.com/erikw/tmux-dark-notify
set -g @dark-notify-theme-path-light "$HOME/.dotfiles/config/tmux/theme-light.conf"
set -g @dark-notify-theme-path-dark "$HOME/.dotfiles/config/tmux/theme-dark.conf"
# https://github.com/tmux-plugins/tmux-continuum
set -g @continuum-restore 'on'
# ── Own scripts ───────────────────────────────────────────────────────
# If we started tmux with a session name, rename it.
run-shell "$HOME/.dotfiles/config/tmux/rename-session.sh"
# Load theme based on tmux-dark-notify state.
# This script helps states where dark-notify is not available,
# and we want to have light or dark state constantly available.
run-shell "$HOME/.dotfiles/config/tmux/theme-activate.sh"
# ── Sourcing the plugins ──────────────────────────────────────────────
run-shell "$HOME/.dotfiles/config/tmux/plugins/tmux-suspend/suspend.tmux"
run-shell "$HOME/.dotfiles/config/tmux/plugins/tmux-sessionist/sessionist.tmux"
run-shell "$HOME/.dotfiles/config/tmux/plugins/tmux-current-pane-hostname/current_pane_hostname.tmux"
run-shell "$HOME/.dotfiles/config/tmux/plugins/tmux-resurrect/resurrect.tmux"
run-shell "$HOME/.dotfiles/config/tmux/plugins/tmux-continuum/continuum.tmux"
run-shell "$HOME/.dotfiles/config/tmux/plugins/catppuccin/catppuccin.tmux"
run-shell "$HOME/.dotfiles/config/tmux/plugins/tmux-dark-notify/main.tmux"