From f24c055fe9ebc810dfb35328dd312d4cd9038db1 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 13 Dec 2022 09:48:17 +0100 Subject: [PATCH] feat: better way of dealing with lazy loaded completions (thanks to @lewis6991) --- lua/lazy/core/handler/cmd.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/lazy/core/handler/cmd.lua b/lua/lazy/core/handler/cmd.lua index 3ebba86..a2766a4 100644 --- a/lua/lazy/core/handler/cmd.lua +++ b/lua/lazy/core/handler/cmd.lua @@ -28,10 +28,10 @@ function M:_add(plugin, cmd) end, { bang = true, nargs = "*", - complete = function() + complete = function(_, line) _load(plugin, cmd) - -- HACK: trick Neovim to show the newly loaded command completion - vim.api.nvim_input("") + -- NOTE: return the newly loaded command completion + return vim.fn.getcompletion(line, "cmdline") end, }) end