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