mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-12 21:32:40 +00:00
Add vim::Search command option for non-regex search (#19177)
Similar to e2647025ac
, this adds a `regex`
option to `vim::Search` command to allow disabling regex search.
Release Notes:
- Added `regex` option to `vim::Search` command to allow disabling regex
search by default in the keymap. Example usage:
```yaml
{
"context": "VimControl && !menu",
"bindings": {
"/": ["vim::Search", { "regex": false }],
}
}
```
This commit is contained in:
parent
ec5d6e96bb
commit
325f106c8b
1 changed files with 7 additions and 1 deletions
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue