First pass at making a linux keymap (#8082)
Undoubtedly not perfect, but this should be something we can work off of. Note that matching keybindings with ctrl in them is currently broken on linux (or at least x11). This keymap might just manage to be less useful than using the macos one on linux until that is fixed... the proximate cause of this is that the `key` field of the `Keystroke` struct looks like `"\u{e}"` instead of `"n"` when `ctrl-n` is pressed. Release Notes: - N/A
This commit is contained in:
parent
389d26d974
commit
8f5d7db875
6 changed files with 570 additions and 4 deletions
|
@ -273,7 +273,7 @@ impl TestServer {
|
|||
collab_ui::init(&app_state, cx);
|
||||
file_finder::init(cx);
|
||||
menu::init();
|
||||
settings::KeymapFile::load_asset("keymaps/default.json", cx).unwrap();
|
||||
settings::KeymapFile::load_asset("keymaps/default-macos.json", cx).unwrap();
|
||||
});
|
||||
|
||||
client
|
||||
|
|
|
@ -21,8 +21,14 @@ pub fn default_settings() -> Cow<'static, str> {
|
|||
asset_str::<SettingsAssets>("settings/default.json")
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
pub const DEFAULT_KEYMAP_PATH: &str = "keymaps/default-macos.json";
|
||||
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
pub const DEFAULT_KEYMAP_PATH: &str = "keymaps/default-linux.json";
|
||||
|
||||
pub fn default_keymap() -> Cow<'static, str> {
|
||||
asset_str::<SettingsAssets>("keymaps/default.json")
|
||||
asset_str::<SettingsAssets>(DEFAULT_KEYMAP_PATH)
|
||||
}
|
||||
|
||||
pub fn vim_keymap() -> Cow<'static, str> {
|
||||
|
|
|
@ -54,7 +54,7 @@ impl VimTestContext {
|
|||
cx.update_global(|store: &mut SettingsStore, cx| {
|
||||
store.update_user_settings::<VimModeSetting>(cx, |s| *s = Some(enabled));
|
||||
});
|
||||
settings::KeymapFile::load_asset("keymaps/default.json", cx).unwrap();
|
||||
settings::KeymapFile::load_asset("keymaps/default-macos.json", cx).unwrap();
|
||||
if enabled {
|
||||
settings::KeymapFile::load_asset("keymaps/vim.json", cx).unwrap();
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ use runnable::static_source::StaticSource;
|
|||
use search::project_search::ProjectSearchBar;
|
||||
use settings::{
|
||||
initial_local_settings_content, watch_config_file, KeymapFile, Settings, SettingsStore,
|
||||
DEFAULT_KEYMAP_PATH,
|
||||
};
|
||||
use std::{borrow::Cow, ops::Deref, path::Path, sync::Arc};
|
||||
use terminal_view::terminal_panel::{self, TerminalPanel};
|
||||
|
@ -570,7 +571,7 @@ fn reload_keymaps(cx: &mut AppContext, keymap_content: &KeymapFile) {
|
|||
}
|
||||
|
||||
pub fn load_default_keymap(cx: &mut AppContext) {
|
||||
KeymapFile::load_asset("keymaps/default.json", cx).unwrap();
|
||||
KeymapFile::load_asset(DEFAULT_KEYMAP_PATH, cx).unwrap();
|
||||
if VimModeSetting::get_global(cx).0 {
|
||||
KeymapFile::load_asset("keymaps/vim.json", cx).unwrap();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue