diff --git a/Cargo.lock b/Cargo.lock index 86ae29e16b53431ad0df2ab6088a081366e7304d..8457edcd3ecd591a2f5e47ded1be2b199d6b1642 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -11423,6 +11423,7 @@ dependencies = [ "theme_selector2", "ui2", "util", + "vim2", "workspace2", ] diff --git a/crates/welcome2/Cargo.toml b/crates/welcome2/Cargo.toml index ce2e102ca09d6efcb241f9a50157946822530c65..e45af11e02364d94f93af0365cf5b61bb7696b62 100644 --- a/crates/welcome2/Cargo.toml +++ b/crates/welcome2/Cargo.toml @@ -26,7 +26,7 @@ theme_selector = { package = "theme_selector2", path = "../theme_selector2" } util = { path = "../util" } picker = { package = "picker2", path = "../picker2" } workspace = { package = "workspace2", path = "../workspace2" } -# vim = { package = "vim2", path = "../vim2" } +vim = { package = "vim2", path = "../vim2" } anyhow.workspace = true log.workspace = true diff --git a/crates/welcome2/src/welcome.rs b/crates/welcome2/src/welcome.rs index 429f292edc886012a09f7b0f284bb236ef4376f1..c553a04fc7bcad5c7be3ca980a84581dacfa0d69 100644 --- a/crates/welcome2/src/welcome.rs +++ b/crates/welcome2/src/welcome.rs @@ -11,6 +11,7 @@ use gpui::{ use settings::{Settings, SettingsStore}; use std::sync::Arc; use ui::{prelude::*, Checkbox}; +use vim::VimModeSetting; use workspace::{ dock::DockPosition, item::{Item, ItemEvent}, @@ -128,29 +129,26 @@ impl Render for WelcomePage { .border_color(cx.theme().colors().border) .rounded_md() .child( - // todo!("vim setting") h_stack() .gap_2() .child( Checkbox::new( "enable-vim", - if false - /* VimSettings::get_global(cx).enabled */ - { + if VimModeSetting::get_global(cx).0 { ui::Selection::Selected } else { ui::Selection::Unselected }, - ), - // .on_click(cx.listener( - // move |this, selection, cx| { - // this.update_settings::( - // selection, - // cx, - // |settings, value| settings.enabled = value, - // ); - // }, - // )), + ) + .on_click(cx.listener( + move |this, selection, cx| { + this.update_settings::( + selection, + cx, + |setting, value| *setting = Some(value), + ); + }, + )), ) .child(Label::new("Enable vim mode")), )