Browse Source

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

rebuilt 4 năm trước cách đây
mục cha
commit
275c20a394
1 tập tin đã thay đổi với 2 bổ sung2 xóa
  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