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.

Add vim::Search command option for non-regex search (#19177)

Ömer Sinan Ağacan325f106c8b34
diff --git a/crates/vim/src/normal/search.rs b/crates/vim/src/normal/search.rs
index 364e29242b3..507d21429b8 100644
--- a/crates/vim/src/normal/search.rs
+++ b/crates/vim/src/normal/search.rs
@@ -41,6 +41,8 @@ pub(crate) struct MoveToPrev {
pub(crate) struct Search {
#[serde(default)]
backwards: bool,
+ #[serde(default = "default_true")]
+ regex: bool,
}
#[derive(Debug, Clone, PartialEq, Deserialize)]
@@ -130,7 +132,11 @@ impl Vim {
cx.focus_self();
search_bar.set_replacement(None, cx);
- search_bar.set_search_options(SearchOptions::NONE | SearchOptions::REGEX, cx);
+ let mut options = SearchOptions::NONE;
+ if action.regex {
+ options |= SearchOptions::REGEX;
+ }
+ search_bar.set_search_options(options, cx);
self.search = SearchState {
direction,