Is the wrap function necessary?
Instead of wrapping every keymap, Couldn't you just use the event hooks?
local api = require('nvim-tree.api')
local floatpreview = require('float-preview')
local float_close_wrap = floatpreview.close_wrap
local Event = api.events.Event
api.events.subscribe(Event.TreeClose, function()
float_close_wrap(function() end)()
end)
I didn't know about this nvim-tree feature. I have checked, it's good solution if you don't use window picker. I will try to use this solution soon, I predict we need event like 'open window picker' for best solution.
@haondt Hello, I tested with only events and it isn't work as want. But I think we can move wrapping commands to inside plugin. You can see this idea in https://github.com/JMarkin/nvim-tree.lua-float-preview/pull/10
Fair enough. It works for me fine, fwiw, though I had to use it with vim.schedule to get everything working. I understand my use case might be a bit different since I am using the tree in a floating window too.
api.events.subscribe(Event.TreeClose, function()
vim.schedule(function ()
float_close_wrap(function() end)()
end)
end)