From 476f28e1a936f5e7f9df42fbb43d87a79a1286f1 Mon Sep 17 00:00:00 2001 From: Hau Nguyen Date: Thu, 29 Jun 2023 18:26:53 +0700 Subject: [PATCH] chore(nvim): import goo --- data/nvim/init.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/data/nvim/init.lua b/data/nvim/init.lua index 2fb9173..6bbe7c5 100644 --- a/data/nvim/init.lua +++ b/data/nvim/init.lua @@ -259,6 +259,7 @@ require("lazy").setup({ lspconfig = require("lspconfig") util = require("lspconfig/util") + -- Go -- https://github.com/golang/tools/blob/master/gopls/doc/vim.md -- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#gopls -- https://github.com/golang/tools/blob/master/gopls/doc/settings.md @@ -271,8 +272,17 @@ require("lazy").setup({ }, }) + vim.api.nvim_create_autocmd("BufWritePre", { + pattern = "*.go", + callback = function() + vim.lsp.buf.code_action({ context = { only = { "source.organizeImports" } }, apply = true }) + end, + }) + + -- Proto lspconfig.bufls.setup({}) + -- General keymap vim.keymap.set("n", "[d", vim.diagnostic.goto_prev) vim.keymap.set("n", "]d", vim.diagnostic.goto_next) @@ -302,4 +312,4 @@ require("lazy").setup({ "github/copilot.vim", }) -vim.api.nvim_command("colorscheme minicyan") +vim.api.nvim_command("colorscheme minischeme")