miv_editor/input_handling/
command_mode.rs

1use std::collections::HashMap;
2
3use lazy_static::lazy_static;
4
5use crate::{app::InputMode, commands::Command};
6
7use super::Keymap;
8
9lazy_static! {
10    pub static ref COMMAND_MAP: HashMap<String, Keymap> = {
11        HashMap::from([
12            (
13                "esc".into(),
14                Keymap::One(vec![
15                    Command::CommandLineStop,
16                    Command::ChangeInputMode(InputMode::Normal),
17                ]),
18            ),
19            (
20                "enter".into(),
21                Keymap::One(vec![
22                    Command::CommandLineEnter,
23                    Command::CommandLineStop,
24                    Command::ChangeInputMode(InputMode::Normal),
25                ]),
26            ),
27            ("back".into(), Keymap::One(vec![Command::CommandLineDelete])),
28            ("left".into(), Keymap::One(vec![Command::CommandLineLeft])),
29            ("right".into(), Keymap::One(vec![Command::CommandLineRight])),
30        ])
31    };
32}