Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

keymap_editor: Allow to open the keymap.json with a keybinding (#45987)

Smit Chaudhary0821cddcaa7e
diff --git a/assets/keymaps/default-linux.json b/assets/keymaps/default-linux.json
index e9016ec8270..83b2939746a 100644
--- a/assets/keymaps/default-linux.json
+++ b/assets/keymaps/default-linux.json
@@ -1209,6 +1209,7 @@
"ctrl-c": "keymap_editor::CopyAction",
"ctrl-shift-c": "keymap_editor::CopyContext",
"ctrl-t": "keymap_editor::ShowMatchingKeybinds",
+ "ctrl-e": "zed::OpenKeymapFile",
},
},
{
diff --git a/assets/keymaps/default-macos.json b/assets/keymaps/default-macos.json
index 7ec882dbfd4..867dbc3b6f7 100644
--- a/assets/keymaps/default-macos.json
+++ b/assets/keymaps/default-macos.json
@@ -1310,6 +1310,7 @@
"cmd-c": "keymap_editor::CopyAction",
"cmd-shift-c": "keymap_editor::CopyContext",
"cmd-t": "keymap_editor::ShowMatchingKeybinds",
+ "cmd-e": "zed::OpenKeymapFile",
},
},
{
diff --git a/assets/keymaps/default-windows.json b/assets/keymaps/default-windows.json
index 4cf24f56ec5..6fa1f73343d 100644
--- a/assets/keymaps/default-windows.json
+++ b/assets/keymaps/default-windows.json
@@ -1237,6 +1237,7 @@
"ctrl-c": "keymap_editor::CopyAction",
"ctrl-shift-c": "keymap_editor::CopyContext",
"ctrl-t": "keymap_editor::ShowMatchingKeybinds",
+ "ctrl-e": "zed::OpenKeymapFile",
},
},
{
diff --git a/crates/keymap_editor/src/keymap_editor.rs b/crates/keymap_editor/src/keymap_editor.rs
index 6f3521877e1..160d32ce5cd 100644
--- a/crates/keymap_editor/src/keymap_editor.rs
+++ b/crates/keymap_editor/src/keymap_editor.rs
@@ -1872,6 +1872,10 @@ impl Render for KeymapEditor {
.child(
Button::new("edit-in-json", "Edit in JSON")
.style(ButtonStyle::Subtle)
+ .key_binding(
+ ui::KeyBinding::for_action_in(&zed_actions::OpenKeymapFile, &focus_handle, cx)
+ .map(|kb| kb.size(rems_from_px(10.))),
+ )
.on_click(|_, window, cx| {
window.dispatch_action(
zed_actions::OpenKeymapFile.boxed_clone(),