From 4d203e5ea4fba9181b1c4c5ab18bd0433fb69d56 Mon Sep 17 00:00:00 2001 From: mateen bagheri Date: Tue, 10 Feb 2026 21:59:56 +0330 Subject: [PATCH] feat: initial golang setup and mason packages ensure install --- init.lua | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/init.lua b/init.lua index d49fcb97..bd8fa1a0 100644 --- a/init.lua +++ b/init.lua @@ -231,6 +231,21 @@ vim.api.nvim_create_autocmd('TextYankPost', { callback = function() vim.hl.on_yank() end, }) +-- Autosave on focus lost and buffer leave +vim.api.nvim_create_autocmd({ 'FocusLost', 'BufLeave' }, { + pattern = '*', + command = 'silent! wall', +}) + +vim.api.nvim_create_autocmd('FileType', { + pattern = 'go', + callback = function() + vim.opt_local.tabstop = 4 -- a TAB character displays as 8 columns + vim.opt_local.shiftwidth = 4 -- indent commands use 8 columns + vim.opt_local.expandtab = false -- use real TABs + end, +}) + -- [[ Install `lazy.nvim` plugin manager ]] -- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' @@ -617,6 +632,14 @@ require('lazy').setup({ vim.list_extend(ensure_installed, { 'lua-language-server', -- Lua Language server 'stylua', -- Used to format Lua code + 'gopls', + 'gofumpt', + 'goimports', + 'goimports-reviser', + 'golangci-lint-langserver', + 'golines', + 'gomodifytags', + 'gotests', -- You can add other tools here that you want Mason to install })