use std::fmt;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Mode {
Normal,
Insert,
Visual,
VisualLine,
VisualBlock,
}
impl Mode {
pub fn is_visual(self) -> bool {
matches!(self, Mode::Visual | Mode::VisualLine | Mode::VisualBlock)
}
}
impl fmt::Display for Mode {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Mode::Normal => write!(f, "NORMAL"),
Mode::Insert => write!(f, "INSERT"),
Mode::Visual => write!(f, "VISUAL"),
Mode::VisualLine => write!(f, "V-LINE"),
Mode::VisualBlock => write!(f, "V-BLOCK"),
}
}
}