@@ -345,7 +345,15 @@ pub mod completers {
345345 }
346346
347347 pub fn filename(editor: &Editor, input: &str) -> Vec<Completion> {
348− filename_impl(editor, input, |entry| {
348+ filename_with_git_ignore(editor, input, true)
349+ }
350+
351+ pub fn filename_with_git_ignore(
352+ editor: &Editor,
353+ input: &str,
354+ git_ignore: bool,
355+ ) -> Vec<Completion> {
356+ filename_impl(editor, input, git_ignore, |entry| {
349357 let is_dir = entry.file_type().map_or(false, |entry| entry.is_dir());
350358
351359 if is_dir {
@@ -416,7 +424,15 @@ pub mod completers {
416424 }
417425
418426 pub fn directory(editor: &Editor, input: &str) -> Vec<Completion> {
419− filename_impl(editor, input, |entry| {
427+ directory_with_git_ignore(editor, input, true)
428+ }
429+
430+ pub fn directory_with_git_ignore(
431+ editor: &Editor,
432+ input: &str,
433+ git_ignore: bool,
434+ ) -> Vec<Completion> {
435+ filename_impl(editor, input, git_ignore, |entry| {
420436 let is_dir = entry.file_type().map_or(false, |entry| entry.is_dir());
421437
422438 if is_dir {
@@ -439,7 +455,12 @@ pub mod completers {
439455 }
440456
441457 // TODO: we could return an iter/lazy thing so it can fetch as many as it needs.
442− fn filename_impl<F>(_editor: &Editor, input: &str, filter_fn: F) -> Vec<Completion>
458+ fn filename_impl<F>(
459+ _editor: &Editor,
460+ input: &str,
461+ git_ignore: bool,
462+ filter_fn: F,
463+ ) -> Vec<Completion>
443464 where
444465 F: Fn(&ignore::DirEntry) -> FileMatch,
445466 {
@@ -482,6 +503,7 @@ pub mod completers {
482503 let mut files: Vec<_> = WalkBuilder::new(&dir)
483504 .hidden(false)
484505 .follow_links(false) // We're scanning over depth 1
506+ .git_ignore(git_ignore)
485507 .max_depth(Some(1))
486508 .build()
487509 .filter_map(|file| {