From 275c20a394ef9c239d08a03258849255ed496c0f Mon Sep 17 00:00:00 2001 From: rebuilt Date: Mon, 26 Jul 2021 14:57:18 +0200 Subject: BufWritePre enables format on save for lv-config.lua (#1111) --- lua/lv-utils/init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lua/lv-utils/init.lua') diff --git a/lua/lv-utils/init.lua b/lua/lv-utils/init.lua index 29d05fe2..f76d0de2 100644 --- a/lua/lv-utils/init.lua +++ b/lua/lv-utils/init.lua @@ -62,7 +62,7 @@ local toggle_autoformat = function() require("core.autocmds").define_augroups { autoformat = { { - "BufWritePost", + "BufWritePre", "*", ":silent lua vim.lsp.buf.formatting_sync()", }, @@ -71,7 +71,7 @@ local toggle_autoformat = function() end if not lvim.format_on_save then - vim.cmd [[if exists('#autoformat#BufWritePost') + vim.cmd [[if exists('#autoformat#BufWritePre') :autocmd! autoformat endif]] end -- cgit v1.2.3