[mirror] Make your go dev experience better
github.com/olexsmir/gopher.nvim
neovim
golang
1--- NOTE: runs in defer since this file before gopher.config
2--- I'm not sure if this is the best to do this
3vim.schedule(function()
4 if require("gopher.config").should_setup_commands() then
5 vim.api.nvim_create_user_command("GopherLog", function()
6 vim.cmd("tabnew " .. require("gopher._utils.log").get_outfile())
7 end, { nargs = 0 })
8
9 vim.api.nvim_create_user_command("GoIfErr", function()
10 require("gopher").iferr()
11 end, { nargs = 0 })
12
13 vim.api.nvim_create_user_command("GoCmt", function()
14 require("gopher").comment()
15 end, { nargs = 0 })
16
17 vim.api.nvim_create_user_command("GoImpl", function(args)
18 require("gopher").impl(unpack(args.fargs))
19 end, { nargs = "*" })
20
21 -- :GoInstall
22 vim.api.nvim_create_user_command("GoInstallDeps", function()
23 require("gopher").install_deps()
24 end, { nargs = 0 })
25
26 vim.api.nvim_create_user_command("GoInstallDepsSync", function()
27 require("gopher").install_deps { sync = true }
28 end, { nargs = 0 })
29
30 --- :GoTag
31 vim.api.nvim_create_user_command("GoTagAdd", function(opts)
32 require("gopher").tags.add(unpack(opts.fargs))
33 end, { nargs = "*" })
34
35 vim.api.nvim_create_user_command("GoTagRm", function(opts)
36 require("gopher").tags.rm(unpack(opts.fargs))
37 end, { nargs = "*" })
38
39 vim.api.nvim_create_user_command("GoTagClear", function()
40 require("gopher").tags.clear()
41 end, { nargs = 0 })
42
43 --- :GoTest
44 vim.api.nvim_create_user_command("GoTestAdd", function()
45 require("gopher").test.add()
46 end, { nargs = 0 })
47
48 vim.api.nvim_create_user_command("GoTestsAll", function()
49 require("gopher").test.all()
50 end, { nargs = 0 })
51
52 vim.api.nvim_create_user_command("GoTestsExp", function()
53 require("gopher").test.exported()
54 end, { nargs = 0 })
55
56 -- :Go
57 vim.api.nvim_create_user_command("GoMod", function(opts)
58 require("gopher").mod(opts.fargs)
59 end, { nargs = "*" })
60
61 vim.api.nvim_create_user_command("GoGet", function(opts)
62 vim.print(opts)
63 require("gopher").get(opts.fargs)
64 end, { nargs = "*" })
65
66 vim.api.nvim_create_user_command("GoWork", function(opts)
67 require("gopher").get(opts.fargs)
68 end, { nargs = "*" })
69
70 vim.api.nvim_create_user_command("GoGenerate", function(opts)
71 require("gopher").generate(opts.fargs or "")
72 end, { nargs = "?" })
73 end
74end)