[mirror] Make your go dev experience better
github.com/olexsmir/gopher.nvim
neovim
golang
1--- *gopher.nvim*
2---
3--- ==============================================================================
4---
5--- gopher.nvim is a minimalistic plugin for Go development in Neovim written in Lua.
6--- It's not an LSP tool, the main goal of this plugin is add go tooling support in Neovim.
7
8--- Table of Contents
9---@tag gopher.nvim-table-of-contents
10---@toc
11
12local log = require "gopher._utils.log"
13local tags = require "gopher.struct_tags"
14local tests = require "gopher.gotests"
15local gocmd = require("gopher._utils.runner.gocmd").run
16local gopher = {}
17
18---@toc_entry Setup
19---@tag gopher.nvim-setup
20---@text Setup function. This method simply merges default config with opts table.
21--- You can read more about configuration at |gopher.nvim-config|
22--- Calling this function is optional, if you ok with default settings. Look |gopher.nvim.config-defaults|
23---
24---@usage `require("gopher").setup {}` (replace `{}` with your `config` table)
25---@param user_config gopher.Config
26gopher.setup = function(user_config)
27 log.debug "setting up config"
28 require("gopher.config").setup(user_config)
29 log.debug(vim.inspect(user_config))
30end
31
32---@toc_entry Install dependencies
33---@tag gopher.nvim-install-deps
34---@text Gopher.nvim implements most of its features using third-party tools.
35--- To install these tools, you can run `:GoInstallDeps` command
36--- or call `require("gopher").install_deps()` if you want to use lua api.
37gopher.install_deps = require("gopher.installer").install_deps
38
39gopher.impl = require("gopher.impl").impl
40gopher.iferr = require("gopher.iferr").iferr
41gopher.comment = require("gopher.comment").comment
42
43gopher.tags = {
44 add = tags.add,
45 rm = tags.remove,
46 clear = tags.clear,
47}
48
49gopher.test = {
50 add = tests.func_test,
51 exported = tests.all_exported_tests,
52 all = tests.all_tests,
53}
54
55gopher.get = function(...)
56 gocmd("get", { ... })
57end
58
59gopher.mod = function(...)
60 gocmd("mod", { ... })
61end
62
63gopher.generate = function(...)
64 gocmd("generate", { ... })
65end
66
67gopher.work = function(...)
68 gocmd("work", { ... })
69end
70
71return gopher