Watch ~/.zed/bindings.json file for custom key bindings

Co-authored-by: Keith Simmons <keith@zed.dev>
This commit is contained in:
Max Brunsfeld
2022-04-11 16:50:44 -07:00
co-authored by Keith Simmons
parent 92a5c30389
commit be11f63f1e
8 changed files with 110 additions and 60 deletions
+4
View File
@@ -1358,6 +1358,10 @@ impl MutableAppContext {
self.keystroke_matcher.add_bindings(bindings);
}
pub fn clear_bindings(&mut self) {
self.keystroke_matcher.clear_bindings();
}
pub fn dispatch_keystroke(
&mut self,
window_id: usize,
+9
View File
@@ -106,6 +106,11 @@ impl Matcher {
self.keymap.add_bindings(bindings);
}
pub fn clear_bindings(&mut self) {
self.pending.clear();
self.keymap.clear();
}
pub fn clear_pending(&mut self) {
self.pending.clear();
}
@@ -164,6 +169,10 @@ impl Keymap {
fn add_bindings<T: IntoIterator<Item = Binding>>(&mut self, bindings: T) {
self.0.extend(bindings.into_iter());
}
fn clear(&mut self) {
self.0.clear();
}
}
impl Binding {