I got this function that works in harpoon:
function()
local index = require("harpoon.mark").get_current_index()
if index ~= nil then
local config = require('harpoon').get_mark_config()
table.remove(config.marks, index)
local global_settings = require("harpoon").get_global_settings()
if global_settings.tabline then
vim.cmd("redrawt")
end
end
require("mini.bufremove").delete(0, true)
end,
This function removes harpoon mark and also deletes buffer using mini.bufremove.
local opts = { noremap = true, silent = true }
local harpoon = require("harpoon")
local list = harpoon:list()
-- Based on https://github.com/ThePrimeagen/harpoon/blob/0378a6c428a0bed6a2781d459d7943843f374bce/lua/harpoon/list.lua#L184
function Remove(item)
item = item or list.config.create_list_item(list.config)
print("Hello")
local Extensions = require("harpoon.extensions")
local Logger = require("harpoon.logger")
local items = list.items
if item ~= nil then
for i = 1, list._length do
local v = items[i]
print(vim.inspect(v))
if list.config.equals(v, item) then
-- this clears list somehow
-- items[i] = nil
table.remove(items, i)
list._length = list._length - 1
Logger:log("HarpoonList:remove", { item = item, index = i })
Extensions.extensions:emit(
Extensions.event_names.REMOVE,
{ list = list, item = item, idx = i }
)
break
end
end
end
end
Then you can use this function with mini.bufremove
.