From 573c6404259f21f71bff1ba2bc5946e7c0785f15 Mon Sep 17 00:00:00 2001 From: Benjamin Chausse Date: Sun, 24 Sep 2023 17:23:21 -0400 Subject: New lsp languages + go.nvim plugin --- lua/ben/plugins/go.lua | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 lua/ben/plugins/go.lua (limited to 'lua/ben/plugins/go.lua') diff --git a/lua/ben/plugins/go.lua b/lua/ben/plugins/go.lua new file mode 100644 index 0000000..a2610c8 --- /dev/null +++ b/lua/ben/plugins/go.lua @@ -0,0 +1,29 @@ +return { + "ray-x/go.nvim", + dependencies = { -- optional packages + "ray-x/guihua.lua", + "neovim/nvim-lspconfig", + "nvim-treesitter/nvim-treesitter", + }, + config = function() + require("go").setup() + -- Go keymaps + vim.api.nvim_set_keymap("n", "gb", "GoBuild", { noremap = true, silent = true }) + vim.api.nvim_set_keymap("n", "gr", "GoRun", { noremap = true, silent = true }) + vim.api.nvim_set_keymap("n", "gd", "GoDoc", { noremap = true, silent = true }) + -- Commands to run on save: + -- local format_sync_grp = vim.api.nvim_create_augroup("GoFormat", {}) + -- vim.api.nvim_create_autocmd("BufWritePre", { + -- pattern = "*.go", + -- callback = function() + -- -- Go format: + -- require("go.format").gofmt() + -- -- Goimports: + -- require("go.format").goimport() + -- end, + -- group = format_sync_grp, + -- }) + end, + ft = { "go", "gomod", "gowork", "gosum" }, + build = ':lua require("go.install").update_all_sync()', -- if you need to install/update all binaries +} -- cgit v1.2.3