fix: Exclude unlisted lsp buffers in oldfiles picker (#1219)
Files opened by LSPs are listed with a trailing `line 0` instead of a date like files opened by the user. Use this behavior to filter out buffers that should not be displayed in oldfiles.
This commit is contained in:
@@ -373,7 +373,8 @@ internal.oldfiles = function(opts)
|
||||
if opts.include_current_session then
|
||||
for _, buffer in ipairs(vim.split(vim.fn.execute ":buffers! t", "\n")) do
|
||||
local match = tonumber(string.match(buffer, "%s*(%d+)"))
|
||||
if match then
|
||||
local open_by_lsp = string.match(buffer, "line 0$")
|
||||
if match and not open_by_lsp then
|
||||
local file = vim.api.nvim_buf_get_name(match)
|
||||
if vim.loop.fs_stat(file) and match ~= current_buffer then
|
||||
table.insert(results, file)
|
||||
|
||||
Reference in New Issue
Block a user