diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 2e15dcdcc..56006821b 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -2524,6 +2524,7 @@ fn global_search(cx: &mut Context) { .parents(config.file_picker_config.parents) .ignore(config.file_picker_config.ignore) .follow_links(config.file_picker_config.follow_symlinks) + .require_git(config.file_picker_config.require_git) .git_ignore(config.file_picker_config.git_ignore) .git_global(config.file_picker_config.git_global) .git_exclude(config.file_picker_config.git_exclude) diff --git a/helix-term/src/ui/mod.rs b/helix-term/src/ui/mod.rs index a76adbe21..a18aa91f8 100644 --- a/helix-term/src/ui/mod.rs +++ b/helix-term/src/ui/mod.rs @@ -213,6 +213,7 @@ pub fn file_picker(editor: &Editor, root: PathBuf) -> FilePicker { .parents(config.file_picker.parents) .ignore(config.file_picker.ignore) .follow_links(config.file_picker.follow_symlinks) + .require_git(config.file_picker.require_git) .git_ignore(config.file_picker.git_ignore) .git_global(config.file_picker.git_global) .git_exclude(config.file_picker.git_exclude) @@ -597,10 +598,12 @@ pub mod completers { }; let end = input.len()..; + let require_git = editor.config().file_picker.require_git; let files = WalkBuilder::new(&dir) .hidden(false) .follow_links(false) // We're scanning over depth 1 + .require_git(require_git) .git_ignore(git_ignore) .max_depth(Some(1)) .build() diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index be2218997..3ec036e16 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -189,6 +189,9 @@ pub struct FilePickerConfig { /// Enables reading `.ignore` files. /// Whether to hide files listed in .ignore in file picker and global search results. Defaults to true. pub ignore: bool, + /// Enables `git_*` features only if a `.git` directory is present + /// Defaults to true + pub require_git: bool, /// Enables reading `.gitignore` files. /// Whether to hide files listed in .gitignore in file picker and global search results. Defaults to true. pub git_ignore: bool, @@ -211,6 +214,7 @@ impl Default for FilePickerConfig { deduplicate_links: true, parents: true, ignore: true, + require_git: true, git_ignore: true, git_global: true, git_exclude: true,