From 7626a9adc84d6757042670f9816a583dcd717823 Mon Sep 17 00:00:00 2001 From: Ogulcan Celik Date: Thu, 28 May 2026 23:12:50 +0300 Subject: feat: add pane copy mode refs #231 --- src/config/keybinds.rs | 14 ++++++++++++++ src/config/model.rs | 3 +++ 2 files changed, 17 insertions(+) (limited to 'src/config') diff --git a/src/config/keybinds.rs b/src/config/keybinds.rs index ea7f411c..401154bc 100644 --- a/src/config/keybinds.rs +++ b/src/config/keybinds.rs @@ -282,6 +282,7 @@ pub struct Keybinds { pub close_tab: ActionKeybinds, pub rename_pane: ActionKeybinds, pub edit_scrollback: ActionKeybinds, + pub copy_mode: ActionKeybinds, pub focus_pane_left: ActionKeybinds, pub focus_pane_down: ActionKeybinds, pub focus_pane_up: ActionKeybinds, @@ -460,6 +461,7 @@ impl Config { close_tab: action!("keys.close_tab", &self.keys.close_tab), rename_pane: action!("keys.rename_pane", &self.keys.rename_pane), edit_scrollback: action!("keys.edit_scrollback", &self.keys.edit_scrollback), + copy_mode: action!("keys.copy_mode", &self.keys.copy_mode), focus_pane_left: action!("keys.focus_pane_left", &self.keys.focus_pane_left), 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), @@ -1266,6 +1268,18 @@ next_tab = "prefix+n" assert!(kb.remove_worktree.bindings.is_empty()); } + #[test] + fn copy_mode_uses_tmux_prefix_bracket_by_default() { + let kb = Config::default().keybinds(); + assert_eq!( + binding_triggers(&kb.copy_mode), + vec![BindingTrigger::Prefix(( + KeyCode::Char('['), + KeyModifiers::empty() + ))] + ); + } + #[test] fn back_and_forth_keybinds_are_unset_by_default() { let kb = Config::default().keybinds(); diff --git a/src/config/model.rs b/src/config/model.rs index ac304973..84d03bc2 100644 --- a/src/config/model.rs +++ b/src/config/model.rs @@ -199,6 +199,8 @@ pub struct KeysConfig { pub rename_pane: BindingConfig, /// Open the focused pane scrollback in $EDITOR. Default: "prefix+e". pub edit_scrollback: BindingConfig, + /// Enter keyboard copy mode for the focused pane. Default: "prefix+[". + pub copy_mode: BindingConfig, /// Focus the pane to the left. Default: "prefix+h". pub focus_pane_left: BindingConfig, /// Focus the pane below. Default: "prefix+j". @@ -389,6 +391,7 @@ impl Default for KeysConfig { close_tab: BindingConfig::one("prefix+shift+x"), rename_pane: BindingConfig::one("prefix+shift+p"), edit_scrollback: BindingConfig::one("prefix+e"), + copy_mode: BindingConfig::one("prefix+["), focus_pane_left: BindingConfig::one("prefix+h"), focus_pane_down: BindingConfig::one("prefix+j"), focus_pane_up: BindingConfig::one("prefix+k"), -- cgit v1.2.3