From a49c3aa977651f96f55b0a2f640f859832e8116c Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Sun, 14 May 2023 23:04:46 +0300 Subject: [PATCH] fix: exclude directories from oldfiles picker (#2485) (cherry picked from commit 0900f6fcaa3dcc9a1ecfb1299300f5d6b16be5a4) --- lua/telescope/builtin/__internal.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/telescope/builtin/__internal.lua b/lua/telescope/builtin/__internal.lua index 77165a4..d6f3870 100644 --- a/lua/telescope/builtin/__internal.lua +++ b/lua/telescope/builtin/__internal.lua @@ -512,7 +512,8 @@ internal.oldfiles = function(opts) end for _, file in ipairs(vim.v.oldfiles) do - if vim.loop.fs_stat(file) and not vim.tbl_contains(results, file) and file ~= current_file then + local file_stat = vim.loop.fs_stat(file) + if file_stat and file_stat.type == "file" and not vim.tbl_contains(results, file) and file ~= current_file then table.insert(results, file) end end