This commit is contained in:
Tom Schafer 2025-04-01 00:18:51 -07:00 committed by GitHub
commit 0d17b71741
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 2 deletions

View file

@ -79,7 +79,8 @@
| `search_selection` | Use current selection as search pattern | normal: `` <A-*> ``, select: `` <A-*> `` |
| `search_selection_detect_word_boundaries` | Use current selection as the search pattern, automatically wrapping with `\b` on word boundaries | normal: `` * ``, select: `` * `` |
| `make_search_word_bounded` | Modify current search to make it word bounded | |
| `global_search` | Global search in workspace folder | normal: `` <space>/ ``, select: `` <space>/ `` |
| `global_search` | Global search in workspace folder (regex) | normal: `` <space>/ ``, select: `` <space>/ `` |
| `global_search_fixed_strings` | Global search in workspace folder (fixed strings) | |
| `extend_line` | Select current line, if already selected, extend to another line based on the anchor | |
| `extend_line_below` | Select current line, if already selected, extend to next line | normal: `` x ``, select: `` x `` |
| `extend_line_above` | Select current line, if already selected, extend to previous line | |

View file

@ -377,7 +377,8 @@ impl MappableCommand {
search_selection, "Use current selection as search pattern",
search_selection_detect_word_boundaries, "Use current selection as the search pattern, automatically wrapping with `\\b` on word boundaries",
make_search_word_bounded, "Modify current search to make it word bounded",
global_search, "Global search in workspace folder",
global_search, "Global search in workspace folder (regex)",
global_search_fixed_strings, "Global search in workspace folder (fixed strings)",
extend_line, "Select current line, if already selected, extend to another line based on the anchor",
extend_line_below, "Select current line, if already selected, extend to next line",
extend_line_above, "Select current line, if already selected, extend to previous line",
@ -2416,6 +2417,14 @@ fn make_search_word_bounded(cx: &mut Context) {
}
fn global_search(cx: &mut Context) {
global_search_impl(cx, false)
}
fn global_search_fixed_strings(cx: &mut Context) {
global_search_impl(cx, true)
}
fn global_search_impl(cx: &mut Context, fixed_strings: bool) {
#[derive(Debug)]
struct FileResult {
path: PathBuf,
@ -2434,6 +2443,7 @@ fn global_search(cx: &mut Context) {
struct GlobalSearchConfig {
smart_case: bool,
fixed_strings: bool,
file_picker_config: helix_view::editor::FilePickerConfig,
directory_style: Style,
number_style: Style,
@ -2443,6 +2453,7 @@ fn global_search(cx: &mut Context) {
let config = cx.editor.config();
let config = GlobalSearchConfig {
smart_case: config.search.smart_case,
fixed_strings,
file_picker_config: config.file_picker.clone(),
directory_style: cx.editor.theme.get("ui.text.directory"),
number_style: cx.editor.theme.get("constant.numeric.integer"),
@ -2496,6 +2507,7 @@ fn global_search(cx: &mut Context) {
let matcher = match RegexMatcherBuilder::new()
.case_smart(config.smart_case)
.fixed_strings(config.fixed_strings)
.build(query)
{
Ok(matcher) => {