Skip to content

feat(home): org tmux keybindings and terminal defaults for vigos.multiplexer - #1606

Merged
c-vigo merged 4 commits into
devfrom
feature/1605-multiplexer-keybindings
Sep 7, 2026
Merged

c-vigo merged 4 commits into
devfrom
feature/1605-multiplexer-keybindings

Conversation

@c-vigo

@c-vigo c-vigo commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Description

vigos.multiplexer set five options and no keybindings, and left
programs.tmux.terminal at home-manager's default. Every consumer re-derived
the same extraConfig by hand, and a host running the module bare — a shared
remote development guest, a devcontainer — got none of it.

Two concrete symptoms, both from #1605:

  • prefix + X (kill the current session) lived only in a downstream personal
    config. prefix + x still worked there because kill-pane is a tmux default;
    X is not, so a habit built on one machine silently did nothing on the next.
  • programs.tmux.terminal evaluated to "screen": 8 colors, no italics. Every
    colored tool the org ships — starship, neovim, delta, lazygit, gh-dash —
    rendered degraded the moment it ran inside tmux, on every host.

Type of Change

  • feat -- New feature

Modifiers

  • Breaking change (!) -- This change breaks backward compatibility

Not breaking, but two behaviour caveats for a host already enabling the module
(both accepted in the issue's Impact section):

  • prefix + l becomes select-pane -R rather than stock last-window. The
    only default this replaces; coherent with the module's own keyMode = "vi",
    and the cookbook now shows how to take the key back.
  • detach-on-destroy off changes what happens to a client after its session
    ends — it switches to another live session instead of dropping to a shell
    (still detaches if that was the last one).

Changes Made

nix/home/multiplexer.nix:

  • terminal = lib.mkDefault "tmux-256color" plus
    set -ga terminal-overrides ",*256col*:Tc" for truecolor.
  • bind-key X confirm-before … kill-session — X is unbound in stock tmux, so
    this takes nothing away, and the prompt keeps a stray prefix from destroying
    a project's layout.
  • cwd-preserving splits/new windows, renumber-windows, focus-events.
  • set-clipboard on (OSC 52 — a yank on a remote host reaches the local
    clipboard with no X forwarding) and v/y in copy mode, which the module's
    own vi keyMode does not imply.
  • detach-on-destroy off, set-titles / set-titles-string "#S".
  • h/j/k/l pane selection.

The block is a plain (not mkAfter) extraConfig definition, so it lands
before any lib.mkAfter block. tmux takes the last binding of a key, so
the override seam vigos.sesh already uses for bind o keeps working, and a
consumer can take a key back the same way.

docs/home/COOKBOOK.md documents that seam.

Deliberately not done: a per-group enable option (YAGNI — extraConfig is
already the seam and every option is mkDefault), and nothing moved into
vigos.sesh.

Changelog Entry

### Added

- **`vigos.multiplexer`: org tmux keybindings and terminal defaults**
  ([#1605](https://github.com/vig-os/devkit/issues/1605))
  - The module set five options and no keybindings, so every consumer
    re-derived the same `extraConfig` — and a host running it bare (a shared
    remote development guest, a devcontainer) got none of it. `prefix + X`,
    kill the current session, is the concrete case: unbound in stock tmux, so
    a habit built on one machine silently did nothing on the next
  - `programs.tmux.terminal` now defaults to `tmux-256color`; home-manager's
    default is `screen`, which advertises 8 colors and no italics. Everything
    the org ships that draws color — starship, neovim, delta, lazygit,
    `gh-dash` — was rendering degraded the moment it ran inside tmux, on every
    host. A `terminal-overrides` line adds truecolor on top
  - New bindings: `prefix + X` kills the session behind a confirm prompt;
    splits and new windows inherit the pane's cwd; `v`/`y` in copy mode match
    the module's own vi `keyMode`; `h`/`j`/`k`/`l` select panes. New settings:
    `renumber-windows`, `focus-events`, `set-clipboard` (OSC 52 — a yank on a
    remote host reaches the local clipboard with no X forwarding),
    `detach-on-destroy off`, and per-session terminal titles
  - Two behaviour changes for a host already enabling the module: `prefix + l`
    is now `select-pane -R` rather than `last-window`, and a client whose
    session is destroyed switches to another live session instead of dropping
    to a shell (it still detaches if that was the last session). Everything
    else is additive or a `mkDefault` a bare assignment overrides
  - The block lands before any `lib.mkAfter` definition and tmux takes the
    *last* binding of a key, so a consumer takes a key back through
    `programs.tmux.extraConfig = lib.mkAfter …` — the same seam `vigos.sesh`
    already uses for `bind o`

Testing

  • Tests pass locally (just test)
  • Manual testing performed (describe below)

Three new tests in tests/test_flake_checks.py, all reading the existing
cached _ci_full_config() eval slice (no new eval): the terminal default, that
every binding reaches a host which only enables the module, and that the block
precedes vigos.sesh's bind o so the override seam still works. TDD — all
three committed red first (screen != tmux-256color, then substring not found), then green.

$ uv run pytest tests/test_flake_checks.py tests/test_flake_modules.py -q
60 passed in 873.29s (0:14:33)

$ prek run --all-files          # full suite, both hook sets
(all Passed)

$ nix build .#checks.x86_64-linux.hm-full
# only hm_tmuxtmux.conf + home-manager-{files,generation} rebuilt

Manual Testing Details

The generated tmux.conf was loaded into a real tmux 3.6a server on an
isolated socket, and the resulting bindings/options read back — the eval
asserts the text, this asserts tmux actually accepts it:

$ tmux -f "$conf" -S ./t.sock new-session -d -s probe \; list-keys \; show-options -g
bind-key -T copy-mode-vi v   send-keys -X begin-selection
bind-key -T copy-mode-vi y   send-keys -X copy-pipe-and-cancel
bind-key -T prefix       X   confirm-before -p "kill session '#S'? (y/n)" kill-session
bind-key -T prefix       \"  split-window -v -c "#{pane_current_path}"
bind-key -T prefix       \%  split-window -h -c "#{pane_current_path}"
bind-key -T prefix       c   new-window -c "#{pane_current_path}"
bind-key -T prefix       h   select-pane -L
bind-key -T prefix       j   select-pane -D
bind-key -T prefix       k   select-pane -U
bind-key -T prefix       l   select-pane -R
base-index 1
detach-on-destroy off
history-limit 100000
mouse on
renumber-windows on
set-titles on
set-titles-string "#S"

$ ... \; show-options -s \; show-options -gw
default-terminal tmux-256color
escape-time 10
focus-events on
set-clipboard on
terminal-overrides[0] linux*:AX@
terminal-overrides[1] *256col*:Tc
mode-keys vi

terminal-overrides appends to tmux's own default rather than replacing it,
and the merged extraConfig ends with bind o display-popup -E "sesh-picker"
— sesh's mkAfter still last.

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly
  • I have updated CHANGELOG.md in the [Unreleased] section (and pasted the entry above)
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Additional Notes

The issue flagged group 6 (vim pane navigation) for review as the only item
that removes a tmux default. Implemented as specified — the issue's own Impact
section accepts the prefix + l trade — but it is the one thing worth an
explicit yes/no at review, and it is a two-line revert if the answer is no.

Refs: #1605

@c-vigo
c-vigo merged commit a213016 into dev Sep 7, 2026
14 checks passed
@c-vigo
c-vigo deleted the feature/1605-multiplexer-keybindings branch September 7, 2026 07:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant