aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Triguba <hello@eugenetriguba.com>2026-11-14 11:16:46 -0800
committerEugene Triguba <hello@eugenetriguba.com>2026-11-14 11:16:46 -0800
commit920531ce7d1e544cb106f40fa1a97923bbb50e57 (patch)
treee88b5a6cf5ce042a8bc77c751006c55ed9a25aaa
parentFix bullet list in readme (diff)
downloadtmux-toggle-term-920531ce7d1e544cb106f40fa1a97923bbb50e57.zip
Use prefix key by default for split and float keys
-rw-r--r--CHANGELOG.md7
-rwxr-xr-xsrc/main.sh4
-rw-r--r--tests/tests.sh50
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
}