Work on delete function
parent
a1ee18ca96
commit
4dff8063a7
|
|
@ -18,7 +18,7 @@ local M = { ---@type Rabbit.Plugin
|
|||
---@param p Rabbit.Plugin.Buffers
|
||||
init = function(p)
|
||||
p.listing[0] = {}
|
||||
p.listing.paths = {}
|
||||
p.listing.bufnrs = {}
|
||||
end,
|
||||
|
||||
---@type Rabbit.Plugin.Buffers.Options
|
||||
|
|
@ -28,16 +28,16 @@ local M = { ---@type Rabbit.Plugin
|
|||
}
|
||||
|
||||
local get_buffers = function()
|
||||
M.listing.paths = {}
|
||||
M.listing.bufnrs = {}
|
||||
M.listing[0] = {}
|
||||
|
||||
local bufs = vim.fn.getbufinfo({ buflisted = 1 })
|
||||
table.sort(bufs, function(a, b)
|
||||
return a.lastused > b.lastused
|
||||
return a.lastused < b.lastused
|
||||
end)
|
||||
|
||||
for _, b in ipairs(bufs) do
|
||||
set.add(M.listing.paths, b.bufnr)
|
||||
set.add(M.listing.bufnrs, b.bufnr)
|
||||
set.add(M.listing[0], b.name)
|
||||
end
|
||||
end
|
||||
|
|
@ -49,7 +49,7 @@ end
|
|||
|
||||
---@param n integer
|
||||
function M.func.file_del(n)
|
||||
vim.print(M.listing.paths[n])
|
||||
vim.print(M.listing.bufnrs[n])
|
||||
-- vim.cmd("bd " .. tostring(M.listing.paths[n]))
|
||||
-- table.remove(M.listing, n)
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in New Issue