From 905fe60936949d4f0ab1cb8880b217774cafa147 Mon Sep 17 00:00:00 2001 From: Bryan Date: Sat, 16 May 2026 19:19:28 +0800 Subject: [PATCH] add reverseSplitBindings option --- CHANGELOG | 11 +++++++++++ modules/programs/tmux.nix | 18 ++++++++++++++++-- modules/system/version.nix | 2 +- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 94e9287..81d09f8 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,14 @@ +2026-05-16 +- The reversed split-window key bindings previously generated by + `programs.tmux.enableSensible` are no longer emitted when + `system.stateVersion` is 7 or later, so tmux uses its conventional + behavior: `%` splits the current pane horizontally and `"` splits it + vertically. + + Existing configurations with `system.stateVersion` 6 or earlier keep + the previous reversed bindings. You can explicitly choose either + behavior with `programs.tmux.reverseSplitBindings`. + 2026-02-10 - Major changes to `homebrew` module diff --git a/modules/programs/tmux.nix b/modules/programs/tmux.nix index 4e09fcb..79d4341 100644 --- a/modules/programs/tmux.nix +++ b/modules/programs/tmux.nix @@ -57,6 +57,17 @@ in description = "Enable sensible configuration options for tmux."; }; + programs.tmux.reverseSplitBindings = mkOption { + type = types.bool; + default = config.system.stateVersion <= 6 && cfg.enableSensible; + defaultText = literalExpression "config.system.stateVersion <= 6 && config.programs.tmux.enableSensible"; + example = true; + description = '' + Whether to reverse the `%` and `"` split-window key bindings + emitted by the tmux module. + ''; + }; + programs.tmux.enableMouse = mkOption { type = types.bool; default = false; @@ -127,8 +138,6 @@ in set -s escape-time 0 bind c new-window -c '#{pane_current_path}' - bind % split-window -h -c '#{pane_current_path}' - bind '"' split-window -v -c '#{pane_current_path}' # TODO: make these interactive bind C new-session @@ -138,6 +147,11 @@ in # set -g utf8 on ''; + programs.tmux.tmuxOptions.splitBindings.text = mkIf cfg.reverseSplitBindings '' + bind % split-window -v -c '#{pane_current_path}' + bind '"' split-window -h -c '#{pane_current_path}' + ''; + programs.tmux.tmuxOptions.mouse.text = mkIf cfg.enableMouse '' set -g mouse on setw -g mouse on diff --git a/modules/system/version.nix b/modules/system/version.nix index ae30b5a..195c1d8 100644 --- a/modules/system/version.nix +++ b/modules/system/version.nix @@ -51,7 +51,7 @@ in system.maxStateVersion = mkOption { internal = true; type = types.int; - default = 6; + default = 7; }; system.darwinLabel = mkOption {