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.

Allow the keybinding context to detect the terminal vi_mode (#26236)

iyht0a49ccbebfcb
diff --git a/crates/terminal/src/terminal.rs b/crates/terminal/src/terminal.rs
index 354044706b2..99aa5ca4df2 100644
--- a/crates/terminal/src/terminal.rs
+++ b/crates/terminal/src/terminal.rs
@@ -1911,6 +1911,10 @@ impl Terminal {
}
}
}
+
+ pub fn vi_mode_enabled(&self) -> bool {
+ self.vi_mode_enabled
+ }
}
// Helper function to convert a grid row to a string
diff --git a/crates/terminal_view/src/terminal_view.rs b/crates/terminal_view/src/terminal_view.rs
index 66635b12f5f..20619f73fdf 100644
--- a/crates/terminal_view/src/terminal_view.rs
+++ b/crates/terminal_view/src/terminal_view.rs
@@ -590,6 +590,10 @@ impl TerminalView {
let mut dispatch_context = KeyContext::new_with_defaults();
dispatch_context.add("Terminal");
+ if self.terminal.read(cx).vi_mode_enabled() {
+ dispatch_context.add("vi_mode");
+ }
+
let mode = self.terminal.read(cx).last_content.mode;
dispatch_context.set(
"screen",