diff --git a/assets/keymaps/default-linux.json b/assets/keymaps/default-linux.json index 9ede1f5d63bf290ce1b1da84236c6745337c9e9b..ae15492b804274bc3ceacaae156a19093344a9b7 100644 --- a/assets/keymaps/default-linux.json +++ b/assets/keymaps/default-linux.json @@ -30,8 +30,8 @@ "ctrl-+": ["zed::IncreaseBufferFontSize", { "persist": false }], "ctrl--": ["zed::DecreaseBufferFontSize", { "persist": false }], "ctrl-0": ["zed::ResetBufferFontSize", { "persist": false }], - "ctrl-,": "zed::OpenSettingsEditor", - "ctrl-alt-,": "zed::OpenSettings", + "ctrl-,": "zed::OpenSettings", + "ctrl-alt-,": "zed::OpenSettingsFile", "ctrl-q": "zed::Quit", "f4": "debugger::Start", "shift-f5": "debugger::Stop", @@ -621,7 +621,7 @@ "ctrl-shift-f": "pane::DeploySearch", "ctrl-shift-h": ["pane::DeploySearch", { "replace_enabled": true }], "ctrl-shift-t": "pane::ReopenClosedItem", - "ctrl-k ctrl-s": "zed::OpenKeymapEditor", + "ctrl-k ctrl-s": "zed::OpenKeymap", "ctrl-k ctrl-t": "theme_selector::Toggle", "ctrl-alt-super-p": "settings_profile_selector::Toggle", "ctrl-t": "project_symbols::Toggle", diff --git a/assets/keymaps/default-macos.json b/assets/keymaps/default-macos.json index 31424e7b2f4f32b75e370bab1c78934b73047c97..50528dca6f97e8b287333d4011ebc97bb1ed27a2 100644 --- a/assets/keymaps/default-macos.json +++ b/assets/keymaps/default-macos.json @@ -39,8 +39,8 @@ "cmd-+": ["zed::IncreaseBufferFontSize", { "persist": false }], "cmd--": ["zed::DecreaseBufferFontSize", { "persist": false }], "cmd-0": ["zed::ResetBufferFontSize", { "persist": false }], - "cmd-,": "zed::OpenSettingsEditor", - "cmd-alt-,": "zed::OpenSettings", + "cmd-,": "zed::OpenSettings", + "cmd-alt-,": "zed::OpenSettingsFile", "cmd-q": "zed::Quit", "cmd-h": "zed::Hide", "alt-cmd-h": "zed::HideOthers", @@ -690,7 +690,7 @@ "cmd-shift-f": "pane::DeploySearch", "cmd-shift-h": ["pane::DeploySearch", { "replace_enabled": true }], "cmd-shift-t": "pane::ReopenClosedItem", - "cmd-k cmd-s": "zed::OpenKeymapEditor", + "cmd-k cmd-s": "zed::OpenKeymap", "cmd-k cmd-t": "theme_selector::Toggle", "ctrl-alt-cmd-p": "settings_profile_selector::Toggle", "cmd-t": "project_symbols::Toggle", diff --git a/assets/keymaps/default-windows.json b/assets/keymaps/default-windows.json index c0412152d70790ad89bcf1374cb315affb8fce36..570766e92ce8adddb6913fcc20acd71bf7ed240b 100644 --- a/assets/keymaps/default-windows.json +++ b/assets/keymaps/default-windows.json @@ -29,8 +29,8 @@ "ctrl-shift-=": ["zed::IncreaseBufferFontSize", { "persist": false }], "ctrl--": ["zed::DecreaseBufferFontSize", { "persist": false }], "ctrl-0": ["zed::ResetBufferFontSize", { "persist": false }], - "ctrl-,": "zed::OpenSettingsEditor", - "ctrl-alt-,": "zed::OpenSettings", + "ctrl-,": "zed::OpenSettings", + "ctrl-alt-,": "zed::OpenSettingsFile", "ctrl-q": "zed::Quit", "f4": "debugger::Start", "shift-f5": "debugger::Stop", @@ -623,7 +623,7 @@ "ctrl-shift-f": "pane::DeploySearch", "ctrl-shift-h": ["pane::DeploySearch", { "replace_enabled": true }], "ctrl-shift-t": "pane::ReopenClosedItem", - "ctrl-k ctrl-s": "zed::OpenKeymapEditor", + "ctrl-k ctrl-s": "zed::OpenKeymap", "ctrl-k ctrl-t": "theme_selector::Toggle", "ctrl-alt-super-p": "settings_profile_selector::Toggle", "ctrl-t": "project_symbols::Toggle", diff --git a/assets/keymaps/linux/jetbrains.json b/assets/keymaps/linux/jetbrains.json index 59a182a968a849edb3359927e7647f611bcd44da..a5e387c014e1315bf51cfdf7c5226adaa8a20b27 100644 --- a/assets/keymaps/linux/jetbrains.json +++ b/assets/keymaps/linux/jetbrains.json @@ -1,7 +1,7 @@ [ { "bindings": { - "ctrl-alt-s": "zed::OpenSettings", + "ctrl-alt-s": "zed::OpenSettingsFile", "ctrl-{": "pane::ActivatePreviousItem", "ctrl-}": "pane::ActivateNextItem", "shift-escape": null, // Unmap workspace::zoom diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index ae9bf372172965a97bb2bc009891d1f0c7617596..06256c35971e72b283fb99cb1fc40799e410b2d5 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -24645,7 +24645,7 @@ impl Render for MissingEditPredictionKeybindingTooltip { .items_end() .w_full() .child(Button::new("open-keymap", "Assign Keybinding").size(ButtonSize::Compact).on_click(|_ev, window, cx| { - window.dispatch_action(zed_actions::OpenKeymap.boxed_clone(), cx) + window.dispatch_action(zed_actions::OpenKeymapFile.boxed_clone(), cx) })) .child(Button::new("see-docs", "See Docs").size(ButtonSize::Compact).on_click(|_ev, _window, cx| { cx.open_url("https://zed.dev/docs/completions#edit-predictions-missing-keybinding"); diff --git a/crates/keymap_editor/src/keymap_editor.rs b/crates/keymap_editor/src/keymap_editor.rs index 327d0962f23c1e8b4cdc6743d985db85bd9bbcd1..76c14ccfe48dbd85b6b02249ac4a26a73c129f4f 100644 --- a/crates/keymap_editor/src/keymap_editor.rs +++ b/crates/keymap_editor/src/keymap_editor.rs @@ -38,7 +38,7 @@ use workspace::{ }; pub use ui_components::*; -use zed_actions::OpenKeymapEditor; +use zed_actions::OpenKeymap; use crate::{ persistence::KEYBINDING_EDITORS, @@ -77,7 +77,7 @@ pub fn init(cx: &mut App) { let keymap_event_channel = KeymapEventChannel::new(); cx.set_global(keymap_event_channel); - cx.on_action(|_: &OpenKeymapEditor, cx| { + cx.on_action(|_: &OpenKeymap, cx| { workspace::with_active_or_new_workspace(cx, move |workspace, window, cx| { workspace .with_local_workspace(window, cx, |workspace, window, cx| { @@ -1700,7 +1700,7 @@ impl Render for KeymapEditor { move |window, cx| { Tooltip::for_action_in( "View Default...", - &zed_actions::OpenKeymap, + &zed_actions::OpenKeymapFile, &focus_handle, window, cx, @@ -1714,7 +1714,7 @@ impl Render for KeymapEditor { .style(ButtonStyle::Outlined) .on_click(|_, window, cx| { window.dispatch_action( - zed_actions::OpenKeymap.boxed_clone(), + zed_actions::OpenKeymapFile.boxed_clone(), cx, ); }) diff --git a/crates/language_tools/src/key_context_view.rs b/crates/language_tools/src/key_context_view.rs index 4140713544ed2b22413f909ac45989de8df4e706..1d3cd451f19ce6bc28540f10b2a91a7a6319214a 100644 --- a/crates/language_tools/src/key_context_view.rs +++ b/crates/language_tools/src/key_context_view.rs @@ -207,7 +207,7 @@ impl Render for KeyContextView { .on_click(|_, _, cx| cx.open_url("https://zed.dev/docs/key-bindings")), ) .child( - Button::new("view_default_keymap", "View default keymap") + Button::new("view_default_keymap", "View Default Keymap") .style(ButtonStyle::Filled) .key_binding(ui::KeyBinding::for_action( &zed_actions::OpenDefaultKeymap, @@ -219,11 +219,11 @@ impl Render for KeyContextView { }), ) .child( - Button::new("edit_your_keymap", "Edit your keymap") + Button::new("edit_your_keymap", "Edit Keymap File") .style(ButtonStyle::Filled) - .key_binding(ui::KeyBinding::for_action(&zed_actions::OpenKeymap, window, cx)) + .key_binding(ui::KeyBinding::for_action(&zed_actions::OpenKeymapFile, window, cx)) .on_click(|_, window, cx| { - window.dispatch_action(zed_actions::OpenKeymap.boxed_clone(), cx); + window.dispatch_action(zed_actions::OpenKeymapFile.boxed_clone(), cx); }), ), ) diff --git a/crates/onboarding/src/welcome.rs b/crates/onboarding/src/welcome.rs index b5daef156849e4f44ce0945631cbc07e26f16bb1..50f0d83698adbd1b8bff0d7e73a5f342d8fe11cd 100644 --- a/crates/onboarding/src/welcome.rs +++ b/crates/onboarding/src/welcome.rs @@ -9,7 +9,7 @@ use workspace::{ item::{Item, ItemEvent}, with_active_or_new_workspace, }; -use zed_actions::{Extensions, OpenSettingsEditor, agent, command_palette}; +use zed_actions::{Extensions, OpenSettings, agent, command_palette}; use crate::{Onboarding, OpenOnboarding}; @@ -53,7 +53,7 @@ const CONTENT: (Section<4>, Section<3>) = ( SectionEntry { icon: IconName::Settings, title: "Open Settings", - action: &OpenSettingsEditor, + action: &OpenSettings, }, SectionEntry { icon: IconName::ZedAssistant, diff --git a/crates/settings_ui/src/settings_ui.rs b/crates/settings_ui/src/settings_ui.rs index 46bef9365b28043fe145cc1df54cd7dc49623848..93bbd0dfc080cfc250222f0759023b52cf41cb19 100644 --- a/crates/settings_ui/src/settings_ui.rs +++ b/crates/settings_ui/src/settings_ui.rs @@ -38,7 +38,7 @@ use ui::{ use ui_input::{NumberField, NumberFieldType}; use util::{ResultExt as _, paths::PathStyle, rel_path::RelPath}; use workspace::{OpenOptions, OpenVisible, Workspace, client_side_decorations}; -use zed_actions::OpenSettingsEditor; +use zed_actions::OpenSettings; use crate::components::SettingsEditor; @@ -286,7 +286,7 @@ pub fn init(cx: &mut App) { init_renderers(cx); cx.observe_new(|workspace: &mut workspace::Workspace, _, _| { - workspace.register_action(|workspace, _: &OpenSettingsEditor, window, cx| { + workspace.register_action(|workspace, _: &OpenSettings, window, cx| { let window_handle = window .window_handle() .downcast::() diff --git a/crates/title_bar/src/title_bar.rs b/crates/title_bar/src/title_bar.rs index 85890f017f46fc2e06e2cb6201dbf4fae6d062f3..be3ee9c4415465de74e42aec0c889ea3e6931d85 100644 --- a/crates/title_bar/src/title_bar.rs +++ b/crates/title_bar/src/title_bar.rs @@ -664,49 +664,55 @@ impl TitleBar { pub fn render_app_menu_button(&mut self, cx: &mut Context) -> impl Element { let user_store = self.user_store.read(cx); - if let Some(user) = user_store.current_user() { - let has_subscription_period = user_store.subscription_period().is_some(); - let plan = user_store.plan().filter(|_| { - // Since the user might be on the legacy free plan we filter based on whether we have a subscription period. - has_subscription_period - }); + let user = user_store.current_user(); - let user_avatar = user.avatar_uri.clone(); - let free_chip_bg = cx - .theme() - .colors() - .editor_background - .opacity(0.5) - .blend(cx.theme().colors().text_accent.opacity(0.05)); - - let pro_chip_bg = cx - .theme() - .colors() - .editor_background - .opacity(0.5) - .blend(cx.theme().colors().text_accent.opacity(0.2)); - - PopoverMenu::new("user-menu") - .anchor(Corner::TopRight) - .menu(move |window, cx| { - ContextMenu::build(window, cx, |menu, _, _cx| { - let user_login = user.github_login.clone(); - - let (plan_name, label_color, bg_color) = match plan { - None | Some(Plan::V1(PlanV1::ZedFree) | Plan::V2(PlanV2::ZedFree)) => { - ("Free", Color::Default, free_chip_bg) - } - Some(Plan::V1(PlanV1::ZedProTrial) | Plan::V2(PlanV2::ZedProTrial)) => { - ("Pro Trial", Color::Accent, pro_chip_bg) - } - Some(Plan::V1(PlanV1::ZedPro) | Plan::V2(PlanV2::ZedPro)) => { - ("Pro", Color::Accent, pro_chip_bg) - } - }; + let user_avatar = user.as_ref().map(|u| u.avatar_uri.clone()); + let user_login = user.as_ref().map(|u| u.github_login.clone()); + + let is_signed_in = user.is_some(); + + let has_subscription_period = user_store.subscription_period().is_some(); + let plan = user_store.plan().filter(|_| { + // Since the user might be on the legacy free plan we filter based on whether we have a subscription period. + has_subscription_period + }); + + let free_chip_bg = cx + .theme() + .colors() + .editor_background + .opacity(0.5) + .blend(cx.theme().colors().text_accent.opacity(0.05)); + + let pro_chip_bg = cx + .theme() + .colors() + .editor_background + .opacity(0.5) + .blend(cx.theme().colors().text_accent.opacity(0.2)); + + PopoverMenu::new("user-menu") + .anchor(Corner::TopRight) + .menu(move |window, cx| { + ContextMenu::build(window, cx, |menu, _, _cx| { + let user_login = user_login.clone(); + + let (plan_name, label_color, bg_color) = match plan { + None | Some(Plan::V1(PlanV1::ZedFree) | Plan::V2(PlanV2::ZedFree)) => { + ("Free", Color::Default, free_chip_bg) + } + Some(Plan::V1(PlanV1::ZedProTrial) | Plan::V2(PlanV2::ZedProTrial)) => { + ("Pro Trial", Color::Accent, pro_chip_bg) + } + Some(Plan::V1(PlanV1::ZedPro) | Plan::V2(PlanV2::ZedPro)) => { + ("Pro", Color::Accent, pro_chip_bg) + } + }; - menu.custom_entry( + menu.when(is_signed_in, |this| { + this.custom_entry( move |_window, _cx| { - let user_login = user_login.clone(); + let user_login = user_login.clone().unwrap_or_default(); h_flex() .w_full() @@ -724,75 +730,59 @@ impl TitleBar { }, ) .separator() - .action("Settings", zed_actions::OpenSettingsEditor.boxed_clone()) - .action("Keymap Editor", Box::new(zed_actions::OpenKeymapEditor)) - .action( - "Themes…", - zed_actions::theme_selector::Toggle::default().boxed_clone(), - ) - .action( - "Icon Themes…", - zed_actions::icon_theme_selector::Toggle::default().boxed_clone(), - ) - .action( - "Extensions", - zed_actions::Extensions::default().boxed_clone(), - ) - .separator() - .action("Sign Out", client::SignOut.boxed_clone()) }) - .into() - }) - .trigger_with_tooltip( - ButtonLike::new("user-menu") - .child( - h_flex() - .gap_0p5() - .children( - TitleBarSettings::get_global(cx) - .show_user_picture - .then(|| Avatar::new(user_avatar)), - ) - .child( - Icon::new(IconName::ChevronDown) - .size(IconSize::Small) - .color(Color::Muted), - ), - ) - .style(ButtonStyle::Subtle), - Tooltip::text("Toggle User Menu"), - ) - .anchor(gpui::Corner::TopRight) - } else { - PopoverMenu::new("user-menu") - .anchor(Corner::TopRight) - .menu(|window, cx| { - ContextMenu::build(window, cx, |menu, _, _| { - menu.action("Settings", zed_actions::OpenSettings.boxed_clone()) - .action( - "Settings Profiles", - zed_actions::settings_profile_selector::Toggle.boxed_clone(), - ) - .action("Key Bindings", Box::new(zed_actions::OpenKeymapEditor)) - .action( - "Themes…", - zed_actions::theme_selector::Toggle::default().boxed_clone(), - ) - .action( - "Icon Themes…", - zed_actions::icon_theme_selector::Toggle::default().boxed_clone(), - ) - .action( - "Extensions", - zed_actions::Extensions::default().boxed_clone(), - ) + .action("Settings", zed_actions::OpenSettings.boxed_clone()) + .action("Keymap", Box::new(zed_actions::OpenKeymap)) + .action( + "Themes…", + zed_actions::theme_selector::Toggle::default().boxed_clone(), + ) + .action( + "Icon Themes…", + zed_actions::icon_theme_selector::Toggle::default().boxed_clone(), + ) + .action( + "Extensions", + zed_actions::Extensions::default().boxed_clone(), + ) + .when(is_signed_in, |this| { + this.separator() + .action("Sign Out", client::SignOut.boxed_clone()) }) - .into() }) - .trigger_with_tooltip( - IconButton::new("user-menu", IconName::ChevronDown).icon_size(IconSize::Small), - Tooltip::text("Toggle User Menu"), - ) - } + .into() + }) + .map(|this| { + if is_signed_in { + this.trigger_with_tooltip( + ButtonLike::new("user-menu") + .child( + h_flex() + .gap_0p5() + .children( + TitleBarSettings::get_global(cx) + .show_user_picture + .then(|| user_avatar.clone()) + .flatten() + .map(|avatar| Avatar::new(avatar)), + ) + .child( + Icon::new(IconName::ChevronDown) + .size(IconSize::Small) + .color(Color::Muted), + ), + ) + .style(ButtonStyle::Subtle), + Tooltip::text("Toggle User Menu"), + ) + } else { + this.trigger_with_tooltip( + IconButton::new("user-menu", IconName::ChevronDown) + .icon_size(IconSize::Small), + Tooltip::text("Toggle User Menu"), + ) + } + }) + .anchor(gpui::Corner::TopRight) } } diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index daaf963d269afce25a0ce287427e8f275c84fe4f..58fb18ebd2b94c0f68cbe7e0de3128d5acedf491 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -93,7 +93,8 @@ use workspace::{ }; use workspace::{Pane, notifications::DetachAndPromptErr}; use zed_actions::{ - OpenAccountSettings, OpenBrowser, OpenDocs, OpenServerSettings, OpenSettings, OpenZedUrl, Quit, + OpenAccountSettings, OpenBrowser, OpenDocs, OpenServerSettings, OpenSettingsFile, OpenZedUrl, + Quit, }; actions!( @@ -196,7 +197,7 @@ pub fn init(cx: &mut App) { open_telemetry_log_file(workspace, window, cx); }); }); - cx.on_action(|&zed_actions::OpenKeymap, cx| { + cx.on_action(|&zed_actions::OpenKeymapFile, cx| { with_active_or_new_workspace(cx, |_, window, cx| { open_settings_file( paths::keymap_file(), @@ -206,7 +207,7 @@ pub fn init(cx: &mut App) { ); }); }); - cx.on_action(|_: &OpenSettings, cx| { + cx.on_action(|_: &OpenSettingsFile, cx| { with_active_or_new_workspace(cx, |_, window, cx| { open_settings_file( paths::settings_file(), @@ -1270,57 +1271,60 @@ pub fn handle_settings_file_changes( MigrationNotification::set_global(cx.new(|_| MigrationNotification), cx); // Helper function to process settings content - let process_settings = - move |content: String, is_user: bool, store: &mut SettingsStore, cx: &mut App| -> bool { - let id = NotificationId::Named("failed-to-migrate-settings".into()); - // Apply migrations to both user and global settings - let (processed_content, content_migrated) = match migrate_settings(&content) { - Ok(result) => { - dismiss_app_notification(&id, cx); - if let Some(migrated_content) = result { - (migrated_content, true) - } else { - (content, false) - } + let process_settings = move |content: String, + is_user: bool, + store: &mut SettingsStore, + cx: &mut App| + -> bool { + let id = NotificationId::Named("failed-to-migrate-settings".into()); + // Apply migrations to both user and global settings + let (processed_content, content_migrated) = match migrate_settings(&content) { + Ok(result) => { + dismiss_app_notification(&id, cx); + if let Some(migrated_content) = result { + (migrated_content, true) + } else { + (content, false) } - Err(err) => { - show_app_notification(id, cx, move |cx| { - cx.new(|cx| { - MessageNotification::new( - format!( - "Failed to migrate settings\n\ + } + Err(err) => { + show_app_notification(id, cx, move |cx| { + cx.new(|cx| { + MessageNotification::new( + format!( + "Failed to migrate settings\n\ {err}" - ), - cx, - ) - .primary_message("Open Settings File") - .primary_icon(IconName::Settings) - .primary_on_click(|window, cx| { - window.dispatch_action(zed_actions::OpenSettings.boxed_clone(), cx); - cx.emit(DismissEvent); - }) + ), + cx, + ) + .primary_message("Open Settings File") + .primary_icon(IconName::Settings) + .primary_on_click(|window, cx| { + window.dispatch_action(zed_actions::OpenSettingsFile.boxed_clone(), cx); + cx.emit(DismissEvent); }) - }); - // notify user here - (content, false) - } - }; + }) + }); + // notify user here + (content, false) + } + }; - let result = if is_user { - store.set_user_settings(&processed_content, cx) - } else { - store.set_global_settings(&processed_content, cx) - }; + let result = if is_user { + store.set_user_settings(&processed_content, cx) + } else { + store.set_global_settings(&processed_content, cx) + }; - if let Err(err) = &result { - let settings_type = if is_user { "user" } else { "global" }; - log::error!("Failed to load {} settings: {err}", settings_type); - } + if let Err(err) = &result { + let settings_type = if is_user { "user" } else { "global" }; + log::error!("Failed to load {} settings: {err}", settings_type); + } - settings_changed(result.err(), cx); + settings_changed(result.err(), cx); - content_migrated - }; + content_migrated + }; // Initial load of both settings files let global_content = cx @@ -1499,7 +1503,7 @@ fn show_keymap_file_json_error( MessageNotification::new(message.clone(), cx) .primary_message("Open Keymap File") .primary_on_click(|window, cx| { - window.dispatch_action(zed_actions::OpenKeymap.boxed_clone(), cx); + window.dispatch_action(zed_actions::OpenKeymapFile.boxed_clone(), cx); cx.emit(DismissEvent); }) }) @@ -1516,7 +1520,7 @@ fn show_keymap_file_load_error( error_message, "Open Keymap File".into(), |window, cx| { - window.dispatch_action(zed_actions::OpenKeymap.boxed_clone(), cx); + window.dispatch_action(zed_actions::OpenKeymapFile.boxed_clone(), cx); cx.emit(DismissEvent); }, cx, @@ -1635,7 +1639,7 @@ pub fn handle_settings_changed(error: Option, cx: &mut App) { .primary_message("Open Settings File") .primary_icon(IconName::Settings) .primary_on_click(|window, cx| { - window.dispatch_action(zed_actions::OpenSettings.boxed_clone(), cx); + window.dispatch_action(zed_actions::OpenSettingsFile.boxed_clone(), cx); cx.emit(DismissEvent); }) }) @@ -4653,6 +4657,7 @@ mod tests { "window", "workspace", "zed", + "zed_actions", "zed_predict_onboarding", "zeta", ]; diff --git a/crates/zed/src/zed/app_menus.rs b/crates/zed/src/zed/app_menus.rs index 6e58714cb82ea65282d148e35f6e3700a6de6a68..cd18503f61be4a712caf5e4399f794b12c6bf889 100644 --- a/crates/zed/src/zed/app_menus.rs +++ b/crates/zed/src/zed/app_menus.rs @@ -63,13 +63,13 @@ pub fn app_menus(cx: &mut App) -> Vec { MenuItem::submenu(Menu { name: "Settings".into(), items: vec![ - MenuItem::action("Open Settings", zed_actions::OpenSettingsEditor), - MenuItem::action("Open Settings JSON", super::OpenSettings), + MenuItem::action("Open Settings", zed_actions::OpenSettings), + MenuItem::action("Open Settings File", super::OpenSettingsFile), MenuItem::action("Open Project Settings", super::OpenProjectSettings), MenuItem::action("Open Default Settings", super::OpenDefaultSettings), MenuItem::separator(), - MenuItem::action("Open Keymap Editor", zed_actions::OpenKeymapEditor), - MenuItem::action("Open Keymap JSON", zed_actions::OpenKeymap), + MenuItem::action("Open Keymap", zed_actions::OpenKeymap), + MenuItem::action("Open Keymap File", zed_actions::OpenKeymapFile), MenuItem::action( "Open Default Key Bindings", zed_actions::OpenDefaultKeymap, diff --git a/crates/zed_actions/src/lib.rs b/crates/zed_actions/src/lib.rs index eaa81b1e1040fc2c178d668754290ce37752fee6..d62de329c9af63ab8c15e1703b2517ac12594195 100644 --- a/crates/zed_actions/src/lib.rs +++ b/crates/zed_actions/src/lib.rs @@ -30,22 +30,26 @@ pub struct OpenZedUrl { actions!( zed, [ - /// Opens the settings JSON file. + #[action(deprecated_aliases = ["zed_actions::OpenSettingsEditor"])] OpenSettings, + /// Opens the settings JSON file. + #[action(deprecated_aliases = ["zed_actions::OpenSettings"])] + OpenSettingsFile, /// Opens the settings editor. - OpenSettingsEditor, /// Opens the default keymap file. OpenDefaultKeymap, + /// Opens the user keymap file. + #[action(deprecated_aliases = ["zed_actions::OpenKeymap"])] + OpenKeymapFile, + /// Opens the keymap editor. + #[action(deprecated_aliases = ["zed_actions::OpenKeymapEditor"])] + OpenKeymap, /// Opens account settings. OpenAccountSettings, - /// Opens the keymap editor. - OpenKeymapEditor, /// Opens server settings. OpenServerSettings, /// Quits the application. Quit, - /// Opens the user keymap file. - OpenKeymap, /// Shows information about Zed. About, /// Opens the documentation website. diff --git a/docs/src/getting-started.md b/docs/src/getting-started.md index 22af3b36d733f9d7eccb72cc622d6d07c942ca20..2dd04c70a944a06fe15854d98826b174b95bb94b 100644 --- a/docs/src/getting-started.md +++ b/docs/src/getting-started.md @@ -83,6 +83,6 @@ Visit [the AI overview page](./ai/overview.md) to learn how to quickly get start ## Set up your key bindings -To edit your custom keymap and add or remap bindings, you can either use {#kb zed::OpenKeymapEditor} to spawn the Zed Keymap Editor ({#action zed::OpenKeymapEditor}) or you can directly open your Zed Keymap json (`~/.config/zed/keymap.json`) with {#action zed::OpenKeymap}. +To edit your custom keymap and add or remap bindings, you can either use {#kb zed::OpenKeymap} to spawn the Zed Keymap Editor ({#action zed::OpenKeymap}) or you can directly open your Zed Keymap json (`~/.config/zed/keymap.json`) with {#action zed::OpenKeymap}. To access the default key binding set, open the Command Palette with {#kb command_palette::Toggle} and search for "zed: open default keymap". See [Key Bindings](./key-bindings.md) for more info. diff --git a/docs/src/key-bindings.md b/docs/src/key-bindings.md index e8ddbc46b29962e0bc20a54f94b6b3e0e2028214..306396c73cfc2fab555ce85b223c56a56dd10fa0 100644 --- a/docs/src/key-bindings.md +++ b/docs/src/key-bindings.md @@ -24,7 +24,7 @@ For more information, see the documentation for [Vim mode](./vim.md) and [Helix ## User keymaps Zed reads your keymap from `~/.config/zed/keymap.json`, which you can open with the {#action zed::OpenKeymap} action from the command palette. -You can also edit your keymap through the Zed Keymap Editor, accessible via the {#action zed::OpenKeymapEditor} action or the {#kb zed::OpenKeymapEditor} keybinding. +You can also edit your keymap through the Zed Keymap Editor, accessible via the {#action zed::OpenKeymap} action or the {#kb zed::OpenKeymap} keybinding. The `keymap.json` file contains a JSON array of objects with `"bindings"`. If no `"context"` is set, the bindings are always active. If it is set, the binding is only active when the [context matches](#contexts).