From 6f212262061a2120e42da0d1e87326e8a41c0478 Mon Sep 17 00:00:00 2001 From: Steven Arcangeli Date: Sun, 28 Jan 2024 18:00:51 -0800 Subject: [PATCH] fix: undo fzf-lua cancel hack, was fixed upstream (#142) --- lua/dressing/select/fzf_lua.lua | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/lua/dressing/select/fzf_lua.lua b/lua/dressing/select/fzf_lua.lua index 39e199e..6a9a1ad 100644 --- a/lua/dressing/select/fzf_lua.lua +++ b/lua/dressing/select/fzf_lua.lua @@ -13,29 +13,12 @@ M.select = function(config, items, opts, on_choice) end -- Defer the callback to allow the mode to fully switch back to normal after the fzf terminal local deferred_on_choice = function(...) - local cb = on_choice - on_choice = function() end local args = vim.F.pack_len(...) vim.defer_fn(function() - cb(vim.F.unpack_len(args)) + on_choice(vim.F.unpack_len(args)) end, 10) end ui_select.ui_select(items, opts, deferred_on_choice) - - -- Because fzf-lua doesn't call the on_choice function if exited (e.g. with ), we need to - -- add an autocmd ourselves to make sure that happens. - vim.api.nvim_create_autocmd("BufUnload", { - buffer = vim.api.nvim_get_current_buf(), - once = true, - nested = true, - callback = function() - vim.defer_fn(function() - local cb = on_choice - on_choice = function() end - cb() - end, 10) - end, - }) end return M