feat(buffers): add buffers_sort option (#2793)

* refactor: add sort_buffers option to buffers picker

* refactor: validate sort_buffers opt is a function
This commit is contained in:
Brian Mayo
2023-12-03 19:24:07 +01:00
committed by GitHub
parent e90fdba90d
commit 3f5f165447
2 changed files with 5 additions and 0 deletions

View File

@@ -912,6 +912,10 @@ internal.buffers = function(opts)
end)
end
if type(opts.sort_buffers) == "function" then
table.sort(bufnrs, opts.sort_buffers)
end
local buffers = {}
local default_selection_idx = 1
for _, bufnr in ipairs(bufnrs) do