diff --git a/lua/go/gopls.lua b/lua/go/gopls.lua index b765178..b2b2c5f 100644 --- a/lua/go/gopls.lua +++ b/lua/go/gopls.lua @@ -106,7 +106,8 @@ end function M.version() local cache_dir = vim.fn.stdpath("cache") local path = string.format("%s%sversion.txt", cache_dir, utils.sep()) - local gopls = _GO_NVIM_CFG.gopls_cmd or { "gopls" } + local cfg = _GO_NVIM_CFG or {} + local gopls = cfg.gopls_cmd or { "gopls" } if vim.fn.executable(gopls[1]) == 0 then vim.notify("gopls not found", vim.log.levels.WARN) diff --git a/lua/go/gotest.lua b/lua/go/gotest.lua index 4f6c990..f24d7ec 100644 --- a/lua/go/gotest.lua +++ b/lua/go/gotest.lua @@ -11,7 +11,7 @@ local long_opts = { compile = "c", tags = "t", bench = "b", - floatterm = "F", + floaterm = "F", } local sep = require("go.utils").sep() diff --git a/lua/go/ts/textobjects.lua b/lua/go/ts/textobjects.lua index 203346d..7b97781 100644 --- a/lua/go/ts/textobjects.lua +++ b/lua/go/ts/textobjects.lua @@ -9,8 +9,7 @@ function M.setup() return end - local ts = require("nvim-treesitter.configs") - ts.setup({ + require("nvim-treesitter.configs").setup({ textobjects = { select = { enable = true, @@ -27,20 +26,16 @@ function M.setup() enable = true, set_jumps = true, -- whether to set jumps in the jumplist goto_next_start = { - ["]m"] = "@function.outer", - ["]]"] = "@class.outer", + ["]]"] = "@function.outer", }, goto_next_end = { - ["]M"] = "@function.outer", - ["]["] = "@class.outer", + ["]["] = "@function.outer", }, goto_previous_start = { - ["[m"] = "@function.outer", - ["[["] = "@class.outer", + ["[["] = "@function.outer", }, goto_previous_end = { - ["[M"] = "@function.outer", - ["[]"] = "@class.outer", + ["[]"] = "@function.outer", }, }, }, diff --git a/lua/go/utils.lua b/lua/go/utils.lua index 1889f45..ba96b55 100644 --- a/lua/go/utils.lua +++ b/lua/go/utils.lua @@ -206,6 +206,9 @@ end local cache_dir = vim.fn.stdpath("cache") util.log = function(...) + if not _GO_NVIM_CFG then + return + end if not _GO_NVIM_CFG.verbose then return end diff --git a/lua/tests/go_fmt_spec.lua b/lua/tests/go_fmt_spec.lua index 248d61e..12968cd 100644 --- a/lua/tests/go_fmt_spec.lua +++ b/lua/tests/go_fmt_spec.lua @@ -126,7 +126,7 @@ describe("should run gofmt", function() require("go.format").goimport() print("workspaces:", vim.inspect(vim.lsp.buf.list_workspace_folders())) - vim.wait(400, function() end) + vim.wait(500, function() end) vim.cmd([[w]]) local fmt = vim.fn.join(vim.fn.readfile(path), "\n") print(vim.inspect(fmt))