diff --git a/crates/settings/src/keymap_file.rs b/crates/settings/src/keymap_file.rs index 9ecebfd5d2..97ea45138a 100644 --- a/crates/settings/src/keymap_file.rs +++ b/crates/settings/src/keymap_file.rs @@ -7,14 +7,14 @@ use serde_json::value::RawValue; #[derive(Deserialize, Default, Clone)] #[serde(transparent)] -pub struct KeyMapFile(BTreeMap); +pub struct KeymapFile(BTreeMap); type ActionsByKeystroke = BTreeMap>; #[derive(Deserialize)] struct ActionWithData<'a>(#[serde(borrow)] &'a str, #[serde(borrow)] &'a RawValue); -impl KeyMapFile { +impl KeymapFile { pub fn load_defaults(cx: &mut MutableAppContext) { for path in ["keymaps/default.json", "keymaps/vim.json"] { Self::load(path, cx).unwrap(); diff --git a/crates/settings/src/settings.rs b/crates/settings/src/settings.rs index eb4120bb52..ccd39baf46 100644 --- a/crates/settings/src/settings.rs +++ b/crates/settings/src/settings.rs @@ -15,7 +15,7 @@ use std::{collections::HashMap, sync::Arc}; use theme::{Theme, ThemeRegistry}; use util::ResultExt as _; -pub use keymap_file::KeyMapFile; +pub use keymap_file::KeymapFile; #[derive(Clone)] pub struct Settings { diff --git a/crates/vim/src/vim_test_context.rs b/crates/vim/src/vim_test_context.rs index 2e9b0f60aa..2e87115af2 100644 --- a/crates/vim/src/vim_test_context.rs +++ b/crates/vim/src/vim_test_context.rs @@ -24,7 +24,7 @@ impl<'a> VimTestContext<'a> { editor::init(cx); crate::init(cx); - settings::KeyMapFile::load("keymaps/vim.json", cx).unwrap(); + settings::KeymapFile::load("keymaps/vim.json", cx).unwrap(); }); let params = cx.update(WorkspaceParams::test); diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs index d7b43bd721..1d1f08f639 100644 --- a/crates/zed/src/main.rs +++ b/crates/zed/src/main.rs @@ -10,7 +10,7 @@ use gpui::{App, AssetSource, Task}; use log::LevelFilter; use parking_lot::Mutex; use project::Fs; -use settings::{self, KeyMapFile, Settings, SettingsFileContent}; +use settings::{self, KeymapFile, Settings, SettingsFileContent}; use smol::process::Command; use std::{env, fs, path::PathBuf, sync::Arc}; use theme::{ThemeRegistry, DEFAULT_THEME_NAME}; @@ -112,7 +112,7 @@ fn main() { }) .detach_and_log_err(cx); - let (settings_file, bindings_file) = cx.background().block(config_files).unwrap(); + let (settings_file, keymap_file) = cx.background().block(config_files).unwrap(); let mut settings_rx = settings_from_files( default_settings, vec![settings_file], @@ -120,7 +120,7 @@ fn main() { cx.font_cache().clone(), ); - cx.spawn(|cx| watch_keymap_file(bindings_file, cx)).detach(); + cx.spawn(|cx| watch_keymap_file(keymap_file, cx)).detach(); let settings = cx.background().block(settings_rx.next()).unwrap(); cx.spawn(|mut cx| async move { @@ -262,7 +262,7 @@ fn load_config_files( fs: Arc, ) -> oneshot::Receiver<( WatchedJsonFile, - WatchedJsonFile, + WatchedJsonFile, )> { let executor = app.background(); let (tx, rx) = oneshot::channel(); @@ -271,9 +271,8 @@ fn load_config_files( .spawn(async move { let settings_file = WatchedJsonFile::new(fs.clone(), &executor, zed::SETTINGS_PATH.clone()).await; - let bindings_file = - WatchedJsonFile::new(fs, &executor, zed::BINDINGS_PATH.clone()).await; - tx.send((settings_file, bindings_file)).ok() + let keymap_file = WatchedJsonFile::new(fs, &executor, zed::KEYMAP_PATH.clone()).await; + tx.send((settings_file, keymap_file)).ok() }) .detach(); rx diff --git a/crates/zed/src/settings_file.rs b/crates/zed/src/settings_file.rs index 024a49447f..d805e7490d 100644 --- a/crates/zed/src/settings_file.rs +++ b/crates/zed/src/settings_file.rs @@ -4,8 +4,7 @@ use postage::sink::Sink as _; use postage::{prelude::Stream, watch}; use project::Fs; use serde::Deserialize; -use settings::KeyMapFile; -use settings::{Settings, SettingsFileContent}; +use settings::{KeymapFile, Settings, SettingsFileContent}; use std::{path::Path, sync::Arc, time::Duration}; use theme::ThemeRegistry; use util::ResultExt; @@ -77,11 +76,11 @@ pub fn settings_from_files( }) } -pub async fn watch_keymap_file(mut file: WatchedJsonFile, mut cx: AsyncAppContext) { +pub async fn watch_keymap_file(mut file: WatchedJsonFile, mut cx: AsyncAppContext) { while let Some(content) = file.0.recv().await { cx.update(|cx| { cx.clear_bindings(); - settings::KeyMapFile::load_defaults(cx); + settings::KeymapFile::load_defaults(cx); content.add(cx).log_err(); }); } diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index 6deecc9b0c..7b1ff803f5 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -45,7 +45,7 @@ lazy_static! { .expect("failed to determine home directory") .join(".zed"); pub static ref SETTINGS_PATH: PathBuf = ROOT_PATH.join("settings.json"); - pub static ref BINDINGS_PATH: PathBuf = ROOT_PATH.join("bindings.json"); + pub static ref KEYMAP_PATH: PathBuf = ROOT_PATH.join("keymap.json"); } pub fn init(app_state: &Arc, cx: &mut gpui::MutableAppContext) { @@ -103,7 +103,7 @@ pub fn init(app_state: &Arc, cx: &mut gpui::MutableAppContext) { workspace::lsp_status::init(cx); - settings::KeyMapFile::load_defaults(cx); + settings::KeymapFile::load_defaults(cx); } pub fn build_workspace(