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 fn import_from_vscode(_vscode: &settings::VsCodeSettings, _content: &mut SettingsContent) {
24 // TODO: could possibly check if any of the `vim.<foo>` keys are set?
25 }
26}
27
28pub struct HelixModeSetting(pub bool);
29
30impl Settings for HelixModeSetting {
31 fn from_settings(content: &SettingsContent) -> Self {
32 Self(content.helix_mode.unwrap())
33 }
34
35 fn import_from_vscode(_vscode: &settings::VsCodeSettings, _current: &mut SettingsContent) {}
36}