commands get rerun by default now

This commit is contained in:
2025-07-04 05:25:06 -04:00
parent 5aff147731
commit 3b33a604d8
2 changed files with 16 additions and 1 deletions

View File

@ -37,6 +37,9 @@ end
function lazy_loader:cmd(name, opts)
opts = opts or {}
-- rerun is on by default
opts["rerun"] = opts["rerun"] or true
-- load the plugin on completion
if not opts["complete"] then
opts["complete"] = function(_, line, _)
@ -52,6 +55,11 @@ function lazy_loader:cmd(name, opts)
vim.api.nvim_create_user_command(name, opts['callback'] or function(_)
self:cleanup()
-- attempt to rerun the command
if not opts["rerun"] then
pcall(vim.cmd, name)
end
end, opts)
table.insert(self.command_ids, name)