Tmux configuration#

The tmux setup is structured to keep OS-specific terminal color wiring explicit and override-friendly.

Directory layout#

Show layout
home/dot-tmux#
$ lsd --almost-all --tree home/dot-tmux
dot-tmux
├── symlink_terminal-colors-config.conf.tmpl
├── terminal-colors-linux.conf
├── tmux.conf
└── tmuxline.conf

Load order#

This is primarily useful to avoid explicit conditional logic within tmux.conf (we do have an if), but keep it somewhat declarative and isolated to the OS environment we’re in.

By default we use terminal-colors-linux.conf, otherwise we switch as per the setup below:

  1. symlink_terminal-colors-config.conf.tmpl selects the OS/environment target

    symlink_terminal-colors-config.conf.tmpl#
    1{{- /* vim: set ft=gotmpl: */ -}}
    2{{- $source_tmux := joinPath .chezmoi.sourceDir "dot-tmux" -}}
    3{{- $environment := lower (env "VVN_DOTFILES_ENVIRONMENT") -}}
    4{{- $candidate := print "terminal-colors-linux_" $environment ".conf" -}}
    5{{- if and (ne $environment "") (stat (joinPath $source_tmux $candidate)) -}}
    6{{ $candidate }}
    7{{- else -}}
    8terminal-colors-linux.conf
    9{{- end -}}
    
  2. tmux.conf sources the selected config, otherwise uses Linux fallback

    tmux.conf#
    21# Linux-specific terminal color setup (if present)
    22if-shell "test -f ~/dot-tmux/terminal-colors-config.conf" \
    23  "source ~/dot-tmux/terminal-colors-config.conf" \
    24  "source ~/dot-tmux/terminal-colors-linux.conf"
    

Relevant changelogs#