From c7172ac3f0a9b7d4173f1f1143313bea8657cf95 Mon Sep 17 00:00:00 2001 From: Bryan Date: Sat, 19 Oct 2024 09:23:16 -0600 Subject: [PATCH] Work on delete function --- lua/rabbit-buffers/init.lua | 32 ++------------------------------ 1 file changed, 2 insertions(+), 30 deletions(-) diff --git a/lua/rabbit-buffers/init.lua b/lua/rabbit-buffers/init.lua index e8499d9..b813eb4 100644 --- a/lua/rabbit-buffers/init.lua +++ b/lua/rabbit-buffers/init.lua @@ -19,10 +19,6 @@ local M = { ---@type Rabbit.Plugin init = function(p) p.listing[0] = {} p.listing.paths = {} - -- p.listing.persist = {} --set.clean(set.read(p.memory)) - -- p.listing.opened = {} - -- p.listing.collections = {} - -- p.listing.recursive = nil end, ---@type Rabbit.Plugin.Buffers.Options @@ -50,34 +46,10 @@ function M.evt.RabbitEnter() get_buffers() end --- ---@param n integer --- function M.func.select(n) --- local rabbit = require("rabbit") --- if M.listing[0] == nil or n ~= 1 then --- return rabbit.func.select(n) --- end --- -- --- -- M.listing[0] = rabbit.ctx.listing --- -- table.remove(M.listing[0], 1) --- -- M.listing[rabbit.user.win] = M.listing[0] --- -- vim.api.nvim_win_set_buf(rabbit.user.win, tonumber(M.listing[0][1]) or 0) --- -- M.listing[0] = nil --- -- vim.api.nvim_set_current_buf(M.listing.paths --- -- rabbit.func.close() --- end - ---@param n integer function M.func.file_del(n) - -- local rabbit = require("rabbit") - -- M.listing[rabbit.user.win] = rabbit.ctx.listing - -- table.remove(M.listing[rabbit.user.win], n) - -- table.insert(M.listing[rabbit.user.win], 1, rabbit.user.buf) - -- if M.listing[0] ~= nil then - -- table.remove(M.listing[rabbit.user.win], 1) - -- M.listing[0] = vim.deepcopy(M.listing[rabbit.user.win]) - -- table.insert(M.listing[0], 1, "rabbitmsg://Restore full history") - -- end - -- require("rabbit").Redraw() + vim.cmd("bd " .. M.listing[0][n]) + require("rabbit").Redraw() end return M