feature request: Add an api for keymap triggered callback
xzbdmw opened this issue · comments
When I tried to combine with Arrow, I found that your API is very flexible. Using content callback can almost achieve everything I want. However, I hope to correspond with Arrow's UI. For example, after opening these small floating windows, typing d + any hint to enter deletion mode, and typing v + any hint to horizontally open a new split, so I may need an API to accept a callback from a keymap(dynamically change Content's original callback is enough), do you think it is feasible?
And with this pr nvim-treesitter/nvim-treesitter-context#419 , the screenshot below is possible, but it need to trigger WinEnter autocmd for every floating window to show context, what do you think is the best way to trigger that?
@xzbdmw I've made a few updates to Portal.nvim. You should now have a bit more control over the search results and generated windows. Instead of adding a hook, you can now explicitly open/close/select the windows directly. For example,
-- Return the results of a query over the jumplist
local query = require("portal.builtin").jumplist.query()
local results = require("portal").search(query)
local windows = require("portal").portals(results)
-- Open the portal windows
require("portal").open(windows)
-- Select the first location from the list of portal windows
windows[1]:select()
-- Close the portal windows
require("portal").close(windows)
I would encourage you to checkout the Portal API.