Skip to content

config flag to dispose "occurrence mode" after operator done #13

Description

@hornyjailfish

This is mostly for built-in operators or integrations where you dont have control over operator.
Right now this possible only with manually overriding after hook which is inconvenient for built-ins/third-party integrations.

Also there are no way to get all available operators. occurrence.api ok for built-ins

just in case anyone else want built-ins but with dispose after operator

local api = require("occurrence.api")

-- filter api because have keymaps there too!
local actions = vim.tbl_map(function(item)
	if item.operator ~= nil then
		return item
	end
end, api)

actions = vim.tbl_map(function(action)
	local after = action.after
	action.after = function(marks, ctx)
		if after then
			after(marks, ctx)
		end
		ctx.occurrence:dispose()
	end
	return action
end, actions)

require("occurrence").setup({
	operators = actions,
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions