From e1390e210183e1f24977c547dad59f413955a034 Mon Sep 17 00:00:00 2001 From: Ducky Date: Mon, 12 May 2025 22:04:49 +1000 Subject: [PATCH] Install and configure vim-go --- lua/custom/plugins/vim-go.lua | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 lua/custom/plugins/vim-go.lua diff --git a/lua/custom/plugins/vim-go.lua b/lua/custom/plugins/vim-go.lua new file mode 100644 index 0000000..051ca9a --- /dev/null +++ b/lua/custom/plugins/vim-go.lua @@ -0,0 +1,26 @@ +return { + 'fatih/vim-go', -- Popular Go plugin + config = function() + -- Explicitly set Go-specific indentation + vim.api.nvim_create_augroup('GoIndentation', { clear = true }) + vim.api.nvim_create_autocmd('FileType', { + group = 'GoIndentation', + pattern = 'go', + callback = function() + vim.opt_local.tabstop = 4 + vim.opt_local.shiftwidth = 4 + vim.opt_local.softtabstop = 4 + vim.opt_local.expandtab = false -- Go prefers tabs, not spaces + end, + }) + -- Additional Go-specific settings + vim.g.go_fmt_command = 'goimports' -- Automatically import packages + vim.g.go_auto_type_info = 1 -- Show type information + vim.g.go_highlight_types = 1 + vim.g.go_highlight_fields = 1 + vim.g.go_highlight_functions = 1 + vim.g.go_highlight_function_calls = 1 + vim.g.go_highlight_operators = 1 + vim.g.go_highlight_extra_types = 1 + end, +}