From 920531ce7d1e544cb106f40fa1a97923bbb50e57 Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Sat, 14 Nov 2026 11:16:46 -0800 Subject: Use prefix key by default for split and float keys --- CHANGELOG.md | 7 +++++++ src/main.sh | 4 ++-- tests/tests.sh | 50 +++++++++++++++++++++++++++++++++++++------------- 3 files changed, 46 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 58fcbb8..785f13e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Changed + +- `@toggle-term-float-use-prefix` now default to `"true"`. +- `@toggle-term-split-use-prefix` now default to `"true"`. + ## [0.4.0] - 2025-10-25 ### Added diff --git a/src/main.sh b/src/main.sh index 4bc01c2..c643a5e 100755 --- a/src/main.sh +++ b/src/main.sh @@ -42,7 +42,7 @@ float_key() { } use_prefix_for_float() { - get_tmux_option "$FLOAT_USE_PREFIX_OPTION" "false" + get_tmux_option "$FLOAT_USE_PREFIX_OPTION" "true" } split_key() { @@ -50,7 +50,7 @@ split_key() { } use_prefix_for_split() { - get_tmux_option "$SPLIT_USE_PREFIX_OPTION" "false" + get_tmux_option "$SPLIT_USE_PREFIX_OPTION" "true" } float_enabled() { diff --git a/tests/tests.sh b/tests/tests.sh index ed4eaa8..a010167 100644 --- a/tests/tests.sh +++ b/tests/tests.sh @@ -99,30 +99,36 @@ load_plugin() { run load_plugin assert_success - run tmux_has_root_binding "C-f" "float" + run tmux_has_prefix_binding "C-f" "float" assert_success - run tmux_has_root_binding "C-;" "split" + run tmux_has_prefix_binding "C-;" "split" assert_success } @test 'custom float key without prefix works' { tmux_set_option "@toggle-term-float-key" "M-f" + tmux_set_option "@toggle-term-float-use-prefix" "false" run load_plugin assert_success run tmux_has_root_binding "M-f" "float" assert_success + run tmux_has_prefix_binding "M-f" "float" + assert_failure } @test 'custom split key without prefix works' { tmux_set_option "@toggle-term-split-key" "M-t" + tmux_set_option "@toggle-term-split-use-prefix" "false" run load_plugin assert_success run tmux_has_root_binding "M-t" "split" assert_success + run tmux_has_prefix_binding "M-t" "split" + assert_failure } @test 'float key with prefix enabled' { @@ -171,7 +177,25 @@ load_plugin() { assert_failure } -@test 'prefix options default to false' { +@test 'prefix options default to true' { + run load_plugin + assert_success + + run tmux_has_prefix_binding "C-f" "float" + assert_success + run tmux_has_prefix_binding "C-;" "split" + assert_success + + run tmux_has_root_binding "C-f" "float" + assert_failure + run tmux_has_root_binding "C-;" "split" + assert_failure +} + +@test 'prefix can be disabled for both keys' { + tmux_set_option "@toggle-term-float-use-prefix" "false" + tmux_set_option "@toggle-term-split-use-prefix" "false" + run load_plugin assert_success @@ -190,9 +214,9 @@ load_plugin() { run load_plugin assert_success - run tmux_has_root_binding "C-f" "float" + run tmux_has_prefix_binding "C-f" "float" assert_success - run tmux_has_root_binding "C-;" "split" + run tmux_has_prefix_binding "C-;" "split" assert_success } @@ -202,9 +226,9 @@ load_plugin() { run load_plugin assert_success - run tmux_has_root_binding "C-f" "float" + run tmux_has_prefix_binding "C-f" "float" assert_failure - run tmux_has_root_binding "C-;" "split" + run tmux_has_prefix_binding "C-;" "split" assert_success } @@ -214,9 +238,9 @@ load_plugin() { run load_plugin assert_success - run tmux_has_root_binding "C-f" "float" + run tmux_has_prefix_binding "C-f" "float" assert_success - run tmux_has_root_binding "C-;" "split" + run tmux_has_prefix_binding "C-;" "split" assert_failure } @@ -227,9 +251,9 @@ load_plugin() { run load_plugin assert_success - run tmux_has_root_binding "C-f" "float" + run tmux_has_prefix_binding "C-f" "float" assert_failure - run tmux_has_root_binding "C-;" "split" + run tmux_has_prefix_binding "C-;" "split" assert_failure } @@ -240,7 +264,7 @@ load_plugin() { run load_plugin assert_success - run tmux_has_root_binding "M-f" "float" + run tmux_has_prefix_binding "M-f" "float" assert_failure } @@ -251,7 +275,7 @@ load_plugin() { run load_plugin assert_success - run tmux_has_root_binding "M-t" "split" + run tmux_has_prefix_binding "M-t" "split" assert_failure } -- cgit v1.2.3