Skip to repository content

tenant.openagents/omega

No repository description is available.

OpenAgents Git authority 2026-07-28T04:31:26.364Z Public web read
NIP-34 coordinate30617:7649603503856e5148d571eac2766b288a8ff1e9e35d380337a1d2b0015b4f92:omega
MaintainersHidden in public view
References2 branches · 1 tag
Read-only clonegit clone https://openagents.com/git/tenant.openagents/omega.git
Browse files

vim_mode_setting.rs

43 lines · 1.1 KB · rust
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::{RegisterSetting, Settings, SettingsContent};
9
10#[derive(RegisterSetting)]
11pub struct VimModeSetting(pub bool);
12
13impl Settings for VimModeSetting {
14    fn from_settings(content: &SettingsContent) -> Self {
15        Self(content.vim_mode.unwrap())
16    }
17}
18
19impl VimModeSetting {
20    pub fn is_enabled(cx: &App) -> bool {
21        Self::try_get(cx)
22            .map(|vim_mode| vim_mode.0)
23            .unwrap_or(false)
24    }
25}
26
27#[derive(RegisterSetting)]
28pub struct HelixModeSetting(pub bool);
29
30impl HelixModeSetting {
31    pub fn is_enabled(cx: &App) -> bool {
32        Self::try_get(cx)
33            .map(|helix_mode| helix_mode.0)
34            .unwrap_or(false)
35    }
36}
37
38impl Settings for HelixModeSetting {
39    fn from_settings(content: &SettingsContent) -> Self {
40        Self(content.helix_mode.unwrap())
41    }
42}
43
Served at tenant.openagents/omega Member data and write actions are omitted.