1//! Contains the [`VimModeSetting`] and [`HelixModeSetting`] used to enable/disable Vim and Helix modes.
 2//!
 3//! This is in its own crate as we want other crates to be able to enable or
 4//! disable Vim/Helix modes without having to depend on the `vim` crate in its
 5//! entirety.
 6
 7use gpui::App;
 8use settings::{Settings, SettingsContent};
 9
10/// Initializes the `vim_mode_setting` crate.
11pub fn init(cx: &mut App) {
12    VimModeSetting::register(cx);
13    HelixModeSetting::register(cx);
14}
15
16pub struct VimModeSetting(pub bool);
17
18impl Settings for VimModeSetting {
19    fn from_settings(content: &SettingsContent) -> Self {
20        Self(content.vim_mode.unwrap())
21    }
22}
23
24pub struct HelixModeSetting(pub bool);
25
26impl Settings for HelixModeSetting {
27    fn from_settings(content: &SettingsContent) -> Self {
28        Self(content.helix_mode.unwrap())
29    }
30}