From f5067ed829ae5743499916b941b2310c50681f29 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 10 Aug 2026 00:55:28 +0200 Subject: feat: add move tab keybind actions (#2561) * feat: add move tab keybind actions Add optional keys.move_tab_previous/move_tab_next actions that reorder the active tab one position, wrapping at either end. Reuses the existing tab.move runtime path that mouse drag reordering already drives. * fix: exit navigate mode on single-tab move attempts --- src/config/keybinds.rs | 6 ++++++ src/config/model.rs | 14 ++++++++++++++ 2 files changed, 20 insertions(+) (limited to 'src/config') diff --git a/src/config/keybinds.rs b/src/config/keybinds.rs index de732121..79dc87e3 100644 --- a/src/config/keybinds.rs +++ b/src/config/keybinds.rs @@ -328,6 +328,8 @@ pub struct Keybinds { pub rename_tab: ActionKeybinds, pub previous_tab: ActionKeybinds, pub next_tab: ActionKeybinds, + pub move_tab_previous: ActionKeybinds, + pub move_tab_next: ActionKeybinds, pub switch_tab: Vec, pub switch_workspace: Vec, pub close_tab: ActionKeybinds, @@ -494,6 +496,8 @@ impl Config { rename_tab: empty_action!(), previous_tab: empty_action!(), next_tab: empty_action!(), + move_tab_previous: empty_action!(), + move_tab_next: empty_action!(), switch_tab: Vec::new(), switch_workspace: Vec::new(), close_tab: empty_action!(), @@ -629,6 +633,8 @@ impl Config { apply_action!(keybinds.rename_tab, rename_tab, source); apply_action!(keybinds.previous_tab, previous_tab, source); apply_action!(keybinds.next_tab, next_tab, source); + apply_action!(keybinds.move_tab_previous, move_tab_previous, source); + apply_action!(keybinds.move_tab_next, move_tab_next, source); apply_indexed!( keybinds.switch_tab, switch_tab, diff --git a/src/config/model.rs b/src/config/model.rs index 16aa1d7d..0b237376 100644 --- a/src/config/model.rs +++ b/src/config/model.rs @@ -393,6 +393,10 @@ pub struct KeysConfig { pub previous_tab: BindingConfig, /// Select the next tab. Default: "prefix+n". pub next_tab: BindingConfig, + /// Move the active tab one position toward the front. Unset by default. + pub move_tab_previous: BindingConfig, + /// Move the active tab one position toward the back. Unset by default. + pub move_tab_next: BindingConfig, /// Switch to tab 1-9. Default: "prefix+1..9". pub switch_tab: BindingConfig, /// Switch to workspace 1-9 from prefix mode. Unset by default. @@ -521,6 +525,10 @@ pub(crate) struct KeysConfigOverlay { #[serde(skip_serializing_if = "Option::is_none")] next_tab: Option, #[serde(skip_serializing_if = "Option::is_none")] + move_tab_previous: Option, + #[serde(skip_serializing_if = "Option::is_none")] + move_tab_next: Option, + #[serde(skip_serializing_if = "Option::is_none")] switch_tab: Option, #[serde(skip_serializing_if = "Option::is_none")] switch_workspace: Option, @@ -627,6 +635,8 @@ impl<'de> Deserialize<'de> for KeysConfig { apply_field!(rename_tab); apply_field!(previous_tab); apply_field!(next_tab); + apply_field!(move_tab_previous); + apply_field!(move_tab_next); apply_field!(switch_tab); apply_field!(switch_workspace); apply_field!(close_tab); @@ -729,6 +739,8 @@ impl KeysConfig { copy_effective_action_field!(rename_tab, keybinds.rename_tab); copy_effective_action_field!(previous_tab, keybinds.previous_tab); copy_effective_action_field!(next_tab, keybinds.next_tab); + copy_effective_action_field!(move_tab_previous, keybinds.move_tab_previous); + copy_effective_action_field!(move_tab_next, keybinds.move_tab_next); copy_effective_indexed_field!(switch_tab, keybinds.switch_tab); copy_effective_indexed_field!(switch_workspace, keybinds.switch_workspace); copy_effective_action_field!(close_tab, keybinds.close_tab); @@ -1025,6 +1037,8 @@ impl Default for KeysConfig { rename_tab: BindingConfig::one("prefix+shift+t"), previous_tab: BindingConfig::one("prefix+p"), next_tab: BindingConfig::one("prefix+n"), + move_tab_previous: BindingConfig::empty(), + move_tab_next: BindingConfig::empty(), switch_tab: BindingConfig::one("prefix+1..9"), switch_workspace: BindingConfig::empty(), close_tab: BindingConfig::one("prefix+shift+x"), -- cgit v1.2.3