1use editor::CursorShape;
2use gpui::keymap::Context;
3
4#[derive(Clone, Copy, Debug, PartialEq, Eq)]
5pub enum Mode {
6 Normal,
7 Insert,
8}
9
10impl Mode {
11 pub fn cursor_shape(&self) -> CursorShape {
12 match self {
13 Mode::Normal => CursorShape::Block,
14 Mode::Insert => CursorShape::Bar,
15 }
16 }
17
18 pub fn keymap_context_layer(&self) -> Context {
19 let mut context = Context::default();
20 context.map.insert(
21 "vim_mode".to_string(),
22 match self {
23 Self::Normal => "normal",
24 Self::Insert => "insert",
25 }
26 .to_string(),
27 );
28 context
29 }
30}
31
32impl Default for Mode {
33 fn default() -> Self {
34 Self::Normal
35 }
36}