diff --git a/doc/gopher.nvim.txt b/doc/gopher.nvim.txt index 5a6c018..56d8d6d 100644 --- a/doc/gopher.nvim.txt +++ b/doc/gopher.nvim.txt @@ -11,6 +11,7 @@ Table of Contents Setup....................................................|gopher.nvim-setup| Install dependencies..............................|gopher.nvim-install-deps| Configuration...........................................|gopher.nvim-config| + Commands..............................................|gopher.nvim-commands| Modify struct tags.................................|gopher.nvim-struct-tags| Auto implementation of interface methods..................|gopher.nvim-impl| Generating unit tests boilerplate......................|gopher.nvim-gotests| @@ -36,7 +37,8 @@ Parameters ~ Gopher.nvim implements most of its features using third-party tools. To install these tools, you can run `:GoInstallDeps` command or call `require("gopher").install_deps()` if you want to use lua api. -By default dependencies will be installed asynchronously, to install them synchronously pass `{sync = true}` as an argument. +By default dependencies will be installed asynchronously, +to install them synchronously pass `{sync = true}` as an argument. ============================================================================== @@ -99,6 +101,14 @@ Class ~ {gopher.Config} +============================================================================== +------------------------------------------------------------------------------ + *gopher.nvim-commands* + +If don't want to automatically register plugins' commands, +you can set `vim.g.gopher_register_commands` to `false`, before loading the plugin. + + ============================================================================== ------------------------------------------------------------------------------ *gopher.nvim-struct-tags* diff --git a/lua/gopher/init.lua b/lua/gopher/init.lua index 0028dcc..16cfb17 100644 --- a/lua/gopher/init.lua +++ b/lua/gopher/init.lua @@ -35,7 +35,8 @@ end ---@text Gopher.nvim implements most of its features using third-party tools. --- To install these tools, you can run `:GoInstallDeps` command --- or call `require("gopher").install_deps()` if you want to use lua api. ---- By default dependencies will be installed asynchronously, to install them synchronously pass `{sync = true}` as an argument. +--- By default dependencies will be installed asynchronously, +--- to install them synchronously pass `{sync = true}` as an argument. gopher.install_deps = require("gopher.installer").install_deps gopher.impl = require("gopher.impl").impl diff --git a/plugin/gopher.lua b/plugin/gopher.lua index d5a9575..1ccc74e 100644 --- a/plugin/gopher.lua +++ b/plugin/gopher.lua @@ -1,3 +1,9 @@ +---@toc_entry Commands +---@tag gopher.nvim-commands +---@text +--- If don't want to automatically register plugins' commands, +--- you can set `vim.g.gopher_register_commands` to `false`, before loading the plugin. + if vim.g.gopher_register_commands == false then return end @@ -5,6 +11,7 @@ end ---@param name string ---@param fn fun(args: table) ---@param nargs? number|"*"|"?" +---@private local function cmd(name, fn, nargs) nargs = nargs or 0 vim.api.nvim_create_user_command(name, fn, { nargs = nargs }) @@ -35,7 +42,7 @@ cmd("GoInstallDepsSync", function() require("gopher").install_deps { sync = true } end) ---- :GoTag +-- :GoTag cmd("GoTagAdd", function(opts) require("gopher").tags.add(unpack(opts.fargs)) end, "*") @@ -48,7 +55,7 @@ cmd("GoTagClear", function() require("gopher").tags.clear() end) ---- :GoTest +-- :GoTest cmd("GoTestAdd", function() require("gopher").test.add() end) diff --git a/scripts/docgen.lua b/scripts/docgen.lua index 87cbd3a..381d3c4 100644 --- a/scripts/docgen.lua +++ b/scripts/docgen.lua @@ -10,6 +10,7 @@ end local files = { "lua/gopher/init.lua", "lua/gopher/config.lua", + "plugin/gopher.lua", "lua/gopher/struct_tags.lua", "lua/gopher/impl.lua", "lua/gopher/gotests.lua",