aboutsummaryrefslogtreecommitdiff
path: root/src/config
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-06-05 21:59:10 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-06-05 22:06:02 +0300
commit556b16b2df7ea2c3e9b8ad13db4ad7370c1ad838 (patch)
tree0a6f61701f2c8992c6cd1ee6d61171ef92a92533 /src/config
parentae3c88ab8c64931740d89623f688f7d3f408da5e (diff)
feat: add pane navigation controls
refs #421 refs #330 related discussions: https://github.com/ogulcancelik/herdr/discussions/422 https://github.com/ogulcancelik/herdr/discussions/438 https://github.com/ogulcancelik/herdr/discussions/442
Diffstat (limited to 'src/config')
-rw-r--r--src/config/keybinds.rs36
-rw-r--r--src/config/model.rs12
2 files changed, 48 insertions, 0 deletions
diff --git a/src/config/keybinds.rs b/src/config/keybinds.rs
index 299af6cb..cc054995 100644
--- a/src/config/keybinds.rs
+++ b/src/config/keybinds.rs
@@ -291,6 +291,10 @@ pub struct Keybinds {
pub focus_pane_down: ActionKeybinds,
pub focus_pane_up: ActionKeybinds,
pub focus_pane_right: ActionKeybinds,
+ pub swap_pane_left: ActionKeybinds,
+ pub swap_pane_down: ActionKeybinds,
+ pub swap_pane_up: ActionKeybinds,
+ pub swap_pane_right: ActionKeybinds,
pub cycle_pane_next: ActionKeybinds,
pub cycle_pane_previous: ActionKeybinds,
pub last_pane: ActionKeybinds,
@@ -470,6 +474,10 @@ impl Config {
focus_pane_down: action!("keys.focus_pane_down", &self.keys.focus_pane_down),
focus_pane_up: action!("keys.focus_pane_up", &self.keys.focus_pane_up),
focus_pane_right: action!("keys.focus_pane_right", &self.keys.focus_pane_right),
+ swap_pane_left: action!("keys.swap_pane_left", &self.keys.swap_pane_left),
+ swap_pane_down: action!("keys.swap_pane_down", &self.keys.swap_pane_down),
+ swap_pane_up: action!("keys.swap_pane_up", &self.keys.swap_pane_up),
+ swap_pane_right: action!("keys.swap_pane_right", &self.keys.swap_pane_right),
last_pane: action!("keys.last_pane", &self.keys.last_pane),
cycle_pane_next: action!("keys.cycle_pane_next", &self.keys.cycle_pane_next),
cycle_pane_previous: action!(
@@ -1734,6 +1742,34 @@ switch_workspace = "prefix+shift+1..9"
.bindings
.iter()
.all(|binding| binding.trigger.is_prefix()));
+ assert_eq!(
+ binding_triggers(&kb.swap_pane_left),
+ vec![BindingTrigger::Prefix((
+ KeyCode::Char('h'),
+ KeyModifiers::SHIFT
+ ))]
+ );
+ assert_eq!(
+ binding_triggers(&kb.swap_pane_down),
+ vec![BindingTrigger::Prefix((
+ KeyCode::Char('j'),
+ KeyModifiers::SHIFT
+ ))]
+ );
+ assert_eq!(
+ binding_triggers(&kb.swap_pane_up),
+ vec![BindingTrigger::Prefix((
+ KeyCode::Char('k'),
+ KeyModifiers::SHIFT
+ ))]
+ );
+ assert_eq!(
+ binding_triggers(&kb.swap_pane_right),
+ vec![BindingTrigger::Prefix((
+ KeyCode::Char('l'),
+ KeyModifiers::SHIFT
+ ))]
+ );
}
#[test]
diff --git a/src/config/model.rs b/src/config/model.rs
index 9fda88f4..3b8b2cb7 100644
--- a/src/config/model.rs
+++ b/src/config/model.rs
@@ -315,6 +315,14 @@ pub struct KeysConfig {
pub focus_pane_up: BindingConfig,
/// Focus the pane to the right. Default: "prefix+l".
pub focus_pane_right: BindingConfig,
+ /// Swap the focused pane with the pane to the left. Default: "prefix+shift+h".
+ pub swap_pane_left: BindingConfig,
+ /// Swap the focused pane with the pane below. Default: "prefix+shift+j".
+ pub swap_pane_down: BindingConfig,
+ /// Swap the focused pane with the pane above. Default: "prefix+shift+k".
+ pub swap_pane_up: BindingConfig,
+ /// Swap the focused pane with the pane to the right. Default: "prefix+shift+l".
+ pub swap_pane_right: BindingConfig,
/// Cycle to the next pane. Default: "prefix+tab".
pub cycle_pane_next: BindingConfig,
/// Cycle to the previous pane. Default: "prefix+shift+tab".
@@ -527,6 +535,10 @@ impl Default for KeysConfig {
focus_pane_down: BindingConfig::one("prefix+j"),
focus_pane_up: BindingConfig::one("prefix+k"),
focus_pane_right: BindingConfig::one("prefix+l"),
+ swap_pane_left: BindingConfig::one("prefix+shift+h"),
+ swap_pane_down: BindingConfig::one("prefix+shift+j"),
+ swap_pane_up: BindingConfig::one("prefix+shift+k"),
+ swap_pane_right: BindingConfig::one("prefix+shift+l"),
cycle_pane_next: BindingConfig::one("prefix+tab"),
cycle_pane_previous: BindingConfig::one("prefix+shift+tab"),
last_pane: BindingConfig::empty(),