tui_vim_editor/buffer/mode.rs
1/// The editor mode.
2#[derive(Default, Debug, Clone, Copy, Eq, Hash, PartialEq)]
3pub enum Mode {
4 #[default]
5 Normal,
6 Insert,
7 Visual,
8}
9
10impl Mode {
11 /// Returns the name of the [`Mode`] as a string.
12 pub fn name(&self) -> String {
13 match self {
14 Self::Normal => "Normal".to_string(),
15 Self::Insert => "Insert".to_string(),
16 Self::Visual => "Visual".to_string(),
17 }
18 }
19}