ratatui_toolkit/master_layout/keybindings/constructors/
default.rs

1//! Default constructor for MasterLayoutKeyBindings
2
3use crate::master_layout::keybindings::MasterLayoutKeyBindings;
4use crossterm::event::{KeyCode, KeyModifiers};
5
6impl Default for MasterLayoutKeyBindings {
7    fn default() -> Self {
8        Self {
9            quit: vec![
10                (KeyCode::Char('q'), KeyModifiers::empty()),
11                (KeyCode::Char('Q'), KeyModifiers::empty()),
12            ],
13            clear_selection: (KeyCode::Esc, KeyModifiers::empty()),
14            deselect_pane: (KeyCode::Char('a'), KeyModifiers::CONTROL),
15            switch_tabs: (1..=9)
16                .map(|n| {
17                    (
18                        KeyCode::Char(char::from_digit(n, 10).unwrap()),
19                        KeyModifiers::empty(),
20                    )
21                })
22                .collect(),
23            navigate_left: (KeyCode::Char('h'), KeyModifiers::empty()),
24            navigate_right: (KeyCode::Char('l'), KeyModifiers::empty()),
25            navigate_up: (KeyCode::Char('k'), KeyModifiers::empty()),
26            navigate_down: (KeyCode::Char('j'), KeyModifiers::empty()),
27            focus_pane: (KeyCode::Enter, KeyModifiers::empty()),
28            exit_focus_mode: (KeyCode::Char('a'), KeyModifiers::CONTROL),
29            copy_selection: (
30                KeyCode::Char('c'),
31                KeyModifiers::CONTROL.union(KeyModifiers::SHIFT),
32            ),
33        }
34    }
35}