diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-05-28 23:12:50 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-05-28 23:12:50 +0300 |
| commit | 7626a9adc84d6757042670f9816a583dcd717823 (patch) | |
| tree | 56095c659834727ca73b03627a1f6eddc86ac666 /src/config | |
| parent | 28222b20890a1f6cd36fd477de8e9bc6e5537ff5 (diff) | |
feat: add pane copy mode
refs #231
Diffstat (limited to 'src/config')
| -rw-r--r-- | src/config/keybinds.rs | 14 | ||||
| -rw-r--r-- | src/config/model.rs | 3 |
2 files changed, 17 insertions, 0 deletions
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), @@ -1267,6 +1269,18 @@ next_tab = "prefix+n" } #[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(); assert!(kb.last_pane.bindings.is_empty()); 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"), |
