Skip to main content

indigo_core/
mode.rs

1pub mod command;
2pub mod insert;
3pub mod normal;
4pub mod prompt;
5pub mod replace;
6pub mod seek;
7
8#[derive(Clone, Default)]
9pub enum Mode {
10    #[default]
11    Normal,
12    Insert,
13    Prompt(prompt::State),
14    // TODO: Replace this with multi-key mappings in normal mode
15    Seek(seek::State),
16    Replace,
17}
18
19impl Mode {
20    #[must_use]
21    pub fn kind(&self) -> ModeKind {
22        match self {
23            Self::Normal => ModeKind::Normal,
24            Self::Insert => ModeKind::Insert,
25            Self::Prompt(_) => ModeKind::Prompt,
26            Self::Seek(_) => ModeKind::Seek,
27            Self::Replace => ModeKind::Replace,
28        }
29    }
30}
31
32#[derive(Clone, Copy)]
33pub enum ModeKind {
34    Normal,
35    Insert,
36    Prompt,
37    // TODO: `Command`?
38    Seek,
39    Replace,
40}