From 2c67e9da3d36cadb47a265db3caf2006ee98649c Mon Sep 17 00:00:00 2001 From: Tony Grosinger Date: Wed, 29 May 2024 07:42:00 -0700 Subject: [PATCH] Neovim: Add goimports and gofumpt --- nvim/init.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nvim/init.lua b/nvim/init.lua index db7ff06..ced4df7 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -496,7 +496,9 @@ require('lazy').setup({ -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ local servers = { -- clangd = {}, - -- gopls = {}, + gopls = { + gofumpt = true, + }, -- pyright = {}, -- rust_analyzer = {}, -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs @@ -537,6 +539,8 @@ require('lazy').setup({ local ensure_installed = vim.tbl_keys(servers or {}) vim.list_extend(ensure_installed, { 'stylua', -- Used to format Lua code + 'goimports', -- Used to format Go code + 'gofumpt', -- Used to format Go code }) require('mason-tool-installer').setup { ensure_installed = ensure_installed } @@ -581,6 +585,7 @@ require('lazy').setup({ } end, formatters_by_ft = { + go = { 'goimports', 'gofumpt' }, lua = { 'stylua' }, -- Conform can also run multiple formatters sequentially -- python = { "isort", "black" },