Bläddra i källkod

BufWritePre enables format on save for lv-config.lua (#1111)

rebuilt 4 år sedan
förälder
incheckning
275c20a394
1 ändrade filer med 2 tillägg och 2 borttagningar
  1. 2 2
      lua/lv-utils/init.lua

+ 2 - 2
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