summaryrefslogtreecommitdiff
path: root/lua/telescope/builtin/internal.lua
diff options
context:
space:
mode:
authorSimon Hauser <Simon-Hauser@outlook.de>2021-07-19 09:10:06 +0200
committerGitHub <noreply@github.com>2021-07-19 09:10:06 +0200
commit46e03a935f1d080a9bd856d5a8acfcc093cd1461 (patch)
tree1ad21f773c357fede0a344b1ed06a676e7fde86b /lua/telescope/builtin/internal.lua
parent8c3f2b630be0241fe10709e61ee9dab473518f32 (diff)
feat: sort_mru for builtin buffers (#1028)
:help builtin.buffers
Diffstat (limited to 'lua/telescope/builtin/internal.lua')
-rw-r--r--lua/telescope/builtin/internal.lua5
1 files changed, 5 insertions, 0 deletions
diff --git a/lua/telescope/builtin/internal.lua b/lua/telescope/builtin/internal.lua
index a874016..ad6293c 100644
--- a/lua/telescope/builtin/internal.lua
+++ b/lua/telescope/builtin/internal.lua
@@ -593,6 +593,11 @@ internal.buffers = function(opts)
return true
end, vim.api.nvim_list_bufs())
if not next(bufnrs) then return end
+ if opts.sort_mru then
+ table.sort(bufnrs, function(a, b)
+ return vim.fn.getbufinfo(a)[1].lastused > vim.fn.getbufinfo(b)[1].lastused
+ end)
+ end
local buffers = {}
local default_selection_idx = 1