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, +}