Files
zed/crates/vim_mode_setting/src/vim_mode_setting.rs
T
Conrad Irwin 5a5978fe3a Remove cx from ThemeSettings (#38836)
Before this change the active theme and icon theme were retrofitted onto
the ThemeSettings.

Now they're in their own new global (GlobalTheme::theme(cx) and
GlobalTheme::icon_theme(cx))

This lets us remove cx from the settings traits, and tidy up a few other
things along the way.

Release Notes:

- N/A
2025-10-06 23:06:50 +00:00

37 lines
1.1 KiB
Rust

//! Contains the [`VimModeSetting`] and [`HelixModeSetting`] used to enable/disable Vim and Helix modes.
//!
//! This is in its own crate as we want other crates to be able to enable or
//! disable Vim/Helix modes without having to depend on the `vim` crate in its
//! entirety.
use gpui::App;
use settings::{Settings, SettingsContent};
/// Initializes the `vim_mode_setting` crate.
pub fn init(cx: &mut App) {
VimModeSetting::register(cx);
HelixModeSetting::register(cx);
}
pub struct VimModeSetting(pub bool);
impl Settings for VimModeSetting {
fn from_settings(content: &SettingsContent) -> Self {
Self(content.vim_mode.unwrap())
}
fn import_from_vscode(_vscode: &settings::VsCodeSettings, _content: &mut SettingsContent) {
// TODO: could possibly check if any of the `vim.<foo>` keys are set?
}
}
pub struct HelixModeSetting(pub bool);
impl Settings for HelixModeSetting {
fn from_settings(content: &SettingsContent) -> Self {
Self(content.helix_mode.unwrap())
}
fn import_from_vscode(_vscode: &settings::VsCodeSettings, _current: &mut SettingsContent) {}
}