Install and configure vim-go
This commit is contained in:
26
lua/custom/plugins/vim-go.lua
Normal file
26
lua/custom/plugins/vim-go.lua
Normal file
@@ -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,
|
||||
}
|
||||
Reference in New Issue
Block a user