diff options
| author | A. Schueler <schueleraron@lakur.tech> | 2021-10-24 08:22:56 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-24 08:22:56 +0200 |
| commit | 09b0d87b9f99d37c3e4b64be20389f6797898cf5 (patch) | |
| tree | cb52dad89b882914aa7136600583209420116d92 /lua | |
| parent | a823ae8eb54425ee7cad6becfd860ca026a8c831 (diff) | |
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.
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/telescope/builtin/internal.lua | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lua/telescope/builtin/internal.lua b/lua/telescope/builtin/internal.lua index 079b655..f95e0e5 100644 --- a/lua/telescope/builtin/internal.lua +++ b/lua/telescope/builtin/internal.lua @@ -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) |
