fix(plugin): now commands register properly

This commit is contained in:
Oleksandr Smirnov 2025-03-21 16:37:26 +02:00
parent 0fb1c01806
commit ada9e1461d
No known key found for this signature in database
2 changed files with 8 additions and 9 deletions

View file

@ -55,19 +55,19 @@ gopher.test = {
} }
gopher.get = function(...) gopher.get = function(...)
gocmd("get", { ... }) gocmd("get", ...)
end end
gopher.mod = function(...) gopher.mod = function(...)
gocmd("mod", { ... }) gocmd("mod", ...)
end end
gopher.generate = function(...) gopher.generate = function(...)
gocmd("generate", { ... }) gocmd("generate", ...)
end end
gopher.work = function(...) gopher.work = function(...)
gocmd("work", { ... }) gocmd("work", ...)
end end
return gopher return gopher

View file

@ -58,7 +58,7 @@ if c.setup_commands then
-- :Go -- :Go
vim.api.nvim_create_user_command("GoMod", function(opts) vim.api.nvim_create_user_command("GoMod", function(opts)
require("gopher").mod(unpack(opts.fargs)) require("gopher").mod(opts.fargs)
end, { nargs = "*" }) end, { nargs = "*" })
vim.api.nvim_create_user_command("GoGet", function(opts) vim.api.nvim_create_user_command("GoGet", function(opts)
@ -67,11 +67,10 @@ if c.setup_commands then
end, { nargs = "*" }) end, { nargs = "*" })
vim.api.nvim_create_user_command("GoWork", function(opts) vim.api.nvim_create_user_command("GoWork", function(opts)
vim.print(opts) require("gopher").get(opts.fargs)
require("gopher").get(unpack(opts.fargs))
end, { nargs = "*" }) end, { nargs = "*" })
vim.api.nvim_create_user_command("GoGenerate", function(opts) vim.api.nvim_create_user_command("GoGenerate", function(opts)
require("gopher").generate(unpack(opts.fargs)) require("gopher").generate(opts.fargs or "")
end, { nargs = 1 }) end, { nargs = "?" })
end end