Try another thing
parent
ae897c8d27
commit
77e1ea97a3
|
|
@ -10,15 +10,19 @@ local M = { ---@type Rabbit.Plugin
|
||||||
func = {},
|
func = {},
|
||||||
switch = "b",
|
switch = "b",
|
||||||
listing = {},
|
listing = {},
|
||||||
empty_msg = "There's nowhere to jump to! Get started by opening another buffer",
|
empty_msg = "No opened buffers",
|
||||||
skip_same = true,
|
skip_same = true,
|
||||||
keys = {},
|
keys = {},
|
||||||
evt = {},
|
evt = {},
|
||||||
|
|
||||||
---@param p Rabbit.Plugin.Buffers
|
---@param p Rabbit.Plugin.Buffers
|
||||||
init = function(p)
|
init = function(p)
|
||||||
p.listing.last_closed = {}
|
-- p.listing[0] = {}
|
||||||
p.listing.opened = {}
|
p.listing.paths = {}
|
||||||
|
-- p.listing.persist = {} --set.clean(set.read(p.memory))
|
||||||
|
-- p.listing.opened = {}
|
||||||
|
-- p.listing.collections = {}
|
||||||
|
-- p.listing.recursive = nil
|
||||||
end,
|
end,
|
||||||
|
|
||||||
---@type Rabbit.Plugin.Buffers.Options
|
---@type Rabbit.Plugin.Buffers.Options
|
||||||
|
|
@ -27,35 +31,29 @@ local M = { ---@type Rabbit.Plugin
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
function M.evt.BufEnter(evt, winid)
|
function M.evt.RabbitEnter(_, _)
|
||||||
local is_listed = vim.api.nvim_get_option_value("buflisted", { buf = evt.buf })
|
M.listing.paths = nil
|
||||||
if M.opts.ignore_unlisted and not is_listed then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
set.add(M.listing[winid], evt.buf)
|
|
||||||
set.add(M.listing.opened, evt.buf)
|
|
||||||
end
|
|
||||||
|
|
||||||
function M.evt.BufDelete(evt, winid)
|
|
||||||
set.sub(M.listing[winid], evt.buf)
|
|
||||||
set.sub(M.listing.opened, evt.buf)
|
|
||||||
end
|
|
||||||
|
|
||||||
function M.evt.RabbitEnter(_, winid)
|
|
||||||
M.listing[0] = nil
|
M.listing[0] = nil
|
||||||
if #M.listing[winid] > 1 then
|
local bufs = vim.api.nvim_list_bufs()
|
||||||
return
|
for _, b in ipairs(bufs) do
|
||||||
end
|
local path = vim.api.nvim_buf_get_name(b)
|
||||||
|
set.add(M.listing.paths, path)
|
||||||
if #M.listing.last_closed > 1 then
|
set.add(M.listing[0], path)
|
||||||
M.listing[0] = vim.deepcopy(M.listing.last_closed)
|
|
||||||
table.insert(M.listing[0], 1, "rabbitmsg://Restore full history")
|
|
||||||
M.listing.last_closed = {}
|
|
||||||
elseif #M.listing.opened > 1 then
|
|
||||||
M.listing[0] = vim.deepcopy(M.listing.opened)
|
|
||||||
table.insert(M.listing[0], 1, "rabbitmsg://Open all buffers")
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
-- function M.evt.BufEnter(evt, winid)
|
||||||
|
-- local is_listed = vim.api.nvim_get_option_value("buflisted", { buf = evt.buf })
|
||||||
|
-- if M.opts.ignore_unlisted and not is_listed then
|
||||||
|
-- return
|
||||||
|
-- end
|
||||||
|
-- set.add(M.listing[winid], evt.buf)
|
||||||
|
-- set.add(M.listing.opened, evt.buf)
|
||||||
|
-- end
|
||||||
|
|
||||||
|
-- function M.evt.BufDelete(evt, winid)
|
||||||
|
-- set.sub(M.listing[winid], evt.buf)
|
||||||
|
-- set.sub(M.listing.opened, evt.buf)
|
||||||
|
-- end
|
||||||
|
|
||||||
function M.evt.WinClosed(_, winid)
|
function M.evt.WinClosed(_, winid)
|
||||||
if M.listing[winid] ~= nil and #M.listing[winid] > 0 then
|
if M.listing[winid] ~= nil and #M.listing[winid] > 0 then
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue