@@ -15,6 +15,7 @@ mod statusline;
1515mod text;
1616
1717use crate::compositor::{Component, Compositor};
18+use crate::filter_picker_entry;
1819use crate::job::{self, Callback};
1920pub use completion::Completion;
2021pub use editor::EditorView;
@@ -163,6 +164,9 @@ pub fn file_picker(root: PathBuf, config: &helix_view::editor::Config) -> FilePi
163164
164165 let now = Instant::now();
165166
167+ let dedup_symlinks = config.file_picker.deduplicate_links;
168+ let absolute_root = root.canonicalize().unwrap_or_else(|_| root.clone());
169+
166170 let mut walk_builder = WalkBuilder::new(&root);
167171 walk_builder
168172 .hidden(config.file_picker.hidden)
@@ -173,10 +177,7 @@ pub fn file_picker(root: PathBuf, config: &helix_view::editor::Config) -> FilePi
173177 .git_global(config.file_picker.git_global)
174178 .git_exclude(config.file_picker.git_exclude)
175179 .max_depth(config.file_picker.max_depth)
176− // We always want to ignore the .git directory, otherwise if
177− // `ignore` is turned off above, we end up with a lot of noise
178− // in our picker.
179− .filter_entry(|entry| entry.file_name() != ".git");
180+ .filter_entry(move |entry| filter_picker_entry(entry, &absolute_root, dedup_symlinks));
180181
181182 // We want to exclude files that the editor can't handle yet
182183 let mut type_builder = TypesBuilder::new();
@@ -195,14 +196,11 @@ pub fn file_picker(root: PathBuf, config: &helix_view::editor::Config) -> FilePi
195196 // We want files along with their modification date for sorting
196197 let files = walk_builder.build().filter_map(|entry| {
197198 let entry = entry.ok()?;
198−
199199 // This is faster than entry.path().is_dir() since it uses cached fs::Metadata fetched by ignore/walkdir
200− let is_dir = entry.file_type().map_or(false, |ft| ft.is_dir());
201− if is_dir {
202− // Will give a false positive if metadata cannot be read (eg. permission error)
203− None
204− } else {
200+ if entry.file_type()?.is_file() {
205201 Some(entry.into_path())
202+ } else {
203+ None
206204 }
207205 });
208206