diff options
| author | David Heinemeier Hansson <david@hey.com> | 2026-08-09 18:10:52 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-08-09 19:10:52 +0300 |
| commit | 4e31084495120674a0cf403a27d3d91c5efb34fe (patch) | |
| tree | 5c47ba87d2cd7fe0bb9a02a360de38c79d8a9d5c /src/config | |
| parent | ca1af383a82733608a0563fce2252058b478498c (diff) | |
feat: add direct pane resize keybindings (#2558)
Diffstat (limited to 'src/config')
| -rw-r--r-- | src/config/keybinds.rs | 12 | ||||
| -rw-r--r-- | src/config/model.rs | 28 |
2 files changed, 40 insertions, 0 deletions
diff --git a/src/config/keybinds.rs b/src/config/keybinds.rs index 199076f0..de732121 100644 --- a/src/config/keybinds.rs +++ b/src/config/keybinds.rs @@ -350,6 +350,10 @@ pub struct Keybinds { pub close_pane: ActionKeybinds, pub zoom: ActionKeybinds, pub resize_mode: ActionKeybinds, + pub resize_pane_left: ActionKeybinds, + pub resize_pane_down: ActionKeybinds, + pub resize_pane_up: ActionKeybinds, + pub resize_pane_right: ActionKeybinds, pub toggle_sidebar: ActionKeybinds, pub custom_commands: Vec<CustomCommandKeybind>, } @@ -512,6 +516,10 @@ impl Config { close_pane: empty_action!(), zoom: empty_action!(), resize_mode: empty_action!(), + resize_pane_left: empty_action!(), + resize_pane_down: empty_action!(), + resize_pane_up: empty_action!(), + resize_pane_right: empty_action!(), toggle_sidebar: empty_action!(), custom_commands: Vec::new(), }; @@ -653,6 +661,10 @@ impl Config { apply_action!(keybinds.close_pane, close_pane, source); apply_action!(keybinds.zoom, zoom, source); apply_action!(keybinds.resize_mode, resize_mode, source); + apply_action!(keybinds.resize_pane_left, resize_pane_left, source); + apply_action!(keybinds.resize_pane_down, resize_pane_down, source); + apply_action!(keybinds.resize_pane_up, resize_pane_up, source); + apply_action!(keybinds.resize_pane_right, resize_pane_right, source); apply_action!(keybinds.toggle_sidebar, toggle_sidebar, source); if source == field_source!(indexed) { diff --git a/src/config/model.rs b/src/config/model.rs index ba700731..9bd83a96 100644 --- a/src/config/model.rs +++ b/src/config/model.rs @@ -438,6 +438,14 @@ pub struct KeysConfig { pub zoom: BindingConfig, /// Enter resize mode. Default: "prefix+r" pub resize_mode: BindingConfig, + /// Resize the focused pane toward the left. Unset by default. + pub resize_pane_left: BindingConfig, + /// Resize the focused pane downward. Unset by default. + pub resize_pane_down: BindingConfig, + /// Resize the focused pane upward. Unset by default. + pub resize_pane_up: BindingConfig, + /// Resize the focused pane toward the right. Unset by default. + pub resize_pane_right: BindingConfig, /// Toggle sidebar collapse. Default: "prefix+b" pub toggle_sidebar: BindingConfig, /// Optional indexed shortcuts expanded over number keys 1-9. @@ -557,6 +565,14 @@ pub(crate) struct KeysConfigOverlay { #[serde(skip_serializing_if = "Option::is_none")] resize_mode: Option<BindingConfig>, #[serde(skip_serializing_if = "Option::is_none")] + resize_pane_left: Option<BindingConfig>, + #[serde(skip_serializing_if = "Option::is_none")] + resize_pane_down: Option<BindingConfig>, + #[serde(skip_serializing_if = "Option::is_none")] + resize_pane_up: Option<BindingConfig>, + #[serde(skip_serializing_if = "Option::is_none")] + resize_pane_right: Option<BindingConfig>, + #[serde(skip_serializing_if = "Option::is_none")] toggle_sidebar: Option<BindingConfig>, #[serde(skip_serializing_if = "Option::is_none")] indexed: Option<IndexedKeysConfig>, @@ -633,6 +649,10 @@ impl<'de> Deserialize<'de> for KeysConfig { apply_field!(close_pane); apply_field!(zoom); apply_field!(resize_mode); + apply_field!(resize_pane_left); + apply_field!(resize_pane_down); + apply_field!(resize_pane_up); + apply_field!(resize_pane_right); apply_field!(toggle_sidebar); apply_field!(indexed); apply_field!(command); @@ -731,6 +751,10 @@ impl KeysConfig { copy_effective_action_field!(close_pane, keybinds.close_pane); copy_effective_action_field!(zoom, keybinds.zoom); copy_effective_action_field!(resize_mode, keybinds.resize_mode); + copy_effective_action_field!(resize_pane_left, keybinds.resize_pane_left); + copy_effective_action_field!(resize_pane_down, keybinds.resize_pane_down); + copy_effective_action_field!(resize_pane_up, keybinds.resize_pane_up); + copy_effective_action_field!(resize_pane_right, keybinds.resize_pane_right); copy_effective_action_field!(toggle_sidebar, keybinds.toggle_sidebar); copy_user_field!(indexed); @@ -1019,6 +1043,10 @@ impl Default for KeysConfig { close_pane: BindingConfig::one("prefix+x"), zoom: BindingConfig::one("prefix+z"), resize_mode: BindingConfig::one("prefix+r"), + resize_pane_left: BindingConfig::empty(), + resize_pane_down: BindingConfig::empty(), + resize_pane_up: BindingConfig::empty(), + resize_pane_right: BindingConfig::empty(), toggle_sidebar: BindingConfig::one("prefix+b"), indexed: IndexedKeysConfig::default(), command: Vec::new(), |
