From 0900f6fcaa3dcc9a1ecfb1299300f5d6b16be5a4 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) --- 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 4607062..bba6f10 100644 --- a/lua/telescope/builtin/__internal.lua +++ b/lua/telescope/builtin/__internal.lua @@ -519,7 +519,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