From f036fe3648a8f0a94dda17460c5961b682cad522 Mon Sep 17 00:00:00 2001 From: serxoz Date: Mon, 4 Mar 2024 16:28:56 +0100 Subject: [PATCH] formateo automatico para go --- nvim/init.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/nvim/init.lua b/nvim/init.lua index 94783d8..cd7f659 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -1,2 +1,16 @@ require("serxoz") require('serxoz.packer') + +-- autoformat +vim.api.nvim_create_augroup("AutoFormat", {}) +vim.api.nvim_create_autocmd( + "BufWritePost", + { + pattern = "*.go", + group = "AutoFormat", + callback = function() + vim.cmd("silent !go fmt %") + vim.cmd("edit") + end, + } +)