Separate out macOS and Linux keymaps (#13792)

Release Notes:

- Added Linux-Specific keymaps for JetBrains, Atom and Sublime Text
- Improved MacOS-specific keymaps for JetBrains and Atom
- Improved Linux default keymap (VSCode compatibility)
- Windows now uses same keymap as Linux

---------

Co-authored-by: Peter Tripp <peter@zed.dev>
This commit is contained in:
Mikayla Maki 2024-07-08 12:05:29 -07:00 committed by GitHub
parent f555f66a8c
commit 032b203519
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 316 additions and 25 deletions

View file

@ -32,6 +32,7 @@ impl Display for BaseKeymap {
}
impl BaseKeymap {
#[cfg(target_os = "macos")]
pub const OPTIONS: [(&'static str, Self); 5] = [
("VSCode (Default)", Self::VSCode),
("Atom", Self::Atom),
@ -40,12 +41,31 @@ impl BaseKeymap {
("TextMate", Self::TextMate),
];
#[cfg(not(target_os = "macos"))]
pub const OPTIONS: [(&'static str, Self); 4] = [
("VSCode (Default)", Self::VSCode),
("Atom", Self::Atom),
("JetBrains", Self::JetBrains),
("Sublime Text", Self::SublimeText),
];
pub fn asset_path(&self) -> Option<&'static str> {
#[cfg(target_os = "macos")]
match self {
BaseKeymap::JetBrains => Some("keymaps/jetbrains.json"),
BaseKeymap::SublimeText => Some("keymaps/sublime_text.json"),
BaseKeymap::Atom => Some("keymaps/atom.json"),
BaseKeymap::TextMate => Some("keymaps/textmate.json"),
BaseKeymap::JetBrains => Some("keymaps/macos/jetbrains.json"),
BaseKeymap::SublimeText => Some("keymaps/macos/sublime_text.json"),
BaseKeymap::Atom => Some("keymaps/macos/atom.json"),
BaseKeymap::TextMate => Some("keymaps/macos/textmate.json"),
BaseKeymap::VSCode => None,
BaseKeymap::None => None,
}
#[cfg(not(target_os = "macos"))]
match self {
BaseKeymap::JetBrains => Some("keymaps/linux/jetbrains.json"),
BaseKeymap::SublimeText => Some("keymaps/linux/sublime_text.json"),
BaseKeymap::Atom => Some("keymaps/linux/atom.json"),
BaseKeymap::TextMate => None,
BaseKeymap::VSCode => None,
BaseKeymap::None => None,
}