[mirror] Make your go dev experience better
github.com/olexsmir/gopher.nvim
neovim
golang
1---@diagnostic disable: undefined-global
2--# selene: allow(undefined_variable)
3
4local okay, minidoc = pcall(require, "mini.doc")
5if not okay then
6 error "mini.doc not found, please install it. https://github.com/echasnovski/mini.doc"
7 return
8end
9
10local files = {
11 "lua/gopher/init.lua",
12 "lua/gopher/config.lua",
13 "plugin/gopher.lua",
14 "lua/gopher/struct_tags.lua",
15 "lua/gopher/json2go.lua",
16 "lua/gopher/impl.lua",
17 "lua/gopher/gotests.lua",
18 "lua/gopher/iferr.lua",
19 "lua/gopher/comment.lua",
20}
21
22minidoc.setup()
23
24local hooks = vim.deepcopy(minidoc.default_hooks)
25hooks.write_pre = function(lines)
26 -- Remove first two lines with `======` and `------` delimiters to comply
27 -- with `:h local-additions` template
28 table.remove(lines, 1)
29 table.remove(lines, 1)
30
31 return lines
32end
33
34hooks.sections["@dochide"] = function(s)
35 s.parent:clear_lines()
36end
37
38MiniDoc.generate(files, "doc/gopher.nvim.txt", { hooks = hooks })